Incorrect Action Application

For questions about using Classic.

Post » Thu Mar 24, 2011 4:03 am

This does not seem to be working correctly:

[code:usrqvyif]+ System: For each Ship
+ Ship: Pick by GetToken(Ship.Value('Equipment:EngineCount'), 2, "|") Equal to ""
[/code:usrqvyif]
Sub-Event:
[code:usrqvyif]+ Ship: Value 'AI:Purpose' Equal to "Dock"
[/code:usrqvyif]
Sub-Sub-Event:
[code:usrqvyif]+ Ship: Value 'Movement:State' Equal to "Go"
[/code:usrqvyif]
Sub-Sub-Sub-Event:
[code:usrqvyif]+ System: Ship.Value('Movement:ReverseCalc') Greater than Ship.Value('Movement:Distance')
-> Ship: Set 'Movement:TurnTo' to Ship[Movement].Angle-180
[/code:usrqvyif]

What this code should do is pick all the ship that have no engines in the second token and have the purpose for docking and have the movement state of "Go" and if the time it takes to reverse their direction is greater than the distance they are from their target, then reverse their direction.

It seems to ignore that last condition. And this is driving me [u:usrqvyif]NUTS[/u:usrqvyif].

Anyhoo...

What am I doing stupidilly?

Thanks
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Thu Mar 24, 2011 6:34 am

[code:2vcorxsq]+ System: Ship.Value('Movement:ReverseCalc') Greater than Ship.Value('Movement:Distance')
-> Ship: Set 'Movement:TurnTo' to Ship[Movement].Angle-180[/code:2vcorxsq]

Might try using "Compare a private variable"
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Mar 24, 2011 4:09 pm

Thanks, I just found out this morning what was up!

[code:3aupakc4]Ship: Pick by GetToken(Ship.Value('Equipment:EngineCount'), 2, "|") Equal to ""[/code:3aupakc4]

Was messing it up. I made the second token say "0" instead of nothing (and updated the picking event to match) and it works now!
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests