Beforeturn script, user context

Arbutus
27 Jul 2005, 02:28
How does one identify the User ID (context) within the BEFORETURN script? I keep reading 0, the Server ID. Anyone have any experience with this?

francisstokes
28 Jul 2005, 15:35
Isn't it something like:

#player[%userid%]#

Arbutus
29 Jul 2005, 20:40
player%userid% would be that player's inventory room.

The challenge I'm looking at is that when the BEFORETURN script runs, there is no context to it. In other words, I can't tell which player initiated it.

I think Im Dead
30 Jul 2005, 02:08
Yeah, I've been thinking about your problem and the conclusion I came to was the same as yours. BEFORETURN is from the singleplayer code so it doesn't have any reference to an ID. My only thought on how to get whatever you are doing without modifying your existing code too much would be to try the built in function $thisobject$, that might attach an id or object to the context of which it is run.

My other suggestion would be to use the "with" option after your before turn OR somewhere creatively in it, to attempt to run it in context to the executing player.

Arbutus
31 Jul 2005, 04:14
Thanks for replying, guys..

In the Quest Help file: Making Multiplayer Games For QuestNet Server page there is a list of commands that "have no function in QuestNet Server". I guess we should add:

beforeturn
afterturn
dontprocess
outputon
outputoff

Elexxorine
01 Aug 2005, 08:39
you could make it so when you need the player's id, run a procedue to check it then do what you want with it. eg: (note: not full code) (other note: not do questnet eVER before).
command <whatever> {
do <test.playerid>
do <whatever you need to do> }

procedue <test.playerid> {
set <playeridnum; %playerid%> }

i'll say again: never done questnet, playid maybe be something else (prolly that though). but that should vaugly work. in TBC i'm making my own log in script (not using built-in one), with tron's help. when it's (ever) working i'll post it. each user account for the game has a set account number (for the arrays). tron can explain it a bit better. hop i've helped.

paul_one
01 Aug 2005, 17:52
Yes, you could probably do a workaround like that, this has to go at the very top of the command list though (and if in a library, the library has to be at the bottom of the library list - it's odd how Quest loads lib's from the bottom up):
command <#com#> {
if ( $beforeturn_func$ = 0) then exec <#com#;normal>
do <afterturn_proc>
}


But beforeturn and afterturn have been disabled from what I've tried...

The if is so that you can have the same as "dontproccess" in ASL. So if something happens before the command is actually executed you can stop the command from going through.

And Elex, player%userid% would be the object name for each player connected, %userid% is the number given to each player.

Arbutus
01 Aug 2005, 21:03
I started working on a similar solution as a way to implement a beforeturn script; but I didn't want to code it if there was some way the regular beforeturn script would work. It looks like a command catcher is the best option now. Thanks.