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


Joined: 26 Sep 2005
Posts: 13

PostPosted: Sun Oct 02, 2005 10:43 pm   

Reversing a cycle
 
Here is the cycle alias I wrote. It works beautifully. Everytime I type cycle.. it sends me from one mob, then back to shop, then to the next mob, then back to shop, etc, etc. However.. I am have trouble figuring out how to reverse it.

I would like it so when I type rcycle it will send me to the previous mob I was at, hit it again, goes back to shop, again to the mob before that, etc, etc.

Here is the cycle alias I wrote:

Code:

#if @var_cycle=1 {ethilrist;#var cycle_mob ethilrist;#ec ** Ethilrist **}
#if @var_cycle=2 {ethilrist-s;#var cycle_mob shop}
#if @var_cycle=3 {mroth;#var cycle_mob mroth;#ec ** Mroth **}
#if @var_cycle=4 {mroth-s;#var cycle_mob shop}
#if @var_cycle=5 {tarzan;#var cycle_mob tarzan;#ec ** Tarzan **}
#if @var_cycle=6 {tarzan-s;#var cycle_mob shop}
#if @var_cycle=7 {hydra;#var cycle_mob hydra;#ec ** Hydra **}
#if @var_cycle=8 {hydra-s;#var cycle_mob shop}
#if @var_cycle=9 {icedragon;#var cycle_mob dragon;#ec ** Ice-blue Dragon **}
#if @var_cycle=10 {icedragon-s;#var cycle_mob shop}
#if @var_cycle=11 {bluedragon;#var cycle_mob dragon;#ec ** Blue Dragon **}
#if @var_cycle=12 {bluedragons;#var cycle_mob shop}
#if @var_cycle=13 {sdragon;#var cycle_mob dragon;#ec ** Silver Dragon **}
#if @var_cycle=14 {sdragons;#var cycle_mob shop}
#if @var_cycle=15 {deathk;#var cycle_mob knight;#ec ** Death Knight **}
#if @var_cycle=16 {deathks;#var cycle_mob shop}
#if @var_cycle=17 {kitiara;#var cycle_mob kitiara;#ec ** Kitiara **}
#if @var_cycle=18 {kitiaras;#var cycle_mob shop}
#if @var_cycle=19 {mk;#var cycle_mob king;#ec ** Mouse King **}
#if @var_cycle=20 {mks;#var cycle_mob shop}
#if @var_cycle=21 {tempguards;#var cycle_mob guard;#ec ** Temple Guards **}
#if @var_cycle=22 {tempguards-s;#var cycle_mob shop}
#if @var_cycle=23 {warden;#var cycle_mob warden;#ec ** Warden **}
#if @var_cycle=24 {wardens;#var cycle_mob shop}
#if @var_cycle=25 {sreyla;#var cycle_mob sreyla;#ec ** Sreyla **}
#if @var_cycle=26 {sreyla-s;#var cycle_mob shop}
#if @var_cycle=27 {rose;#var cycle_mob rose;#ec ** Sir Rose **}
#if @var_cycle=28 {rose-s;#var cycle_mob shop}
#if @var_cycle=29 {chang;#var cycle_mob chang;#ec ** Chang **}
#if @var_cycle=30 {chang-s;#var cycle_mob shop}
#if @var_cycle=31 {aqueen;#var cycle_mob princess;#ec ** Amazon Princess **}
#if @var_cycle=32 {aqueen-s;#var cycle_mob shop}
#if @var_cycle=33 {nestor;#var cycle_mob nestor;#ec ** King Nestor **}
#if @var_cycle=34 {nestor-s;#var cycle_mob shop}
#if @var_cycle=35 {dleader;#var cycle_mob guard;#ec ** Dwarf Chief **}
#if @var_cycle=36 {dleader-s;#var cycle_mob shop}
#if @var_cycle=37 {bigd;#var cycle_mob dragon;#ec ** Big Dragon **}
#if @var_cycle=38 {bigd-s;#var cycle_mob shop}
#if @var_cycle=39 {lashdeem;#var cycle_mob lashdeem;#ec ** Lashdeem **}
#if @var_cycle=40 {lashdeem-s;#var cycle_mob shop}
#if @var_cycle=41 {lguard;#var cycle_mob guard;#ec ** Lighthouse Guard **}
#if @var_cycle=42 {lguard-s;#var cycle_mob shop}
#if @var_cycle=43 {moose;#var cycle_mob moose;#ec ** Moose **}
#if @var_cycle=44 {moose-s;#var cycle_mob shop}
#if @var_cycle=45 {premier;#var cycle_mob guard;#ec ** Premier Guard **}
#if @var_cycle=46 {premiers;#var cycle_mob shop}
#if @var_cycle=47 {hguard;#var cycle_mob guard;#ec ** Huge Guard **}
#if @var_cycle=48 {hguard-s;#var var_cycle 0;#var cycle_mob shop}
#math var_cycle @var_cycle+1


