Spammy alias.

by Unknown

Back to Mechanic's Corner.

Unknown2006-06-12 08:15:33
For my curing alias, I have a smoke, eat, drink, etc variable that is set depending on the priority of the affliction in the alias.. I.E. haemophelia might set drink to "drink sanguine", and below that powersink might set drink to "drink phlegmatic".. The actual mechanics are below.

#if {@smoke!="" AND @HS_balance=1} {
@smoke
HS_balance=0
#alarm +2 {#if @HS_balance=1 {@smoke}}
}
#if {@apply!="" AND @apply_balance=1} {
@apply
apply_balance=0
#alarm +2 {#if apply_balance=1 {@apply}}
}
#IF {@eat!="" AND @HS_balance=1} {
#exec @eat
HS_balance=0
#alarm +2 {#if @HS_balance=1 {@eat}}
}
#if {@drink!="" AND @drink_balance=1} {
@drink
drink_balance=0
#alarm +2 {#if @drink_balance=1 {@drink}}
}
#if @wake!="" {@wake}
#if @writhe!="" {@writhe}
#if @focus!="" {@focus}
#va smoke ""
#va apply ""
#va eat ""
#va drink ""
#va wake ""
#va writhe ""
#va focus ""

Now, it does work, but when I use it, the alias triggers a new prompt. So, if I put it on a 1 second timer like I want to do, it will spam a new prompt every second. Anyone have a work around or solution on how to change that, yet still have it running every second?

Edit: The balance bit is still iffy, I'm not sure yet how to attempt to eat or drink, then if it fails due to stupidity, or what have you, try again in a few seconds without always trying again if another cure put it off-balance yet again.

I know you can track what you've eaten, appled, drunk, smoked etc, but I don't want to do that, and I'm hoping there's a more elegant solution.....somehow.
Unknown2006-06-12 08:40:39
Hmmm... try having it in a trigger that fires off the prompt itself, rather than as an alias that loops for an eternity... it would probably make it stop spamming back a prompt everytime it fires.

Also could have it fire off every prompt, but then use a #COND with a {Wait|Param=1000} so that it fires off every prompt, but no more then once per second.
Unknown2006-06-12 08:48:16
That's a good idea, I'll try it and see what happens..
Right now, I think that if I use it in a trigger it will do the same thing, but maybe not..
I fixed the secondary problem about failed actions with drink, salves, etc.

#if {@smoke!="" AND @HS_balance=1} {
@smoke
HS_balance=0
#alarm "smoke" +2 {#if @HS_balance=0 {@smoke}}
}
#if {@apply!="" AND @apply_balance=1} {
@apply
apply_balance=0
#alarm "apply" +2 {#if @apply_balance=0 {@drink}}
}
#IF {@eat!="" AND @HS_balance=1} {
#exec @eat
HS_balance=0
#alarm "eat" +2 {#if @HS_balance=0 {@eat}}
}
#if {@drink!="" AND @drink_balance=1} {
@drink
drink_balance=0
#alarm "drink" +2 {#if @drink_balance=0 {@drink}}
}
#if @wake!="" {@wake}
#if @writhe!="" {@writhe}
#if @focus!="" {@focus}
#va smoke ""
#va apply ""
#va eat ""
#va drink ""
#va wake ""
#va writhe ""
#va focus ""

I just had to name the alarms, so they reset if the action is successful.

The trigger bit doesn't work. I still get a carriage return, giving me another prompt. I don't know why, either. I believe it has to do with resetting the variables. I'll try creating a reset alias that resets them, then have the command run that.


Edit: Bah, I fixed it. I had added comments using //, and I'd missed one. Duh.

Thanks for the help though.
Unknown2006-06-12 08:51:40
It must be one of the statements in the trigger. My guess is the #exec is doing it. I'll test it myself in a bit.