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
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Mon Mar 03, 2003 10:17 pm   

AutoEat v2.0 (for any mud) ***UPDATED 03/06/03***
 
I was going to update the original AutoEat post on the finished scripts forum, but the script was over 1 year old and was archived off.

I used Unicorn Valley (Smaug) as the basis for the script. You must also have Carabas's Color Replacement script, which I will add to this post also. First import the color replacement script before you import the AutoEat script.
Must have version 6.x to work. This script was created with version 6.53Beta.

AutoEat script
Code:

#CLASS {autoeat}
#ALIAS checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#ALA +@AlarmTime {checkmorecontainers}}
#ALIAS checkmorecontainers {#T- FoodTypeTrig;#IF (%numitems( @havefood) > 0) {get %item( @havefood, 1) %item( @havecontainer, @loopcount);eat %item( @havefood, 1);#VAR stillhungry 0} {#ECHO {I have no food in my %item( @havecontainer, @loopcount)!};#IF (@loopcount < @containercount) {checkcontainers} {#ECHO {I have no food at all, better get some!}}}}
#VAR foodtypes {meat|mushroom}
#VAR containertypes {sack|kreel|bag}
#VAR stillhungry {1}
#VAR loopcount {1}
#VAR containercount {1}
#VAR AlarmTime {2}
#VAR havefood {}
#VAR havecontainer {sack}
#TRIGGER "FoodTypeTrig" {({@foodtypes})} {#IF %ismember( %1, {@foodtypes}) {#VAR havefood %addItem( %1, @havefood)}} "" {disable}
#TRIGGER "ConTypeTrig" {({@containertypes})} {#IF %ismember( %1, {@containertypes}) {#VAR havecontainer %addItem( %1, @havecontainer)}} "" {disable}
#TRIGGER "AutoEatTrig" {You are {STARVING|a mite peckish|hungry|really hungry}} {#var havefood "";#var havecontainer "";#var loopcount 0;#var containercount "";#var stillhungry "";inventory}
#COND "AutoEatTrig" {You are carrying:} {#T+ ConTypeTrig;#T+ FoodTypeTrig}
#COND "AutoEatTrig" {@AlarmTime} {#T- ConTypeTrig;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {eat %item( @havefood, 1);#ab 1} {#echo {@bCyan I have no food in my inventory list.}};#IF (%numitems( @havecontainer)>0) {#var stillhungry 1;#var containercount %numitems( @havecontainer);checkcontainers} {#echo {@bMagenta I have no containers need go buy one, duh!}}} {alarm}
#CLASS 0

#CLASS {autoeat|System}
#TRIGGER {You drop down and fall asleep on the ground.} {#T- AutoEatTrig}
#TRIGGER {You wake and stand up.} {#T+ AutoEatTrig}
#CLASS 0

#CLASS {autoeat|AutoeatAliases}
#ALIAS condel {#delitem containertypes {%-1};#cr;#echo @bYellow You have deleted %1 from your list.}
#ALIAS eathelp {#show @bGreen AutoEat Help;#show @bYellow -------------------------------------------------------------------;#show @bGreen This script is to reduce the mundane eating crap!;#show @bGreen Please set your AlarmTime Variable. This variable is the delay time from the mud to;#show @bGreen all of you things in your inventory and containter lists.;#show @bGreen salarm @bYellow ----- @bRed Set the AlarmTime ~(variable). ex: salarm 3;#show @bGreen foodadd @bYellow ----- @bRed Add food to the food list ~(variable).;#show @bGreen fooddel @bYellow ----- @bRed Delete food from the food list ~(variable).;#show @bGreen conadd @bYellow ----- @bRed Add container to the container list ~(variable).;#show @bGreen condel @bYellow ----- @bRed Delete container from the container list ~(variable).;#show @bGreen eatshow @bYellow ----- @bRed Shows your list of food, containers and the AlarmTime ~(variables).;#cr}
#ALIAS fooddel {#delitem foodtypes {%-1};#cr;#echo @bYellow You have deleted %1 from your list.}
#ALIAS foodadd {#additem foodtypes {%-1};#cr;#echo @bYellow You have added %1 to your list.}
#ALIAS salarm {#var AlarmTime %1}
#ALIAS eatshow {#echo %crlf @bYellow *** YOUR LISTS ***;#echo %crlf @bGreen Food List;#echo @dGreen-------------------;#loop 1,%numitems( @foodtypes) { #echo @dGreen %i~. @bRed %item( @foodtypes, %i)};#echo %crlf @bGreen Container's List;#echo @dGreen-------------------;#loop 1,%numitems( @containertypes) {#show @dGreen %i~. @bRed %item( @containertypes, %i)};#echo %crlf @bGreen Alarm Time;#echo @dGreen-------------------;#echo Your current alarm time is set to @bRed@AlarmTime@bCyan seconds.;#cr}
#ALIAS conadd {#ADDITEM containertypes {%-1};#CR;#ECHO @bYellow You have added %1 from your list.}
#CLASS 0
#clr
#show You have just imported AutoEat v2.0!
#show This script uses Carabas's Color Replacement script.
#show This script will will first look in your inventory for food.
#show If can't find any food in your inventory, it will look in each container for food.
#show Run eathelp to configure.


