actionplayer messed up?

From reading the commands.rtf and graalbible I would have expected “actionplayer” to be “0” if I’m the only person in the room. But for some reason both online and offline it comes up as “-2”.

WTF?

if (playerchats && strequals(#c,test)) {
  // increase player's rupees just to verify that we have the right guy
  players[actionplayer].rupees = players[actionplayer].rupees + 1;

  // also say what we think actionplayer is
  say2 actionplayer = #v(actionplayer);
}

Am I misunderstanding the purpose of “actionplayer” or am I just misusing it somehow?

Edit: clarification point, the code above does not work. My rupees stay the same and the say2 comes up with “actionplayer = -2”

Imma guess that noone triggered an action…

oh, so “playerchats” is not an action? So, what if I want to find out who the player is that chatted? Don’t want my bank teller to be putting money in the wrong guy’s pocket :wink:

actionplayer, only gets assigned a value if an NPC their client is running calls a triggeration command from what i understand.

___Merged doublepost__________________

Also, if(playerchats) will only work for the player that entered text and hit enter, not every person in the level…

[QUOTE=urza;65676]
actionplayer, only gets assigned a value if an NPC their client is running calls a triggeration command from what i understand.

Merged doublepost_______________

Also, if(playerchats) will only work for the player that entered text and hit enter, not every person in the level…
[/QUOTE]

Right, but how do I translate “the guy who playerchat()ed” into an index so that I can do things like “players[what_goes_here].rupees”? Are indexes constant things (i.e. if I walk into a level and there are 2 people already there is my index going to be 2 for everybody and everything?)

Or do indexes switch or something depending on who “playertouchsme()”, “playerchats()”, etc…

Err, not so good with player indexes, that’s a Beholder/Downsider question…

If you do if (playerchats), anything that occurs inside there will occur to the player that triggered playerchats. In cases like that, you don’t have to use an index, you simply use it like so:

if (playerchats) { playerrupees = playerrupees + 1; }

[QUOTE=Downsider;65686]
If you do if (playerchats), anything that occurs inside there will occur to the player that triggered playerchats. In cases like that, you don’t have to use an index, you simply use it like so:

if (playerchats) { playerrupees = playerrupees + 1; }
[/QUOTE]

Hurr Derp…

[QUOTE=Downsider;65686]
If you do if (playerchats), anything that occurs inside there will occur to the player that triggered playerchats. In cases like that, you don’t have to use an index, you simply use it like so:

if (playerchats) { playerrupees = playerrupees + 1; }
[/QUOTE]

Aaaahhhhhh, cool. Thanks.