Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
exedor69
Wanderer


Joined: 11 Dec 2000
Posts: 50
Location: USA

PostPosted: Wed Dec 13, 2000 1:46 am   

Dead of Night - Autolocater
 
Dead of Night mud dead.greenwing.com 5000

Leviathan's Autolocater

First I would like to introduce myself. I am Leviathan on Dead of Night. I learned computer programming while in college but just recently discovered mudding. I build a little "program" but I am not sure how to list it here since I did not have any guide to how to write script code. I just build triggers, alias' et. al. until I got some cool things to work. I will try to present it in a usable format. If there is a better, more consise way to post code such as mine, drop me an email and let me know how to write it.[url]exedor69@inwave.com[/url]

In the alias, atconnect, insert the line:

#var locatecounter 1

Then I created a toggle button whose caption in the button up state is "loc off"
The commands in the button up state are:

#t+ autolocate
emote is now autolocating.
#show item number @locatecounter
locate@locatecounter

The button in the button down state caption is "loc on"
the commands in the button down state are:

#t- autolocate
emote is no longer autolocating.

Now we create an alias called locate1 which has a class of autolocate containing the following commands:

#var next 0
cas locate amethyst-earring
#wait 5000
#if (@next = 0) {locate1}
#if (@next = 1) {#var locatecounter 1}
#if (@next = 1) {#math locatecounter @locatecounter+1}
#if (@next = 1) {#show item number @locatecounter}
#if (@next = 1) {locate2}

then create another alias called locate2 which has a class of autolocate containing the following commands:

#var next 0
cas locate sapphire-neckchain
#wait 5000
#if (@next = 0) {locate2}
#if (@next = 1) {#math locatecounter @locatecounter+1}
#if (@next = 1) {#show item number @locatecounter}
#if (@next = 1) {locate3}

then create another alias called locate3 which has a class of autolocate containing the following commands:

#var next 0
cas locate kodiak-cloak
#wait 5000
#if (@next = 0) {locate3}
#if (@next = 1) {#math locatecounter @locatecounter+1}
#if (@next = 1) {#show item number @locatecounter}
#if (@next = 1) {locate1}

Lastly a trigger whose pattern is "Ok." and the one command is:

#var next 1

To add an additional item to the list of items you are autolocating, you copy the commands from locate3 into a new alias called locate4. then you change the last line of locate3 to:

#if (@next = 1) {locate1}

Then you have to make two changes to the new alias, locate4. First you change the itemname to the name of the new item to be located, then you change the fourth command to:

#if (@next = 0) {locate4}

This creates a series of recursive alias' which begin to loop when the button is pressed and which stop only once the button is pressed a second time. This is an infinite recursive loop. The reason I used recursion is because on this mud, you can fail to cast your spell so it will automatically recast the locate spell on an item until successful.

why do I love recursive alias'?
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: Wed Dec 13, 2000 2:05 am   
 
quote:

If there is a better, more consise way to post code such as mine, drop me an email and let me know how to write it.[url]exedor69@inwave.com[/url]



You could always Export that section out to a text file, then just cut and paste it. Then all anyone would have to do is, cut and paste into a text file, then import the file into Zmud.

Killing a fly on a friends forhead may not be overkill, use a hatchet to make sure the job is done.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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