|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Thu Nov 12, 2009 8:16 pm
Having trouble calling and event and sending an augument with it |
<event event="CheckForCask (%w)" priority="3750" id="375">
<value>p %1 do you have room for a cask?
#waitfor {<< %1 >> I do have room for a cask.} 2000
{
//buywine
give cask to %1
}
{
p no cask for %1
}</value>
</event>
i am trying to have a check for cask event that asks my different players if they have a cask and acts accordingly.
i want to call it something like this, #raise CheckForCask bones |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Thu Nov 12, 2009 9:00 pm |
If you want to pass an argument to an event, use named arguments - your code will be more readable. Of course, you may not declare any arguments and stick with %1 as you'd do with aliases, but I recommend you to use named arguments. Do not use (%w) or other pattern-matching wildcards - events are not triggers, they have no patterns. Paste the following event XML code into Package Editor and see in the UI how you can properly set up an event, how to declare params, etc. I do not discuss whether your code is correct or no though.
Code: |
<event event="CheckForCask" priority="3750" id="375">
<value>p $strPlayerName do you have room for a cask?
#waitfor {<< $strPlayerName >> I do have room for a cask.} 2000
{
//buywine
give cask to $strPlayerName
}
{
p no cask for $strPlayerName
}</value>
<arglist>$strPlayerName</arglist>
<notes>You can use more than 1 argument: just separate them with commas in the Params field: $strArg1, $strArg2, ... and with spaces when you call an event with #RAISE</notes>
</event>
|
You can raise the event with this command: #RAISE CheckForCask bones.
Warning! If you have more than 1 argument you must separate them in the #RAISE command by spaces - make use of {} or "" in this case. |
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
Josiah.Bruns Apprentice
Joined: 04 Mar 2007 Posts: 103
|
Posted: Fri Nov 13, 2009 12:48 am Woot Thanks |
what i wasn't able to figure out till i pasted in your code was how to do this in the gui
no that i see i was supposed to use the param field below it all makes sense and works too :) |
|
|
|
|
|