Page 2 of 6

Posted: Sun Jul 08, 2007 1:05 pm
by JensAyton
Commander McLane wrote:
Resetting on other screens unfortunately works only on some of the screens, as some other screens do not return a correct value to gui_screen_string. (I mentioned that earlier. It is annoying. Must be a bug in the code. Perhaps our codemonkeys could search for it if they get some spare time from their other projects?)
Specifics would be helpful. Also, have you tested under 1.69?
Commander McLane wrote:
There is another drawback in resetting the variable when the player looks at another screen: As scripts are run only every ten seconds or so, the player has to stay a another screen for up to ten seconds in order to make sure that the script is run while he is there. In the scripting model there is no way to overcome this 10-second-rule. In Javascript this seems to be different, if I understand Ahruman correctly.
Kind of. JavaScripts get instant notification of various events, but switching GUI screens isn’t currently one of them. This is complicated by the fact that there’s no consistent model of GUI screens internally.

Posted: Sun Jul 08, 2007 1:08 pm
by Commander McLane
Ahruman wrote:
Specifics would be helpful. Also, have you tested under 1.69?
I just posted a small script which you can use for testing (one post above). And no, I haven't yet fired up 1.69.

Posted: Sun Jul 08, 2007 2:34 pm
by LittleBear
I'm testing on the 1.69 version (patched with another_commander's death_actions fix). I'll have another go at this proabley next weekend. The comms message test-script is a nice idea. I'll see what that thows up and then have another fiddle. ATM I have this test for the mission screen in the main assassins "ladder" of comamnds. Perhaps, the [ ] it off into its own section would be better, as CM suggests.

Posted: Sun Jul 08, 2007 3:00 pm
by JensAyton
OK… it works for:
  • GUI_SCREEN_EQUIP_SHIP
  • GUI_SCREEN_SHIPYARD
  • GUI_SCREEN_STATUS
  • GUI_SCREEN_MANIFEST
  • GUI_SCREEN_INVENTORY
  • GUI_SCREEN_SHORT_RANGE_CHART
  • GUI_SCREEN_LONG_RANGE_CHART
  • GUI_SCREEN_SYSTEM_DATA
  • GUI_SCREEN_CONTRACTS
It does not work for:
  • GUI_SCREEN_OPTIONS
  • GUI_SCREEN_MARKET
  • GUI_SCREEN_LOAD
  • GUI_SCREEN_SAVE
  • GUI_SCREEN_SAVE_OVERWRITE
Not tested:
  • GUI_SCREEN_MAIN
  • GUI_SCREEN_INTRO1
  • GUI_SCREEN_INTRO2
  • GUI_SCREEN_STICKMAPPER (doesn’t exist on Macs)
  • GUI_SCREEN_MISSION
  • GUI_SCREEN_REPORT
A script tickle is sent immediately when switching to GUI_SCREEN_STATUS, GUI_SCREEN_MANIFEST, GUI_SCREEN_INVENTORY or GUI_SCREEN_SYSTEM_DATA, but not the others.

Posted: Sun Jul 08, 2007 3:50 pm
by Commander McLane
BTW: I'm doing all my playtesting with small scripts like this, displaying the value I am hunting in a commsMessage on-screen. It's very handy, because you see the things that are happening as they are happening without taking your eyes off the Oolite-window.

And it's not necessary to put it in a script of its own. Just these few lines of conditions at the end of the script I want to debug, there you are. :)

Posted: Sun Jul 08, 2007 4:41 pm
by Commander McLane
Ahruman wrote:
Not tested:
  • GUI_SCREEN_MAIN
As far as I remember GUI_SCREEN_MAIN works (at least as of 1.65). But it's only used when not docked (it's the view out of the cockpit, including the external views).

And there is at least one difference on my machine: On the ship's manifest screen it's not GUI_SCREEN_MANIFEST, but UNDEFINED. Same for the carrier market. The commodity market doesn't return anything. The save screen doesn't return anything as well. The ship market again returns UNDEFINED.

All of this tested with 1.68 now. Make of it what you want.

Posted: Sun Jul 08, 2007 4:54 pm
by Frame
Commander McLane wrote:
Ahruman wrote:
Not tested:
  • GUI_SCREEN_MAIN
As far as I remember GUI_STRING_MAIN works (at least as of 1.65). But it's only used when not docked (it's the view out of the cockpit).
Commander Mclane.. i hate to be nitpicking but did you mean

GUI_SCREEN_MAIN

and not

GUI_STRING_MAIN

;-)...

Posted: Sun Jul 08, 2007 5:22 pm
by LittleBear
Sorry, this is a dumb non-programmers question!

When its said that Oolite scans the scripts every ten seconds, does this mean:-

