|
Tommy4286 Newbie
Joined: 22 Aug 2004 Posts: 3 Location: Maryland
|
Posted: Mon Aug 23, 2004 4:48 am
Trigger Firing Too Many Times |
I know this looks amateurish, but I'm really struggling with this.
I'm trying to write an auto-sneak script for MajorMUD. In Major you can break sneak without there being a fail message. You'll just be moving and it might fail sneak, but there's no game message that says it failed, just an absence of the message that says you're sneaking. For example, this is the text you would see when moving while sneaking:
[HP=200/MA=100]:s
Sneaking...
Bank of Godfrey
Also here: guardsman.
Obvious exits: north, east
So I have these triggers setup for movement, which would be
Pattern: [HP=200/MA=100]:s
Value:
#var sneakcheck 1
#t+ Autosneak2
I have triggers like that for each direction. Autosneak2 then contains the following trigger
Pattern: ^(*)$
Value:
#if (@sneakcheck == 1) {
#if (%1 == "Sneaking...") {#var sneaking 1} {#var sneaking 0}
#t- Autosneak2
#var sneakcheck 0
}
I also did this code with some "#echo Blah"'s thrown in there for debug purposes.
Now that SHOULD only fire once due to the variable check, but it fires about 50 times before finally disabling.
I'm sure it's probably something simple and I'm just a moron, but it's now 1 am, I've been at it for hours, and I'm about ready to destroy my computer.
So I figured it would be best for all involved if I posted this, and went to sleep for a while.
Thanks in advance for any help, and sorry for the rambling. |
|
|
|
Tommy4286 Newbie
Joined: 22 Aug 2004 Posts: 3 Location: Maryland
|
Posted: Mon Aug 23, 2004 4:51 am Forgot to Add |
Oh yeah, I meant to add that the line of text right after "Sneaking..." (Bank Of Godfrey) is different for every room and area. This is what makes it so tricky to code this particular section. If it just had some kind of standard text, it would make things much easier. Anyway, off to bed now.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Aug 23, 2004 10:14 am |
#ONINPUT {%t} {DidSneak=0;MobsPresent=0}
#TR {^Sneaking...$} {DidSneak=1}
#TR {^Also here:} {MobsPresent=1}
#TR {^Obvious exits:} {#IF ((@AutoSneak=1)&(@DidSneak=0)&(@MobsPresent=0)) {sneak}
I used to play MajorMud so I filled in some more of the stuff needed. Basically it sets the variables to 0 when a direction is sent, then sets them to 1 if the line is present. I included a check for mobs because it is a waste of time to issue a sneak command when mobs are there. The check does not distinguish between players and mobs, so you might just want to remove it. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Tommy4286 Newbie
Joined: 22 Aug 2004 Posts: 3 Location: Maryland
|
Posted: Tue Aug 24, 2004 4:41 am Ok |
Ok, that's helpful, but I was kinda wondering if anyone know the reason that that trigger was repeating like that, cuz it looks fine to me
|
|
|
|
|
|
|
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
|
|