A way to queue spells, so it casts the next after the previo

Scripts and support for your favorite MUD client.
Lilithelle
Sojourner
Posts: 230
Joined: Wed Oct 10, 2001 5:01 am
Location: Vancouver, BC, Canada
Contact:

A way to queue spells, so it casts the next after the previo

Postby Lilithelle » Sun Jun 09, 2002 7:36 am

In fact this alias/triggers combo will let you queue any commands to be cast before, or after spells.

#CLASS {Buffer}
#ALIAS B {
#if (%len( %1)) {
#if (%lower( %1) = "off") {
#var Casting 0
#var Commands {}
#echo Buffer cleared.
} {
#echo Buffering: %-1
#if (%len( @Commands)) {#var Commands %concat( @Commands, ";")}
#var Commands %concat( @Commands, %-1)
}
}
#while (%len( @Commands) & !@Casting) {
#var Command %word( @Commands, 1, ";")
#if (%pos( %word( @Command, 1), "cast") = 1) {
#var Casting 1
}
@Command
#var Commands %right( @Commands, %len( @Command) + 1)
}
}
#TRIGGER {You don't have that spell memorized.$} {
#var Casting 0
B
}
#TRIGGER {You start chanting...} {
#var Casting 1
}
#TRIGGER {^You complete your spell...} {
#var Casting 0
B
}
#TRIGGER {You abort your prayer before its done!} {
#var Casting 0
b
}
#TRIGGER {You abort your spell before its done!} {
#var Casting 0
b
}
#CLASS 0

To use it simply put a B (and a space)before the command and it'll queue it and excute it in the right sequence. For example if you want to preserve a corpse 3 times and then pray you'd enter (in zmud):
#3 b cast 'pres' pcorpse
b rest
b pray
b med

If you want to queue multiple commands in the same B call you can put them inside quotes with a semicolon seperating them. Using the above example you'd use:
#3 b cast 'pres' pcorpse
b "rest;pray;med"

If something happens that you need to abort the queue'd spells you enter:
b off
That discards all the commands in the queue.

If you are going to use it make sure you don't queue anything while there are still commands that have been sent to the mud but not yet executed. For example if you enter:
cast 'create f';b "rest;pray;med"
ZMud will send the cast 'create f' to the mud, zmud doesn't know when it'll get there. Immediately after sending it runs the B alias. Often the cast command won't have been received by the mud yet when the B alias looks to see if your casting or not. It thinks you aren't and spits out the "rest;pray;med". But infact its spitting them out immediately after the cast 'create f', so you start casting then immediatley after it does the "rest;pray;med" and these commands are lost and you get the "You're busy spellcasting!" message.

I think you'll find this very useful when you want to cast alot of spells and then do something else while its spitting the spells out in turn.
- Lilithelle
Malacar
Sojourner
Posts: 1640
Joined: Fri Jan 26, 2001 6:01 am
Location: Boston, MA, USA

Postby Malacar » Tue Jun 11, 2002 6:25 pm

Hrm, when I am trying to use this with aliases, it is not recognizing them.


Is there a way to use an alias for this? I love this idea, it's great. Image

------------------
Malacar - omg ymir!
Lilithelle
Sojourner
Posts: 230
Joined: Wed Oct 10, 2001 5:01 am
Location: Vancouver, BC, Canada
Contact:

Postby Lilithelle » Wed Jun 12, 2002 3:38 pm

I don't use many aliases so I didn't notice this didn't work with them. Change the alias as follows and it'll work with aliases.

#ALIAS B {
#if (%len( %1)) {
#if (%lower( %1) = "off") {
#var Casting 0
#var Commands {}
#echo Buffer cleared.
} {
#echo Buffering: %-1
#if (%len( @Commands)) {#var Commands %concat( @Commands, ";")}
#var Commands %concat( @Commands, %-1)
}
}
#while (%len( @Commands) & !@Casting) {
#var Command %word( @Commands, 1, ";")
#if (%pos( %word( @Command, 1), "cast") = 1) {
#var Casting 1
}
#exec @Command
#var Commands %right( @Commands, %len( @Command) + 1)
}
}

