I’m remembering how to script again pretty quickly now that I’m back, but I could have sworn I was able to pass parameters through a function before…
ie:
[code]function dostuff(a,b){
}
dostuff(5,#v(this.randomvariable));[/code]
What am I doing wrong? Graal yells mean things at me when I try to give it hot, steamy scripting.
Unless I’m just missing triggeractions a little too much subconsciously. I’m assuming that is the case.
I would be attempting to call the function in a weapon, from an npc. (I know calling the function alone would not do that-- I also forgot how to talk to a weapon, I know callweapon, but I’m not sure if that’s what I need. I’m picking this stuff back up as I go. :D)
cough Yeah really D:
Oh yeah, maximum script (char) length the client seems to accept in online mode is 13k per NPC/NPCw. Anything after 13,000 or so, gets cropped off.
Ya, like was said I guess, Functions work. Passing parameters doesn’t, but npcs share variables between all their functions, so there isn’t really any need for parameters.
call weapon works, but I think the weapon has to be selected to be called. Or you have to know the index of the weapon. (atleast that’s what my past scripting suggests)
ie.
for (i=0;i<weaponscount;i++) {
if (strequals(#w(i),weaponname)) {
callweapon i,weaponname;
}
}
Callweapon uses an eventflag, like if I said callweapon i,dothings,toadstools;
if (dothings){
setplayerprop #c,#p(0);
}
On the weapon, would set the player’s chat to toadstools. I can indeed effectively set client strings from such events, and they may work hand and hand with my functions without need for a timeout! Parameters sent from npc to weapon via callweapon instead. (Because I like less strings and variables and timeouts… Yeah, I’m insane.)
Thanks everyone, I believe I have just arrived at a completely desireable solution. <3
I hope a small for loop (callweapon()) within a small for loop (getplayer()) is better than using a timeout in a system weapon. The loops would be ran only once, upon the death of the npc. However, there would likely be many npcs dying around the server at a time.
Thoughts? I’m remembering so much, it’s awesome. @_@