So, for example.. after I am back at the shop from just having gone to the moose (var_cycle=44), and I hit rcycle it will send me back to the moose (var_cycle=43), then to the lguard (var_cycle=41) hit it again, it will go to shop from lguard (var_cycle=42), hit it again it will go to lashdeem (var_cycle=39), then to shop from lashdeem (var_cycle=40).

If I need to make a whole new alias cycle i will.. if someone can just suggest what to do to make this reverse cycle work, it would be greatly appreciated. The forward cycle works fine.

I tried making something like this for rcycle but it didnt work:
#if @cycle_mob=shop {#math var_cycle @var_cycle-2;cycle} {cycle}

If I could have an rcycle and a cycle alias, i would have free forward and reverse motion between the mobs, which is what i am looking for.

Going in reverse is definately more complicated than going forward. It has to check if you are at shop, if you are at shop.. it has to go to the previous mob, if not at shop, it has to simply go forward to bring you back at shop.


Last edited by Simucal on Sun Oct 09, 2005 7:13 pm; edited 4 times in total
Reply with quote
Simucal
Beginner


Joined: 26 Sep 2005
Posts: 13

PostPosted: Mon Oct 03, 2005 2:06 pm   
 
any ideas?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Oct 04, 2005 11:19 pm   
 
As you have it set up now it looks like you can simply copy the whole thing to another alias (rcycle). Move the #MATH statement to the top, and change the sign in it from + to -. I really didn't even think it worth my time to tell you that, it is just that obvious.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Simucal
Beginner


Joined: 26 Sep 2005
Posts: 13

PostPosted: Wed Oct 05, 2005 12:29 am   
 
It will not work with a simple - instead of a +. I would not post such a simple request. For example:

Lets say I am at deathk (@var_cycle=15), if I subtract 1 from the var_cycle and run it again, it will run (@var_cycle=14) which is the reverse directions back to shop from the sdragon, which will send me to some random place.. because i am not at sdragon. It needs to go TO the shop from deathk which is (@var_cycle=16). Then if you go one step back from that, it needs to go (@var_cycle=13), to send me to the forward directions to the sdragon.

So, here is how it should go:

@var_cycle=15 (At deathk)
@var_cycle=16 (back to shop from deathk)
@var_cycle=13 (to sdragon, which is the mob before deathk)
@var_cycle=14 (to shop from sdragon)
@var_cycle=11 (to bluedragon, which is the mob before sdragon)
@var_cycle=12 (to shop from bluedragon)

Lets say I was at the shop after having just been at deathk, which is:
@var_cycle=16 (at the shop, the last mob I have been to is deathk)

the next one it needs to go to, if it is to truly and correctly reverse where I have been, is deathk.
@var_cycle=15


So you can see, that subtracting one, only works if I am at the shop, and the second it gets to the next mob, and trys to subtract one, it will send me to the reverse directions for the mob before that.
Reply with quote
Vorax
Apprentice


Joined: 29 Jun 2001
Posts: 198
Location: USA

PostPosted: Wed Oct 05, 2005 6:18 am   
 