I also notice if you mispell your spell name it'll might think your casting and the spell hasn't completed since there was no completion message. The following triggers should solve this.
#TRIGGER {Sorry, typo, try again!} {
#var Casting 0
b
}
#TRIGGER {Excuse me?} {
#var Casting 0
b
}
#TRIGGER {Nobody here by that name.} {
#Var Casting 0
b
}
#TRIGGER {You cannot cast this spell upon yourself.} {
#var Casting 0
b
}
#TRIGGER {Um . . . you made a typo!} {
#var Casting 0
b
}
#TRIGGER {Sorry, you spelled it wrong!} {
#var Casting 0
b
}
#TRIGGER {You ok??} {
#var Casting 0
b
}
Malacar
Sojourner
Posts: 1640
Joined: Fri Jan 26, 2001 6:01 am
Location: Boston, MA, USA

Postby Malacar » Thu Jun 13, 2002 6:00 am

Awesome Lili.. Thanks so much. Image

------------------
Malacar - omg ymir!
rachaz
Sojourner
Posts: 72
Joined: Tue Feb 12, 2002 6:01 am
Location: New York

Postby rachaz » Wed Aug 07, 2002 3:17 am

If someone can help me fix this alias so that it works for me, I would really appreciate it.

example of my bug...

#2 B c 'minor create' ration =

;#if (2) {;#if ( c = off) {;#var Casting 0;#var Commands {};#echo Buffer cleared.;} {;#echo Buffering: c 'minor' ration;#if (10) {#var Commands @Commands ;};#var Commands @Commands c 'minor' ration;};}
;#if (2) {;#if ( c = off) {;#var Casting 0;#var Commands {};#echo Buffer cleared.;} {;#echo Buffering: c 'minor' ration;#if (10) {#var Commands @Commands ;};#var Commands @Commands c 'minor' ration;};}

That is what I see... I dunno what that is.
Thank you Image
Cira
Sojourner
Posts: 16
Joined: Thu Dec 06, 2001 6:01 am

Postby Cira » Fri Oct 11, 2002 9:51 pm

I've been trying to use this, it seems like a great set.. but for some reason it just won't work for me. When I use the command

#2 b c 'pres' Person

I get:

< > Buffering: #2 pres Person
c 'preserve' Person
c 'preserve' Person
You start chanting...

< 667h/667H 167v/167V >
< > You're busy spellcasting!

and that's it.. for whatever command I put in. Maybe it's user error, but I can't for the life of me figure out what I'm doing wrong.

------------------
Cira - ShaWOman
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Tue Oct 29, 2002 2:38 am

cira:
Try

#loop 3 {b c 'pres' player}

-Gerad Image




------------------
Auril tells you 'Yes, we're plotting the destruction of all that is holy - and unholy, too. Just to be thorough.'
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Tue Oct 29, 2002 2:45 am

This works fine for me for the first one,
but if I try to que multiples, I get this:
(heal is my alias for c 'heal', that part works ok)

>heal me
>b heal me
>b heal me
You start chanting...
You complete your spell
You heal gerad
c 'heal' me
c 'heal' me
You start chanting...
Your busy spellcasting!

Shrug,
Gerad

------------------
Auril tells you 'Yes, we're plotting the destruction of all that is holy - and unholy, too. Just to be thorough.'
Alomlim
Sojourner
Posts: 99
Joined: Wed Apr 03, 2002 6:01 am

Postby Alomlim » Tue Oct 29, 2002 8:34 am

Gerad,

Gotta buffer them all...

b heal me
b heal me
b heal me

That works good!

------------------
-Alomlim
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Tue Oct 29, 2002 9:12 pm

shakes... same result with
heal me
b heal me
b heal me

as with

b heal me
b heal me
b heal me

Image

Jorus! Save us with thine holy zmud skillzorz

------------------
Auril tells you 'Yes, we're plotting the destruction of all that is holy - and unholy, too. Just to be thorough.'
Malacar
Sojourner
Posts: 1640
Joined: Fri Jan 26, 2001 6:01 am
Location: Boston, MA, USA

Postby Malacar » Tue Oct 29, 2002 9:28 pm

