v1.72.1 reset-handler fired to early
Moderators: winston, another_commander, Getafix
v1.72.1 reset-handler fired to early
System: WIN
The behaviour of the reset-handler has changed in v1.72.x. When fired it is still in the old system so JS-scripts will run into trouble.
Before the system-data was set correctly when the handler was fired.
The behaviour of the reset-handler has changed in v1.72.x. When fired it is still in the old system so JS-scripts will run into trouble.
Before the system-data was set correctly when the handler was fired.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Sure. The last working version was v1.71.2 - just checked it again.
Take this testscriptload savedgameA (maybe at Diso) and you will see that the systemdata still says Lave. And then load another savedgame (maybe at Esusti) and you are still in the system of savedgameA (Diso).
I haven't checked the state of missionVariables yet, but today I don't have the time anymore. Before they are set for the current savedgame - hope this is still the same. Maybe this is also the ( or one ) reason for the Commies problem.
Take this testscript
Code: Select all
this.name = "testA";
this.author = "Svengali";
this.copyright = "CC-by-nc-sa-3.0";
this.description = "test";
this.version = "1.00";
this.reset = function()
{
log('Test','Test: System:'+system.name);
}
I haven't checked the state of missionVariables yet, but today I don't have the time anymore. Before they are set for the current savedgame - hope this is still the same. Maybe this is also the ( or one ) reason for the Commies problem.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Only when you use bouyRepair at the same time. But when the source of the bug is the condition, it are probably not only the buoys that are missing but also a certain percentage of the police. commies also defines those with conditions.Ark wrote:Errr!!!!!! does that means that the nav bouys are back in place when you have commies???
I did notice that the bug does not happen when added by script. When I do a system.legacy_addShipsWithinRadius('buoy', 10, 'abs', player.ship.position, 10000) there are always 10 buoys and with police also always 10 police.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
I think Eric is right and it won't solve all problems related to missing buoys. But step by step we can hunt the problems down.Eric Walch wrote:Only when you use bouyRepair at the same time. But when the source of the bug is the condition, it are probably not only the buoys that are missing but also a certain percentage of the police. commies also defines those with conditions.Ark wrote:Errr!!!!!! does that means that the nav bouys are back in place when you have commies???
I can imagine that this is related to the way Oolite handles the legacy_add... methods. If the first try fails it repeats it a few times. So the chance that a entity will be added is a lot higher.Eric Walch wrote:I did notice that the bug does not happen when added by script. When I do a system.legacy_addShipsWithinRadius('buoy', 10, 'abs', player.ship.position, 10000) there are always 10 buoys and with police also always 10 police.
I noticed it when doing the Vector. There I've used a legacy_add... under some conditions. The shipdata.plist contains also conditions and last but not least the shipscript checks if there is already a ship with this role. If so it switches the AI and the ship leaves the system. This leads sometimes to ~20 leaving ships. It doesn't happen very often, but all these blue Hyperspheres are... erm... nice to watch. Looks like a police raid in a red light quarter :-)
- Commander McLane
- ---- 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:
It does. I noticed the bug first when in combination with Commies total_patrol failed to add additional police (but total_patrol doesn't use ...WithinRadius; perhaps that makes a difference, although I don't know why it should).Eric Walch wrote:I did notice that the bug does not happen when added by script. When I do a system.legacy_addShipsWithinRadius('buoy', 10, 'abs', player.ship.position, 10000) there are always 10 buoys and with police also always 10 police.