Jump to content

Boolean variable in the same AI update hack


i30817

Recommended Posts

Found a nasty way to have one.

 

IF
 Detect(Nothing)
 <Conditions>
 Detect(Myself)
THEN
 RESPONSE #100
  Continue()
END
...
IF
 Range(LastSeenBy(Myself), 0)
...

 

 

 

This test code:

IF
 HotKey(V)
THEN
 RESPONSE #100
 SendTrigger(Myself,0)
 Continue()
END

IF
 Detect(Nothing)
THEN
RESPONSE #100
  DisplayStringHead(Myself,@6)
  Continue()
END

IF
 Detect(Myself)
THEN
RESPONSE #100
  DisplayStringHead(Myself,@7)
  Continue()
END

IF
 Detect(Nothing)
 OR(2)
  HotKey(V)
  Trigger(0)
 Detect(Myself)
THEN
 RESPONSE #100
  Continue()
END
IF
 Range(LastSeenBy(Myself), 0)
THEN
 RESPONSE #100
  DisplayStringHead(Myself,@8)
END

 

Will print @6 and @7 continuously and if you press V @8 twice one in the same round, one in the next AI round.

 

The dirty secret is the Detect obviously. It depends on if it is always possible to detect yourself and Nothing and that Range(LastSeenBy(Myself), 0) if lastseen is Myself is true and if it is Nothing it is false. The test for Detect is in the code, and for the other you can test by commenting the last Detect (it won't print @8 if you press V).

 

This is a single boolean, so you can't use it to check multiple conditions at the same time if those conditions don't fit together in all cases, it can get confused by targeting, and of course, you have to use continue in all subsequent blocks you want to use the "variable" after "setting" it.

 

 

Edit: wanted to post this in the IESDP forum, but maybe it's for the best it's not documented there :p

Link to comment

If you're wondering

 

WHY should you do something so INSANE, why not just repeat the check?

 

Well, i found out that the HotKey trigger is "special"

 

Using

!Hotkey doesn't give you if the key was not pressed but:

1) !(false) any other key pressed - ok.

2) false if no key pressed (!), except just after loading (!!!) or after pressing it once (!!!!!!!)

 

So i need it to invert Hotkey without flakiness on the same round.

Link to comment

Can't edit the first post anymore (what's up with that?)

 

Long story short, the method doesn't work because the Nothing object shadows the nearest or something. Yes i was surprised.

This:

IF//not pressed one of the hotkeys and not in combat bail out
 Name("Imoen", Nothing)
THEN
 RESPONSE #100
 AttackReevaluate(Nothing, 30)
END

 

On a team with imoen and charname running the script makes charname attack imoen.

 

Go figure. I expected when something is named "Nothing" it actually be "Nothing".

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...