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
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sun Oct 31, 2004 5:02 am   

basic bot script needs a little bit of help
 
So i have a basic bot that uses a path, and triggers to make it pause and kill the different enemies I want it to. It has worked very well for several years, but now i would like to modify it to do one more thing. In the newest city that i have moved into, the citizens are loaded with monies.... The only problem is that there are wandering guards that will attack you if you start combat with a citizen while they are in the same room. So basically I want to make my bot not attack the citizens if there is a guard in the room. I was wondering if any of you guys could reccommend a good way to go about doing this.

Thanks a lot, Rufus
_________________
Rufus- Winner of Stuff
Reply with quote
misterbalrog
Apprentice


Joined: 26 Oct 2004
Posts: 108

PostPosted: Sun Oct 31, 2004 6:35 am   
 
The concept that appears in my head would be to save the mobs in the room in a list and check that list for any entries of a guard before attacking, and if false, attack each mobile through the list.

I guess I'm just a bit lazy for not writing up the code :P
Reply with quote
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sun Oct 31, 2004 11:06 pm   alright here's where i am
 
ok, i've saved the enemies as a list, and set triggers to do things like


#TRIGGER A member of the town guard {@guard = 1}
#TRIGGER A wealthy citizen {@citizen = 1}

so it assigns a value when it enters a room and sees the stuff

but how then do i make it so it "checks" these values, before executing commands based on the knowledge that it gathered



thanks a lot


Also I would like to know how to reset my values back to zero when i leave the room.

When i use #RESET, it resets all my variables, which isnt good because i use lots of stuff to keep track of my gold exp and gear. So how could i use this command to single out the variables i want to reset, or is there another command better suited to it.


Ideally I want to enter the room in my slow walk, set a 1 for all the enemies that are there to represent true, and then if the guard is true, keep walking.



So as i'm writing this, i think i may have solved my own problem, but someone i guess take a quick look at it.





could i do something like set those triggers i said above

and then in the guard trigger, add into it

#IF @guard == 1 {#STEP}

and then reset however you reset

and for the citizen i could add

#IF @guard == 0 {kill citizen}

and similarly i would need to make them reset prior to stepping


so anyways, im open to all thoughts and inputs.

thanks a lot guys
_________________
Rufus- Winner of Stuff
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Nov 01, 2004 2:35 am   
 
#IF (@guard) {#STEP} {kill citizen}
It seems like you have the concepts under control
you can also #RESET classname for settings in a class or write your own reset routine in the begining of your script

For help on where exactly all this stuff goes we would have to see your script. as diff people have diff ways of doing things And I can only use my mind reading powers so many times a day before it wears me out :P
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Mon Nov 01, 2004 6:39 am   clarification
 
ok here's the finished product for now... wanted to post it if anyone wants to use it...

umm dont know how to document in zmud so i'll go through what does what up here.

first in the central part, i have a guard trigger that is always actice, as well as a kill trigger, and a trigger that detects when you have more than 1,000 gold, and then makes it so you no longer stop and fight, and you go and deposit (on this game you fight less well w hen you are weighed down)

the second class is the enemies it stops to kill. It attacks the one that is listed first, and then disables the class so you dont attack every enemy and overwhelm yourself

the third is a failsafe repeating alarm that re-enables the second class every 10 seconds, just to make sure things keep going steady

the fourth class is in case you get some bad luck in combat, and have to run away. You'll run a random exit in this game, so this class waits for 50 minutes so your life ticks up, and then goes back into the fray.

Now two last notes:

First, I still cant get the #RESET to work, so what i did, was just have the value manually be set back to false. This works for now, but i'd like to try and figure out why it doesnt work.

And secondly i'd like anyones opinion on other cool/neat things i could add into a bot to make it more fun/better.

Thanks again guys, and the code is below!


Code:

#CLASS {bigcity}
#TRIGGER {A large guard stands here} {@guard = 1;#PAUSE;#RESET;#STEP;@guard = 0}
#TRIGGER {has died.} {#T+ bigcit;gold;#WAIT 1000;#STEP}
#TRIGGER {is bleeding to death and needs to be bandaged!} {kill}
#TRIGGER {locating 1,} {#T- bigcit;#T- camengine}
#TRIGGER {A big guard} {deposit all;#T+ bigcit;#T+ camengine;#WAIT 5000;#SL bigcity}
#CLASS 0

#CLASS {bigcity|bigcit}
#TRIGGER {A wealthy citizen} {#PAUSE;#T- bigcit;#IF (@guard) {#RESET;#STEP} {kill citizen}}
#TRIGGER {female citizen} {#PAUSE;#T- bigcit;#IF (@guard) {#RESET;#STEP} {kill citizen}}
#TRIGGER {male citizen} {#PAUSE;#T- bigcit;#IF (@guard) {#RESET;#STEP} {kill citizen}}
#CLASS 0

#CLASS {bigcity|engine}
#ALARM "engine" {10} {#T+ bigcit}
#CLASS 0

#CLASS {bigcity|wimpy}
#TRIGGER {you flee %w} {@direction = %1;#T- bigcit;#T- camengine;#ALARM +300 {%reversedir( @direction)}}
#CLASS 0
_________________
Rufus- Winner of Stuff
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Nov 01, 2004 12:39 pm   
 
A couple of problems @guard = 1 When assigning variables like this don't use @ in front of it
Your still not using reset like I said The Reset Help File you HAVE to supply a class name if you don't want it to reset everything
#WAIT bad idea in general

The Best way to work with a bot (IMO) is to set variables and then on your prompt go through and exectute commands depending on the values
_________________
Zmud Support Library
Zmud Knowledge Base
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