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
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Mon Mar 10, 2008 4:33 pm   

Help With Setup of a alias/trigger
 
Hi There,
On the MUD i play, i currently use an alias with #alarm triggers set in an alias for enchanting items, so it fires a new command of every x seconds, this works perfectly but whenever i happen to hit a lag spike(which can sometimes happen frequently) cmud obviously sends commands to the mud which can not be performed yeat because the mud hasnt set my balance back yet, resulting in a flop for encgant ment, so i need to know if there is some way to set up a kind of trigger that works off some kind of variable that will fire off everytime the mud sends "you have recovered balnce" to me, i will post my and example of what the commands look like(commands differ for all enchantments).

BEGIN ENCHANTMENT OF @item WITH AUGMENTATION
#alarm {+5} {Outc Kola;CRUSH KOLA}
#alarm {+12} {STRUM LUTE}
#alarm {+19} {STRUM LUTE}
#alarm {+26} {STRUM LUTE}
#alarm {+33} {BANG DRUM}
#alarm {+40} {BANG DRUM}
#alarm {+47} {BANG DRUM}
#alarm {+54} {CLAP HANDS}
#alarm {+61} {WAVE ARMS}
#alarm {+68} {WAVE ARMS}
#alarm {+75} {RING BELL}
#alarm {+82} {RING BELL}
#alarm {+89} {BURN INCENSE}
#alarm {+96} {SQUARE THE CIRCLE}
#alarm {+103} {SPIN AROUND THRICE}
#alarm {+110} {LIGHT CANDLE}
#alarm {+117} {outc kola;CRUSH KOLA}
#alarm {+124} {outc kola;CRUSH KOLA}
#alarm {+131} {outc kola;CRUSH KOLA}
#alarm {+138} {WAVE FEATHER}
#alarm {+145} {WAVE FEATHER}
#alarm {+152} {WAVE FEATHER}
#alarm {+159} {END RITUAL}

Hope someone with a bit more knowledge with this kind of thing can set me in the right direction,

Thanks

-edit It wont help lengthening the time between alarms because then when i am not lagged, it will take to long and the enchantment fails anyway
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 10, 2008 5:05 pm   
 
There're a couple of ways to do this, the simplest of which is probably a multistate trigger. I use an oninput trigger rather than an alias because that way it's easier to have more than one of them - if you used an alias for each enchantment, you'd have to have a separate trigger for each enchantment too, which'd probably get confusing. Anyway:

#oninput {augment %1} {begin enchantment of %1 with augmentation}
#cond {You have recovered balance} {outc kola;crush kola}
#cond {You have recovered balance} {strum lute}
#cond {You have recovered balance} {strum lute}
#cond {You have recovered balance} {strum lute}

etc etc. The pattern can be anything you like, actually, if you have a different message you need to trigger on (perhaps equilibrium or the event itself if it takes no balance). A slightly more complicated but more versatile solution is to use a balance queue. That'd go something like:

#event OnPrompt {#if (@balance and @equilibrium and @StuffToDo) {#exec %pop(StuffToDo)}

Where OnPrompt is an event you raise at each prompt, @balance and @equilibrium are variables you keep up-to-date with whether or not you have those balances (1=yes 0=no) and @StuffToDo is a string list of things you want to do. Then your alias just adds all the things it needs to do to the @StuffToDo list and starts it off by running the first one.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Mon Mar 10, 2008 5:30 pm   
 
ok so if was to use the second solution, i would just set triggers for "you have recovered balance" "balance=1" and equilibrium as well. and then i will set up an alias that sets stufftodo=(outc kola;crush kola, strum lute etc, each on a new line?

I'm just not sure what you mean by an event i raise at each prompt for OnPrompt, could you over simplify that for me please? Embarassed
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Mar 10, 2008 5:33 pm   
 
See the #raise command - it's just like calling an alias, you put #raise OnPrompt in your prompt trigger.

Don't be fooled by the lack of code that the second example is simpler - it's not, and it's more likely to go wrong. Really, I advise using the first one - while it's more work, you won't need to do it again once you've done it.

Anyway, the script needs to know both when you've regained balance ("You have recovered balance") and when you've lost it - the easiest way to tell that is by having a script that checks the letters after your prompt. You can use %pos to see if a letter's there. The StuffToDo list should have each item separated with a bar | - the easiest way is to have CMUD do that for you with #additem:

#additem StuffToDo {outc kola;crush kola}
#additem StuffToDO {strum lute}
#additem StuffToDO {strum lute}

etc
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Mon Mar 10, 2008 5:45 pm   
 
allright, then i will use the first one Laughing
thanks for the quick replies and help! Very Happy
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Sat Apr 12, 2008 6:26 pm   back again
 
ok, i have been away for quite a while, got back and tried to use the new oninput triggers, but they arent working.

Here is my trigger :
Code:
outc silver;outc horn;outc horn;Put silver in ouroboros32494;Put horn in ouroboros32494;Put horn in ouroboros32494;BEGIN CREATION OF FIST SIGIL
#cond {A somehow toneless yet beautiful sound} {chant fartak ishla spooz tran}
#cond {You have recovered balance on all limbs.} {chant fartak ishla spooz tran}
#cond {You have recovered balance on all limbs.} {chant fartak ishla spooz tran}
#cond {You have recovered balance on all limbs.} {@E1}
#cond {You have recovered balance on all limbs.} {END RITUAL;get fist sigil from ouroboros}


Here is what the mud says after the first part fires(begin creation of fist sigil)

Code:

H:3093 M:2451 E:14365 W:11800 XP:87% [eb]
A somehow toneless yet beautiful sound is heard in the distance, indicating that
you may begin.
H:3093 M:2451 E:14365 W:11800 XP:87% [eb]chant fartak ishla spooz tran

You chant, "Fartak ishla spooz tran."
H:3093 M:2451 E:14365 W:11800 XP:87% [e-]
You have recovered balance on all limbs.
H:3093 M:2451 E:14365 W:11800 XP:87% [eb]


I did the chanting manually due to it not firing, i have said the first condition to the full text of "A somehow toneless yet beautiful sound is heard in the distance, indicating that
you may begin." which did not work either, i am assuming its due to the fact that it spans two lines in cmud, but i do not know which pattern to use to fix that.[/code]
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sat Apr 12, 2008 8:51 pm   
 
Are those #cond statements within the trigger value? If so, that's not how you do it. A #cond statement is done on the command line, and adds a condition the last #trigger statement input on the command line. If you create the trigger within the settings editor, you add a condition by clicking New Trigger State under the New menu.
Reply with quote
Xarsas
Beginner


Joined: 05 Mar 2008
Posts: 16

PostPosted: Sat Apr 12, 2008 9:32 pm   
 
Rahab wrote:
Are those #cond statements within the trigger value? If so, that's not how you do it. A #cond statement is done on the command line, and adds a condition the last #trigger statement input on the command line. If you create the trigger within the settings editor, you add a condition by clicking New Trigger State under the New menu.


erm yeah, thats exactly what was wrong....

thanks for that Rolling Eyes
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