Tagged String Hell
by Lee Latham · in Torque Game Engine · 09/01/2008 (7:42 pm) · 2 replies
Hello,
I'm trying to add a little bit of information to this:
Basically, I've contrived to get the weapon name into %weapon. But nothing I do seems to work. I would have thought this would work:
But all that yields is something like:
bob killed susan with the weapon
Where "weapon" should be "chainsaw".
I've tried various tricks with tagging and detagging to no avail--any input would be greatly appreciated!
I'm trying to add a little bit of information to this:
messageAll('MsgClientKilled','%2 killed %1 ',%this.name,%sourceClient.name);Basically, I've contrived to get the weapon name into %weapon. But nothing I do seems to work. I would have thought this would work:
messageAll('MsgClientKilled','%2 killed %1 with the %weapon ',%this.name,%sourceClient.name);But all that yields is something like:
bob killed susan with the weapon
Where "weapon" should be "chainsaw".
I've tried various tricks with tagging and detagging to no avail--any input would be greatly appreciated!
#2
Thanks for straightening me out! That worked just fine. :-)
09/01/2008 (11:01 pm)
Riiiiiiiiiiiiiiiiiiigggghhhhhht. Right. Riiiiight. Ok, now I remember how it's supposed to work. I thought it had some of that %1 %2 voodoo that has always mystified me (because I haven't played with it much). I was thinking those referred to the parameters of the function you are in. As opposed to what they really are, is references to the parameters of the function you are calling in this case.Thanks for straightening me out! That worked just fine. :-)
Associate Chris Haigler
Jester Dance
messageAll('MsgClientKilled', '%2 killed %1 with the %3.', %this.name, %sourceClient.name, %weapon);If you're calling messageAll elsewhere, you'll most likely want to add the name of the weapon the player is carrying to their Player object so that it can be referenced in any serverside code like messageAll(). I can't say how you go about that exactly without seeing more code although I'd imagine whatever function controls giving players weapons would probably be a good place to start. In the end you'd want to end up with something like %client.player.weaponName which would then fit into messageAll as such:
messageAll('MsgClientKilled', '%2 killed %1 with the %3.', %this.name, %sourceClient.name, %sourceClient.player.weaponName);