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 Goto page 1, 2  Next
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon Feb 19, 2007 3:47 pm   

Question about building a combat bot
 
Hello,

Given I more or less know how a bot like that should be built, I still have cpl problems with getting past some parts of it. Namely, how can I attack one mob at a time in a room when there's more than one mob present? Let me give an simple example.

Code:

Mob1 stands here.
Mob2 stands here.
Mob3 stands here.

... etc


Basically, there's several issues about rooms like that. First off, when I'm alone in the room, it needs to attack one mob at the time and when its done, move over to next one and so on until the room is cleared. Then it can choose a random direction and move on. Secondly, when there's someone else in the room besides me who is also attacking one of the mobs (can well be more than one person at present tho), it should understand to attack the mob no-one's attacking yet. To clarify with example again...

Code:

Mob1 is here, fighting Player1.
Mob3 is here, fighting Player2.
Mob2 is here.


Thats about it. Any help I can get is greatly appreciated.
Thanks in advance.

Prog
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon Feb 19, 2007 11:47 pm   
 
If anyone's able, please help. Basically I think I know how I'll fix a predetermined route on which the bot will travel (use #SLOW, and when a line with mob's desc will appear, it will attack and #PAUSE the #SLOW and once the fight is over it'll pick it up with #STEP again, least thats how i understand it). My problem is that how do I determine that the bot should only attack one mob in a room at a time, triggers shouldn't fire for every mob in room in any case. And as I said earlier, same would go if someone's already killing one/or more mobs in the room - bot just shouldn't try to attack those at all and either move on or attack the mob thats left in the room untouched in case there's any. Thats my problem here. Have thought a lot about it but I have no idea how to make it attack mobs in a room one by one (Mob line would trigger the attack, so if there's several mobs in room, it'll just attack to try every mob at once).

I really need help with this, thanks in advance.


Prog
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Tue Feb 20, 2007 5:33 am   
 
Ok, you have a couple of things to try.

First, you can create a trigger to test for a FIGHTING state. IE if you are in a fight already a trigger will not attempt to fight again.

Example.

#trigger {A mob is here.} {#if (@fighting=0) {fighting=1;kill mob}}

That will stop further lines from the mud from starting more fights.

Then you would need.

#trigger {You have slain a mob.} {fighting=0;look}

This would tell your bot that you are no longer fighting and to look in the same room for more mobs to kill.

#trigger {You have been slain by a mob.} {fighting=0;curse wildly}

This unfortunately sometimes happens.

The easiest way to deal with other players in the room is to simply LEAVE the room if there is someone there.

A lot of muds use ansi colors for player names. If your mud does you can use a trigger to set a variable that tells you to go to the next room. Or even just uses the #step command.

Another method is to create a string list of mobs in the room.

#trigger {A mob is here.} {mobs=%additem("mob",@mobs)}

Then when you get your prompt attack the first mob on the list and set your fighting variable to true.

When the mob dies.
kill %pop(mobs)

These are only meant to be GENERAL help. I'm not going to clarify or code any more examples here. Botting is illegal on many muds and can get to be a real bugger to code regardless. There should be a few examples in the finished scripts forum. Though I admit I haven't looked in there in years I think I saw a few.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Tue Feb 20, 2007 6:19 pm   
 
OK...

First question I got is that how do I make sure I'll only attack one mob in a room when I go to that room. What I mean is, when I trigger the attack based on mob's desc, it'll just fire the commands for attack to every mob in the room. That means it'll generate a lot of spam commands I don't like to happen. Of course, it will attack only one mob (though spamming commands for every single mob desc in process) so generally i could add look to check fighting status but imho then its too late because the spam is already over, anyway. Let me give you an example:

Code:

Moving to room...

Mob1 is standing here.
triggers will fire: backstab mob1
triggers will fire: cast spell mob1

Mob2 is standing here.
triggers will fire: backstab mob2
triggers will fire: cast spell mob2

etc...


I guess there's a way to avoid that and thats why I was asking how to make sure it'll attack only one mob in room at first. Definitely, going from there and add look after mob is dead to trigger another attack is a lot easier.
I might just have misunderstood you, though...

Thanks in advance.


Prog
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Feb 20, 2007 6:52 pm   
 
#trigger {A mob is here.} {#if (@fighting=0) {fighting=1;kill mob}}
#trigger {You have slain a mob.} {fighting=0;look}

These triggers mean that the following will happen:

Code:

Moving to room...

Mob1 is standing here.
Trigger fires: fighting is 0, so kill is sent and fighting is set to 1.

Mob2 is standing here.
Trigger fires: fighting is 1, so the #if fails and nothing happens.

etc...

When you slay the mob, it automatically LOOKs to acquire a new target.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Tue Feb 20, 2007 8:57 pm   
 
Nope... Doesn't work.

I did the exact triggers for mob descs with the info you gave me.

Code:

#trigger {A bodyguard stands here.} {#IF (@fighting=0) {fighting=1;backstab bodyguard}}


Now... lets just say I have several bodyguards in one room and that trigger fired a backstab for each of them even though it shouldn't as you said...
Look part works, tho.

just to be clear, gonna give an exact example whats happening for me atm....

Code:


Moving to a room with mobs I need to kill....

A bodyguard is standing here.
[backstab bodyguard]
A bodyguard is standing here.
[backstab bodyguard]




Thanks in advance



Prog
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Wed Feb 21, 2007 7:36 pm   
 
No one has any ideas how to accomplish this?



Prog
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Thu Feb 22, 2007 8:49 pm   
 
Okay, as I can see I haven't gotten any help/feedback yet, I figured I'd throw out some ideas I have gotten along the way by myself and by going through finished scripts threads for like 100th of times...

First off,
http://forums.zuggsoft.com/phpbb/viewtopic.php?t=17006

Thats Asm's script posted while back. Won't paste it here to avoid spam/long msg, so if there's anyone at all who'd feel like helping me out here, just use the link I gave. Anyway, I had a number of problems while playing around with it a little. Firstly, I couldn't get the trigger to resume walking after mob's dead to work at all. I do have different as that of Asm's for mob's death msg (Namely, lets say You receive 343 points of experience) and I did the same trigger using that syntax but nothing. As the same line is used within several other scripts I figured that could be the case and disabled everything else where its used and tried again. Still nothing. Tried with cpl of msgs that aren't in any use at all and still nothing. So I basically just ran out of ideas to try.

Anyway, now I started to wander around the zmud commands and trying different things myself (Yes, you're allowed to say 'I told you to research things on your own' :P) and ended up running into cpl more problems :P So here I go:

The experience line I mentioned before. I built

Code:

#TRIGGER {You received (%d) points of experience.} {#1 %item(@dirlist,%random(2))}


Following in next msg....
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Thu Feb 22, 2007 8:53 pm   
 
Basically its nothing big at all so most of you programming buffs know what it means anyway. But here's my problem. At the moment, this trigger is firing after one mob in the room is dead which itself isn't bad. As this trigger makes it step only once in a random direction I made precicely same one for Exits line in my mud. And thats not a bad thing either. Based on those 2 triggers, its just wandering off itself after a mob in a room is dead. Anyway, herein lies my problem. I know that in general I can put that trigger into a different class (other than the class for my combat triggers) and disable it for the time I'm in fight. But what if there's more than one mob in the said room I want to kill? I know simple 'look' after a kill might solve the problem but how am I able to 1) make sure it always looks after a kill without wandering off 2) wandering off once there's nothing more to kill in a room. Those 2 problems bug the hell out of me at the moment. And I clearly lack the knowleadge to overcome them.

