Page 1 of 1
AMS ammo counter
Posted: Fri Feb 12, 2010 9:01 pm
by Cmdr Wyvern
I want to set up a dart ammo tally for AMS; for when you go to the manifest screen(F5-F5), you can read a message like "AMS dart ammo available: <darts in magazine>". I recon it would be useful to quickly tell how much ammo is remaining in the AMS, and since it doesn't use missile stores like other ammo...
I know the AMS uses a mission variable, amCount, to keep track of it's ammo, and it would be swell to read the amCount variable for the manifest message.
The thing is, I'm completely at a loss on how to make that happen. Some assistance, please
Posted: Fri Feb 12, 2010 9:12 pm
by Thargoid
The mission javascript element is your friend here, specifically mission.setInstructionsKey()
That said I must admit I'm highly dubious about using the manifest screen for such things, simply because very very quickly it seems to fill up once you get a few OXPs in the game and becomes indecipherable and messy. That's why I've avoided using it for just this kind of consideration, and use a pop-up message on launch instead.
Posted: Fri Feb 12, 2010 10:43 pm
by Cmdr Wyvern
Thargoid wrote:The mission javascript element is your friend here, specifically mission.setInstructionsKey()
Sorry bud, that's not a lot of help. I'm hopelessly ignorant on how to make this go. I tried studying the code from mission oxps, and got lost in the code and even more confused.
Thargoid wrote:That said I must admit I'm highly dubious about using the manifest screen for such things, simply because very very quickly it seems to fill up once you get a few OXPs in the game and becomes indecipherable and messy. That's why I've avoided using it for just this kind of consideration, and use a pop-up message on launch instead.
Noted. I don't have a lot of mission oxps installed myself, just UPS and RH at the moment. I tend to uninstall one-shot missions once I play them through.
But what the hell, I thought it would be a handy widget to have. Normally AMS only displays a hud message when you launch or it shoots off a dart.
For anyone who gives a flip, here's the code I'm tinkering with.
Code: Select all
this.startUp = this.shipLaunchedFromStation = this.shipExitedWitchspace = this.shipDockedWithStation = function() { // Displays dart ammo count on the manifest screen. No ammo display if AMS N/A.
if(player.ship.hasEquipment("EQ_AMS") && missionVariables.amCount > 0) {
mission.setInstructionsKey("ams_ammo_status" + (this.amCount));
}
else if(player.ship.hasEquipment("EQ_AMS") && missionVariables.amCount < 1) {
mission.setInstructionsKey("ams_ammo_status_empty");
}
}
Posted: Fri Feb 12, 2010 10:54 pm
by JensAyton
Cmdr Wyvern wrote:Sorry bud, that's not a lot of help. I'm hopelessly ignorant on how to make this go. I tried studying the code from mission oxps, and got lost in the code and even more confused.
The good news is, mission screens will be far simpler in 1.74.
Posted: Sat Feb 13, 2010 7:49 am
by Thargoid
@Wyvern - looks in the right kind of lines.
Grab my Planetfall taxi add-on and have a look in there, that uses the manifest screen to show where the destination is, and the script's reasonably small.
Not much time at the moment (off on hols on Monday, so manic sorting out etc) but if this goes on until next weekend I'll look at it for you).
Posted: Sat Feb 13, 2010 1:59 pm
by Kaks
Wyvern, it looks ok, but what have you got inside missiontext.plist?
As Ahruman said, the whole mission stuff is going to be simpler to handle in 1.74.
In this specific case, in 1.74 you will also be able to just do
mission.setInstructions("AMS dart ammo available: " + (this.amCount));
without adding all the various instructions key definitions inside missiontext.plist.
Posted: Sat Feb 13, 2010 8:24 pm
by Cmdr Wyvern
Thargoid wrote:@Wyvern - looks in the right kind of lines.
Grab my Planetfall taxi add-on and have a look in there, that uses the manifest screen to show where the destination is, and the script's reasonably small.
Not much time at the moment (off on hols on Monday, so manic sorting out etc) but if this goes on until next weekend I'll look at it for you).
Thank, Thargy. This puts me on the right track, methinks.