PDA

View Full Version : serverside keyname() problem


Lance
12-17-2005, 04:35 AM
#k(float) seems to be working fine serverside in this class (after it adds a kart to the player, it tells them which keys they should press to accelerate/brake):

say2("
You now control a kart!

Press #k(5) to accelerate

and #k(4) to brake");

works. It properly displays which keys are set (traditionally) to S and D.

However, when I try to convert it to use keyname(float):

say2("
You now control a kart!

Press" SPC keyname(5) SPC "to accelerate

and" SPC keyname(4) SPC "to brake");
}

it returns 0 now and causes this error:

GraalScript: Function keyname not found at line 15 of karthouses in script of npcs[302] (in level worldr-08.nw at pos (41, 52))

Any suggestions? Is there something I'm missing?

prozac424242
12-17-2005, 07:02 AM
at least you see what i mean, its errors like these that cause me to mix gs1 and gs2. As we all know, gs2 is still under development. Mostly, but not completely functional. I look forward to when gs2 works fully they way the wiki says its supposed to work.
To whoever is the one person writing the wiki, good work so far. If many people are writing the wiki, how do you know what to put in there? What is your resource and credentials to add to the gs2 parts of the wiki?

Lance
12-17-2005, 08:33 AM
at least you see what i mean, its errors like these that cause me to mix gs1 and gs2. As we all know, gs2 is still under development. Mostly, but not completely functional. I look forward to when gs2 works fully they way the wiki says its supposed to work.
To whoever is the one person writing the wiki, good work so far. If many people are writing the wiki, how do you know what to put in there? What is your resource and credentials to add to the gs2 parts of the wiki?

I'm not sure why you're posting that in this topic, but many people edit the wiki (you can too).

Admins
12-17-2005, 05:07 PM
The new scripting engine is fully working, we are already using it on Graal Kingdoms, Zone, Era and Classic. I am helping for the wiki too.
About keyname(): it is a clientside-function, I have no idea why #k is working for you on serverside (and should not work since they keys are different for each client, otherwise we wouldn't need that function). The normal way is to save the keyname on clientside into some client. variable and then use that client. variable on serverside.
About say2: it is better to use the format() function, the code looks much more readable then, like format("Press %s to jump!", client.Akey)

ApothiX
12-18-2005, 06:28 AM
The new scripting engine is fully working, we are already using it on Graal Kingdoms, Zone, Era and Classic. I am helping for the wiki too.
About keyname(): it is a clientside-function, I have no idea why #k is working for you on serverside (and should not work since they keys are different for each client, otherwise we wouldn't need that function). The normal way is to save the keyname on clientside into some client. variable and then use that client. variable on serverside.
About say2: it is better to use the format() function, the code looks much more readable then, like format("Press %s to jump!", client.Akey)
I think Lance is saying that #k() serverside returns the default keys, if that is the case, why use #k() serverside at all?

Also, that format() function brings back some fond C-memories :)

Admins
12-20-2005, 03:27 PM
Well we figured out the problem - in old scripting engine the #k thing is ignored on serverside, and if you pass it to the client with say2 then the client is filling the key name in once it displays the sign text.
In new scripting engine the server needs to compile the script, but doesn't provide the keyname functionality itself. So it only works in clientside scripts or if you just pass the text to the clientside (by using the new scripting version of say2 with say2("blabla #k")).