I've setup a script for my thief so that if no enemies are around, he'll automatically search for traps (by calling FindTraps()).
This is working, there's just a slight nuisance though. It seems everytime I call FindTraps(), it first STOPS looking for traps, and then starts looking again. You see this come up over and over again in the message area.
Is there a trigger I can use that'll tell me if I'm already looking for traps?
Scripting - am I finding traps?
Guess I'll answer my own question! It's not perfect, but I did manage to get something I'm happy with:
IF
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",0)
Continue()
END
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
Global("LOOKING","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
IF
HotKey(F)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
Basically, when I start searching for traps, I set a local flag so I know I've done it. This stops me from repeating the command over and over again ...
Then just made sure the flag is cleared when entering combat (so I'll start searching again automatically when the combat is over). Then since other actions can also stop my search, I also added a hotkey.
IF
See(NearestEnemyOf(Myself))
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",0)
Continue()
END
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
Global("LOOKING","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
IF
HotKey(F)
THEN
RESPONSE #100
SetGlobal("LOOKING","LOCALS",1)
FindTraps()
END
Basically, when I start searching for traps, I set a local flag so I know I've done it. This stops me from repeating the command over and over again ...
Then just made sure the flag is cleared when entering combat (so I'll start searching again automatically when the combat is over). Then since other actions can also stop my search, I also added a hotkey.
Figured out how to do it properly now - this will make sure you're detecting traps whenever there's no enemies around:
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
!ModalState(DETECTTRAPS)
THEN
RESPONSE #100
FindTraps()
END
Although I've actually paired up a Monk with my Thief now - makes a great combo. My Monk is now the one detecting traps, which leaves my thief free to hide in shadows (and therefore is ready to backstab at the start of every combat).
IF
ActionListEmpty()
!See(NearestEnemyOf(Myself))
!ModalState(DETECTTRAPS)
THEN
RESPONSE #100
FindTraps()
END
Although I've actually paired up a Monk with my Thief now - makes a great combo. My Monk is now the one detecting traps, which leaves my thief free to hide in shadows (and therefore is ready to backstab at the start of every combat).