Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Wed Jan 06, 2016 10:47 am   

Looping happening where it shouldnt
 
Hey guys, made a very basic script, but for some reason it started throwing LOOP errors for other scripts when it activates or simply locking up CMUD!

This is the ingame pattern:

----------------------------------------
player input:mem
mud returns:
You have memorized:
haste
haste
disintegrate
disintegrate
firewind
firewind
firewind

<928hp 958ma 375mv>
-----------------------------------------

The idea is to capture text to a varlist for each line that starts right after You have memorized: if this line matches any value inside another list
and stop capturing as soon as prompt appears

This is how I coded for it:

-----------------------------------------
It's a 3 trigger class

<class name="mem" id="526678">
<trigger priority="5266790" id="526679">
<pattern>^You have memorized:</pattern>
<value>#T+ memcheck
#T+ memprompt</value>
</trigger>
<trigger name="memprompt" priority="1" prompt="true" enabled="false" id="526680">
<pattern><(%d)hp (%d)ma (%d)mv></pattern>
<value>#T- memcheck
#T- memprompt</value>
</trigger>
<trigger name="memcheck" priority="5266810" enabled="false" id="526681">
<pattern>(%w)</pattern>
<value>#if (%ismember(%1,@needmem)) {#show %additem(%1,memmed)}</value>
</trigger>
</class>
-----------------------------------------

needmem var is defined as: haste|gate|firewind|disintegrate, so the pattern (%w) should only fire when it's matched to any of those, those params aren't matched by any other scripts or mentioned by any other scripts! Yet this is what happens when this script is activated


http://imgur.com/ToJuyZc


This is what my main window shows when CMUD unfreezes after i close all those looping messages

You have memorized:
haste
haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste
haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste
haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste
haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste|haste
And it just goes on forever obivously trying to match the first line or itself forever, i wont copy them all here, it's obvious that this continues untill CMUD realizes that it's a loop and shows me a looping error that's shown in the above picture, then when script is cancelled it continues as normal
disintegrate
disintegrate
firewind
firewind
firewind


Another important clue, is that when i disable trigger on trigger checkmark inside the (%w) trigger, it starts to work properly and this is what happens:

You have memorized:
haste
haste
haste
haste|haste
disintegrate
haste|haste|disintegrate
disintegrate
haste|haste|disintegrate|disintegrate
firewind
haste|haste|disintegrate|disintegrate|firewind
firewind
haste|haste|disintegrate|disintegrate|firewind|firewind
firewind
haste|haste|disintegrate|disintegrate|firewind|firewind|firewind


I don't really care much for this trigger, but this error is doing my head in and I want to know what's going wrong inside my CMUD!
Reply with quote
Anrok
Apprentice


Joined: 19 Nov 2010
Posts: 119

PostPosted: Wed Jan 06, 2016 11:42 am   
 
Ok, I'm a dumbo, for some reason I got it into my head that whatever CMUD outputs itself, like #show or #print doesn't get matched in a pattern, well darn!

/Topic
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Jan 06, 2016 1:13 pm   
 
#PRINT will not activate triggers. All the other screen display commands will.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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