|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Tue Aug 24, 2004 5:02 pm
combat trigger help please for LPMUD |
I'm trying to write a script that runs around a maze attacking creatures it sees.
the only directions used are N,E,W,S .. It's a maze with 1200+ rooms, so #PATH isn't a good idea.
I have a script now that killed creature in each room, if it's there, it waits until it dies, then types kill creature, when it sees no creature in the room, it moves to the next room(someone made the movement script and I have no idea how they did it)
I'm trying to make it so I don't kill creature each time, just move until it sees one, stops, and waits till it dies and moves again.
I tried revising it myself, but I just couldn't get it working properly, sometimes it would move 1 room too far and stop, sometimes it would start running like my pants caught fire... |
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Wed Aug 25, 2004 9:24 am |
So what kind of help do you need, exactly?
If you want the script written for you, we'll need you to paste the output of moving through about five rooms with at least one having a creature.
If you want a really fast response, include the script that you have now.
If you need pointers on how to fix this yourself, I'm certain you can find solutions to similar problems by using search at the top of this page.
What you've posted so far will only get you pseudo-code since even LP-muds vary in actual output. |
|
|
|
Falan Wanderer
Joined: 17 Aug 2004 Posts: 98 Location: OK, USA
|
Posted: Wed Aug 25, 2004 11:06 am |
A simple kill script like what you're using is fairly efficient, but yeah, it does get spammy. If you're concerned about the spamminess (sp?), then you can #SEND the kill command directly to the MUD so it doesn't show on screen and then #GAG the "no monster here" response.
|
|
_________________ zMUD 7.05a |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Wed Aug 25, 2004 11:56 am |
There is no creature here.
e
kill creature
> Maze (s,w)
> There is no creature here.
s
kill creature
> Maze (e,n)
> There is no creature here.
e
kill creature
> Maze (w)
A Creature.
> You attack A creature.
the main trigger to run me through the rooms looks like this
#TRIGGER {Maze} ~((?),(?),(?),(?)~)
#VAR skipvar 0
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
I have one of these for each room with 1 2 3 and 4 exits. It's generally 90% efficient, it gets stuck in about 2 spots, and I'm unsure why, I didn't code the original, I'm just trying to revise it so that I don't spam the mud so much..
it types kill creature in each room, if it receives "there is no creature here." it enters @mazedir and attacks again until it finds the attack message, and waits until the message "there is no creature here." and keeps going.
I tried making a directory testing with 3 subdirectories, mobcheck(checks to see if a mob is present, sets var mobcheck 1) movement (moves around until mobcheck 1 is yes and skipvar is no (player present, don't need kill stealing), attacks and turns off the triggers in mobcheck and movement. the third subdirectory looks for killing blow, and no creature present. when it sees no creature, it turns on the triggers for mobcheck and movement..
my problem, is I can't get the movement to work properly, and when it DOES find a mob(when it decides it randomly wants to work), it moves 1 room to far, attacks nothing, and keeps going cause the creature is behind me...
kinda long and drawn out :( but that's my detalied question :)
Here's a post of the script I tried to revise....
#TRIGGER {Maze} ~((?),(?),(?),(?)~)
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- testing|movement
#T- testing|mobcheck
#T+ testing|xcheck
kill creature
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#T+ testing|mobcheck
#T+ testing|movement
#T- testing|xcheck
@mazedir
}
any and all help is more than welcome.. Thanks!!!!!! |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Thu Aug 26, 2004 1:45 pm |
well for those of you who are following this and/or trying to help me ?? I'll post a revised version of the script I'm using now.. it's shorter than the original, but after I finally got it working, it's identical to the old script.. which doesn't make sense cause I rewrote the processes... :S so confused...sooooo confused...
#CLASS {testing} {menu}
#VAR findportal {0}
#VAR mazedir {w}
#VAR mazetemp {e}
#VAR mazevar {0}
#VAR prevmazedir {s}
#VAR skipvar {0}
#VAR mobpresent {0}
#CLASS 0
#CLASS {testing|movement}
#VAR reversedir {}
#VAR mobpresent {0}
#TRIGGER ({beast|monster|sludge|fungus|mudman}) {#var mobpresent 1} "" {notrig}
#TRIGGER {{<=-|Dire wolf|~(peeronic|~(heavenly|~(saintly|~(very good|~(good|~(pure|~(righteous|~(moral|~(nice|~(neutral|~(mean|~(immoral|~(malicious|~(corrupt|~(evil|~(very evil|~(satanic|~(demonic|~(tensoric}} {#VAR skipvar 1}
#TRIGGER {Portal ~(} {#IF (@findportal) {#T- maze}}
#TRIGGER {As you fly through the air, your body} {glance}
#TRIGGER {{Maze|Portal|End} ~((?),(?),(?)~)} {
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- movement
kill bug
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#VAR mobpresent 0
@mazedir
}
}
#TRIGGER {{Maze|Portal|End} ~((?),(?)~)} {
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- testing|movement
kill bug
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#VAR mobpresent 0
@mazedir
}
}
#TRIGGER {{Maze|Portal|End} ~((?),(?),(?),(?)~)} {
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w or %3 = w or %4 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n or %3 = n or %4 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e or %3 = e or %4 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s or %3 = s or %4 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- testing|movement
kill bug
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#VAR mobpresent 0
@mazedir
}
}
#TRIGGER {{Maze|Portal|End} ~((?)~)} {
#VAR prevmazedir @mazedir
#VAR mazedir %1
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- testing|movement
kill bug
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#VAR mobpresent 0
@mazedir
}
}
#CLASS 0
#CLASS {testing|xcheck}
#VAR mobpresent {0}
#TRIGGER {There is no bug here.} {
#VAR mobpresent 0
#T+ testing|movement
@mazedir
}
#CLASS 0
the old script attacked each time it moved in a direction, I'm trying to stop this, I want it to wait until it sees the creature in the room, THEN attack...
I rewrote the script, but it still attacks in each room.. and I can't figure out why... I've tried adding vars in different spots.. it's just.. not.. cooperating!!!!! argh....
If anyone can see my flaws, please gimme a heads up.. I'd really appreciate it... |
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Thu Aug 26, 2004 3:03 pm |
I don't see any trigger that makes @mobpresent = "0".
|
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Thu Aug 26, 2004 5:33 pm |
#VAR mobpresent 0 is set if there's no mob in the room, or there's a player in the room... Also, in the subdir xcheck when there is no creature left to kill, it sets mobpresent to 0
|
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Sat Aug 28, 2004 11:19 am |
In your #IF evaluations, try quoting the numbers. Just a guess, but I've had trouble with that before.
"0" and "1" |
|
|
|
Loftaris Adept
Joined: 24 Aug 2004 Posts: 277
|
Posted: Sun Aug 29, 2004 2:36 am |
Didn't help any.... Does anyone else have any ideas they might be able to give me to fix my problem??
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Wed Sep 01, 2004 9:08 pm |
> Maze (w)
A Creature.
The MUD sends you the information in the order: room title, room contents
Your desired actions depend on what's in the room, so you need to wait until after you've received the room contents before taking action. You should probably include an alarm in each of your main triggers to provide a small delay before deciding the next action.
#TRIGGER {{Maze|Portal|End} ~((?),(?),(?)~)} {
#VAR prevmazedir @mazedir
#IF (@mazedir = n and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = n and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = n and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = n and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = w and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = w and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = w and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = s and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = s and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#IF (@mazedir = s and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = w or %2 = w or %3 = w)) {#VAR mazetemp w}
#IF (@mazedir = e and (%1 = n or %2 = n or %3 = n)) {#VAR mazetemp n}
#IF (@mazedir = e and (%1 = e or %2 = e or %3 = e)) {#VAR mazetemp e}
#IF (@mazedir = e and (%1 = s or %2 = s or %3 = s)) {#VAR mazetemp s}
#VAR mazedir @mazetemp
#ALA +1 {
#IF (@mobpresent = 1 and @skipvar = 0) {
#T- movement
kill bug
}
#IF (@mobpresent = 0 or @skipvar = 1) {
#VAR skipvar 0
#VAR mobpresent 0
@mazedir
}
}
} |
|
_________________ LightBulb
Senior member
Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious. |
|
|
|
|
|
|
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
|
|