 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Wed Feb 12, 2003 8:44 pm
Mundane AutoEat script |
I don't play MUD's much anymore, but I have heard how much the autoeat script worked. I am going to rewrite the script to use the newest features of zMUD, like conditions, having a subclass that works. I wrote that back in 1999. I may also add a database.
Was also thinking of writing a generic spell up script too.
Anybody have any ideas what they would like?
I know this isn't very important to some of you.
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Thu Feb 13, 2003 11:09 pm |
I have reworked this script and have come up with some changes. I would like the GURUS to look over this and see if they can think of any way to compress this into a more efficient way.
Uses Carabas's color replacement script:
#CLASS {Color Replacement}
#VAR bGreen {[1;32m}
#VAR bBlue {[1;34m}
#VAR bCyan {[1;36m}
#VAR bRed {[1;31m}
#VAR bMagenta {[1;35m}
#VAR bYellow {[1;33m}
#VAR White {[1;37m}
#VAR AnsiReset {[0m}
#VAR dBlue {[0;34m}
#VAR dCyan {[0;36m}
#VAR dGreen {[0;32m}
#VAR dMagenta {[0;35m}
#VAR dRed {[0;31m}
#VAR dYellow {[0;33m}
#VAR bGrey {[0;37m}
#VAR dGrey {[1;30m}
#VAR Colors {White|bYellow|bMagenta|bRed|bCyan|bGreen|bBlue|bGrey|dYellow|dMagenta|dRed|dCyan|dGreen|dBlue|dGrey}
#VAR ansi {@%1}
#CLASS 0
Now the autoeat script:
#CLASS {autoeat}
#ALIAS checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#wa 3000;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {get %item( @havefood, 1) %item( @havecontainer, @loopcount);eat %item( @havefood, 1);stillhungry = 0;#abort 1} { #echo I have no food in %item( @havecontainer, @loopcount)};#IF ((@stillhungry=1) and (@loopcount<@containercount)) {checkcontainers}{#echo I have nothing at all better get some}}
#VAR foodtypes {waybread|cookie|filet|clams|meat} {waybread|cookie|filet|clams|meat}
#VAR containertypes {backpack|jar|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 {You are STARVING!} {#unv havefood;#unv havecontainer;#unv loopcount;#unv containercount;#unv stillhungry;inventory}
#COND {You are carrying:} {#T+ ConTypeTrig;#T+ FoodTypeTrig}
#COND {} {#T- ConTypeTrig;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {eat %item( @havefood, 1);#ab 1} {#show {
@bGreen I have no food on me}};#IF (%numitems( @havecontainer)>0) {#var stillhungry 1;#var loopcount 0;#var containercount %numitems( @havecontainer);checkcontainers} {#show {@bRed I have no containers need go buy one, duh!}}} {wait|param=3500}
#CLASS 0
#CLASS {autoeat|AutoeatAliases}
#ALIAS condel {#delitem containertypes {%-1};#show @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 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 the list of food and container you have in your lists ~(variables)}
#ALIAS fooddel {#delitem foodtypes {%-1};#show @bYellow You have deleted %1 from your list.}
#ALIAS foodadd {#additem foodtypes {%-1};#show @bYellow You have added %1 to your list.}
#ALIAS conadd {#additem containertypes {%-1};#show @bYellow You have added %1 to your list.}
#ALIAS eatshow {#show %crlf @bYellow *** YOUR LISTS ***;#show %crlf @bGreen Food List;#show @dGreen-------------------;#loop 1,%numitems( @foodtypes) { #show @dGreen %i~. @bRed %item( @foodtypes, %i)};#show %crlf @bGreen Container's List;#show @dGreen-------------------;#loop 1,%numitems( @containertypes) {#show @dGreen %i~. @bRed %item( @containertypes, %i)}}
#CLASS 0
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Sun Feb 16, 2003 7:36 pm |
quote:
I have reworked this script and have come up with some changes. I would like the GURUS to look over this and see if they can think of any way to compress this into a more efficient way.
Uses Carabas's color replacement script:
#CLASS {Color Replacement}
#VAR bGreen {[1;32m}
#VAR bBlue {[1;34m}
#VAR bCyan {[1;36m}
#VAR bRed {[1;31m}
#VAR bMagenta {[1;35m}
#VAR bYellow {[1;33m}
#VAR White {[1;37m}
#VAR AnsiReset {[0m}
#VAR dBlue {[0;34m}
#VAR dCyan {[0;36m}
#VAR dGreen {[0;32m}
#VAR dMagenta {[0;35m}
#VAR dRed {[0;31m}
#VAR dYellow {[0;33m}
#VAR bGrey {[0;37m}
#VAR dGrey {[1;30m}
#VAR Colors {White|bYellow|bMagenta|bRed|bCyan|bGreen|bBlue|bGrey|dYellow|dMagenta|dRed|dCyan|dGreen|dBlue|dGrey}
#VAR ansi {@%1}
#CLASS 0
Now the autoeat script:
#CLASS {autoeat}
#ALIAS checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#wa 3000;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {get %item( @havefood, 1) %item( @havecontainer, @loopcount);eat %item( @havefood, 1);stillhungry = 0;#abort 1} { #echo I have no food in %item( @havecontainer, @loopcount)};#IF ((@stillhungry=1) and (@loopcount<@containercount)) {checkcontainers}{#echo I have nothing at all better get some}}
#VAR foodtypes {waybread|cookie|filet|clams|meat} {waybread|cookie|filet|clams|meat}
#VAR containertypes {backpack|jar|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 {You are STARVING!} {#unv havefood;#unv havecontainer;#unv loopcount;#unv containercount;#unv stillhungry;inventory}
#COND {You are carrying:} {#T+ ConTypeTrig;#T+ FoodTypeTrig}
#COND {} {#T- ConTypeTrig;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {eat %item( @havefood, 1);#ab 1} {#show {
@bGreen I have no food on me}};#IF (%numitems( @havecontainer)>0) {#var stillhungry 1;#var loopcount 0;#var containercount %numitems( @havecontainer);checkcontainers} {#show {@bRed I have no containers need go buy one, duh!}}} {wait|param=3500}
#CLASS 0
#CLASS {autoeat|AutoeatAliases}
#ALIAS condel {#delitem containertypes {%-1};#show @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 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 the list of food and container you have in your lists ~(variables)}
#ALIAS fooddel {#delitem foodtypes {%-1};#show @bYellow You have deleted %1 from your list.}
#ALIAS foodadd {#additem foodtypes {%-1};#show @bYellow You have added %1 to your list.}
#ALIAS conadd {#additem containertypes {%-1};#show @bYellow You have added %1 to your list.}
#ALIAS eatshow {#show %crlf @bYellow *** YOUR LISTS ***;#show %crlf @bGreen Food List;#show @dGreen-------------------;#loop 1,%numitems( @foodtypes) { #show @dGreen %i~. @bRed %item( @foodtypes, %i)};#show %crlf @bGreen Container's List;#show @dGreen-------------------;#loop 1,%numitems( @containertypes) {#show @dGreen %i~. @bRed %item( @containertypes, %i)}}
#CLASS 0
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Feb 17, 2003 6:03 am |
Do you have a question? I'd guess that by now all the interested Gurus have looked it
over. The lack of response just indicates they don't have any suggestions. There's
certainly no need to quote your entire (very long) post without adding a single word.
LightBulb
Advanced Member |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Mon Feb 17, 2003 7:19 pm |
I didn't mean to put it in a quote I was just trying to bump it back up to the top.
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Fri Feb 21, 2003 9:01 pm |
I was testing this script and I found a bug in the checkcontainers alias but I can't figure out why it isn't working. Let's say the you have more than one container in the havecontainer variable and you don't have any food in the current container you are looking in. Well, the script then calls the alais checkcontains again, but it doesn't recognize it as an alias. Any ideas?
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sun Feb 23, 2003 7:22 pm |
It only took one test of your alias to find the problem. It was fairly obvious when zMUD displayed:
{checkcontainers}{#echo I have nothing at all better get some}
You left out the space between {checkcontainers} and {#ECHO ...}.
#ALIAS checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#wa 3000;#T- FoodTypeTrig;#IF (%numitems( @havefood)>0) {get %item( @havefood, 1) %item( @havecontainer, @loopcount);eat %item( @havefood, 1);stillhungry = 0;#abort 1} { #echo I have no food in %item( @havecontainer, @loopcount)};#IF ((@stillhungry=1) and (@loopcount<@containercount)) {checkcontainers}{#echo I have nothing at all better get some}}
However, before I got around to testing I'd already rewritten the alias to remove the #WAIT and #ABORT. So you can either correct your original alias or replace it with the snippet below.
#AL checkcontainers {#ADD loopcount 1;#T+ FoodTypeTrig;look in %item( @havecontainer, @loopcount);#ALA +3 {checkcontainers2}}
#AL checkcontainers2 {#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 %item( @havecontainer, @loopcount)};#IF (@loopcount < @containercount) {checkcontainers} {#ECHO {I have nothing at all, better get some}}}}
LightBulb
Advanced Member |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Sun Feb 23, 2003 10:39 pm |
quote: It only took one test of your alias to find the problem. It was fairly obvious when zMUD displayed:
{checkcontainers}{#echo I have nothing at all better get some}
You left out the space between {checkcontainers} and {#ECHO ...}.
I found the space problem earlier.
Thanks Lightbulb. I didn't think of another alias.
Darmir
"A gentle answer turns way wrath,
but a harsh word stirs up anger"
Proverbs 15:1 |
|
|
 |
darmir Sorcerer

Joined: 10 Oct 2000 Posts: 706 Location: USA
|
Posted: Mon Mar 03, 2003 4:43 pm |
Well, the script is done. I wanted to post it here before I put it on the the finished scripts forum.
Why can't you update or see a post more than one year old? I was going to update the original AutoEat post on the finished scripts forum.....
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.
The script:
#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 {cookie|filet|clams|meat|mushroom}
#VAR containertypes {sack|kreel|bag}
#VAR stillhungry {0}
#VAR loopcount {1}
#VAR containercount {1}
#VAR AlarmTime {3}
#VAR havefood {mushroom}
#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 {You are {STARVING|a mite peckish|hungry|really hungry}} {#var havefood "";#var havecontainer "";#var loopcount 0;#var containercount "";#var stillhungry "";inventory}
#COND {You are carrying:} {#T+ ConTypeTrig;#T+ FoodTypeTrig}
#COND {@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|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}
#CLASS 0
#clr
#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.
olor Replacement script:
#CLASS {Color Replacement}
#VAR bGreen {[1;32m}
#VAR bBlue {[1;34m}
#VAR bCyan {[1;36m}
#VAR bRed {[1;31m}
#VAR bMagenta {[1;35m}
#VAR bYellow {[1;33m}
#VAR White {[1;37m}
#VAR AnsiReset {[0m}
#VAR dBlue {[0;34m}
#VAR dCyan {[0;36m}
#VAR dGreen {[0;32m}
#VAR dMagenta {[0;35m}
#VAR dRed {[0;31m}
#VAR dYellow {[0;33m}
#VAR bGrey {[0;37m}
#VAR dGrey {[1;30m}
#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 |
|
|
 |
|
|
|
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
|
|