Oolite Bulletins

For information and discussion about Oolite.
It is currently Mon Jun 25, 2018 7:31 am

All times are UTC




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: alertConditionChanged
PostPosted: Tue Mar 06, 2018 6:13 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Wed Aug 15, 2012 4:19 am
Posts: 2527
Location: Finland
I'm trying to get alertConditionChanged event to trigger for the main station with a ship script attached to the station by shooting the station. In the debug console system.mainStation.alertCondition shows that the alert condition has changed. Should this work or am I missing something obvious?


Top
   
PostPosted: Tue Mar 06, 2018 10:43 pm 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 2076
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
I think this is a bug. I've had a look, and it appears the station version of the alertConditionChanged event is only triggered if the AI functions increaseAlertLevel and decreaseAlertLevel are executed. The standard station AI routine (the JS one, not the plist one) uses the behaviour behaviourStationLaunchDefenseShips to control the alertCondition. However, in the priority AI functions, behaviourStationLaunchDefenseShips just sets the alertCondition directly to 3 (condition red), rather than performing an increaseAlertLevel function. Therefore, the alertConditionChanged event never fires.

Not sure what the fix is yet (if this is indeed the problem).

_________________
My OXP's
YouTube: Oolite Teaser Trailer


Top
   
PostPosted: Wed Mar 07, 2018 6:27 am 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5155
Could we check and confirm if this occurs in 1.84 and 1.82 too (can't do it right now myself)?


Top
   
PostPosted: Wed Mar 07, 2018 7:50 pm 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 2076
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
For all these tests I used this code in the Javascript debug console to add the event listener for alertConditionChanged.
Code:
S.mainStation.script.alertConditionChanged = function(newCond, oldCond) {log(this.name, "got here");}
Here's the procedure and results of my tests:

Test 1
1. Add event script to main station
2. Launch, spin, fire on station.
Result: No event triggered

Test 2
1. Restart game, add event script to main station
2. Switch station AI to "stationAI.plist"
3. Launch, spin, fire on station
Result: Event is triggered.

Results were the same in 1.80, 1.82, 1.84, 1.86 (in each case, vanilla install with only the debug OXP)

_________________
My OXP's
YouTube: Oolite Teaser Trailer


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


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

Search for:
Powered by phpBB® Forum Software © phpBB Limited