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


Joined: 10 Nov 2006
Posts: 22

PostPosted: Fri Apr 13, 2007 3:43 pm   

Matching values within room script and room variables
 
Hi all.

I am trying to improve my herb scripter, which uses herb names that are assigned to room specific variables using the room script commands.

For example, rooms with herbs have the following in the room script to set the herbs for the room:

Code:

#VA searchherb belladonna
#additem searchherb {black potato}
herbvarexits // This last one just sets a temporary trigger so that when you leave the room @searchherb is reset


What I would like to do is create a loop to walk to the rooms that have the rooms I desire by looping through the rooms in a given range. After walking to the given room, the desired herb would be picked, and then it would move to the next room in the loop.

I am having a problem running the loop script successfully to match the herb values I have set.

Further information:

The herbs I desire I kept in a string list, @searchherb_filter.

This is my current attempt, which I have a sinking feeling is miles away from what will ultimately work as a solution:

Code:

#LOOP 14373,14381 {#loop %numwords( %roomcom( %i)) {#IF (%ismember( %word( %roomcom( %i), %i), @searchherb_filter)) {
      #EXEC %walk( %i)
      sh3 //alias for the search function
      } {#SAY No match in room %i.}}}


Question The idea is to loop through each word in the room script and if one of them matches an herb in my @searchherb_filter list, to execute the search command in the room. All of my herbs have been coded into my map using the room script already, so if at all possible, I would like to avoid a solution that involves changing how the room herbs are stored. Smile

I suspect the problem is with the multiple "%i"s being used in nested statements, or perhaps the fact that the room scripts have multiple lines which may not be parsed correctly by the %ismember and %word functions. Thank you in advance for the help. If I have failed to include anything critical, please let me know.
Reply with quote
myrison
Beginner


Joined: 10 Nov 2006
Posts: 22

PostPosted: Fri Apr 13, 2007 9:40 pm   
 
I actually wasn't far off in where I was going with the script. The problem was not knowing how to use %i versus %j due to the nested loop statements, which I eventually uncovered in one of the old posts. If anyone happens to have a similar issue and would like to see the solution, feel free to PM me.
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