About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
mcakatlk
Newbie


Joined: 12 Jan 2002
Posts: 4

PostPosted: Mon Oct 06, 2003 4:17 pm   

Creating a command queue
 
On the mud I play, issuing a command while casting a spell means doesn't work. Therefore, I'm trying to create a set of triggers that will execute any triggers that fire during the spell after it has completed. This is what I have so far. As of now, it crashes Zmud completely. (I'm using 6.62)

#var list 0
#trigger {You are busy spellcasting...} {comq=%push(%action)}
#trigger {You complete your spell.} {comq=%expandlist(@comq, ";");
#if (comq!=0) {@comq} {};
#var comq 0}

The above causes zmud to freeze. Following is a log of mud output ect. Any help would be greatly appreciated.

cast 'minute meteor'
You start chanting...

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
Alea barely crushes a wood elf scout.
A wood elf scout barely hits Mok.
Mok skillfully dodges the attack of a wood elf scout.
A wood elf scout skillfully dodges the attack of Mok.
Mok crushes a wood elf scout hard.
Mok misses a wood elf scout with his crush.

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
Casting: ***

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
Casting: **

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
Casting: *

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
gs ...
You are busy spellcasting...

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
Alea starts casting a spell.

< 276h/276H 135v/135V P:Fighting >
< T: Mok TC: small wounds E: scout EC: pretty hurt >
You complete your spell.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Tue Oct 07, 2003 4:14 am   
 
Someone soon will give you a BRIGHT idea, but untill then think of this:

Add this line to all your castings
busycasting=1

noew to all of your triggers put this at the beggining:
#if @busycasting=0 {take the rest of the trigger and put it here}

now this will just not allow you to do what ever it was you where tring to do

I know not what you asked for, but it should give you ideas.

Also Triggering 'You are busy casting' may not be the way to go
I don't know about your mud but mine has a lag and if
I trid to capture what i was tring to do in a fight to do later it would mess up bad.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Oct 07, 2003 8:18 am   
 
Assuming %push( %action) works as you intend, this should do. You do have to specify the list with %push. You should also note that %push places each new item at the front of the list, so you'll do the commands in reverse order. Use %additem if you want to do them in the original order.

#VAR comq ""
#TR {You are busy spellcasting...} {comq = %push( %action, @comq)}
#TR {You complete your spell.} {#IF (%numitems( @comq) > 0) {#FORALL @comq {%i}};#VAR comq ""}
Reply with quote
avrian
Newbie


Joined: 19 Dec 2002
Posts: 3
Location: Finland

PostPosted: Tue Oct 07, 2003 7:32 pm   
 
#VAR comq ""
#TR {You are busy spellcasting...} {comq = %push( %action, @comq)}
#TR {You complete your spell.} {#IF (%numitems( @comq) > 0) {#FORALL @comq {%i}};#VAR comq ""}

This causes zmud (6.62) to freeze my computer :( later when trigger is about to fire.

Variable comq seems to be flooded with strings
comq = %push( %action, @comq)

When I do "comq = %push( %action, @comq)" on command line the
comq variable is being filled perfectly, must be settings settings problems, GUH, any ideas guys?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Oct 07, 2003 11:15 pm   
 
As I told mcakatlk, "Assuming %push(%action) works as you intend". I didn't bother to check whether it does or not. I'm usually reluctant to test scripts which are reported to cause lockups or crashes.

I can't see any reason for using %action in the first place.
%action the action executed from the last trigger
What you probably really want is %lastinput, %lastin2, %lastcom, or %lastcom2.

Since you're trying to capture commands (from whatever source) you wouldn't want to store the action section of the trigger, you'd want the command that preceded it.

Worse, of course, is that this is a recursive action.
#TR {You are busy spellcasting...} {comq = %push( %action, @comq)}
The blue part is the action executed from the last trigger (this one, since it just fired), so after replacing %action the command becomes:
comq = %push( comq = %push( %action, @comq), @comq)
And then, there's another %action to be replaced
comq = %push( comq = %push( comq = %push( comq = %push( %action, @comq), @comq)
, @comq), @comq)
Of course, this contains another %action which will need to be replaced and then there will be another %action, and another, and another...until zMUD gives up.

Personally, I'd probably just highlight or color the "busy" phrase so I'd realize my commands had to wait, and then reenter them myself.
Reply with quote
avrian
Newbie


Joined: 19 Dec 2002
Posts: 3
Location: Finland

PostPosted: Wed Oct 08, 2003 6:00 pm   
 
Ahh, I see the error of my ways!
Thank you :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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