Constrictor mission oddities (a lot of spoilers!)

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Svengali wrote:
If timer-events would stay untouched and the notification for legacy-scripts after that is granted - switch them off. I can't see a reason to do a tickle on such screens. But that would mean to disallow launching from these screens too?
Tickle events have nothing to do with launching. They’re just periodic messages sent to both types of scripts. (An explicit script update happens immediately after you launch, through the same mechanism, but it’s not related to the periodic tickles.)
Svengali wrote:
If I remember right, you've said that the use of legacy-scripting will be discouraged after the MSNR. Is this still the plan?
Yes, but the idea is to remain compatible with existing scripts.
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

From a practical user pont of view, I sometimes hit F1 by mistake and have to shift D immediately, I suppose you could argue that you should only be able to launch from the local/galaxy maps or the standard F5 screen, but there again for speed of play, it would be better to launch from any screen, so a bit indecided. The only one to disallow I guess should be the mission screen.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Ahruman wrote:
Tickle events have nothing to do with launching. They’re just periodic messages sent to both types of scripts. (An explicit script update happens immediately after you launch, through the same mechanism, but it’s not related to the periodic tickles.)
But what happens then to the mission screens? If you dock on a station and maybe the REPORT-screen pops up and after that you switch to one of these 'SPECIAL' screens, you could miss a important mission screen. Maybe I'm wrong, but I'm thinking about more than one or two mission screens (legacy scripting) from different Oxps. A Legacy script depends on the tickle, or not?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

TGHC wrote:
From a practical user pont of view, .... it would be better to launch from any screen, so a bit indecided. The only one to disallow I guess should be the mission screen.
Maybe a good option. It is easy to implement to not accept a F1 key when on a missionscreen. A programmer can anticipate on that misbehaviour, but a lot of oxp's don't. So just forbid it hardcoded. On the other hand, the way UPs (and several others) do it, there is no problem. On docking the message with choices is just made again. For messages without choices it is more difficult as the script has no clue why the screen ended (launch or spacebar)
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Svengali wrote:
Ahruman wrote:
Tickle events have nothing to do with launching. They’re just periodic messages sent to both types of scripts. (An explicit script update happens immediately after you launch, through the same mechanism, but it’s not related to the periodic tickles.)
But what happens then to the mission screens? If you dock on a station and maybe the REPORT-screen pops up and after that you switch to one of these 'SPECIAL' screens, you could miss a important mission screen. Maybe I'm wrong, but I'm thinking about more than one or two mission screens (legacy scripting) from different Oxps. A Legacy script depends on the tickle, or not?
That can already happen, so there’s no compatibility issue.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Cmdr James wrote:
He does not drop a canister, just one metal (which is just alloys) - did I miss out on a cloaking device, or any other equipment? I know there is a cloaking device mission in galaxy 5. He also does not seem to eject even though I know he has an escape pod (this is interesting as there is a bonus for catching the pod)
Out of 5 tries 4 he ejected 4 times an escape pod. But maybe I have more experience with those things as I use them a lot in UPS. The pod only launches when the ship is died but not destroyed. Meaning it is a hulk and white on the scanner. The pilot needs time to realise his ship is dead and has to eject. When killing to fast you kill the beast before launch of the pod. (with a boa there is an extra complication the launch position is badly chosen so that the escape pod often crashes on the back of the Boa that is wide on the back. For the UPS boa I relocated the launch position a bit.)

There are however several OXP's that cheat and just use the spawn command in the death_actions to create the pod. Such pods of course will always be there.

But there is a bug with the scripted pilot. It does not trigger the message on docking and I can not find the bug yet. To find the bug I gave the scripted character now a name: "The Mission Thieve". On scooping the pod I get the message: "captured the Mission Thieve", meaning that I have the scripted pilot on board. But I don't get the message on docking. I checked with the "boa_ptt" from UPS. That ship does the same. When scooping that pod, I do get the message on docking.

----
Besides this problem the translation works. (Removed two typos in the debriefing part of the code I gave a view messages back). The ship script is working will however use the new guiScreenChanged handler. I gave the ship his own AI. It does the same as the PirateAI but sets the ship to clean when the player is far away. And as the constrictor has no scoops, I removed all the AI states for scooping and docking.
----
Targoid_plans is now also converted. Next to test when the scripted pilot is working as it should.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

OK I found the bug with the scripted pilot. It was so obvious that I overlooked it. The script never set up a mission screen to display the text.

Hmm. But that was the original script. Has it never worked at all?? When I started writing my own scripted pilots that was with version 1.65. For some reason I did set up a mission screen for my pilots. Hmm, my fist mission with a scripted pilot was "romeo" from "lovecatsoxp" That script also did setup a missionscreen.

I start to believe it has never worked. I did the mission under Oolite 1.55 so there never was a pod for sure. But getting the pod was difficult. In the fist four kills the constrictor ejected them 3 times and I always got them. But after changing my script I wanted to know for sure if this was the bug. And you know Murphy: Two times the pod smashed I pieced into the ship. And killing the constructor while on injector-speed was not a good idea: the pod also left on injector speed. I chased them twice but gave up. On scooping with injectors on, you crash into the pot.