There still stays the third problem I have mentioned several times before, though. If there are several mobs in the room (to whom all I have made attack triggers via their desc) then how can I program it to only attack one mob at a time?
I know most of my questions might sound really stupid, but I'm trying to learn here, and most of the time I'm being hit by a brick wall, even here....


Thanks in advance.

Prog
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Feb 22, 2007 9:53 pm   
 
I said above that I wouldn't elaborate, but I can see you are trying so here we go again.

Code:
#trigger {A mob is here.} {#if (@fighting=0) {fighting=1;kill mob}}
#trigger {You have slain a mob.} {fighting=0;look}


This was meant to point to an idea. Not as the end of the problem. Botting as I said before can be very complicated and you need to understand concepts more than the code that is used to express them.

The decision statement is used to make a choice based on given facts. IF is the easiest decision statement to understand.

Event occurs, Alias/trigger/event/button/menu, and information is gathered.
Code:
#if (This is true) {If it is true then do this.} {If it is not true then do this.}


So instead of a trigger you could also make a aliases to understand the two triggers I gave you above.

Code:
#var fighting 0 0
#alias Kmob {#if (@fighting=0) {fighting=1;kill mob}}


Place both of those into your command line and hit enter. This will create the variable fighting and the alias kmob.

Now, type kmob once. You will receive the output "kill mob".
Ok, now spam kmob. NOTHING will happen. Why? Because the value of the variable fighting is 0.

