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
impyplayer
Beginner


Joined: 02 Nov 2008
Posts: 10

PostPosted: Tue Apr 20, 2010 4:08 pm   

Clearing string lists?
 
Hi, I'm trying to do a very simple script to help me auto-dissect in Aetolia. I have setup a string list that captures all the information from the corpse and then starts to dissect for each organ. My problem is the corpses become useless generally before every organ is taken out and the script just continues. I set up a trigger from a message that has organ="" in the value. That seems to clear out the list but it doesn't stop the script from still churing through everything. Is there another way to clear it, or some way to stop it from trying to get everything in the string list? Also I have no idea when it is going to stop, the corpse being useless is random so I wasn't sure how to use any of the delitem things execpt for deleting the actual organs it did dissect. Any help would be appreciated. Thanks!
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Tue Apr 20, 2010 4:11 pm   
 
We'll need to see the script in order to say how to stop any queued commands.
_________________
Taz :)
Reply with quote
impyplayer
Beginner


Joined: 02 Nov 2008
Posts: 10

PostPosted: Tue Apr 20, 2010 5:36 pm   
 
Right, sorry about that. I have:

This adds the organs to the organ list:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="19290" copy="yes">
<pattern>^You detect a viable (%w) to extract.$</pattern>
<value>#additem organs %1</value>
</trigger>
</cmud>

and then I have this to dissect them:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<alias name="sdiss" copy="yes">
<value>#FORALL @organs {dissect %i from corpse; #wait 6000}</value>
</alias>
</cmud>


I put the wait in there because you get thrown off balance when you start dissecting so you have to wait until balance is restored to move on to the next.

Then I put this in to try and stop it from dissect organs after the corpse was empty:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="19340" copy="yes">
<pattern>You realise that the corpse has now been dissected</pattern>
<value>organs=""</value>
</trigger>
</cmud>


I actually got that from a zmud script from the forums. I tried looking up ways to stop or clear the string list for cmud but couldn't find anything or anything that I understood at least.
Reply with quote
Martaigne
Wanderer


Joined: 05 Jan 2002
Posts: 88
Location: Atlanta, GA

PostPosted: Tue Apr 20, 2010 6:19 pm   
 
Probably a few ways to handle this. Try enclosing the #FORALL's logic in an #IF statement that checks to see if @organs = "" then #EXIT if true, like:


#FORALL @organs {#IF (@organs = "") {#EXIT} {dissect %i from corpse; #wait 6000}}
_________________
Unwritten Legends
Reply with quote
impyplayer
Beginner


Joined: 02 Nov 2008
Posts: 10

PostPosted: Wed Apr 21, 2010 12:02 am   
 
That worked Martaigne. Thanks!
Reply with quote
Martaigne
Wanderer


Joined: 05 Jan 2002
Posts: 88
Location: Atlanta, GA

PostPosted: Wed Apr 21, 2010 2:43 pm   
 
Happy to help!
_________________
Unwritten Legends
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