 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Sat Jun 30, 2007 11:46 am
#slow |
When umsing slow walk I am having trouble entering my directions. I would like to move south twicen then southeast, how would I manage this?
Thanks in advance.
Eul.
EDIT: Never mind, I figured out that putting brackets around the two directions fixes the problem.
Thanks anyway! |
|
|
 |
xiangwei Beginner
Joined: 17 Apr 2004 Posts: 18
|
Posted: Tue Jul 03, 2007 2:13 am |
#no %walkmode(2)
#walk
is good |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Tue Jul 03, 2007 2:19 pm |
Thanks!
I have another problem at the moment. I am trying to edit the script found here: http://forums.zuggsoft.com/forums/viewtopic.php?t=17006&start=25 to work on the mud I play. The problem I have is that while I have got it to function properly and attack the right things it is making a mistake that a human would not.
There are rough guards that patrol the village I am trying to kill and they are pretty tough. I am trying to make line of text to make the bot keep walking if he comes across one of these guards regardless of whatever else is on the same screen (he will help out the commoners). Could someone please point me in the right direction, or link a similar thread please?
******-_EDIT_-******
Ok, I am guessing I should use something like;
#IF (@line =~ " Rough Guard "){#walk}
But I am not sure if that will actualy stop it from trying to start combat, any help would be great.
******-_EDIT_-******
Thanks in advance!
Eul. |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jul 03, 2007 6:31 pm |
You'll probably need to add the functionality to the bot that would let you disable killing for any mob in the room, and then apply it specifically to that mob (which will also help you out if there are other mobs you want to avoid with different names). You could try causing the trigger(s) that cause the kill command to be sent to instead use %additem (and not #additem, so you're allowed duplicates) to add the mob's name to the list of killable mobs in the room, if there are any.
There are a number of ways you can handle mob processing. I personally would remove the parts of the mob trigger that suspend the main loop timer and disable the other classes, and send the kill command, and replace them with just an %additem. You want the bot to know ALL the mobs that're in the room and not just first one. Once the bot is properly compiling a list of mobs in the room, you have the main loop alarm check to see if the list is empty. If it's empty, the bot moves. If it has one of the mobs you want to avoid, the bot moves. If it doesn't have either of those, then it'll attack like it normally would. This has the added bonus of removing the #suspend command, because the main loop should be running all the time and won't be suspended. You'll have to add a line to the exit trigger to wipe the mob list, too.
Oh, and as an addendum, spaces are very important in zScript syntax. It's "#if (expression) {command}" and not "#if (expression){command}" |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Thu Jul 05, 2007 8:13 am |
Thanks for those tips, I appreciate it :)
If it is not too much to ask could you explain the %additem command a little more please? I am still new to this and a lot of the help files for the commands don’t go into enough depth for me :(. To be honest I have no idea where to start with the bot looking at the NPC's in the room and checking to see if there is a rough guard there. I have just finished reading the novice trigger and button guide, so I'll just have to find the next set of guides to read for triggers :)
Also I just made my first simple trigger to start combat with a special command and then repeat it once I have done it/attempted to do it.
#CLASS {LAUNCH}
#TRIGGER {^You get ready to kill the *.} {batter %1 with club} /// this message is generated when I attack an NPC.
#TRIGGER {^You powerfully *.} {batter %1 with club} /// This message is generated when I try to batter them with my trusty club.
#TRIGGER {^You swing *.} {batter %1 with club} /// This message is generated when I fail to batter them :(
#CLASS 0
Also could you combine the three triggers to something like this;
#TRIGGER {^You get ready to kill the *.|^You powerfully *.|^You swing *.} {batter %1 with club}
Other than any spelling mistakes can you see any problems with these texts? :) |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 05, 2007 12:48 pm |
You need to add another set of braces around the list in the last trigger, making it
#TRIGGER {{^You get ready to kill the *.|^You powerfully *.|^You swing *.}} {batter %1 with club}
so that zMUD knows it's a list of patterns. That leads me quite nicely onto the %additem function because what you've created there is a string list - a list of strings. String lists are just that - a load of values for the same variable that're separated by |. "#additem whatever value"adds an item to the list if it's not already there. "#var whatever %additem(value,@whatever)" adds it whether or not it's already there (the %additem function returns a new string list with the item added, which you then make the new value of the variable).
So you start out with a blank variable:
#var something ""
then you use #additem to add something to the list:
#additem something hello
the value of @something is now "hello". Now you use it again to add something to the list:
#additem something world
now the value is "hello|world". If I were to now do
#additem something world
the value wouldn't change - I'd have to do
#var something %additem("world",@something)
to change the value to "hello|world|world". Now I can use %item or %pop to get an item from these lists for use elsewhere.
You get specific items out of a string list by using either the %item function or the %pop function. This file from the CMUD help is a list of all stringlist-related functions, too. |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Thu Jul 05, 2007 1:25 pm |
Alright, now I am beggining to understand... I think! :)
So I have started to rewrite some of this, I am going to replace the class {akill} with this:
#CLASS {AKILL}
#IF (@line =~ " * Rough guard *.") {#walk} {COMBAT}
#CLASS 0
So that should skip any screens that will have any of those pesky guards on it, no? And now I have to write a new combat loop under the class name {COMBAT}. (please stop me anywhere if I am doing this wrong or long winded)
As for the %additem I am asuming I should write a line of script to pick up a list of the NPC's standioing on a screen when I walk in, and then use %pop to call them off one by one and kill them?
Oh, and thanks for all the help so far! I am sorry if I am picking this up slowly.
Eul |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 05, 2007 1:50 pm |
The trouble is twofold - first, you can't have an #if floating around on its own inside a class - it needs to be contained inside some kind of setting (alias, trigger, etc). If you just meant to change the current class, you probably don't need to.
To explain the logical problem with that script, though, I need to use some sample room text:
Quote: |
A lovely round room.
A lovely round room's description
There are three obvious exits: NEW
A mob you don't want to kill is here.
A mob you want to kill is here.
A mob you want to avoid is here. |
Right. So the bot receives the exit line, and the two-second walk alarm starts ticking. It then receives the next line, the mob you don't want to kill - no trigger for that, so the line is skipped. Then it receives the line of the mob you want to kill - this sets off the trigger that starts combat. You can't use a simple "#if %line" because it's not THIS line you want to check against. This line doesn't contain the words "rough guard" or whatever, so the script won't stop. You want to check against EVERY line in the list of mobs in the room before you start fighting any of them.
The easiest way to do that is with a string list and just compile a list of EVERY relevant mob in the room. The processing would go something like this: Exit line, walk alarm starts. First mob is received and ignored. Second mob is %additem-ed onto the list. Same for the third. Now the walk alarm goes off - the walk alarm first checks if the list is empty - if it is, it moves. If it's not, it uses "#if %ismember()" to see if any of the mobs you want to avoid are in the list. If they are, it moves. If not, it uses %pop to get a mob's name from the list and attacks it. The whole thing will be repeated once the mob dies and LOOK is sent to restart the bot. |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Thu Jul 05, 2007 2:11 pm |
Ok, I see what you have been saying now. so, I have rewritten akill to;
#CLASS {akill}
#VAR MOBLIST ""
#TRIGGER {a* ({pickpocket|youth|rat|sensei|guard})* standing here} {#var moblist %additem("%1",@MOBLIST)}
#IF (@MOBLIST =~ " * guard *.") {#walk} {#T- walk;#SUSPEND a1;kill %POP ;#T- akill}
#CLASS 0
Is this more what you are sugesting? Sorry if I have totaly grabbed the wrong end of the stick here, I might be confusing myself :(
Eul.
EDIT -- Wait I have put the IF statemnt outside a trigger again, gimme 5...
#CLASS {akill}
#VAR MOBLIST ""
#TRIGGER {a* ({pickpocket|youth|rat|sensei|guard})* standing here} {#var moblist %additem("%1",@MOBLIST){#IF (@MOBLIST =~ " * guard *.") {#walk} {#T- walk;#SUSPEND a1;kill %POP ;#T- akill}}
#CLASS 0
Is the seccond correct? |
|
Last edited by Eul on Thu Jul 05, 2007 2:18 pm; edited 1 time in total |
|
|
 |
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Thu Jul 05, 2007 2:16 pm |
A lot of it depends on how the mob line looks like. If the layout is always the same, ie
A mob I want to kill is here.
Then the simplest way would be to do 3 string lists.
One would have mobs you wouldn't want to kill. Second would have mobs you want to kill and Third will have mobs you want to avoid.
Then you'd only need one pattern trigger which would go something like this:
Code: |
#trigger "MobCap" {{A|An|The|}*(%w)*{is here|stand here}}
value:
#if ((%ismember(%1,@MobsToKill) and (!%ismember(%1,@MobsToAvoid) and (!%ismember(%1,@MobsNotToKill))) {moblist=%additem(%1,@moblist)} {#say Not mobs to kill around, restarting bot with look}
|
Wrote it on the top of my head so it may and probably does contain not enough "(" or "{" but I think you get the general idea.
Prog |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 05, 2007 2:20 pm |
Don't change it! That's right!
#TRIGGER {a* ({pickpocket|youth|rat|sensei|guard})* standing here} {#var moblist %additem("%1",@MOBLIST)}
is exactly what I meant. You'd do your checking inside the +2 alarm that the exits trigger creates. It'd probably look something like this:
Code: |
#TRIGGER {^There are * obvious exits:*} {
#ALARM "a1" +2 {
#if (@MobList="" OR %ismember("Rough Guard",@MobList) OR %ismember("Something else",@Moblist)) {
#walk
} {
#t- walk;kill %pop(moblist);#t- akill
}
}
} "" {notrig} |
Notice how I removed the #suspend, because it's no longer needed.
I bet there's a better way to do this checking than a string of ismembers, but I can't think today :) |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Thu Jul 05, 2007 2:27 pm |
Thanks for the help! Just one observation, if you had a list of what mobs to kill and avoid, why would you need a list of mobs not to kill? Wouldent the bot just ignore anything not stated in the @MobsToKill
Eul. |
|
|
 |
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Thu Jul 05, 2007 2:31 pm |
I took the threefold option out of Fang's quote actually and as he pointed out he can't think today!
EDIT: Joking aside, 2 string lists are enough. Basically you'd check if mob you see is in one list but isn't in another hence you'll kill it and if it isn't in kill-list but is in another, you'll move.
Prog |
|
|
 |
Eul Wanderer
Joined: 30 Jun 2007 Posts: 53
|
Posted: Thu Jul 05, 2007 4:00 pm |
Code: |
#TRIGGER {^There are * obvious exits:*} {
#ALARM "a1" +2 {
#if (@MobList="" OR %ismember("Rough Guard",@MobList) OR %ismember("Something else",@Moblist)) {
#walk
} {
#t- walk;kill %pop(moblist);#t- akill
}
}
} "" {notrig}
|
Could edit this line to have this #WA command in it?
" #t- walk;#WA %random(0,2000);kill %pop(moblist);#t- akill "
Thanks, |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Thu Jul 05, 2007 5:10 pm |
That should work fine, yes. #Wait's only a danger when the trigger fires again while it's still waiting - that shouldn't happen under ordinary operation of the bot. You might want to move the #t- akill command to before the #wa, though.
|
|
|
 |
|
|