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
Death
Apprentice


Joined: 25 Jun 2002
Posts: 109
Location: USA

PostPosted: Fri Jul 25, 2003 3:16 am   

queue help
 
Level 7: armor
Level 8: create water
Level 9: poison
Level 10: burning hands
Level 10: dispel magic

Entering several lines at once, needs to catch the spell/skill name into a queueing system. Where it would pass 1 line at a time, if it doesn't receive "Help entry added to category." for that line, then log it to a file, and continue to the next one. If it does get that message, then move onto the next one in the queue. Can anyone help me with this? Thanks for your time.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 25, 2003 2:32 pm   
 
This is the closest I could come to making sense of what you asked.
1. Catch spell/skill name into queue
2. "Pass" one line at a time from queue
3. Check for "Help entry...", if not received write to file
4. Repeat until queue is empty

#TR {(Level %d: *)} {#ADDI Queue {%1})
#ALA *5 {#IF (%numitems( @Queue)) {#VAR Help 0;#VAR Pass {%pop( @Queue)};pass @Pass;#ALA +3 {#IF (@Help = 0) {#FILE 1 Spells;#WRITE 1 {@Queue};#CLOSE 1}}}}
#TR {Help entry added to category} {#VAR Help 1}

I doubt that it's what you actually meant, but hopefully it's close enough so you can figure it out and modify it to what you really intended.
Reply with quote
Death
Apprentice


Joined: 25 Jun 2002
Posts: 109
Location: USA

PostPosted: Fri Jul 25, 2003 10:15 pm   
 
I'm having a horrible time getting the #additem command to actually add the list to it, then the %pop isn't grabbing the first listing in the queue variable and placing in its own. I've changed a few things around, but kept the main integretity of what you had.

#CLASS {Skill/Spell Update}
#VAR queue {}
#VAR help {0}
#VAR pass {}
#TRIGGER {^Level (%n)~: (*)} {#additem queue {'%2'}}
#ALARM {*5} {#if (%numitems( @queue)) {#var help 0;#var pass {%pop( @queue)};help add @pass;#alarm +3 {#if (@help = 0) {#file 1 Spells;#write 1 {@pass};#close 1}}}}
#TRIGGER {Help entry added to category.} {#var Help 1}
#CLASS 0
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sat Jul 26, 2003 2:17 am   
 
If %pop doesn't work, do it the old way with %item and #DELN.
#ALARM {*5} {#if (%numitems( @queue)) {#var help 0;#var pass {%item( @queue, 1)};#DELN queue 1;help add @pass;#alarm +3 {#if (@help = 0) {#file 1 Spells;#write 1 {@pass};#close 1}}}}

However, it appears it's simply a mistake in the use of %pop which requires that you NOT use @ with the variable name. Changing it to %pop( queue) should also fix it.
#ALARM {*5} {#if (%numitems( @queue)) {#var help 0;#var pass {%pop( queue)};help add @pass;#alarm +3 {#if (@help = 0) {#file 1 Spells;#write 1 {@pass};#close 1}}}}
Reply with quote
Death
Apprentice


Joined: 25 Jun 2002
Posts: 109
Location: USA

PostPosted: Sat Jul 26, 2003 2:25 am   
 
Taking the @ off of queue is working now. Thank you LightBulb. :)
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