Try this:
Code:
#ALIAS rcycle {
#if @var_cycle=1 {ethilrist;#var cycle_mob ethilrist;#ec ** Ethilrist **}
#if @var_cycle=2 {ethilrist-s;#var cycle_mob shop}
#if @var_cycle=3 {mroth;#var cycle_mob mroth;#ec ** Mroth **}
#if @var_cycle=4 {mroth-s;#var cycle_mob shop}
#if @var_cycle=5 {tarzan;#var cycle_mob tarzan;#ec ** Tarzan **}
#if @var_cycle=6 {tarzan-s;#var cycle_mob shop}
#if @var_cycle=7 {hydra;#var cycle_mob hydra;#ec ** Hydra **}
#if @var_cycle=8 {hydra-s;#var cycle_mob shop}
#if @var_cycle=9 {icedragon;#var cycle_mob dragon;#ec ** Ice-blue Dragon **}
#if @var_cycle=10 {icedragon-s;#var cycle_mob shop}
#if @var_cycle=11 {bluedragon;#var cycle_mob dragon;#ec ** Blue Dragon **}
#if @var_cycle=12 {bluedragons;#var cycle_mob shop}
#if @var_cycle=13 {sdragon;#var cycle_mob dragon;#ec ** Silver Dragon **}
#if @var_cycle=14 {sdragons;#var cycle_mob shop}
#if @var_cycle=15 {deathk;#var cycle_mob knight;#ec ** Death Knight **}
#if @var_cycle=16 {deathks;#var cycle_mob shop}
#if @var_cycle=17 {kitiara;#var cycle_mob kitiara;#ec ** Kitiara **}
#if @var_cycle=18 {kitiaras;#var cycle_mob shop}
#if @var_cycle=19 {mk;#var cycle_mob king;#ec ** Mouse King **}
#if @var_cycle=20 {mks;#var cycle_mob shop}
#if @var_cycle=21 {tempguards;#var cycle_mob guard;#ec ** Temple Guards **}
#if @var_cycle=22 {tempguards-s;#var cycle_mob shop}
#if @var_cycle=23 {warden;#var cycle_mob warden;#ec ** Warden **}
#if @var_cycle=24 {wardens;#var cycle_mob shop}
#if @var_cycle=25 {sreyla;#var cycle_mob sreyla;#ec ** Sreyla **}
#if @var_cycle=26 {sreyla-s;#var cycle_mob shop}
#if @var_cycle=27 {rose;#var cycle_mob rose;#ec ** Sir Rose **}
#if @var_cycle=28 {rose-s;#var cycle_mob shop}
#if @var_cycle=29 {chang;#var cycle_mob chang;#ec ** Chang **}
#if @var_cycle=30 {chang-s;#var cycle_mob shop}
#if @var_cycle=31 {aqueen;#var cycle_mob princess;#ec ** Amazon Princess **}
#if @var_cycle=32 {aqueen-s;#var cycle_mob shop}
#if @var_cycle=33 {nestor;#var cycle_mob nestor;#ec ** King Nestor **}
#if @var_cycle=34 {nestor-s;#var cycle_mob shop}
#if @var_cycle=35 {dleader;#var cycle_mob guard;#ec ** Dwarf Chief **}
#if @var_cycle=36 {dleader-s;#var cycle_mob shop}
#if @var_cycle=37 {bigd;#var cycle_mob dragon;#ec ** Big Dragon **}
#if @var_cycle=38 {bigd-s;#var cycle_mob shop}
#if @var_cycle=39 {lashdeem;#var cycle_mob lashdeem;#ec ** Lashdeem **}
#if @var_cycle=40 {lashdeem-s;#var cycle_mob shop}
#if @var_cycle=41 {lguard;#var cycle_mob guard;#ec ** Lighthouse Guard **}
#if @var_cycle=42 {lguard-s;#var cycle_mob shop}
#if @var_cycle=43 {moose;#var cycle_mob moose;#ec ** Moose **}
#if @var_cycle=44 {moose-s;#var cycle_mob shop}
#if @var_cycle=45 {premier;#var cycle_mob guard;#ec ** Premier Guard **}
#if @var_cycle=46 {premiers;#var cycle_mob shop}
#if @var_cycle=47 {hguard;#var cycle_mob guard;#ec ** Huge Guard **}
#if @var_cycle=48 {hguard-s;#var var_cycle 0;#var cycle_mob shop}
#IF (%mod(var_cycle,2)) {#math var_cycle @var_cycle+1} {#MATH var_cycle @var_cycle-3}
}

Added the #IF at the bottom containing a modulus expression. This should keep your reverse order correctly. If var_cycle is an odd number it it increased by 1 so that you will return to the shop, if it's even, it will subtract 3 (as in your example) and send you to the next mob in reverse order. I haven't tested this. The only thing that might need to be changed is the position of the #IF statement from the bottom of the alias to the top.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Oct 05, 2005 8:18 am   
 
Vorax was pretty close. You need an if at the beginning
#if (%mod(@var_cycle,2)) {#add var_cycle -2}
and one at the end
#if (%mod(@var_cycle,2)) {#add var_cycle 1} {#add var_cycle -3}
_________________
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