Color Replacement script
Code:

#CLASS {Color Replacement}
#VAR bGreen {}
#VAR bBlue {}
#VAR bCyan {}
#VAR bRed {}
#VAR bMagenta {}
#VAR bYellow {}
#VAR White {}
#VAR AnsiReset {}
#VAR dBlue {}
#VAR dCyan {}
#VAR dGreen {}
#VAR dMagenta {}
#VAR dRed {}
#VAR dYellow {}
#VAR bGrey {}
#VAR dGrey {}
#VAR Colors {White|bYellow|bMagenta|bRed|bCyan|bGreen|bBlue|bGrey|dYellow|dMagenta|dRed|dCyan|dGreen|dBlue|dGrey}
#VAR ansi {@%1}
#CLASS 0

To enhance for your mud. You will need to modify the #cond "You are carrying" to your muds. This is the first line shown after the inventory command.
If you can enhance this please let me know.. Enjoy!!

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1


Last edited by darmir on Sat Dec 04, 2004 4:58 am; edited 4 times in total
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Tue Mar 04, 2003 5:01 pm   
 
Hello I was looking this over because you know already that i tried and fail at converting it to Realms of Dispair,I have had little time to work on it latly.

I was looking this one over and I see the the color replacement has acouple of things my zmud(6.40) will not cut and past
example :
#VAR bGrey {}
when i cut and past then hit save this is what i get
#VAR bGrey {[0;37m}

I had to go into the class and manually put them back in to get it to work the right way.
I did this by copying the  from the past before i saved and pasted it back in to each @var itself.

will let you know if the food thing really works had a bug i think last time.
Great work!! keep it up

megamog75
Reply with quote
Setepth
Novice


Joined: 17 Dec 2001
Posts: 34
Location: USA

PostPosted: Wed Mar 12, 2003 12:09 am   
 
Really cool script, however, what if i don't want a timer? What numerical value do i set it if i dont want it to ever just go off? thanks

Hey meet my character:
Prince Basher, Of Que-Hagan.

At
telnet: elysium-rpg.com port:7777
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Mar 12, 2003 3:38 pm   
 
If you look at the script the time only goes off after conditions are met. This will only go off if the other condition arm met in the trigger. The main reason to use a Alarm variable is to be able to set it in both places that need the delay to capture all of the inventory items.

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Wed Mar 12, 2003 3:42 pm   
 
If you look at the script the time only goes off after conditions are met. What the alarm does is it turns off the triggers that checks for your food/container items after you run the inventory command. The main reason to use a Alarm variable is to be able to set it in both places that need the delay to capture all of the inventory items.
So what this means it the Alarm won't run all of the time like you thought

Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Reply with quote
Setepth
Novice


Joined: 17 Dec 2001
Posts: 34
Location: USA

PostPosted: Fri Mar 14, 2003 4:22 am   
 