Logically, I can tell you exactly why it does it. I cannot, however, fix it for you.

The way these buffers work(I use them myself), is when you enter a bunch of buffered commands, and you're not already casting, it tries to dump them all at once, instead of one at a time.

Actually, try this:
c 'pres' pcorpse
#5 {#wait 1000 c 'pres' pcorpse}


The wait commands works wonders with this buffer system.


------------------
Malacar - omg ymir!
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Wed Oct 30, 2002 3:22 am

< 571h/814H 126v/127V > c 'heal' me
You start chanting...

< 572h/814H 127v/127V > Buffering: heal me

Casting: heal *****

< 572h/814H 127v/127V >
Casting: heal ***

< 572h/814H 127v/127V > Buffering: heal me

Casting: heal **

< 572h/814H 127v/127V >
Casting: heal *

< 573h/814H 127v/127V >
You complete your spell...
c 'heal' me
c 'heal' me
You heal Gerad.
A warm feeling fills your body.

< 664h/814H 127v/127V > You start chanting...

< 664h/814H 127v/127V > You're busy spellcasting!

< 664h/814H 127v/127V >
Casting: heal *

< 665h/814H 127v/127V >
You complete your spell...
You heal Gerad.
A warm feeling fills your body.


------------------
Auril tells you 'Yes, we're plotting the destruction of all that is holy - and unholy, too. Just to be thorough.'
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Wed Oct 30, 2002 4:57 am

Hi Guys Image

The problem Gerad was having, and Malacar's "problem" of having to wait until the first spell begins to enter subsequent buffers both stem from the "b" alias not evaluating commands to see if they are aliases which result in casting (it only checks to see if they are commands which should be casting themselves).

Lilithelle's addition of #EXEC handles the aliases going one way (on the way out, so to speak). They should also have been handled "on the way in".

Anyways, I've gone and fixed that, as well as changing things around a little bit so the triggers won't be on when there is nothing buffered, which should keep everyone's zmud running speedily.

Regards,
Jorus

Here are the results my modifications, in complete form (paste into a text file and import):

#CLASS {Buffer}
#TRIGGER {Sorry, typo, try again!} {#var Casting 0;b}
#TRIGGER {Excuse me?} {#var Casting 0;b}
#TRIGGER {Nobody here by that name.} {#Var Casting 0;b}
#TRIGGER {You cannot cast this spell upon yourself.} {#var Casting 0;b}
#TRIGGER {Um . . . you made a typo!} {#var Casting 0;b}
#TRIGGER {Sorry, you spelled it wrong!} {#var Casting 0;b}
#TRIGGER {You ok??} {#var Casting 0;b}
#TRIGGER {You don't have that spell memorized.$} {#var Casting 0;B}
#TRIGGER {You start chanting...} {#var Casting 1}
#TRIGGER {^You complete your spell...} {#var Casting 0;B}
#TRIGGER {You abort your prayer before its done!} {#var Casting 0;b}
#TRIGGER {You abort your spell before its done!} {#var Casting 0;b}
#CLASS 0

#ALIAS B {#IF (%len( %1)) {#IF (%lower( %1) = "off") {#VARIABLE Casting 0;#VARIABLE Commands {};#T- buffer;#ECHO Buffer cleared.} {#ECHO Buffering: %-1;#T+ buffer;#IF (%len( @Commands)) {#VARIABLE Commands %concat( @Commands, ";")};#VARIABLE Commands %concat( @Commands, %-1)}};#WHILE (%len( @Commands) & !@Casting) {#VARIABLE Command %word( @Commands, 1, ";");#IF (%pos( %word( %exec( @Command), 1), "cast") = 1) {#VARIABLE Casting 1};#EXECUTE @Command;#VARIABLE Commands %right( @Commands, %len( @Command) + 1);#IF !%len( @Commands) {#T- buffer} {#T+ buffer}}}
Lilithelle
Sojourner
Posts: 230
Joined: Wed Oct 10, 2001 5:01 am
Location: Vancouver, BC, Canada
Contact:

Postby Lilithelle » Wed Oct 30, 2002 9:23 am