Let's make another alias for this trigger.
Code:
#trigger {You have slain a mob.} {fighting=0;look}

Code:
#alias deadmob {fighting=0;look}


Again, paste the alias into your command line and hit enter.

Type deadmob. The look command will be sent.

Now type kmob. Again you get the output "kill mob". Spam it again and notice that you do not get kill mob for output unless you first type deadmob.

If you were not getting these results before then you had other triggers firing that were causing you to attack the mobs. Anyway, now I trust you understand this concept next post for the next problem.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Feb 22, 2007 10:38 pm   
 
Hopefully by the time you reach this post you have actually done what I said in the previous one and you fully understand the #IF command. This will help you with the next problem.

You want to kill ALL mobs in a room before you move on to the next room, and you do not know how to keep your bot from moving on.
Again I am not going to give you the simple answer and I am going to point to something I gave you in that first post.

Code:
#trigger {A mob is here.} {mobs=%additem("mob",@mobs)}


This is an information gathering trigger. The IDEA behind it is to make a list of how many mobs are in the room.
Let's make another alias for this example.

Code:
#var mobs %null %null
#alias addmob {mobs=%additem(%1,@mobs)}


Now type addmob zombie

This will place a zombie into the mobs string list. To see what is on this list type.

Code:
#show @mobs


Type Addmob <your choice of creature here> then look at the list using
Code:
#show @mobs.


Now that we have a list of the mobs in the current room we can use an #IF to choose not to move on.

#if (There are no more mobs on the list) {move to the next room} {Stay and try to kill the next mob}

Ok, but how do I know if there are more mobs on the list?

We can use %numitems or we can just check if the variable has a null value.

#if (@mobs=%null) {move to the next room} {Stay and try to kill the next mob}

Alias time.

Code:
#alias MorK {#if (@mobs=%null) {move to the next room} {kill %pop(mobs) }}


Now that you have made the MorK alias use it three times. Note how it works. Use it untill it makes you move to the next room.

Type #show @mobs. Note that all you will get is a blank line of text. Why? Because the @mobs variable is blank.

Please understand that the people who are helping you do not work for Zugg. We post answers because the questions intrigue us or we have had the problem you are facing and see where you are coming from. But it takes time to write out answers the way I have done here today.

We don't want to spoon feed you and there are thousands of examples in the boards ASIDE from the documentation that is already available to you. Beyond this the more complex a problem becomes the more people expect us to simply write out code for them that does exactly what they want the first time with little or no input or work on their end. This is impossible as I am sure you are beginning to see by now.

I decided to help more because I saw that you are actually working on the problem yourself and not just waiting for help from someone here.

That said follow the instructions I have given and then show us what you have made towards your goal if you need help beyond this point.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Fri Feb 23, 2007 12:12 am   
 
Thanks a lot for the help, I really appreciate it. Now, I'm getting few problems with all the stuff you suggested me. Most likely my tireness has hit tho (had a long day) and I can't think straight enough, hence I'm more than certain that I went wrong somewhere but just in case I'll paste something I got together atm and then I'll tell about whats working and what isn't.

Code:

#TRIGGER {A bodyguard is standing here, looking for some action.} {mobs=%additem("bodyguard",@mobs);#if (@fighting=0) {fighting=1;kill body}}}}
#TRIGGER {You get %d coins} {fighting=0;look}
#ALIAS MorK {#if (@mobs=%null) {#1 %item(@dirlist,%random(2))} {kill %pop(mobs) }}
#VA dirlist {n|s|w|e}


Okay... now, when I understood you correctly, you "A mob is here." stands for a certain mob's desc, thats what I thought at the moment, anyway. But as you can't have 2 identical triggers around, I tried to get it together by putting both mobs variable and #if under the very same mob's desc. I might prolly be totally off and/or misunderstood you but thats what I did right now. Now, I just tried to see what 'showing triggers' option under zmud is saying to all this. Apparently, when I move to room with bodyguards, its putting all of them into mobs variable but thats it, won't start to attack them or anything. So I guess something went wrong there. The middle part in mork alias stands for random direction based on directions on dirlist but sadly I didn't get that far yet to test that alias out. Got stuck right there with mob killing part. Gonna take a fresh look on it tomorrow to see if I can come up with solutions but at the moment it seems that I most likely misunderstood something again :( Anyway, figured I'll write a quick reply just to say how the things look right now. Most likely that won't be my last msg about this :P