Ahh thanks. Hey, can i ask you one favor though? Is it possible for you to update it by adding a hungadd and hungdel command? (hungry add, hungry delete) because its causing me some trouble to change the hungry commands you preset. If you can do that, i'd be grateful!

Hey meet my character:
Nurmek Leptin, Shaman of the Orcs.

At
telnet: elysium-rpg.com port:7777
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Fri Dec 03, 2004 8:03 pm   AutoEat v3.0 (for any mud) ***UPDATED 12/03/04***
 
AutoEat v3.0 (for any mud)

I decided to see if there was anything I could update on this script with the new version of zMUD.
Here is what has changed:
  • I noticed that I didn't put all of the aliases in the last script
  • No longer need Carabas Color Replacement Script
  • Added more comments in script for users.


Code:

#CLR
#SHOW <color cyan>You have just imported AutoEat v3.0!</color>
#SHOW <color cyan>This script will will first look in your inventory for food.</color>
#SHOW <color cyan>If can't find any food in your inventory, it will look in each container for food.</color>
#SHOW <color cyan>Run <color red>eathelp</color> to configure. </color>
#CR
#CLASS {autoeat}
#ALIAS checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#ALA +@AlarmTime {checkmorecontainers}}
#ALIAS checkmorecontainers {#T- FoodTypeTrig;#IF (%numitems( @havefood) > 0) {get %item( @havefood, 1) %item( @havecontainer, @loopcount);eat %item( @havefood, 1);#VAR stillhungry 0} {#CR;#SHOW ~<color cyan>I have no food in my %item( @havecontainer, @loopcount)!~</color>;#IF (@loopcount < @containercount) {checkcontainers} {#SHOW {~<color cyan>I have no food at all, better get some!~</color>}}}}
#VAR foodtypes {bread|apple}
#VAR containertypes {backpack}
#VAR stillhungry {1}
#VAR loopcount {1}
#VAR containercount {1}
#VAR AlarmTime {2}
#VAR havefood {}
#VAR havecontainer {backpack}
#TRIGGER "FoodTypeTrig" {({@foodtypes})} {#NOOP Check to see if you have the food listed;#IF %ismember( %1, {@foodtypes}) {#VAR havefood %additem( %1, @havefood)}} "" {disable}
#TRIGGER "ConTypeTrig" {({@containertypes})} {#NOOP Check to see if you have the container listed;#IF %ismember( %1, {@containertypes}) {#VAR havecontainer %additem( %1, @havecontainer)}} "" {disable}
#TRIGGER "AutoEatTrig" {You are {hungry.|really hungry.|feeling slightly hungry.}} {#NOOP Clear the variables;#VAR havefood "";#VAR havecontainer "";#VAR loopcount 0;#VAR containercount "";#VAR stillhungry "";#NOOP Run your command to show your inventory;inventory}
#COND {(*)} {#NOOP The pattern used in the condition is the first line you will see after;#NOOP your inventory command is run. Change it accordingly.;#T+ ConTypeTrig;#T+ FoodTypeTrig}
#COND {@AlarmTime} {#T- ConTypeTrig;#T- FoodTypeTrig;#NOOP If you have the food in your inventory then eat it, if not look in;#NOOP your containers for the food on the list;#IF (%numitems( @havefood)>0) {eat %item( @havefood, 1);#AB 1} {#CR;#SHOW ~<color cyan>I have no food in my inventory list.~</color>};#IF (%numitems( @havecontainer)>0) {#VAR stillhungry 1;#VAR containercount %numitems( @havecontainer);checkcontainers} {#CR;#SHOW ~<color cyan>I have no containers need go buy one, duh!~</color>}} {alarm}
#CLASS 0

