can an extention read variables set from client?

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

User avatar
mistermind
Posts: 131
Joined: 15 Sep 2007, 01:33
Contact:

can an extention read variables set from client?

Postby mistermind » 14 Nov 2008, 00:12

I've searched quite a lot on the forums and I think I started to realize there is maybe a difference between using _server.setUserVariables() and a regular call from the client to set variables (smartfox.setUserVariables(uVars))

Am I wrong or its not possible to do it so?
When I do an extension call, I can get all the regular variables (user.getName(), user.getUserId()) but when I try getting user variables previosly declared from the client I either get undefined values or error messages from the log.
This is the sinax I'm using to get the values:

Code: Select all

// works
trace(user.getName());

// does not work
var accType = user.getVariable("accType");
trace(accType.getValue());


Any ideas?
SELECT * FROM users WHERE clue > 0
0 rows returned.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 15 Nov 2008, 07:14

Can you please explain what is not working with the code you have shown?
What error do you get?
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
mistermind
Posts: 131
Joined: 15 Sep 2007, 01:33
Contact:

Postby mistermind » 18 Nov 2008, 16:50

Wow this is very weird Lapo :D
I finally made it work. Apparently my issues with that was just a sinax issue, but then I found out there was (is) something else going on. I just figured out today.
Whenever I trace a variable declared inside the extension, the value of it changes unexpectedly to something like this: it.gotoandplay.smartfoxserver.data.UserVariable@13b91af

It doesn't matter what variable. If I declare a userVar or just a regular variable then trace it, it traces just fine, but when I try using it again, it becomes that. I think I've seen someone reporting about this but it wasn't in the same scenario.

Code: Select all

[saveStats.as]: 413
10:54:19.203 - [ SEVERE ] > DbManager error during query/result creation: select idCd from tbTemp where idCd=it.gotoandplay.smartfoxserver.data.UserVariable@13b91af or idCd=64 or idCd=444 or idCd=166 or idCd=198 order by rarity,name


Once I removed the trace code everything worked just fine lol. I'm pretty sure it is repeatable.
SELECT * FROM users WHERE clue > 0

0 rows returned.

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 25 guests