I think I got the pod on the 7th try. And now the message was OK on docking. The constrictor never escaped death on all tries. Injectors or not, NPC ships only have an limited amount of fuel. (Or better they waist their fuel)

----

The bug found by Cmdr James is gone with the new script. When the player kills the constrictor and than launches his escape pod, he still gets the ending mission. The only thing that could have gone wrong in the old system that the mission screen was overwritten as the variables were set. But when things work in future there is no need to find the bug in the old situation.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I had the ship script for the constictor ready, but on testing it, it didn't work. Problem is that "this.ship.bounty" can be read out, but not set. (read only). According to the wiki it should already been read/write. But apparently it is only read/write for he player. I assume this will be fixed in 1.71 but can not test it in 1.70. But this.legalPoints changes with the distance so the script itself works. I call the function checkDistance from several places from within the AI. When the player is far away, the constrictor becomes clean and will be left alone by police and hunters.
The mission variable is only set when killed by the player. When an other ship in an exceptional case kills him, a new ship ship will be re-added when the player launches from the station.

Code: Select all

this.name      = "oolite-constrictor"; 
this.author    = "eric walch"; 
this.copyright = "© 2008 the Oolite team.";
this.description = "";
this.version   = "1.01"; 

this.legalPoints = 0

this.shipSpawned = function()
{
  this.legalPoints = this.ship.bounty
  this.ship.bounty = 0
}

this.shipDied = function(killer) 
{ 
    if(killer == player) missionVariables.conhunt = "CONSTRICTOR_DESTROYED"
}


this.checkDistance = function()
{
  if (player.position.distanceTo(this.ship) < 50000)
  {
    if(this.legalPoints > 0)
    {
        this.ship.bounty = this.legalPoints
        this.legalPoints = 0
    }
  }
  else
  {
    if(this.legalPoints == 0)
    {
        this.legalPoints = this.ship.bounty
        this.ship.bounty = 0
    }
  }
}
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Eric Walch wrote:
Problem is that "this.ship.bounty" can be read out, but not set. (read only). According to the wiki it should already been read/write.
This works in the trunk; I think it was pointed out earlier and fixed.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Translation of the remaining 3 internal Oolite OXP's is ready. I tried to translate everything with changing as little as possible in the functioning. For testing one can just add the OXP. It will replace the originals in 1.70. Be aware it is written for 1.71 and not everything works properly on 1.70 vanilla. Specially the constrictor ship-script will not work there and in the thargoid mission there is even a command that crashes 1.70 vanilla. With the trunk version must be OK. If anybody of the testers want to test.

Internal missions
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6683
Joined: Wed Feb 28, 2007 7:54 am

Post by another_commander »

Eric, I had a look at the Constrictor mission using your script. It seems OK, but there is a typo in line 80 of constrictor_hunt.js (reads constictor_hunt_brief1 instead of constrictor_hunt_brief1), which results in half of the mission briefing not appearing.

Also, in the nova mission, the string "Danger! Fuel Leak!" is hardcoded. In 1.71 this string has been already externalized and has the key "danger-fuel-leak". I believe it would be better to use that instead, doing something like

Code: Select all

player.consoleMessage(expandDescription("[danger-fuel-leak]"))
in the script. This would assist greatly with possible future attempts to make the mission translatable to other languages.

I will test further, so far looks like great work.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

another_commander wrote:
Eric, I had a look at the Constrictor mission using your script. It seems OK, but there is a typo in line 80 of constrictor_hunt.js (reads constictor_hunt_brief1 instead of constrictor_hunt_brief1), which results in half of the mission briefing not appearing.

Also, in the nova mission, the string "Danger! Fuel Leak!" is hardcoded.
Thanks for the typo. I didn't notice the text should be longer while reading it. On the hardcoded text. I didn't want to edit the descriptions file, but you are right. This and a few other texts should be relocated in the descriptions.

One other thing were I am not sure of.: Now I delete the event handlers after mission completion. For me it makes sense as after completion you don't look at the missions anymore so there is no need to evaluate the code. But you also can not restart it when after completion you reload an old game were it was not finished. You have to quit Oolite and then load the old game. It could give confusion. Maybe don't delete them, or do it in the way Kaks is doing in his JS version of asteroid storm: Store the handlers before deletion and reinstall them on reset.

EDIT: Added the changes and the re-enabler code from Kaks.
Internal missions
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Ahruman wrote:
Eric Walch wrote:
The reason was that players could hit return on an item and then select a mission option that just turned up. (it happened me twice with fuel)
The question then becomes: why do tickles happen on the contracts, equip and shipyard screens? Are there any legacy scripts that rely on this?
Yes. Anarchies.oxp is. In three places:
  1. The bribe-offer is made only on the equipment-screen. This was my pre-Eric way to avoid clashes. And I've written the whole bribing story around being in the Equipment Department of the station.
  2. The Multipass needs a tickle in order to work. The player has to stay on the equipment screen until the next tickle and is then transferred to a mission-screen notifying him about the process.
  3. The same is true for the Multi-Passed ID. Its installation also requires a tickle.
So removing the tickle from the equipment screen would disable the whole bribing possibility and make the other legal-status-cleaning devices only work after jumping to a screen that creates a tickle.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

OK, right, keeping those then.

In summary, tickles are boring legacy stuff, so they may continue to not make much sense. ;-)
Post Reply