I completely forgot about aliases when writing it, the other way to make it work is to put:
#var casting 1
at the start of all your spell casting aliases.
Cira
Sojourner
Posts: 16
Joined: Thu Dec 06, 2001 6:01 am

Postby Cira » Wed Oct 30, 2002 1:45 pm

Sweet.. that works perfectly Image Thanks Jorus

------------------
Cira - ShaWOman
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Wed Oct 30, 2002 9:31 pm

Hmm, not quite perfect Image

With the class disabling, a bug appears where if you cast a spell without using the buffering, then try to buffer a spell, it doesn't know you are already casting (because the buffer alias or the triggers are needed to establish that)

There are a few alternative solutions, such as having spellcasting aliases enable the buffer class, but the most "compatible" is to eliminate the disabling of the buffer class altogether.

Anyways, here's a new version of the B alias that won't exhibit that problem (you'll have to enable the buffer class once however)

#ALIAS B {#IF (%len( %1)) {#IF (%lower( %1) = "off") {#VARIABLE Casting 0;#VARIABLE Commands {};#ECHO Buffer cleared.} {#ECHO Buffering: %-1;#IF (%len( @Commands)) {#VARIABLE Commands %concat( @Commands, ";")};#VARIABLE Commands %concat( @Commands, %-1)}};#WHILE (%len( @Commands) & !@Casting) {#VARIABLE Command %word( @Commands, 1, ";");#IF (%pos( %word( %exec( @Command), 1), "cast") = 1) {#VARIABLE Casting 1};#EXECUTE @Command;#VARIABLE Commands %right( @Commands, %len( @Command) + 1);#VARIABLE Command {}}}
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Wed Oct 30, 2002 10:14 pm

That works great! thanx!

------------------
Auril tells you 'Yes, we're plotting the destruction of all that is holy - and unholy, too. Just to be thorough.'
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Wed Oct 30, 2002 11:54 pm

Final update.

My prior version handles SOME aliases, but not all of them (in particular nested aliases) eg:

#al test2 {test %1}
#al test3 {test2 %1}
#al test4 {test3 %1}
#al test {c 'somespell' %1}
b "test4 arishae;test3 arishae;test2 arishae;test arishae"

It also didn't handle simpler aliases (at least not in my settings :P) so b "create ration;create ration" would also fail.

Anyways, the alias below handles all cases I've been able to manufacture.

#ALIAS B {#IF (%len( %1)) {#IF (%lower( %1) = "off") {#VARIABLE Casting 0;#VARIABLE Commands {};#ECHO Buffer cleared.} {#ECHO Buffering: %-1;#IF (%len( @Commands)) {#VARIABLE Commands %concat( @Commands, ";")};#VARIABLE Commands %concat( @Commands, %-1)}};#WHILE (%len( @Commands) & !@Casting) {#VARIABLE Command %word( @Commands, 1, ";");#VARIABLE firstword {%word( @command, 1)};#IF (%pos( %if( %null( %alias( @firstword)), @firstword, %word( %exec( %word( %alias( @firstword), 1)), 1)), "cast") = 1) {#VARIABLE Casting 1};; #SAY %eval( (%pos( %if( %null( %alias( @firstword)), @firstword, %word( %alias( @firstword), 1)), "cast") = 1)) @command -> %if( %null( %alias( @firstword)), @firstword, %word( %alias( @firstword), 1));#EXECUTE @Command;#VARIABLE Commands %right( @Commands, %len( @Command) + 1);#VARIABLE Command {}}}
Tsaen
Sojourner
Posts: 5
Joined: Tue Nov 05, 2002 6:01 am

Postby Tsaen » Tue Dec 03, 2002 9:30 pm

Help Image

Ive been having problems trying to get this to work!

#IF (%len( %1)) {#IF (%lower( %1) = "off") {
#VARIABLE Casting 0
#VARIABLE Commands {}
#ECHO Buffer cleared.
} {
#ECHO Buffering: %-1
#IF (%len( @Commands)) {#VARIABLE Commands %concat( @Commands, ";")}
#VARIABLE Commands %concat( @Commands, %-1)
}}
#WHILE (%len( @Commands) & !@Casting) {
#VARIABLE Command %word( @Commands, 1, ";")
#VARIABLE firstword {%word( @command, 1)}
#IF (%pos( %if( %null( %alias( @firstword)), @firstword, %word( %exec( %word( %alias( @firstword), 1)), 1)), "cast") = 1) {#VARIABLE Casting 1}
#SAY %eval( (%pos( %if( %null( %alias( @firstword)), @firstword, %word( %alias( @firstword), 1)), "cast") = 1)) @command -> %if( %null( %alias( @firstword)), @firstword, %word( %alias( @firstword), 1))
#EXECUTE @Command
#VARIABLE Commands %right( @Commands, %len( @Command) + 1)
#VARIABLE Command {}
}