Great thanks for help.

Prog
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Fri Feb 23, 2007 8:27 pm   
 
Okay...

Tried something else now (didn't work tho, but oh well...). I triggered the variable entry trigger with 2 'words' out of mob's desc, ie "A bodyguard". For the fighting trigger, I used whole line - "A bodyguard is standing here, looking all bored". By doing that, I basically created 2 different kinds of triggers from well, one line. So I figured it might work. And half-way it did - it created the @mobs variable with to "A bodyguard'-s in it. But that was it. The second trigger didn't fire any attack at all. The thing is that everything worked as you told it would with aliases you suggested me to make, but when I write all the thing into triggers, fighting variable seems to have stopped working. I really don't know what to think anymore. Have used more or less anything I understand/can wrap my mind on ... if there's some trick somewhere, I just don't know it... with all my very limited knowledge.

Prog
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Feb 23, 2007 8:50 pm   
 
Your code looks pretty good. You still have a few misconceptions about triggers though.

First trick. You can use the aliases I showed you inside of triggers.

Second trick. COMBINE the ideas I showed you separately

Code:
#TRIGGER {A bodyguard is standing here, looking for some action.} {addmob bodyguard;#if (@fighting=0) {fighting=1;kill %pop(mobs)}}


Misconception
Quote:
But as you can't have 2 identical triggers around.


Why would you WANT two bodyguard triggers? If you have bunny rabbits to attack then you will need to make a trigger for them.

Code:
#TRIGGER {A fluffy eared rabbit hops about nearby.} {addmob rabbit;#if (@fighting=0) {fighting=1;kill %pop(mobs)}}


You can only combine triggers if the text is somewhat similar.

Now you need a trigger to attack the next mob, or move on.

Code:
#TRIGGER {You have slain the *.} {mork}


And if there are no mobs in the room, or you are fighting you need to decide if you are going to move to the next room or not on the prompt.

#trigger {Promt text goes here} {#if (@fighting=0) {mork}}

Third trick, and I will let you try to do it or not.
You can make a third alias out of those two and put THAT alias into the trigger. <this one should wait until you understand how the above works>

Now give this a try and let it simmer a while. Remember I did warn you that botting was not easy.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Fri Feb 23, 2007 10:52 pm   
 
Nods, thanks for pointing out the combing part, I clearly aint thinking clearly enough to realize all the options in my disposal yet (knowing too little etc...) :) However, basically the same thing happend that happend last time I tried my own coded I posted earlier and which was a lot less sophisticated. I turned 'show triggers' option on just to see how all the things are reacting and there it was...

Code:

When moving into room...

A bodyguard is standing here, looking for some action.
[A bodyguard is standing here, looking for some action.-> #ADD mobs bodyguard
#if (@fighting=0) {
  fighting=1
  backstab %pop( mobs)
  }]

etc.. hit the same for every other in the room currently, tho


Basically its doing the adding part correctly again, but thats all it does. Somehow it doesn't trigger the attack although the code seems to be correct, unless I'm missing something. I did change your suggestion of 'addmob bodyguard' into #ADD mobs bodyguard though, but I doubt thats where the flaw lies. I really don't know anymore, I'm more or less starting to understand the conception of how everything must run (triggering the mob desc adds it to variable, killing start when %pop takes first same off the list etc... (I might be completely off again, though :P )), but thats how it works atm.
Oh and one more thing, maybe #ADD part is still bad anyway. When i typed #va mobs after the desc trigger had been hit for every mob in the room, it gave me the mob names but without |'s. Not sure if its important though because in my last posted code it added the names with |'s but the thing still didn't work as it should... Anyway, #VA mobs looks like this atm.


Code:

I type #VA mobs and get...

bodyguardbodyguardbodyguard



Well thats it for now from me ... I'm starting to believe something inside my overall settings might be screwing around with the code, but then again, maybe some tiny little detail is off again, though.


Prog
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Feb 24, 2007 12:33 am   
 
Look at the help topic for #add It is for addition NOT adding items to a string list.

