 |
daemoan.vermillious Apprentice

Joined: 28 Feb 2009 Posts: 135 Location: Chico, Ca
|
Posted: 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 |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
 |
daemoan.vermillious Apprentice

Joined: 28 Feb 2009 Posts: 135 Location: Chico, Ca
|
Posted: 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 |
|
|
|
 |
orphean Apprentice

Joined: 21 Oct 2008 Posts: 147 Location: Olympia, WA
|
Posted: 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. |
|
|
|
 |
|
|
|