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


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Fri Apr 18, 2003 4:37 pm   

Why does this go into an infinite loop?
 
Hi all. Here's my code...

#AL {EQCaptureFinish} {
#DBLOAD EQ
#IF (!@EQNewEntry.Name) {
#ECHO Blah!
#VAR Temp Name
#PROMPT Temp {We need a name for this item, please...}
#ADDKEY EQnewEntry Name Temp
}
#IF !%null( %find( @EQNewEntry.Name, All, Name)) {
#YESNO {A duplicate item already exists, add anyway?} {#NOOP} {#ABORT 1}
}
#NEW All @EQNewEntry
#ECHO %ansi(high,red)***
#ECHO %ansi(high,yellow)New Record added to the EQ Database! Please check for accuracy!
#ECHO %ansi(high,red)***
#DBSAVE EQ
EQDisplayDetails
#VAR EQTemp {}
}

If I need to manually enter a name (the first if) it goes into an infinite loop with the #PROMPT statement. I can type something in it, but it clears and works its way through the rest of the script adding multiple entries to the database. If I take out the #PROMPT statement it works fine, except I can't enter a name when it doesn't catch one by itself. The #ECHO Blah was just to prove to me it was looping lots of times.

Any ideas?

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

RockyMud: Sometimes, life needs to be a little Rocky.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 18, 2003 6:06 pm   
 
The loop doesn't appear to be caused by this particular alias. Check the aliases/triggers which call this alias, any triggers which might fire off its output, and the (presumed) alias it calls, EQDisplayDetails.

Observations:
After the #PROMPT, your item will always be named Temp. You probably meant it to be @Temp.

At the end of the alias you clear the EQTemp variable. You probably meant to clear the EQNewEntry variable.

LightBulb
Advanced Member
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Fri Apr 18, 2003 8:17 pm   
 
Thanks for thinking.

The catch is, if I don't put the #PROMPT line in everything works fine, it's only while the dialog box for the prompt is up - which I can't make go away.

This is the code that calls the bit above in my first post.

#ONINPUT {value *} {
#ECHO ---
#ECHO Inside Oninput...
#ECHO ---
#VAR EQNewEntry {}
#T+ EQCapture
#ALARM +1 {
#ECHO Set the Alarm
#T- EQCapture
EQCaptureFinish
}
}

The #ECHO inside oninput only comes up once. The other #ECHO (set the alarm) comes up multiple times, for ever if I left it I guess. How could the #ALARM bit be carried out so many times? And only when the #PROMPT bit is there?


As an aside, I actually forget why I clear EQTemp at the end, but I do know I clear EQNewEntry at the start of all this stuff. I'm sure I had a sensible reason at the time...

Any other ideas?

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

RockyMud: Sometimes, life needs to be a little Rocky.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 18, 2003 9:02 pm   
 
#PROMPT Temp {We need a name for this item, please...}
#ADDKEY EQnewEntry Name Temp

LightBulb
Advanced Member
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Fri Apr 18, 2003 9:07 pm   
 
I fixed that Temp and nothing changed.

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

RockyMud: Sometimes, life needs to be a little Rocky.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 18, 2003 9:12 pm   
 
I tried the alias, it doesn't loop. I don't doubt that it causes something else to call the alias again, resulting in a loop, but the actual command that causes the loop is elsewhere.

LightBulb
Advanced Member
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Fri Apr 18, 2003 9:16 pm   
 
I edited my first response to you as I realized it was very wrong.

It looks like it's the #ONINPUT, but it's not calling the whole #ONINPUT again, just the bit with the #ALARM.

Make sense?

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

RockyMud: Sometimes, life needs to be a little Rocky.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 18, 2003 9:49 pm   
 
Puzzling. You're sure you don't have this alarm anywhere else?

It may be something in the EQCapture class/setting. However it sounds like the #PROMPT command somehow interferes with the temporary nature of the #ALARM, preventing it from deleting itself. Maybe it can't delete itself when it should because it hasn't finished processing all its commands yet.

Try lengthening the time on the alarm to somewhere around 30-60 (depending on how fast you think you can fill in that prompt). If that fixes it, send in a bugrep.

LightBulb
Advanced Member
Reply with quote
Humpton
Apprentice


Joined: 10 Oct 2000
Posts: 158
Location: Chicago, IL

PostPosted: Fri Apr 18, 2003 10:01 pm   
 
Good suggestion! It's something to do with the #ALARM and #PROMPT. I changed the time and was able to enter something in. But, if don't enter something in within that new time, I get the same problem.

Looks like I get to do a Bug Report - I guess i need to turn all this into sense now.

Thanks for your help Lightbulb!

Stay JOLLY!
H

___
Humpton lives like he types.... fast, and full of mistakes!

RockyMud: Sometimes, life needs to be a little Rocky.
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