You may have been thinking of #additem But that is wrong also as it does not let you have more than one thing. IE only one bodyguard, only one rabbit in a list.


And finally TURN OFF THAT OPTION.

It will ALWAYS show you the same thing. It does not change based on which way the if went. If you have seen it once, you have seen enough.

You MUST use:

Code:
mobs=%additem("Your creature here",@mobs)}


or

Code:
#var mobs %additem("Your creature here",@mobs)} %null


To create a string list with multiple copies of the same mob.

Remember how I told you to LOOK at the output of the aliases in the preceding examples? Look at the output of the triggers as well.

You can do this offline so that you will not have to look at the scroll from the mud using the #show command.

#show A bodyguard is standing here, looking for some action.

Now what output do you get? Also remember to CHECK the status of the @fighting variable. If it is still set to 1 this whole time it will NEVER attack anything.

Something to consider just while testing.
Code:

#if (@fighting=0) {
  fighting=1
  backstab %pop( mobs)
  } {#say I am still fighting some other horrible beast, I am not going to attack another!!}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sat Feb 24, 2007 8:27 pm   
 
Hello again!

So, I finally figured out why the fighting didn't work at all, and its a silly newb error for me as more or less always :P namely I didn't add #VA fighting into the bot class when I wrote it. Now all the fighting part is working 100% and only lacks some minor upgrades and such (some I already made tho) but nothing worth enough to mention.
Anyway, now I'm facing a new question as you figure I might :P Its about further movement. As I have posted earlier, I could use random directions based on info from a variable via %item etc but that idea doesn't really appeal to me to be honest. I know that the Asm's script I have also mentioned above posts uses #SLOW walk option with predetermined path and basically I'd like to use something along the same lines but at least at the moment, I can't figure out how I could get the whole thing working with it.
I tried though, added simple #PAUSE into the code for each trigger to make the #SLOW stop, do everything that needs to be done in a room and #STEP on with the mork alias. Makes sense, I figured. But it didn't work at all. It just ran the walk without doing nothing in rooms full with mobs at all.
Ideally, I'd like to move it within a set predetermined path that would start and end in one place and kill everything along the way. I guess there might be other options than using #SLOW (maybe mapper-based?) but as I already mentioned only idea I got and to be honest I guess only idea I know is the #SLOW walk one.

I'd be really grateful for any suggestion you're willing to make, thanks in advance.

Prog
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sun Feb 25, 2007 2:20 pm   
 
Hi again,


gonna write about one other issue I'm getting now, though. Its somewhat complicated to explain, but I'll try. Lets say I'm having a room with several mobs who have exactly the same desc (lets use the good ol' bodyguard example again). There's no problem to kill them all off with the current setup in case I'm the ONLY ONE in the room. Problems surface when there's one or more people in the room, killing the same mobs. Let me write that down to clear it up a little.

Code:

moving to room...

Player1 is here, battling with bodyguard1.
Player2 is here, battling with bodyguard2.
Bodyguard3 is standing here, looking for some action.



Basically, my bot will come to room, write down that there are 1 bodyguard only (because thats the only desc thats matching) and trigger the 'backstab bodyguard' fight part. But the problem here is, that of course it isn't attacking the only bodyguard not in fight left in a room, its just firing 'backstab bodyguard' and thus, trying to attack the one already in a fight.
I know my explanations isn't the best but maybe you understand what I mean. The question is, how to I avoid the bot to attack mobs like that. I guess one option is to trigger attacking next mob when you get the 'the mob is already fighting' msg, but in case the next 2 mobs will also be in fight and the fourth will be free, it will generate way too much command spamming along the way.
Thats pretty much the only thing I need to figure out within fighting bot part, then its all 100% and I can actually start thinking about movement issues :)

Any help is greatly appreciated, as always.

Prog
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Feb 25, 2007 6:33 pm   
 
#trigger {The bodyguard is already in a fight} {#gag;#gag;backstab bodyguard;#gag}


I hope you get the idea.

Give that a try
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Sun Feb 25, 2007 11:13 pm   
 
Ok ... I'll give it a shot but unlikely it will work and I'm going to try to explain, why.
When there are several, letsay bodyguards in a room where I want to kill, they're keyworded all the same. Meaning I could ideally #GAG the lines where they're in fight, but doubtful it will change anything. Mobs variable will still catch the only bodyguard not in fight and fighting part will issue a 'backstab bodyguard' and MUD will still read it as me trying to backstab the first bodyguard in the room (The one already in a fight with someone else, as the one I should be killing is letssay second or third etc). I might be utterly mistaken though, but that was just my first thought I got.