after removing two syntax errors i got it to look like a real alias but still, nothing happens when i hit b. I see the echo of what's being buffered but thats it.
Could someone help me out here? Image
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Wed Dec 04, 2002 3:19 am

Ok, Tsaen's alias is now working.

The trick is also importing the triggers. That may not have been clear from my last post.

Here's a full version, than also fixes the "syntax errors" Tsaen reported (they were actually caused by zmud not exporting and importing a "comment" correctly).

Just paste into notepad and save it as a .txt file, then tell zmud to import it.

About the only thing it doesn't handle is #ONINPUT triggers designed to imitate aliases (I use some to let me cast at names in a list without needing multiple aliases or spaces).

To solve that, just place "#VAR Casting 1" in any #oninput triggers that emulate casting aliases.

Regards,
Jorus

#CLASS {Buffer}
#TRIGGER {Sorry, typo, try again!} {#var Casting 0;b}
#TRIGGER {Excuse me?} {#var Casting 0;b}
#TRIGGER {Nobody here by that name.} {#Var Casting 0;b}
#TRIGGER {You cannot cast this spell upon yourself.} {#var Casting 0;b}
#TRIGGER {Um . . . you made a typo!} {#var Casting 0;b}
#TRIGGER {Sorry, you spelled it wrong!} {#var Casting 0;b}
#TRIGGER {You ok??} {#var Casting 0;b}
#TRIGGER {You don't have that spell memorized.$} {#var Casting 0;B}
#TRIGGER {You start chanting...} {#var Casting 1}
#TRIGGER {^You complete your spell...} {#var Casting 0;B}
#TRIGGER {You abort your prayer before its done!} {#var Casting 0;b}
#TRIGGER {You abort your spell before its done!} {#var Casting 0;b}
#TRIGGER {You can't do this sitting!} {#VARIABLE casting 0}
#TRIGGER {Who should the spell be cast upon~?$} {#VARIABLE Casting 0;b}
#CLASS 0

#ALIAS B {#IF (%len( %1)) {#IF (%lower( %1) = "off") {#VARIABLE Casting 0;#VARIABLE Commands {};#ECHO Buffer cleared.} {#ECHO Buffering: %-1;#IF (%len( @Commands)) {#VARIABLE Commands %concat( @Commands, ";")};#VARIABLE Commands %concat( @Commands, %-1)}};#WHILE (%len( @Commands) & !@Casting) {#VARIABLE Command %word( @Commands, 1, ";");#VARIABLE firstword {%word( @command, 1)};#IF (%pos( %if( %null( %alias( @firstword)), @firstword, %word( %exec( %word( %alias( @firstword), 1)), 1)), "cast") = 1) {#VARIABLE Casting 1};#EXECUTE @Command;#VARIABLE Commands %right( @Commands, %len( @Command) + 1);#VARIABLE Command {}}}
Gerad
Sojourner
Posts: 591
Joined: Sun May 13, 2001 5:01 am
Location: Cincinnati, OH
Contact:

Postby Gerad » Mon Feb 10, 2003 8:20 am

With the above in 6.53, I am getting

b heal me
< 846h/831H 139v/139V > Buffering: heal me
heal me
Pardon?

< 846h/831H 139v/139V >

Heal is my alias for c 'heal', its not expanding that...

?

-g
<I>When a man lies, he murders some part of the world
These are the pale deaths, which men miscall their lives
All this I cannot bear to witness any longer
Cannot the kingdom of salvation take me home?</I>

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 15 guests