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
dwold
Newbie


Joined: 03 Jun 2006
Posts: 3

PostPosted: Sat Jun 03, 2006 8:56 pm   

Infinite Loop Detected Problem
 
I have a script running that continues to do the same thing over and over and over again, it constantly calls its self at the end of the script. So In essence:

// ALIAS NAME IS mirror //

// This is the walking path
.mirrorruns

// This is the alias I call to do my skill ups
skillups

// This is the alias I call to attack a creature
killdark

// Reverse Walking Path
..mirrorruns

// Call Mirror Alias Again
mirror




Now I know its not exactly clean but it works about 5 times then stops, how do I get around that?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jun 03, 2006 9:18 pm   
 
You cannot just keep calling an alias within itself without ever stopping. When you call an alias from another alias, execution of the first alias is suspended until the second alias finished. This means that the first alias is still in memory. The way you are doing it, all instances of the mirror alias will remain in memory because it just keeps calling itself. Eventually, zMUD runs out of what is called stack memory (which is a portion of memory given to a program to hold information necessary for calling functions) and you get an error message.

What you need to do is change the way you are doing what you want. If you need this process to keep repeating itself forever, then what you could do is setup a trigger that would fire on some line in the last room after ..mirrorruns finished and does the commands once more. Another option is to set-up a temporary alarm after killdark finished that would call the mirror again. Or, you could put the code inside a regular alarm that would keep getting called every X amount of seconds.
_________________
Kjata
Reply with quote
dwold
Newbie


Joined: 03 Jun 2006
Posts: 3

PostPosted: Wed Jun 07, 2006 3:17 am   
 
I just used a variable called #VAR mirrordone

When the runs were finished I would chage the value to 1
then I had an alarm to check when the value was changed to 1 and it would run it all over again
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