|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Feb 10, 2003 2:20 am
Whats wrong with this picture? |
#IF (@dir = e) {
#var dir "n"
} {
#IF (@dir = n) {
#var dir "s"
} {
#IF (@dir = s) {
#var dir "w"
} {
#IF (@dir = w) {
#var dir "e"
}
}
}
}
whats wrong with the above imbedded IF statements? Any help would be appreciated
The Seaworthy |
|
|
|
iljhar GURU
Joined: 10 Oct 2000 Posts: 1116 Location: USA
|
Posted: Mon Feb 10, 2003 2:35 am |
I'm not sure, but I think changing the variable changes it right away, so your next ifcheck looks at the new variable and changes accordingly. Not sure though. Why, what's happening?
Iljhar |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Feb 10, 2003 2:40 am |
Its not embedded properly, If dir = e it works fine, but any other direction it basicly flips out! but i cant figure out why it shouldnt work, cause it should go literly like this if direction equals e then change to n if it doesn't so on and so on...lalalala get the picture...
The Seaworthy |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Feb 10, 2003 3:09 am |
quote:
#IF (@dir = e) {
#var dir "n"
} {
#IF (@dir = n) {
#var dir "s"
} {
#IF (@dir = s) {
#var dir "w"
} {
#IF (@dir = w) {
#var dir "e"
}
}
}
}
whats wrong with the above imbedded IF statements? Any help would be appreciated
The Seaworthy
Is this supposed to be sequential (ie, like a path), or just a simple switcharoo for 4 different directions that appear at a specific time (ie, the exits line)? If it's the latter, you can probably get better results from the #CASE command rather than messing with the headache of nested #IFs.
li'l shmoe of Dragon's Gate MUD |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Feb 10, 2003 3:15 am |
Its triggered off a statement that happens when i can go no farther that dir
for instance: You see nothing in that direction.
at that time if i was going e it changes to n
if i was going n it changes to s
if i was going s it chages to w
if i was going w it changes to e
OR its supposed to, currently East is the only one that triggers properly without having it go haywire.
The Seaworthy |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 3:46 am |
can you post the whole script/trigger? when tested the statements, they worked as expected. also, what version are you using?
--------
moon.icebound.net:9000 |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 3:51 am |
oh, forgot to add:
#case (%pos(@dir, "ensw")) {
#var dir n} {
#var dir s} {
#var dir w} {
#var dir e}
would be a viable solution as well, (and more readable! )
--------
moon.icebound.net:9000 |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Feb 10, 2003 4:02 am |
Well you asked for it, Heres the entire script...
#CLASS {ratstuff}
#ALIAS liirupnow {
#T- morestuff
rats
@stop = 0
#UNTIL {@stop = 1} {
e
#wait 1000
}
#wait 3000
@stop = 0
#UNTIL {@stop = 1} {
n
#wait 1000
}
#wait 3000
#LOOP 7 {
w
#wait 1000
}
#wait 3000
s
leave subdivision
#wait 3000
#FORALL @liirupto {
%i
#wait 1000
}
#wait 5000
sell rat to liirup
#wait 5000
put gold in pack
#wait 5000
#FORALL @subto {
%i
#wait 1000
}
#wait 3000
enter subdivision
#LOOP 8 {
e
#wait 1000
}
#wait 3000
@stop = 0
#UNTIL {@stop = 1} {
s
#wait 1000
}
#wait 3000
rats
#T+ morestuff
@ratskilled = 0
}
#VAR liirupto {w|nw|w|sw|s|w|sw|w|s|w|sw|s|s}
#VAR subto {n|n|ne|e|n|e|ne|e|n|ne|e|se|e}
#TRIGGER {There is no exit in that direction.} {@stop = 1}
#CLASS 0
#CLASS {ratstuff|Rats} {enable}
#TRIGGER {A baby rat noses its way cautiously out of the shadows.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {With a squeak, a baby rat darts into the room, looking about wildly.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {Your eyes are drawn to a black rat that darts suddenly into view.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {An old rat wanders into view, nosing about for food.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A black rat wanders into view, nosing about for food.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {Your eyes are drawn to a rat that darts suddenly into view.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {Your eyes are drawn to an old rat that darts suddenly into view.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {With a squeak, a(*)rat darts into the room, looking about wildly.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A black rat noses its way cautiously out of the shadows.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {Your eyes are drawn to a baby rat that darts suddenly into view.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A young rat noses its way cautiously out of the shadows.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A baby rat wanders into view, nosing about for food.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A young rat wanders into view, nosing about for food.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A rat noses its way cautiously out of the shadows.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {Your eyes are drawn to a young rat that darts suddenly into view.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {A rat wanders into view, nosing about for food.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#TRIGGER {An old rat noses its way cautiously out of the shadows.} {#IF {@killrat = 1} {
curse rat bleed
@killrat = 0
@killing = 1
}}
#CLASS 0
#CLASS {ratstuff|morestuff}
#VAR dir {e}
#VAR ratskilled {40}
#TRIGGER {You point an imperious finger at} {@walk = 1}
#TRIGGER {^You have recovered balance on all limbs.} {#if (@currkill = "") {#IF (@killing = 1) {curse rat bleed}} {
@currmed = 0
@killing = 0
@killrat = 1
get @currkill
curse @currkill bleed
@currkill = ""
; goliirup
@move = 0
#wait 5000
#if (@move = 0) {
@dir
#IF (@ratskilled >= 60) {liirupnow}
}
}}
#TRIGGER {There is no exit in that direction.} {
#case (%pos( @dir, "ensw")) {#var dir n} {#var dir s} {#var dir w} {#var dir e}
@stop = 1
@killrat = 1
@dir
}
#TRIGGER {You pick up the corpse of} {#ad ratskilled 1}
#CLASS 0
#CLASS {ratstuff|morestuff|stuff}
#TRIGGER {You see exits leading} {
#T- stuff
#wait 10000
#T+ stuff
#IF (@move = 0) {@dir}
}
#CLASS 0
The idea behind the whole thing is, to move from one location to the next until a rat comes in, at that time ya kill it obviously and pick it up, once i pick up 60 Rats i go to certain place and sell them then come back and start over, the script works to a point, the movement part is kinda buggy, it doesnt always move when it supposed to, useually it jumped ahead and moves while im still killing a rat, but the basic idea of it works.
The Seaworthy |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Mon Feb 10, 2003 4:04 am |
My main question is this I guess, can someone grasp the main idea im trying to do here, and help me clean up this script some? its pretty sloppy, thanks
The Seaworthy |
|
|
|
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Mon Feb 10, 2003 7:31 pm |
looks alright to me. For the complexity of what your doing, it seems ok. Does the odd movement happen while your killing rats? I'm guessing yes, because it looks like you need a statement in the triggers that begin the killing of rats to do this:
@move = 1
i see a couple of #if's that make sure you want to move before actually moving, but i didn't see a statement that would make @move 1, so @move is always 0 so the if's are superfluous, if you see what i mean?
ofcourse, you could also:
#if (@child = "unwanted") {summon pied piper}
--------
moon.icebound.net:9000 |
|
|
|
Davos Adept
Joined: 30 Jan 2003 Posts: 228 Location: USA
|
Posted: Tue Feb 11, 2003 8:22 pm |
YAY! Ok you found one of my more obvious errors that was driving me crazy, the next part of the problem is, Lets say i Move into a room and a rat comes in immed then i kill it within 10 seconds and no other rat comes in as you can see in this situation it fires the next direction double then it goes back to working right? Catch my drift? Any help would be appreciated!
The Seaworthy |
|
|
|
|
|