Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: 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 {&lt;&lt; %1 &gt;&gt; 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
Reply with quote
Arde
Enchanter


Joined: 09 Sep 2007
Posts: 605

PostPosted: 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
Reply with quote
Josiah.Bruns
Apprentice


Joined: 04 Mar 2007
Posts: 103

PostPosted: 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 :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net