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
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Fri Jul 13, 2007 6:06 am   

IF commands
 
Can someone please tell me how to use IF commands? Or point me in the correct direction. I've already looked at all the local help files.

I'm trying to make bot script and I need it to do certain things if my HP is below a set number, or movement, or whatever.

I appreciate your help.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Jul 13, 2007 10:29 am   
 
#if (expression) {true-commands} {false commands}

The false commands are optional.

"Expression" is a mathematical expression. It will come out as either true or false. "1=1" is true, "3<2" is false. "@hp<250" will sometimes be false, and sometimes be true. You'll probably want something like this:

#if (@hp<28672) {flee} {smack @target with a sword}
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jul 13, 2007 9:17 pm   
 
I'll elaborate a bit on Fang's illustration.

With his script (#if (@hp<28672) {flee} {smack @target with a sword}), the following scenarios would happen.

Your hp: 30000 -> You smack a monster with a sword!
Your hp: 28671 -> You flee from a monster!

If you don't want your script to do anything when your hp is above a certain level, you can have it read like this:

#IF (@hp<25000) {flee}

The statement will execute only if your hp is below 25000. Otherwise, it will do nothing. You can also have it the other way around:

#IF (@hp>25000) {} {flee}

This statement will again only execute if your hp is below 25000. The first {} have nothing inside it, and that's the "true" command.

Anyway, that's some elaboration on the #IF command. You can find more about it in your help files under Help -> Command Reference in zMUD.

By the way, most bots (including the one you're suggesting) are illegal in many MUDs. You may want to check with your Admin team before you use the script, or you may find yourself removed from the game. Aardwolf (the MUD I play) does not allow anything that can be beneficial to the player while that person is away from the keyboard. This script would benefit me because I could initiate combat and walk away knowing that if my HP falls below a certain level, I'll automatically flee. Keep that in mind. Also, don't expect any help from someone if you tell them you're making a bot for botting purposes. Last I heard, Zugg doesn 't allow it, especially since most MUDs don't allow botting.

Charneus
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