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
daemoan.vermillious
Apprentice


Joined: 28 Feb 2009
Posts: 135
Location: Chico, Ca

PostPosted: Sat Oct 17, 2009 3:46 am   

rotation of targets?
 
if I have a vaiable @target

how can I make it to I can rotate thru a list like
{40.skeleton,30.skeleton,20.skeleton}
first round then next tick owuld be the next then the next would be.... and so on...

thanks
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sun Oct 18, 2009 11:06 am   
 
You could use the onTick event (assuming you've set up CMUD to be in sync with your MUD tick) or you could use a trigger that goes on your prompt.

Essentially you'll need two variables: target and targetList. At each prompt( or tick) you set target to be equal to the next member of targetList. Something like so.

Code:
target = %item(@targetList, @counter)
#ADD counter 1
_________________
Asati di tempari!
Reply with quote
daemoan.vermillious
Apprentice


Joined: 28 Feb 2009
Posts: 135
Location: Chico, Ca

PostPosted: Sun Oct 18, 2009 9:54 pm   
 
Sorry Just Trying To Understand...

#var {target} {%item(@targetlist, @counter)
#add counter 1

The add counter adds 1 to the target lister? each time its triggered? and goes to the the next on the list?

so the targetlist would be like
1 shade
2 devil
3 orphan
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Sun Oct 18, 2009 11:21 pm   
 
%item takes two arguments: the list and the position of the item you want in the list. So @counter keeps track of the target position in the list you're currently on.

The main problem I see with Tech's proposal is that is doesn't rotate. You'd need to reset the counter when you arrive at the last item in the list. Or, you could change his example to something like:

Code:

target = %item(@targetList, @counter)
counter = %mod(@counter + 1, %numitems(@targetList)) + 1


I'm not sure how you're building the list but you would need to make it a string list in order to use functions like %item and %numitems. See #additem for easily building string lists.
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