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


Joined: 27 Sep 2005
Posts: 11

PostPosted: Fri Sep 30, 2005 1:43 am   

loop inside loop script
 
what i am trying to do is help make a script to set up a quest for the mud.
i want to go to every zone. random pick 1 room and bury a cube and pick 5 rooms and bury a coin. I am getting lost. I think i have a decent start on the script but i am very new to writing scripts.


Code:
Alias
Name  burycube

Value:
#CLASS cubequest
#VAR tempnum %pop( tempzonenum)
#VAR cube (%random(1,90))
#VAR cuberoom (@tempnum x 100 + @cube)
Goto @cuberoom
Bury cube
#LOOP 5 {
  #VAR coin (random(1,90))
  #VAR coinroom (@tempnum x 100 + @coin)
  Goto @coinroom
  Bury coin
  }



Code:
            Name           tempzonenum

            Value
                        0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|98|99|100|102|103|104|105|112|113|116|117|118|119|120|121|122|123|124|126|128|129|135|136|138|139|142|143|147|148|150|151|152|155|156|160|161|162|163|166|167|168|170|171|172|173|174|175|176|177|179|180|181|182|184|186|190|192|193|196|197|198|199|204|206|210|211|212|217|220|221|224|233|234|240|246|250|254|255|260|261|262|263|264|269|270|271|274|280|285|287|290|295|296|300|301|302|303|308|311|312|313|314|315|316|317|318|320|330|338|339|340|356|357|370|371|649|690|691|692|693|694|695|698|699|700|701|851|852|869|900|920


that part i get lost in is the loop within the loop


any help is greatly appreciated

thank you
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 30, 2005 8:29 am   
 
This should do it for you. Just copy and paste all of it into the command line. I started by deleteing the existing portions of your script I could see so it would all be clean. The outer loop is preformed by a slightly recursive combination of the alias an the alarm. This is better since your zone list has nearly 200 entries. If a series of straight loops were used you would send close to 2400 commands to the mud in a second. While I am sure the mud wouldn't boot an imm for doing that it is still not a good thing to do. This way you send about 6 per second. You can always adjust the speed of the alarm. As a side note I created the alarm by the #TRIGGER command with the alarm option, it is a back method, but I didn't feel like poping up the help just to make sure that #ALARM supports the disable option.
Code:
#UNALIAS burycube
#DELCLASS cubequest
#CLASS cubequest
#VAR ZoneCounter {1} {1}
#VAR ZoneList {0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|98|99|100|102|103|104|105|112|113|116|117|118|119|120|121|122|123|124|126|128|129|135|136|138|139|142|143|147|148|150|151|152|155|156|160|161|162|163|166|167|168|170|171|172|173|174|175|176|177|179|180|181|182|184|186|190|192|193|196|197|198|199|204|206|210|211|212|217|220|221|224|233|234|240|246|250|254|255|260|261|262|263|264|269|270|271|274|280|285|287|290|295|296|300|301|302|303|308|311|312|313|314|315|316|317|318|320|330|338|339|340|356|357|370|371|649|690|691|692|693|694|695|698|699|700|701|851|852|869|900|920}
#TRIGGER "CubeBuryDelay" {*.7} {#T- CubeBuryDelay;#IF (@ZoneCounter<%numitems(@ZoneList)) {#ADD ZoneCounter 1;burycube} {ZoneCounter=1;#ECHO Cube burial complete.}} "" {alarm|disable}
#ALIAS burycube {
 Goto %eval(%item(@ZoneList,@ZoneCounter) * 100 + %random(1,90))
 Bury cube
 #LOOP 5 {
  Goto %eval(%item(@ZoneList,@ZoneCounter) * 100 + %random(1,90))
  Bury coin
 }
 #T+ CubeBuryDelay
}
#CLASS 0
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Mudimm
Beginner


Joined: 27 Sep 2005
Posts: 11

PostPosted: Fri Sep 30, 2005 10:50 am   
 
i was not sure if the zone counter will just add 1 to the last number or will it pull the next number in the list.
the list skips around a little bit. becouse not all the zones are used..the zonelist has the zones that are used.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 30, 2005 9:11 pm   
 
I would suggest looking up, in the help, any and all functions or commands in the script I wrote that you do not understand. I am quite certain, however, that I met or exceeded all the requirements you specified in your original post.
_________________
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 » 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