Shady Billboard - deprecated code

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

Moderators: winston, another_commander, Getafix

Post Reply
itoffshore
Poor
Poor
Posts: 6
Joined: Mon Dec 13, 2010 10:31 pm

Shady Billboard - deprecated code

Post by itoffshore »

In Shady Billboards under scripts/ahruman-billboard-setup.js

Code: Select all

this.ship.setOrientation(Quaternion.random())
Should be:

Code: Select all

this.ship.orientation=Quaternion.random()
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Shady Billboard - deprecated code

Post by Eric Walch »

itoffshore wrote:
In Shady Billboards under scripts/ahruman-billboard-setup.js
Hello itoffshore,
I didn't even know there was a separate oxp for the billboards. Currently they are maintained within the YAH sets. Recently a new YAH set was released with new asteroid billboards. I think the whole oxp should be marked as deprecated on the wiki :lol:
Also the method of adding the billboards does not work anymore:

Code: Select all

this.willLaunch = addBillboards;
this.willExitWitchSpace = addBillboards;
Those handlers are so old that they don't even generate deprecation messages in current Oolite. The effect is that the billboards are not added at all. I added a message on the wiki stating that this demo is outdated.

The only thing I never knew was why the big billboards in YAH are only added on the planet-sun space lane in corporate states. That makes them quite rare.
itoffshore
Poor
Poor
Posts: 6
Joined: Mon Dec 13, 2010 10:31 pm

Fuel Collecter Deprecated Code Fix & OXP Version Trackin

Post by itoffshore »

Hi Eric,

Thanks for the reply. I removed Shady Billboards & have 90 OXP's loaded & playing together quite nicely. I corrected some deprecated code in Fuel Collector OXP showing repeatedly in the logs & added the following to line 776 to declare a Timer just before it was invoked:

Code: Select all

this.DerelictCheckTimer = new Timer(this,this.DerelictCheck,0,1)
I can send a new zip that seems to be working if you PM me.

I was thinking about a way to track OXP version numbers. If an OXP's page on the Wiki can have a new field or category added to show the current version (or if the OXP is deprecated) if would be relatively simple to write an application to check if a users OXP version is current.
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:

Re: Fuel Collecter Deprecated Code Fix & OXP Version Tra

Post by Commander McLane »

itoffshore wrote:
added the following to line 776 to declare a Timer just before it was invoked:

Code: Select all

this.DerelictCheckTimer = new Timer(this,this.DerelictCheck,0,1)
That was superfluous, though. The timer is declared just four lines below, in line 780, and only in case it doesn't exist yet. With your change you will create another equally-named timer each time the code is executed, which is inefficient at best, and problem-creating at worst.

The code in total looks like this:

Code: Select all

    							if(this.DerelictCheckTimer)
    							this.DerelictCheckTimer.start()
    							else
    							{
    								this.DerelictCheckTimer = new Timer(this,this.DerelictCheck,0,1) //tip dont use an arguement when you start a timer like this,this.mytimer(arguement) it will make a CTD
    								player.consoleMessage("Fuel Collector", 3)
    								if(this.backversion)
    								player.consoleMessage("Established link to"+pl_target.shipDisplayName, 3)
    								else
    								player.consoleMessage("Established link to"+pl_target.displayName, 3)
    							}
What it does is this:
  • check if the timer named DerelictCheckTimer already exists
  • if yes, start it (set it to 0 and start it)
  • if not, create and start it
Which is more efficient, because the timer is never deleted, only stopped. So the next time you come across a derelict and want to extract some fuel, there is no need to create another timer, but the existing timer can simply be re-used.

The actual problem in the code is that the console message will only be displayed when creating the timer for the first time, but not for subsequent fuel-extractions. To rectify this, the closing bracket has to be moved up right behind the timer creation:

Code: Select all

    							if(this.DerelictCheckTimer)
    							this.DerelictCheckTimer.start()
    							else
    							{
    								this.DerelictCheckTimer = new Timer(this,this.DerelictCheck,0,1) //tip dont use an arguement when you start a timer like this,this.mytimer(arguement) it will make a CTD
     							}
   								player.consoleMessage("Fuel Collector", 3)
								if(this.backversion)
    							player.consoleMessage("Established link to"+pl_target.shipDisplayName, 3)
    							else
    							player.consoleMessage("Established link to"+pl_target.displayName, 3)
Post Reply