Now, I hate to bug people a lot as it has turned out now, but during some parts my own knowleadge albeit slowly growing isn't enough. Thus I'm coming back to that movement part. Any ideas in that regard? (As I wrote earlier, only idea I'm getting is making it via #slow walk option but as I guess you can't just stop it when it encounters a line that should issue a fight, you need to pull #alarm in someway tho, I'm still pretty much in the dark of how those 2 should work together for the thing to actually work tho. )

Loads of thanks in advance, I really appreciate it.

Prog


oh one more thing regarding the #gag'ing part and all that. One idea I got pretty much during today. Is it possible to somehow use the #pick command to pick the correct mob off the list in case other mobs are in fight. I have no idea how to accomplish it tho because mobs can be in fight very randomly thus making it impossible to make some solid thing out of it. I don't know.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Feb 26, 2007 12:21 am   
 
I'll look back into the movement stuff later tonight...
See problem is I've made more than one of these things and if you look back I keep telling you the same thing over and over different ways until you understand them. Given the situation you have explained there are THREE possible ways to handle it.

First one.
LEAVE THE ROOM
Second one.
#GAG the lines telling you that someone else is fighting that and resend the backstab command.
To cut down on the spam you can also use the #send command.
#send {backstab bodyguard}
Note that you don't see the command get sent.
Third one
type a command in the mud that tells you the info number of every mob/object in the room or one that tells you the info number of the mob you are wishing to attack. Then target the one that is not fighting. The most complex one of the three and the most unlikely to work. Also it would create more spam than #2 and would thus cause you to need to gag more lines.

That's it. Pick one cause there is no more. Speaking of #PICK yes it could be done but if you haven't done #3 then you cannot do #PICK.

I've been coding all day elsewhere. Later tonight I'll look at the movement issue.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
aristotle
Newbie


Joined: 23 Feb 2007
Posts: 8

PostPosted: Mon Feb 26, 2007 5:16 am   
 
Just a quick observation, I'm not sure if it's been covered already (I am definitely not reading all the blahblahblah on here,) but here's an easy out to for the spam kill;

#T- killtrigger {You backstab %w}

or {you attack}

or whatever your MUD uses. Then, include (along with the look command)

#T+ killtrigger {You slay %w}

That might work fairly well, but maybe you've solved that problem already
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Feb 26, 2007 5:25 am   
 
This post will summarize things up to this point and add in a method of walking about automatically. It will NOT handle players in the room fighting other mobs.

Everything in this post once pasted into the command line creates itself inside a class I named WalkBot.
Once all of the examples have been pasted in you will have a bot capable of walking from one point to another and stopping along the way to have scraps with bored bodyguards. ;-)

I will start with the triggers, as you should be able to understand them right away.

Code:
 #TRIGGER {A bodyguard is standing here, looking for some action.} {mobs=%additem( "bodyguard", @mobs);MorK} "WalkBot"

Code:
 #TRIGGER {You received %d points of experience.} {#if (@fighting=1) {fighting=0;MorK}} "WalkBot"

The first one of course loads a bodyguard onto the mobs list then calls MorK. This starts the scrap.

The second one ends the scrap and calls MorK.

Now for the Aliases starting with MorK.
Code:
#ALIAS MorK {#NOOP %alarm( MoveOn, 2000);#if (@mobs=%null) {#if (@fighting=0) {step}} {#if (@fighting=0) {fighting=1;backstab %pop( mobs)}}} "WalkBot"

If you ignore the #Noop part for the moment you should recognize the rest of the code. Look hard here. You will see that I added another #if (@fighting=0). Not having this is probably what was causing some of your troubles.

Now for some aliases that set off the above triggers. I made these for testing.
Code:
 #ALIAS startfight {#show A bodyguard is standing here, looking for some action.} "WalkBot"

Code:
 #ALIAS stopfight {#show You received 55 points of experience.} "WalkBot"

Of course as you noticed on your own if we do not create the variables nothing works right. For the moment ignore the ones you don’t recognize. But DO put them in.

Code:
 #VAR Fighting {0} {0} "WalkBot"

Code:
 #VAR mobs {} {} "WalkBot"

