Functions and parameters

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…


[code]function dostuff(a,b){


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)

Its available… In later versions. It sucks, but its true.


Slightly messy workaround scripting ahead!

I love a challenge.

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.

Which costs 5 more chars per use ;D

Makes you want to punch a baby.

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)

 for (i=0;i<weaponscount;i++) {
      if (strequals(#w(i),weaponname)) {
        callweapon i,weaponname;

Thanks guys. =]

How bad is a timeout in an npcw that every player on a server will have? I was hoping to avoid using one, but eh. I forgot.

I believe what I’m going to do is:

  • A string array to save account names that hit the npc, to the npc.
  • getplayer() to cycle through the accounts and set a client string array for each of them.
  • A timeout in the system (:() to check if the client string has anything in it or not.
  • Activate a function if it does, using the information in the array as if they were parameters, then to clear it. Mission accomplished.

Ah, yeah! Thanks Hand! Actually, callweapon looks more like this:

callweapon i,[b][i]eventflag,param,param,param etc.[/i][/b];

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. @_@

You can use triggeraction.



triggeraction > another loop.

For some reason I thought I wasn’t able to. Didn’t try. <.<


I just remembered the thread on Graal 2.3

Conclusion: Requires an NPC server

Thanks HandupOnYoHip, link fixed.

lol nice link bro