|
Cayr Newbie
Joined: 11 Dec 2006 Posts: 4
|
Posted: Mon Dec 11, 2006 11:53 pm
Trigger Assistance |
#wa 1980;#if {@pushups=2} {look;#reset;pushup} {#add @pushups 1;#wa 1308;pushup}
Alright. What this is supposed to do is increment the PUSHUPS variable each time the trigger fires. Basically, when the character finishes a push-up, this check is run. If enough pushups (for testing purposes, 2 right now) have been done, the script causes the character to look around at the room, and then go back to pushups while resetting the variable. If not, it continues to do pushups.
I can't figure out where I'm wrong. The variable isn't incrementing. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 12:00 am |
You're using the #add syntax wrong - "@variablename" refers to the CONTENTS of that variable. What you mean is #add pushups 1. Your script should work fine after that.
Though I'd really advise not using the #wait command if you can at all help it. It's all kinds of nasty :( |
|
|
|
Cayr Newbie
Joined: 11 Dec 2006 Posts: 4
|
Posted: Tue Dec 12, 2006 2:05 am |
Well, I don't want the trigger to look instant. Thanks for the edit, though. Do I need to completely remove the @ sign from both PUSHUPS, or just the last one?
EDIT: Figured it out. Thanks again for the help. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 2:21 am |
There's normally a way around using the #wait command if you need to - like if it's not absolutely critical that you get them off to thousandth-accuracy, you could just create an alarm for +2 seconds and another for +1.3 seconds. But if you're waiting for input from the MUD that takes that long to receive, why not use a trigger?
|
|
|
|
Cayr Newbie
Joined: 11 Dec 2006 Posts: 4
|
Posted: Tue Dec 12, 2006 3:55 pm |
The time between the MUD sending the trigger prompt, and the time the trigger commands are sent, needs to be more than instant but less than a long time. So, I was going for four-digit times in WAIT.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 4:01 pm |
Well, if it works. Just a heads-up that #WAIT can cause problems, especially in triggers. #ALARM is a better choice.
|
|
|
|
Cayr Newbie
Joined: 11 Dec 2006 Posts: 4
|
Posted: Tue Dec 12, 2006 4:04 pm |
Well, what would the ALARM text be to insert into that trigger rather than the WAIT?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 4:11 pm |
It's explained in detail here, but basically it's just
#alarm +TimeInSeconds {stuff to do}
The lowest TimeInSeconds can be is 0.5. Your example would be something like:
#alarm +2 {#if {@pushups=2} {look;#reset;pushup} {#add @pushups 1;#alarm +1.3 {pushup}}}
EDIT: I just noticed something else about your first example. The expression should be surrounded with brackets () rather than braces {}. Brackets are used for expression evaluation, and braces are used for command evaluation. Using the wrong one doesn't always cause problems, but it can do. So:
#if (@pushups=2) {do stuff} |
|
|
|
Toshiki Beginner
Joined: 20 Nov 2004 Posts: 14
|
Posted: Wed Dec 13, 2006 8:25 am |
Question about the Alarm. I'm a #wait user myself, and yeah it causes problems sometimes, but i manage to work around it. But with the #alarm, can i set more than 1 alarm at once? Like one for 2 seconds 1 for 3 seconds and another for 4 seconds or however many seconds?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 13, 2006 1:16 pm |
Yep, you can run as many alarms as you like. And they come in many flavours - you can have the "In x seconds" you can have the "When I have been connected for xxx" kind, and you can have the "When the time is" kind. Much more versetile than #wait :)
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Thu Dec 14, 2006 7:25 pm |
Not that I'm promoting the usage of illegal bots on muds (yes, this seems to have all the makings of an illegal bot, such as "Well, I don't want the trigger to look instant.")... but you can use random timeframes, as well. That way, if someone is clocking you, you don't do everything on the same beat. :\
Charneus |
|
|
|
umdbandit Wanderer
Joined: 31 Oct 2004 Posts: 94
|
Posted: Thu Dec 14, 2006 8:32 pm |
heh
Well, do use 'Illegal Bots,' and will continue to do so. I think if you are willing to put in the time to make a good enough bot, power to you to use it. Most muds have severe penalties including getting deleted. But like i said, thats where the willingness to make a good one comes in.
So lets see what we can do to work of the realness of your push-up bot.
first we'll take a look at what you have, and what fang xianfu has
#wa 1980;#if {@pushups=2} {look;#reset;pushup} {#add @pushups 1;#wa 1308;pushup}
#alarm +2 {#if {@pushups=2} {look;#reset;pushup} {#add @pushups 1;#alarm +1.3 {pushup}}}
for starters, you said that you want it to run a 'check' once the pushup is done. So i am going to assume that there's some kind of mud output that signifies this, and that you're comfortable triggering it.
Also, from your posts, it is kind of unclear when you are trying to have your bot move... From your original script, if we start at 0, you have your bot go to 1980, go to 1308, do a pushup, go back to 1980, go to 1308, do a pushup, go back to 1980, (counter resets) do a pushup, repeat. this all seems kind of wierd, so i'm not going to include any movement until you further indicate what exactly you are trying to have happen
we'll use a random time interval between 1 and 10 seconds ( you can mess around with this to meet the desired 'awareness' of your bot. For example, if it is busting ass, you'd set it low, but if it was slacking, you'd set it high. ) The reason that I try to stick to variables in the script, is so you can objectify your code the best you can. This will allow you to easily customize anything that you make. Zmud's variable structure isnt my favorite, but in general, i think this is a good thing to do.
first off, the #RESET command is kind of nasty, and i reccommend that you dont use it unless you are actually trying to reset all your stuff. (which in this case you arent, you just want to set a value to its starting point)
so we start with a #TRIGGER pushup1 {push up done} {pushupcheck}
and have the alias pushupcheck
#ALIAS pushupcheck {@pushuptime = %random(@mintime,@maxtime);#ALARM pushup2 +@pushuptime {#IF @pushups=@pushupmax {look;@pushups = 0;pushup} {#ADD pushups 1;pushup}}}
now we need an instant cutoff switch in case a wizard gets up in our business
#ALIAS pushup {#T- pushup1;#T- pushup2}
and you can make aliases so that you can easily change the max pushup amount, or the random interval
Also what i have noticed while i bot, i usually correspond a set of random commands to my actions, to give it a more human feel. For example, i'll have a string list of stuff like gossip history, skills, trains, etc, and i'll randomly type 1 to 3 of those commands in the vicinity of my bot doing something (now maybe this just mirrors me as a typist, but i think we all have our twitch commands that we type every few seconds when we are just waiting)
anyways, thats all for now! |
|
_________________ Rufus- Winner of Stuff |
|
|
|
|
|