Code:
 #VAR path {} {} "WalkBot"

Code:
 #VAR walk {0} {0} "WalkBot"

Code:
 #VAR nextstep {} {} "WalkBot"

Code:
 #VAR walkmode {0} {_nodef} "WalkBot"

Alright that’s all the variables but I left out the actual walking code. Here goes.
Code:
 #ALIAS go {path = %pathexpand( %walk( %1));walkmode=%walkmode;#call %walkmode(0);#if (@path != %null) {walk = 1;MorK;#T+ MoveOn} {#if (%proper( %1)=%proper( %roomid)) {#say What, I'm not there now?} {#say "I can't go there!"}}} "WalkBot"

This is the alias that starts the walking. I know from the other threads that you have a map and have some knowledge of it. You can either enter the RoomID or the ShortID of your destination room into this alias to begin the walk. Example.

Go 20

Will take you to the room with the ID# of 20. If you click on a room in your map, click properties, and go to the other tab you will see a box labeled Short name for room. This is where you can label your rooms. If you labeled the room with the ID of 20 myhouse then you could type. “Go myhouse” to get to that room. If you type go myhouse when the map says you are in that room you will get a message. You will also get a message if the room is not found on the map.

Now we need the step alias and the MoveOn Alarm.
Code:
 #ALIAS step {#if (@walk=1 and @path!=%null) {nextstep=%exec( .%pop( path));@nextstep;#if (@path=%null) {#say End of path.;walk=0;#call %walkmode(@walkmode)}}} "WalkBot"

Code:
 #ALARM "MoveOn" {*2} {#if (@walk = 1) {mork} {#T- MoveOn}} "WalkBot" {disable}

Not knowing how long you are forced to wait between moving to the next room I made the bot walk once every 2 seconds. It stops for fights with bodyguards though.

Remember to disable any Aliases or Variables that have the same names as the ones I created in this post before trying to use this.

This all works, I thoroughly tested it before posting. Most of it should be self evident to you by now. The movement stuff is a little tricky but I do want you to read the help on every command before asking about it.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Feb 26, 2007 5:32 am   
 
aristotle,
Heh, yeah I am a bit long-winded aren't I? *looks at the last post*

Unfortunately I DO already have that handled and turning off the trigger with T- at this point would not help. He's complaining about different spam.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: Mon Feb 26, 2007 2:26 pm   
 
OKay... first off, let me express my biggest gratitude :)
Whole thing is working PERFECTLY! :) Have thought a lot about actions though I need to think for the occasions when someone's in the same room and perhaps leaving the room all together really makes the most sense. Haven't really had a good enough shot to try gagging idea though, but my belief is that even if I gag several lines, then send backstab mobname etc, MUD might still read it as backstabbing the first mob in the room. In that case I'll just get the "that mob is already in battle" msg. There is the idea to make a leaving trigger via that line though. Because clearly sometimes you have a lot of mobs killable in a room where's someone else is killing just one and in that case just leaving without doing a thing can seem pretty silly. So maybe triggering "that mob is already in battle" -> with morK alias could work, or something. Haven't really thought about it more deeply yet.
As I already mentioned before, all the movement is working perfectly. There is however, only detail left which I don't know even is possible to make but I figured I'll write about it. At the moment I put shortID's to every room I need to move in order to kill things. Let me clarify it with an example:

Code:

entering area....
choosing one room for start: go bot1
killing stuff there -> choosing another room: bot2
etc



Basically, I'm moving to one room with "go", killing everything, then entering manually another go "shortID" and going there, killing stuff along the way. The overall movement looks like this: go bot1 (kill everything, enter go bot2) go bot2 (kill everything along the way + in the room, then enter go bot3) go bot3 (same thing;enter bot4) go bot4 (kill everything and run back to bot1). I know it might be hard to understand but I'm not sure I could explain it any better. Basically, I'm moving in a cycle but to do the cycle I need to enter go "room" again every time I need to, manually. Thus, there goes my next question.

Is it possible to make it move itself using the "go" option? Perhaps by using room/walk scripts under map properties? I'm not sure if you understand what I mean but hopefully you do. If its either too troublesome or not possible at all, thats won't matter much tho, I'm just asking because my first idea was about something that would move via fixed way, kill everything on its way and then come back to "start point" to begin again.


Once again, LOADS of thanks for your time, I have learned a lot out of all this. Thanks.


Prog
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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