#CLASS {autoeat|AutoeatAliases}
#ALIAS condel {#DELITEM containertypes {%-1};#CR;#SHOW ~<color cyan>You have deleted %1 from your container list.~</color>}
#ALIAS eathelp {#CR;#CR;#SHOW ~<color cornsilk>~<b>AutoEat Help~</b>~</color>;#SHOW ~<color yellow>-----------------------------------------~</color>;#SHOW ~<color lightgreen>This script is to reduce the mundane eating crap!~</color>;#SHOW ~<color lightgreen>Please set your AlarmTime Variable.~</color>;#SHOW ~<color lightgreen>This variable is the delay time from the mud to~</color>;#SHOW ~<color lightgreen>all of you things in your inventory and containter lists.~</color>;#CR;#SHOW ~<color lightblue>salarm~</color>~<color yellow> -----~</color>~<color red> Set the AlarmTime ~(variable). ex: salarm 3~</color>;#SHOW ~<color lightblue>foodadd~</color>~<color yellow> -----~</color>~<color red> Add food to the food list ~(variable).~</color>;#SHOW ~<color lightblue>fooddel~</color>~<color yellow> -----~</color>~<color red> Delete food from the food list ~(variable).~</color>;#SHOW ~<color lightblue>conadd~</color>~<color yellow> -----~</color>~<color red> Add container to the container list ~(variable).~</color>;#SHOW ~<color lightblue>condel~</color>~<color yellow> -----~</color>~<color red> Delete container from the container list ~(variable).~</color>;#SHOW ~<color lightblue>eatshow~</color>~<color yellow> -----~</color>~<color red> Shows your list of food, containers and the AlarmTime ~(variables).~</color>;#CR}
#ALIAS fooddel {#DELITEM foodtypes {%-1};#CR;#SHOW ~<color cyan>You have deleted %1 to your food list.~</color>}
#ALIAS foodadd {#ADDITEM foodtypes {%-1};#CR;#SHOW ~<color cyan>You have added %1 to your food list.~</color>}
#ALIAS salarm {#var AlarmTime %1}
#ALIAS eatshow {#CR;#CR;#SHOW ~<color yellow>~<b> *** YOUR LISTS ***~</b>~</color>;#CR;#SHOW ~<color cornsilk>~<b>Food List~</b>~</color>;#SHOW ~<color lightgreen>~<b>-----------------~</b>~</color>;#LOOP 1,%numitems( @foodtypes) {#SHOW ~<color cyan> %i~.~</color> ~<color red>%item( @foodtypes, %i)~</color>};#CR;#SHOW ~<color cornsilk>~<b>Container List~</b>~</color>;#SHOW ~<color lightgreen>~<b>-----------------~</b>~</color>;#LOOP 1,%numitems( @containertypes) {#SHOW ~<color cyan> %i~.~</color> ~<color red>%item( @containertypes, %i)~</color>};#CR;#SHOW ~<color cornsilk>~<b>Alarm Time~</b>~</color>;#SHOW ~<color lightgreen>~<b>-----------------~</b>~</color>;#SHOW ~<color aqua>Your current alarm time is set to @bRed@AlarmTime@bCyan seconds.~</color>;#CR}
#ALIAS conadd {#ADDITEM containertypes {%-1};#CR;#SHOW ~<color cyan>You have added %1 from your container list.~</color>}
#CLASS 0

#CLASS {autoeat|System}
#ALIAS atconnect {}
#TRIGGER {You fall asleep.} {#NOOP Change the pattern to the output line of your mud for the sleep command.;#T- AutoEatTrig}
#TRIGGER {You open your eyes} {#NOOP Change the pattern to the output line of your mud for the wake command.;#T+ AutoEatTrig}
#CLASS 0

To enhance for your mud. You will need to modify the
#COND {(You are carrying)}
This is the first line shown after the inventory command.
Enjoy!!
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)

Last edited by darmir on Sat Dec 04, 2004 4:59 am; edited 2 times in total
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Fri Dec 03, 2004 8:49 pm   
 
; commented lines fail to install properly on import you should use #NOOP comment :P
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
darmir
Sorcerer


Joined: 10 Oct 2000
Posts: 706
Location: USA

PostPosted: Sat Dec 04, 2004 4:24 am   
 
Thanks nexela. I was thinking there maybe a problem with it. That maybe a item we should submit as a bug.
I have edited the code as per your suggestion and it works fine.
Enjoy!!
_________________
Run as hard as a wild beast if you will, but you won't get any reward greater than that destined for you.
Source: (Egyptian)
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