|
CreationEdge Newbie
Joined: 06 Sep 2004 Posts: 5
|
Posted: Mon Sep 06, 2004 4:41 am
Total Newb, Need Scripting Help |
Hello...
So, school just started back up, and I've found myself with little to know time to actually play my MUD. My time goes to school and homework. When I have freetime, I'm usually burnt out, and I can't stand to sit and type for the hours I need to level normal.
I decided I'd try to figure out how to script. All I need is a simple script that'll kill and search all of a certain critter in a room. When the room is empty, I pick up my loot and go to the next room. If there's any critters there, the script goes through until they're dead.
Well, I've found that the help files for zMUD and the tutorials on the website are put in no coherent order. Everything is separated from one another, and the examples are so poorly explained that it takes a little bit to figure out what in the heck they're talking about.
I tried looking at some other hunting scripts in the Completed Scripts board, but I have no idea how to use them! (zMUD is not my client of origin) When I think I figured it out, I kept getting syntax errors. I also have no idea how to test the script!
What I hope the more experience of you out there can help me with is to set me on the right track. Such as, letting me know which commands I need to look up and learn to create my described script, and how I actually put the script into zMUD once I think I'm done with it in wordpad.
All help would be appreciated. I've no experience in any programming at all, though I've been wanting to learn for the longest time. I'm a quick learner when the information is presented to me in a clear form.
Just in case it's needed, here's a little more detailed description of the script I need. (I'm not asking for someone to make it for me. It's not right, plus I'll never learn that way.) A list of commands I need to learn about would be extremely helpful(even more helpful if you could explain them clearly yourselves ). I mean, I can read all about #TRIGGER in the help files all I want, but it does no good if I don't know how to apply it useflly. :
Type A:
I move myself. I look in the room. If there's the target critter in the room, I attack it. Then I wait for the round time of my weapon. If the target isn't dead, I attack again. Repeat until critter is dead. Then I search the critter. Next, I check the room again. If there's the target creature in the room, I procede to give it the good ol' bashing. Once the room is clear of the target creature, I move to another room, and the process begins again. This way I'm still active, but I don't have to worry about all the extra typing for everything else.
Type B:
Like Type A, except for it moves me in a pretermined path. Such as, it moves me to a room. Checks for the target critter. If it's there, it attacks. If not, it goes to the next step in the path. Once I'm back to my original spot, the script ends, and I have to reactivate it. This would save me a lot more time, as I could watch my MUD screen while I work on something else.
This is the thread with the script I've mainly been dissecting. http://forums.zuggsoft.com/phpbb/viewtopic.php?t=13019&highlight=hunt
It's the one the gave me syntax errors(probably because I don't know how to enter the script into zMUD). This script is like Type B, but I've not idea how the #BUTTON command works, especially how it's used there. The help file didn't help me at all.
Any and all help would be appreciated! I hope I'm not violating any rules or anything!
Phwew! I'm longwinded! |
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Mon Sep 06, 2004 11:58 am |
1) Consult your MUD's Rules and Regulations to verify the legality of Triggers, Botting, and AFK. Most MUDs disallow botting and promise punishment up to nuking
2) Search the General Forum for autokill, kill, bot, etc. for several examples.
3) The examples in the Help Files are indexed in alphabetical order. If you aren't sure how to find something in the index or if you aren't sure what to look for, then try the Help Files's Search feature.
For example, you'll want to match your MUD output for certain mob names (a pattern) and then send a command or function or MUD action in response. Search each of those words. You'll get several hits for each word. If you find the "Introduction to ..." files a bit overwhelming, then I suggest reading the more specific files #ALIAS, #VARIABLE, #TRIGGER, and pattern matching for the "meat and potatoes" of your scripting.
It's all good, though!
4) The commands and functions written in most posts and in the Help files are for command line entry, i.e. you either type them directly in the command line and press <Enter>, or you copy and paste them into the command line and press <Enter>. Examples,
#TRIGGER {Zugg says, "Hi"} {say Hi, Zugg!}
This trigger will match the pattern Zugg says, "Hi"
Each time you receive it, the trigger will send
say Hi, Zugg! to your MUD
#ALIAS hf {hug Zugg}
This creates an alias named hf
When you type hf, the string
hug Zugg is sent to your MUD
#VARIABLE Friends {Zugg}
This assigns the value Zugg to the the variable Friends
You can combine these in many ways. Example,
#ALIAS hf {hug @Friends}
#TRIGGER {Zugg says, "Hi"} {
say Hi, Zugg!
emote bugs Zugg for a hug
#ALARM +2 {hf}}
When the pattern Zugg says, "Hi" is received
the string say Hi, Zugg! is sent to the MUD,
an emote is sent to the MUD,
and a temporary, one-time 2 second Alarm is created.
After 2 seconds, the alias hf is entered,
the value of @Friends is expanded,
and the string hug Zugg is sent to the MUD.
Just a few introductory examples for you. Several more are available in the Help files. Also, look through past threads for a plethora of examples, and when you see unfamiliar Commands and Functions look them up in the Help Files. |
|
_________________ zMUD 7.05a |
|
|
|
CreationEdge Newbie
Joined: 06 Sep 2004 Posts: 5
|
Posted: Mon Sep 06, 2004 1:39 pm |
As far as I know, my MUD allows scripts(I know they alllow aliases and even show how to set them up), so long as you're at the computer and doing it.
Perhaps you could help me with the #BUTTON thing that was shown in the example I linked to. I understand that the end part is your path, and that #step moves you to the next spot in that path if there's nothing to hunt in the current room, but I'm not sure as to how the #step command knows to go to the #BUTTON command for the path. Nor am I sure about the part before the path. Here:
Quote: |
#TRIGGER {*({@mobEnemyList})*} {#var mobEnemy %lower( {%1}) {_nodef} {Autokill};#t- MatchEnemy}
#CLASS 0
Ok. So @mobEnemyList is the pattern. This will get it to search for my target critter(or mob, if you'd like). Then it types in the command #var mobEnemy and and assigns whatever critter I was hunting to the mobEnemy variable? Then there's no default value, and the class Autokill, and it shuts off class MatchEnemy? Dang, I think I confused myself again.
He had( a couple of times):
#VAR mobEnemy {} {_nodef} {Autokill}
Earlier in the script, with the value empty. Does the #TRIGGER above assign whatever enemy is found from the @mobEnemyList for mobEnemy 's value? And make it as if I'd typed #VAR mobEnemy {mobcritter} {_nodef} {Autokill} ???
#TR [id] pattern command [classname] [options]
#BUTTON 14 {Start-H} {#class Autokill 1;#slow dwarfs;hunt} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {}
The bolded part is what I don't get. 14 is the ID number, right? Then {Start-H} becomes the name. Then when trigged, it sends out #class Autokill 1. Autokill 1 means it makes the class Autokill active, right? (As opposed to 0 for off)? Then there's #slow dwarfs... Which I JUST figured out >_< #slow is the walking/path command, and dwarfs is just the name of it. Then it says hunt, which sets off the rest of the script. Then I activate it by typing $BU 14...
Well, dang, I think I just explained it to myself. I was going mad with the #BUTTON help file, but it wasn't helping at all. Suddenly it all just clicked. Only thing I can't figure out now is how to shut it off.
|
As you can see, I wasn't completely ignorant. I had been using the index, but it wasn't helping to much because it was like learning each of the things separate, but not seeing how they fit together.
I think the #var mobEnemy is giving me the most trouble, along with the #TRIGGER at the top of the quote.
If someone could explain that to me, I'd be grateful, though I don't think I need all these variables for my script. I only want to hunt a specific mob at one time.
Edit: I just realized I have no idea what MatchEnemy is. It's only brought up thrice in the whole example script I've been looking up. And all it has is #t+ MatchEnemy and then the #t- MatchEnemy I showed in the quote, and #CLASS {AutoKill|MatchEnemy} to create the class. I've looked up #T+, and it says that $T+ MatchEnemy will execute everything int he MatchEnemy class. Problem is, I can't find anywhere in the script that adds anything to the MatchEnemy class. What am I reading wrong here? |
|
|
|
CreationEdge Newbie
Joined: 06 Sep 2004 Posts: 5
|
Posted: Mon Sep 06, 2004 2:59 pm |
Ok. Here's what I have so far, but I don't think some stuff is right, because I still don't know what some means. I'm just posting this now so you can see what I'm doing wrong/way I'm thinking when/if you try to explain the stuff in the above post.
Quote: |
(I need the bot to follow a predetermined path. When it moves into a room, I need it to check for a critter. If the critter is there, the bot needs to stop. Then it needs to attack the critter. Then it needs to wait for my RT. Then it needs to see if the critter is still alive. If it is, it continues to attack and wait for my RT. I need it to search the critter when it is dead. After the room is cleared out, I need the bot to get all the items on the floor(put my weapon away, put all the items in my bag, then wait for the RT and get my weapon back out). Then it needs to go into the next room. Sometimes I may fall down, and I need the bot to stop for a certain amount of time before standing and resuming the hunt) --This is just my personal description for the bot. Step by step thing, so I can keep track of what I'm doing.
#CLASS Autohunt
#CLASS Autohunt/MatchEnemy
#CLASS 0
#BUTTON 77 {Start-Hunt} {#class Autokill 1;#slow CritterDeath;moider} {n} {s) {e} {w}
#ALIAS diediedie {kill banana;#wait X;hunt}
#ALIAS moider {
#pause
look banana
#wait 2000
#if (you see a banana) {diediedie} {keepgoing}
}
#ALIAS keepgoing (
#step
#wait 2000
hunt
}
#ALIAS getup {
#CLASS Autohunt 0
#ALARM +X
stand
#CLASS Autohunt 1
hunt}
#ALIAS graverob {search banana;hunt}
#TRIGGER {is dead} {graverob}
#TRIGGER {can't find it}
#TRIGGER {you fall} {getup}
#CLASS 0
#CLASS Autohunt/MatchEnemy
#CLASS 0
#BUTTON 77 {Start-Hunt} {#class Autokill 1;#slow CritterDeath;moider} {n} {s) {e} {w}
|
|
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Tue Sep 07, 2004 9:26 am |
Ya know, I'm at work but still took the time to type out a nice response explaining the trigger and the variable and also provide a few examples. Then the forum timed me out and lost my response. That's what I get for not copying it or typing it up in Wordpad, or something. ::sigh::
Okay, a little shorter this time,
Code: |
#TRIGGER {*({@mobEnemyList})*}
|
This trigger matches the pattern
<any number (even none) of characters or white space>(a value in stringlist @mobEnemyList)<any number (even none) of characters or white space>
Since the stringlist was enclsoed in {}, it's expanded and the pattern will match any of its values {e.g. a|b|c|d|etc). Since it's also enclosed with (), the matched value is stored in a predefined parameter. Since it's the first stored value, it is stored in %1.
Code: |
{#var mobEnemy %lower( {%1}) {_nodef} {Autokill};#t- MatchEnemy}
|
This returns the lowercase value of the string stored in the predefined parameter %1 and then saves it as the value of the variable mobEnemy, which has no default value (you can also use {} to specify no default value) and is in the Autokill class. Then the class MatchEnemy is turned off.
_____________
You jumped into a finished script and aren't satisfied with the layout of the Help files when trying to understand the script. Yeah, the Help files can be lacking at times. Remember, though, hundreds/thousands of zMUD users before you have been using the same files. A few of them are pretty darn good at the scripting (okay, a few of them are awesome!). It takes time and patience.
If the Help files aren't providing sufficient examples, or help, then search the Forum for previous posts. There are hundreds of them that contain great examples, explanation, and teaching.
Sorry, I'm out of time. Maybe another zMUDder will provide further explanations and examples.
P.S. I still think you should search autokill. Hint, hint, there's a basic bot script out there you can start with and add too or modify as you desire. Easily understood too! |
|
_________________ zMUD 7.05a |
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Tue Sep 07, 2004 11:07 am |
Quote: |
my MUD allows scripts(I know they alllow aliases and even show how to set them up), so long as you're at the computer and doing it. |
There's a difference between aliases, scripts, and botting.
Most MUDs have a cool command you can use to verify. Try
help rules |
|
_________________ zMUD 7.05a |
|
|
|
CreationEdge Newbie
Joined: 06 Sep 2004 Posts: 5
|
Posted: Wed Sep 08, 2004 1:52 am |
Alright. The help files aren't set up that great at all. They seem to assume you already understand all the lingo. Honestly, I learned more from the script I've been quoting than the help files.
Thanks for the help :D
BTW, I did type Help Rules, and Help laws, and help scripting. There's nothing mentioned there at all, or on the site, but I heard one of the GMs mention once that it's ok if you're not doing it AFK.
Well, I think I've got what I need, anyway. I made a simple script that just keeps attacking the critter I specify, then shuts off when it's done. Saves me the trouble of trying to time my attacks and constantly typing, even if I'm using aliases.
I thought I did search for "autokill" or maybe I just searching "hunting". I don't know. I'll check eventually. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Wed Sep 08, 2004 2:39 am |
I have heard many new users say that the help files weren't actually helpful. I want to know what would make them helpful. They actually haven't even been rewritten, they just sort of grew over the years as zMud's features grew. Rewriting them would be a monumental task that I don't have time for, and Zugg likely wouldn't approve of anyway.
Last major changes to the help were done a year ago when the contents got vastly expanded, the index was toned up to cover every topic (I could still probably add 1000 keywords here), and topic crosslinking plus related buttons were added to all the reference section.
What needs to be done to make the help good? Does it need a series of "how to" sections covering common questions? Does half the online FAQ have to be included directly in it? Do you really want to download an extra 100Kb everytime zMud is updated?
As it stands right now there are over 1500 pages in the help totalling 850Kb of text. I am in no way saying it is complete or can't be improved upon. All I am saying is that without some good idea of where it is weak I can't think of how to make it better. My perspective as an experienced user just doesn't really help me to see what a new user needs most. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
CreationEdge Newbie
Joined: 06 Sep 2004 Posts: 5
|
Posted: Wed Sep 08, 2004 11:03 pm |
Oh. I'll gladly explain. I'm just thinking that perhaps the help files should be a little more like a textbook. They ARE helpful, if you know what you're doing, and if you've got a little experience, but just connecting the stuff together, I dunno.
Ok. I'll examine "Introduction to Aliases" I already knew about these, but it's still an example of why I found the other intros difficult.
The first paragraph is fine. Tells the person if this is the thing they're looking for.
Quote: |
Aliases are another way to simplify your life of MUD playing. Basically, aliases allow you to assign any command to a shortcut abbreviation. |
But then, we jump into this:
Quote: |
The easiest way to create an alias is to type the command or words you want to make a shortcut for, then press Control-A, or select Make Alias from the Action menu. You will be prompted for the shortcut abbreviation you wish to assign the command to. For example, enter the text fill waterskin statue and press Control-A. Then enter fs and click OK. Now, whenever you enter fs in the command buffer, the string fill waterskin statue will be sent to the MUD.
Note that aliases are only translated if they are the first word in a command. In the example described above, if you entered the text say fs on the command line, the string say fs is sent to the MUD and fs is not translated. |
That's a lot of reading and trying to figure out things in your head. This help file isn't so bad, though. One alternative though, would be:
Quote: |
To create an alias(Option 1)
1. Type the command/words you want to be in your alias. In other words, type in the command/words that you want to have a shortcut.
2. Press control+A, or select Make Alias from the Action menu.
3. A prompt window will appear. Enter into it the shortcut you want.
Example.
Zugg types this into the command buffer: fill waterskin statue
Then Zugg hits control+A
Next, Zugg types "fs" (without the quotes) into the prompt window.
Now, whenever Zugg types "fs", the command "fill waterskin statue" is sent to the MUD. Isn't that great?
To create an alias(Option 2)
To create an alias using the #ALIAS command, you'll want to know the syntax, or structure, of the command.
Syntax: #ALIAS [aliasname] [string] [classname]
What exactly does this mean? We'll explain.
#ALIAS lets zMUD know you're making a new alias.
[aliasname] is what you want for your shortcut(what you would normally enter into the prompt window we discussed above).
[string] is the command/words you want to be shortcutted.
[classname] Is the class you would like your alias to be in. Classes are explained further in Intro to Classes. (Note: A class is not required for an alias).
Now that we know how to use the #ALIAS command, let's demonstrate in out example!
Zugg types in: #ALIAS fs {fill waterskin statue}
Now, whenever Zugg types "fs", he'll "fill waterskin statue" |
Alright. I know my set-up isn't the greatest, either, because I don't really know what I'm talking about. I think what my example is really saying is that stuff needs to be separated and more organized on the pages. The Introduction to Triggers is a prime example.
Quote: |
To define a trigger, you use the #TRIGGER (or #ACTION) command. The syntax is #TRIGGER {pattern} {command}. Whenever the pattern text is received from the MUD, the command is executed. You can also define and edit triggers using the View/Triggers menu command to display the Trigger dialog. |
Everything is thrown into the paragraph, and uses only the proper terms. This can be confusing.
Quote: |
To define a trigger, you use the #TRIGGER (or #ACTION) command.
The syntax for this is #TRIGGER (pattern) (command}
This means that whenever the pattern is received from the MUD, the command is executed. In layman's terms, whenever the word(s) you enter for the (pattern) are received from the MUD, then whatever you put for (command) is sent to the MUD.
Let's start with a simple example. When you are working in a group, it is important to see anything that someone in the group has to say. When someone in the group talks, the MUD usually says something like Zugg tells the group 'heal me'. To ensure you don't miss this important information, let's change the color of the line to red using the #COLOR red command. Thus, the trigger would be defined as #TRIGGER {tells the group} {#COLOR red}. |
I left the example alone, because it seems to be well enough for anyone.
Like I said, the help files aren't awful, but I think they can just be overwhelming for beginners with no previous experience. It's like handing someone an advanced math textbook, and telling them to write an equation that uses X many formulas, but making them look up each formula and trying to understand what the book means when explaining them! That's a lot of going through the index and looking for stuff, trying to figure out what you're doing. But if the textbook was geared more towards you writing that required equation, it would list the steps you need to take to write it.
I don't think I wrote that clearly. Oh well.
Maybe the help files just needs a "Using everything you've learned" file, that combines everything you get from the other intros into one script. |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Sat Sep 25, 2004 7:36 am Hi |
Ok well sence im part of the reason this posted script is messed up ( I did not clear any of it out.) I will go over what the script is all about. (In my next post that is.
|
|
_________________ <Clever text here> |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Sat Sep 25, 2004 7:59 am Ok here it is the script as I use it. |
This is an explanation. DO NOT COPY PASTE THIS IN. This is Falcnor Script I DID NOT MAKE IT! I just changed a few of the things on it that did not work for any of the muds I played on.
#CLASS {Autokill}
Name of the script
#ALIAS Hunt {#t+ MatchEnemy;#VAR mobEnemy {} {_nodef} {Autokill};#pause;l;#wait 1000;#if (@mobEnemy) {x @mobEnemy} {ChangeRoom}}
OK this line basicly checks to see if the mob from your mob list is in the room. If not it moves to the next room. If so, then it Starts combat (x for me is the same as kill whatever) Edit that to your taste.
#ALIAS ChangeRoom {#step;#pause;#wait 2000;hunt}
As a part of the Hunt Alias, this directs the bot on how to move when the room is empty, or an incorrect mob is there.
#VAR mobEnemy {}
This stores the mob that will be killed from the mobEnemyList.
#VAR mobEnemyList {magical|enchanted|undead|Zombie|rotting}
This is my list of mobs. MUST MATCH WHAT YOU SEE IN THE ROOM WHEN YOU LOOK.
#PATH ToFallen {3ej2n3e3n2e3ne3nw3n2e2nhw16n4e4s2w}
#PATH Fallen {4n2w3ew3n}
#PATH {recall syntax} {;.(recall )}
#PATH ToTree {3ej2n3e3n2e2n3w2kw2n4w4h3w5sws3wk6se4s3w2se7s3esw2se4sw2s4e3nw2n;.(enter black)}
#PATH Tree {wnuesuwnuesuwnuesu3s3nwnue3n4suwn3w3eues3e4wnu2e;.(recall )}
These are all my paths notice I recall at the end of the paths, to restart the bot. You can enter any path here, it realy matters little.
#TRIGGER {%1 is KILLED!!} {hunt}
#TRIGGER {They aren't here.} {sac all;hunt}
#TRIGGER {No *({@mobEnemyList})* here!} {hunt}
#TRIGGER {Target is not present.} {hunt}
These are all reasons to make the bot recheck the room then move. (unless the mob is there. Then there is an issue I ran into a few times with the mobs name looking like something its not. Example The skeleton archers (is what you see when you look at the room, but you have to attack some other name like Ugether.) I never came up with a way around that so I just skipped them.
#BUTTON 1 {Tree} {#t- hunt;#slow ToTree;#wait 24000;#t+ hunt;#class Autokill 1;#slow Tree;hunt} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {} {2}
#BUTTON 6 {Fallen} {;#class Autokill 1;#slow Fallen;hunt} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {} {2}
#CLASS 0
This is modified so that I speed walk to the location from my recall, then slow hunt the area once I’m there.
Anyway that is a basic rundown if the script (working like a charm for me) With what I learned from this script and a few others I was able to add things like health checkers and xp/gold tracks auto deposits, and loot checkers. I guess my ending point is you must REALY play with it and learn the scrip piece by piece for it to help you. Once you know it change it so that it works on your mud, the way you want it to. I look at all the scripts/Ideas on these forums as great ideas that I can work with. I cant learn by reading the help files. I must play with something. I really think that is the best way. And in response to Vijilantes question about the help files. I think the best way to update them is to add working examples of how the scripts work. There is not a lot of advance concepts in the help files, just jumping from point a to point j (once you get to the forums.) That’s my 2 cents. Hope this post helped you.[/size][/size] |
|
_________________ <Clever text here> |
|
|
|
Foosball Newbie
Joined: 25 Sep 2004 Posts: 5 Location: Hill AFB, UT.
|
Posted: Sat Sep 25, 2004 8:35 pm |
Hey, complex, I'm trying to use the hunt alias that you have, and I cut and paste everything you had:
#ALIAS Hunt {#t+ MatchEnemy;#VAR mobEnemy {} {_nodef} {Autokill};#pause;l;#wait 1000;#if (@mobEnemy) {a @mobEnemy} {ChangeRoom}}
and changed the 'x' to an 'a' for my board. When I look under my aliases, I'm getting the following error:
#if () {a } {ChangeRoom}
^ syntax error
It's like they @mobEnemy gets left out of the statement or something. I'll type hunt, and I have a "wyvern" in my mobEnemyList, but when I go to a room with one in it, it just keeps doing the 'l' to look and doesn't attack.
A couple of other questions if you'll bear with me.
In the Hunt alias, where is "MatchEnemy" defined? I discovered that it created a new class after I typed in Hunt on my command line, but it has nothing in it. What is it for?
In the two statements:
#VAR mobEnemy {}
and
#VAR mobEnemyList {magical|enchanted|undead|Zombie|rotting}
I can understand the 2nd one looking for any of those monsters, but I don't see how the first statement interacts with the 2nd.
Sorry to inundate you with questions. I'm new to scripting as well. I'm pretty good with C++ and Java, but this stuff hurts my head.
Thanks in advance for any help!
Foos. |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Sat Sep 25, 2004 10:33 pm OK |
Well I said not to copy paste that one but it looks like a few things are missing
Quote: |
Hey, complex, I'm trying to use the hunt alias that you have, and I cut and paste everything you had:
#ALIAS Hunt {#t+ MatchEnemy;#VAR mobEnemy {} {_nodef} {Autokill};#pause;l;#wait 1000;#if (@mobEnemy) {a @mobEnemy} {ChangeRoom}}
and changed the 'x' to an 'a' for my board. When I look under my aliases, I'm getting the following error:
#if () {a } {ChangeRoom}
^ syntax error
It's like they @mobEnemy gets left out of the statement or something. I'll type hunt, and I have a "wyvern" in my mobEnemyList, but when I go to a room with one in it, it just keeps doing the 'l' to look and doesn't attack.
|
well It should be for you #if (@mobEnemy) {a @mobEnemy} {ChangeRoom}
here is my script i have to head to work play with it and let me know if you can get it to work, if not i will help some more later
#CLASS {Autokill}
#ALIAS Hunt {#t+ MatchEnemy;#VAR mobEnemy {} {_nodef} {Autokill};#pause;l;#wait 1000;#if (@mobEnemy) {x @mobEnemy} {ChangeRoom}}
#ALIAS ChangeRoom {#step;#pause;#wait 2000;hunt}
#VAR mobEnemy {}
#VAR mobEnemyList {magical|enchanted|undead|Zombie|rotting}
#PATH ToFallen {3ej2n3e3n2e3ne3nw3n2e2nhw16n4e4s2w}
#PATH Fallen {4n2w3ew3n}
#PATH {recall syntax} {;.(recall )}
#PATH ToTree {3ej2n3e3n2e2n3w2kw2n4w4h3w5sws3wk6se4s3w2se7s3esw2se4sw2s4e3nw2n;.(enter black)}
#PATH Tree {wnuesuwnuesuwnuesu3s3nwnue3n4suwn3w3eues3e4wnu2e;.(recall )}
#TRIGGER {%1 is KILLED!!} {hunt}
#TRIGGER {They aren't here.} {sac all;hunt}
#TRIGGER {No *({@mobEnemyList})* here!} {hunt}
#TRIGGER {Target is not present.} {hunt}
#BUTTON 1 {Tree} {#t- hunt;#slow ToTree;#wait 24000;#t+ hunt;#class Autokill 1;#slow Tree;hunt} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {} {2}
#BUTTON 6 {Fallen} {;#class Autokill 1;#slow Fallen;hunt} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {} {2}
#CLASS 0
#CLASS {Autokill|MatchEnemy}
#TRIGGER {*({@mobEnemyList})*} {#var mobEnemy %lower( {%1}) {_nodef} {Autokill};#t- MatchEnemy}
#CLASS 0
Oh one last thing, I know there is a fancy way to post scripts, ive see others do it. but im not sure how. Any suggestions here would be nice |
|
_________________ <Clever text here> |
|
|
|
Foosball Newbie
Joined: 25 Sep 2004 Posts: 5 Location: Hill AFB, UT.
|
Posted: Sun Sep 26, 2004 3:43 am |
I got nada. I have a different path than yours, so I just used that one instead of Fallen and made sure it was in the autokill class. I click on the button and it executes the first direction in the path, does a 'l', and then just sits there. Once again, I looked at the Hunt alias value box, and again, the @mobEnemyList is missing.
I've been trying to get just the hunt to work for 12 hours now, and I'm about ready to smash my monitor with my keyboard. I was wondering if I should just use a database of monsters instead of defining them in a variable, but I'm not sure how to do that either.
Hope you can help.
Foos |
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Sun Sep 26, 2004 6:13 am |
Did you copy/paste complex's MatchEnemy subclass too?
|
|
_________________ zMUD 7.05a |
|
|
|
complex Apprentice
Joined: 12 Apr 2004 Posts: 134 Location: USA
|
Posted: Sun Sep 26, 2004 10:06 am hmmm |
Ok when i first started this script I had a problem where it would not walk, but keep looking in the area, in the same room, Is that the problem, or does it look once then never look again IE shut off. It could be a problem with the mob names, or your pathing. make sure the hunt is on befor you walk the path you want to hunt. (my buttons fast walk to the area that im hunting, then start to hunt. ect. Other then that im not maby you missed something, I know it works tons of ppl have barrowed it from me. So something must be missing.
|
|
_________________ <Clever text here> |
|
|
|
Foosball Newbie
Joined: 25 Sep 2004 Posts: 5 Location: Hill AFB, UT.
|
Posted: Mon Sep 27, 2004 7:04 pm |
Yeah, I copied the MatchEnemy class. Weird thing, though. zMud created a _nodef class somehow. Also, when I try to run the script, all it does is type a couple of 'l's and then, after a little bit, it sends "a _nodef" to the screen. This is buggin me like you wouldn't believe. I just want to be able to script a simple area and kill monsters. Nothing fancy, but I can't get it to work for the life of me.
Also, instead of using the @mobEnemyList, couldn't you just pull out of an Enemy database?
I really just wish I knew what each line of code was doing. Then I could figure it out for myself.
Sorry to be a pain. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Sep 27, 2004 7:19 pm |
Quote: |
I really just wish I knew what each line of code was doing. Then I could figure it out for myself.
Sorry to be a pain. |
Zmud comes with this nice thing called HELP which has an even nicer thing called a refrence section which has for most every command and function a few exampes on how it is used.
Quote: |
Also, instead of using the @mobEnemyList, couldn't you just pull out of an Enemy database? |
Do you even have an enemy database?.........
Quote: |
I just want to be able to script a simple area and kill monsters. Nothing fancy |
Bots are not easy to write and even harder to get working the first time you write one. And when your trying to use one that someone else wrote it gets even more confusing when you don't know what half the stuff does, take the time to read the help file.
Obviously the script you imported has a few problems somewhere. |
|
|
|
groundzero2010 Novice
Joined: 30 Sep 2004 Posts: 47 Location: Arkansas
|
Posted: Thu Sep 30, 2004 10:19 pm I'm another newbie when it comes to scripting |
I have a script I want to make and have a good example codewise.
But where in the world am I suppose to put it? Sure I know how to make triggers, aliases, even did some variable work so I have health meters. But a full script where do I place the code for that?
Here is the script I'm going to be using for my base.
Code: |
#CLASS {equip_id}
#ALIAS store_data {#IF !%null( %find( @newRecord.Name, All, Name)) {#YESNO "A
duplicate item already exists, add anyway?" {#NOOP} {#ABORT 1}};#PROMPT
newRecord.Source "Where Item Located?";#DBLOAD eq;#NEW All @newRecord;#DBRESET}
#VAR newRecord {Name?leggings quest ancient Type?armor Material?unknown material
Wear?take legs nosac Extra?magic|burnproof|quest Weight?0 Value?833qp Level?202
acpierce?202 acbash?202 acslash?202 acmagic?202 dam?5 affect?acceleration mana?242
mv?242 Hit?20 Source?} {}
#TRIGGER {^Object '(*)' is type (%w).$} {#VAR newRecord %null %null
equip_id;#ADDKEY newRecord Name {%1};#ADDKEY newRecord Type %2;#TEMP eqidtemptrig
{^$} {#T- eqidtemptrig;store_data}}
#TRIGGER {^Wear flags (*), extra flags (*).$} {#ADDKEY newRecord Wear {%
1};#ADDKEY newRecord Extra %replace( "%2", " ", "|")}
#TRIGGER {^Weight is (%d), value is (*), condition is (%d), level is (%d).$}
{#ADDKEY newRecord Weight %1;#ADDKEY newRecord Value {%2};#ADDKEY newRecord
Condition %3;#ADDKEY newRecord Level %4}
#TRIGGER {^Damage is (*) ~(average (%d)~).$} {#ADDKEY newRecord Damage %1;#ADDKEY
newRecord avgdam %2}
#TRIGGER {^Has (%d)~(%d~) charges of level (%d) '(*)'.$} {#ADDKEY newRecord
charges %1;#ADDKEY newRecord castlevel %2;#ADDKEY newRecord Spells {%3}}
#TRIGGER {^Level (%d) spells of: ~'(*)~'.$} {#ADDKEY newRecord castlevel %
1;#ADDKEY newRecord Spells %replace( {%2}, "' '", "|")}
#TRIGGER {^Armor class is (%d) pierce, (%d) bash, (%d) slash, and (%d) vs.
magic.$} {#ADDKEY newRecord acpierce %1;#ADDKEY newRecord acbash %2;#ADDKEY
newRecord acslash %3;#ADDKEY newRecord acmagic %4}
#TRIGGER {^Affects hp by (%n).$} {#ADDKEY newRecord hp %1}
#TRIGGER {^Affects dexterity by (%n).$} {#ADDKEY newRecord dex %1}
#TRIGGER {^Affects strength by (%n).$} {#ADDKEY newRecord str %1}
#TRIGGER {^Affects constitution by (%n).$} {#ADDKEY newRecord con %1}
#TRIGGER {^Affects luck by (%n).$} {#ADDKEY newRecord luck %1}
#TRIGGER {^Affects intelligence by (%n).$} {#ADDKEY newRecord int %1}
#TRIGGER {^Affects wisdom by (%n).$} {#ADDKEY newRecord wis %1}
#TRIGGER {^Affects charisma by (%n).$} {#ADDKEY newRecord char %1}
#TRIGGER {^Affects save vs (%w) by (%n).$} {#ADDITEM newRecord.Saves %concat( %1,
" ", %2)}
#TRIGGER {^Affects ac by (%n).$} {#ADDKEY newRecord ac %1}
#TRIGGER {^Affects affected_by by (*).$} {#ADDITEM newRecord.Affects {%1}}
#TRIGGER {^Affects mana by (%n).$} {#ADDKEY newRecord mana %1}
#TRIGGER {^Affects move by (%n).$} {#ADDKEY newRecord mv %1}
#TRIGGER {^Affects damroll by (%n).$} {#ADDKEY newRecord dam %1}
#TRIGGER {^Affects hitroll by (%n).$} {#ADDKEY newRecord Hit %1}
#TRIGGER {^{@newRecord.Name} appears to be of a ({@allCapacities}) capacity.$}
{#ADDKEY newRecord capacity %ismember( {%1}, @allCapacities)}
#TRIGGER {^Adds resistance to (*)$} {#ADDITEM newRecord.Resists {%1}}
#TRIGGER {^Affects susceptible by (*).$} {#ADDITEM newRecord.Suscepts {%1}}
#TRIGGER {^Adds immunity to (*)$} {#ADDITEM newRecord.Immunes {%1}}
#TRIGGER {^Item's wear location: (%w)$} {#ADDKEY newRecord Wear %replace( "%1", "
", " , ")}
#TRIGGER {Adds (%w) affect.} {#ADDKEY newRecord affect %replace( "%1", " ", "|")}
#TRIGGER {^Has (%d) charges of level (%d) '(*)'.$} {#ADDKEY newRecord charges %
1;#ADDKEY newRecord castlevel %2;#ADDKEY newRecord Spells {%3}}
#TRIGGER {^Affects alignment by (%n).$} {#ADDKEY newRecord align %1}
#TRIGGER {^Object '(*)' is type (%x) made of (*).$} {#VAR newRecord %null %null
equip_id;#ADDKEY newRecord Name {%1};#ADDKEY newRecord Type %2;#ADDKEY newRecord
Material {%3};#TEMP eqidtemptrig {^$} {#T- eqidtemptrig;store_data}}
#TRIGGER {^Weapon type is (*).$} {#ADDKEY newRecord weaponType {%1}}
#TRIGGER {^Weapons flags: (*)$} {#ADDKEY newRecord WepFlag %replace( "%1", " ",
"|")}
#TRIGGER {^Weight is (%d), value is (*), level is (%d).$} {#ADDKEY newRecord
Weight %1;#ADDKEY newRecord Value {%2};#ADDKEY newRecord Level %3}
#CLASS 0
|
This script is suppose to take information off the screen when I identify an object and put all that information in a database.
Am I suppose to make the database first?
If I was to copy paste this code somewhere in Zmud, where exactly would I post it?
Is this script a class?, script? or a lot of trigs and aliases jumbled together?
And I also agree the help files could use some work. To reach the newbs like me. I'm very impressed with what this program can do, if only I could learn how to use it all. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Sep 30, 2004 10:30 pm |
1. Yes the DB has to exist first Here is a great overview http://www.silverbridge.org/~varmel/zmud/tutorials/zmuddb.htm
2. Paste all that in the command line and hit enter
3. A script is a single/collection of zmud triggers, alias, functions, etc. Most scripts on this Forum are written for command line entry. This means you just paste everything into the comman line (the bar wher you send mud commands) and hit enter. Scripts wriiten for command line entry can also be saved to a .txt or .zsc file and imported into zmud. A class is just a folder for organizing parts of a script. In review a script would be a single trigger, and a script would also be a lot of trigs and aliases jumbled together. |
|
|
|
groundzero2010 Novice
Joined: 30 Sep 2004 Posts: 47 Location: Arkansas
|
Posted: Fri Oct 01, 2004 3:45 am |
That last post was very helpful.
I tried exactly what the link said. It worked but not quite what I was expecting it to do. I think the link was just as an overview like you said. Everything worked like it should but why would the link talk about making a equipment database and then when saving the identified equipment it doesn't actually post it to that database. It saves it as a variable.
Is there an easy way to save a variable into the equipment database?
When I identify something if there is a variable named 'item' already it replaces that. What would be a simply solution to that? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Oct 01, 2004 12:54 pm |
The overview adds it to the DB please read
#HELP NEW
First you store All your Identified object into a record variable then you add it to the Database using #new @item, This should take care of your second questions since its in the DB why keep the variable around
*breakdown of this line from overiew*
#IF (%find( @item.name) = "") {#new "" @item}
#IF (look for item name in DB if it = nothing return true) {true - Then Add the contents of @item to the current view in DB}
The DB has to be open! and also the DB has to be loaded |
|
|
|
groundzero2010 Novice
Joined: 30 Sep 2004 Posts: 47 Location: Arkansas
|
Posted: Fri Oct 01, 2004 4:20 pm |
I erased all my work last night at started fresh and it worked out great. What I was having a problem with earlier was patience. It seems to take a few seconds for it to post to the db. At least if its not open when the ID was done. And each new item is stored. Awesome.
So since I got it working. I've started to make triggers to store the right information from the mud I play on. The only problem I'm having here is that I have lines come out like this.
Code: |
NAME TYPE HITROLL DAMROLL
an elven long sword WEAPON +4 +4
a brilliant gem TREASURE +4 +4
|
the brilliant gem doesn't have a hitroll modifier of +4 or the damroll modifier. That should default at 0 but the defaults don't seem to work. What is happening is somehow the Hitroll and Damroll modifiers are bleeding into the next object.
As of right now thats the only problem I'm running into.
Thanks for all your help with this. |
|
|
|
groundzero2010 Novice
Joined: 30 Sep 2004 Posts: 47 Location: Arkansas
|
Posted: Fri Oct 01, 2004 8:12 pm |
After looking at this, I still haven't figured that last post out, but I was wondering if I need to be using the #ADDKEY command or newrecord? I've looked at the help files but still don't quite understand what they do.
Making a trigger for the wear slots on my mud has stumped me a little also. The mud I play on (phoenixmud) uses one line to show all wear slots (single slot or dual slot) I'm not sure what I want to do exactly. I'd like for it to show dual wear slots if the item is capable but if I was to do a sort where would it go? Would I have to create another field called 'slot2'?
Here are a few examples of some identifies I've come up with. Just to give you a variety. At the moment I can't think of an item that would have a 3rd wear slot, but I wouldn't doubt it.
Item can be worn on your head.
Item can be worn as a weapon and in your hand.
Item can be worn as a weapon.
Item can be worn around your waist and as a weapon.
Item can be worn on your legs and on your arms.
Any ideas on this post or the last post? |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Oct 01, 2004 10:55 pm |
#Addkey adds to a data record #New adds a variable (a data record is a type of variable) to the DB.
And since I just noticed this instead of hijacking someone elses post please create a new topic for any additional help. And Also note that "Im a newbie when it comes to scripting" is not a very descriptive Subject, Wouldn't "I need help understanding how to use the database" be a little better. |
|
|
|
|
|
|
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
|
|