1) Oolite looks at the first line of each script, then checks the next line of each script etc. or

2) Oolite "reads" all of the assassins script (say) does any of the dos that are met, before it starts reading the (say) Thargoid Wars script and then does any "do"s in Thargoid Wars only after its read the whole assassins script?

Posted: Sun Jul 08, 2007 6:23 pm
by Commander McLane
As computers do one thing after the other each script is checked from the first line to the last.

But as computer are very fast it looks like all the scripts are checked simultaneously.

Posted: Sun Jul 08, 2007 6:45 pm
by LittleBear
True, but if (even going in mili-seconds), the Computer reaches the Line in the assassins script that says "do this if the mission screen is in use" BEFORE the Thargoid Wars scripts is read and puts the mission screen in use, then Assassins and the Thargoid Wars briefs both come up (and the dreaded clash happens :evil: ) whatever I've told assassins to do because at the time assassins is read the problem event hasn't happened.

If think this may be why its not working:- Oolite reads the Assassins script, the mission screen is not in use (as Thargoid Wars hasn't asked for it yet), so no give_brief variable is set to NO, so it remains undefined, so Assassins runs its brief1 script. When Thargoid Wars is read later (even if its mili-seconds) it sets the mission screen for its own use and the dreaded two OXPs asking for the missions screen at the same time happens. Thargoid Wars puts up its own brief, so both run together. You see the mission text for thargoid wars, but both OXPs have run their (only do this once the mission brief is displayed) scripts.

So think the orginal post of Eric's just to do the oneofs: as a single condition in Assassins would work if every OXP used it. But won't work if even one OXP doesn't. If I add the Command to BOTH OXPs it should work. Mistake made was to only change assassins. (I think). Doh!

If this method works though then it would only work with this tweaked version of Thargoid Wars / Military. I'll have an experiment with this in the week.

Posted: Sun Jul 08, 2007 7:10 pm
by JensAyton
Each script is executed completely before the next one is considered.

Every plist script and every JS script with a tickle method is handled on each “script tickle”, which occurs on a ten-second timer and at certain times when state changes, such as launching, docking, arriving in a new system or switching to certain GUI screens.

Posted: Sun Jul 08, 2007 7:17 pm
by LittleBear
Got it! :wink: Then the plan should work as long as the condition is added to both scripts.

Posted: Sun Jul 08, 2007 8:03 pm
by Commander McLane
@ Ahruman: One more question: Are the scripts executed in alphabetical order?

Posted: Sun Jul 08, 2007 8:20 pm
by LittleBear
IT'S ALIVE! :D

Simply set as a condition "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART" for giving the first assassins brief. AND added the same condition for giving the first Military brief. And the fix worked perfectly.

For testing I have a blank Jameson in G7 with 1001 kills. This means Military, Assassins and Thargoid Wars will all try to offer a brief at the same time (Its a serious test that could not be met in game as the player would have seen the first Thargoid Wars brief in G2 before he could have got to G7 - but its testing the method in a true worst case seniario - three OXPS trying to use the screen at the same time).

With the condition added to all OXPs. The Assassins brief was shown. 10 seconds of remaining in the station (on any screen :) the Mililtary brief was shown, 10 Seconds later the Thargoid Wars brief.

If I launch the second after I press space after seeing the Assassins brief then I will see the Military brief as soon as I next dock.

IT WORKS PERFECTLY THEREFORE as long as the fix is applied to ALL OXPS.

Having C&P Assassins, Military and Thargoid Wars to add a gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART condition before every mission brief command the three OXPS (Military and Thargoid Wars are the only two that can clash with Assassins), the three get all just fine together! 8)

However, any changes I make to Assassins in a new version. Would only work if the player was also using a tweaked version of Military and Thargoid Wars.

Neither Murgh or Wombat are around ATM. I could put a C&Ped version of the two OXPs on the Wiki Crediting them as the Authors and put their readme descriptions on as a description and pointing out that the only change was the c&ping of "gui_screen_string oneof GUI_SCREEN_STATUS, GUI_SCREEN_EQUIP_SHIP, GUI_SCREEN_MARKET, GUI_SCREEN_SHORT_RANGE_CHART" into the script to stop the mission clash bug. BUT it does mean altering their code without their permission, even though it dosen't effect how the OXPs play at all and is just to stop the bug.

@CM Pretty sure they are, as I got the Assassins briefing screen and then 10 seconds later the Military briefing, then 10 seconds later the Thargoid Wars briefing! :wink:

Posted: Sun Jul 08, 2007 8:23 pm
by JensAyton
Commander McLane wrote:
@ Ahruman: One more question: Are the scripts executed in alphabetical order?
There are no guarantees regarding the order of script execution.