Scripters cove
Moderators: winston, another_commander
- 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:
Re: Scripters cove
Not sure whether equipment.plist supports this.
Anyway, if it does, the square brackets should contain the descriptions.plist key, just like in all other substitution cases.
Edit: a quick test shows that it doesn't seem to be supported.
Anyway, if it does, the square brackets should contain the descriptions.plist key, just like in all other substitution cases.
Edit: a quick test shows that it doesn't seem to be supported.
Re: Scripters cove
And even if it did work, there'd be no guarantee that the equipment would have a consistent name from one view to the next, since entries from descriptions.plist arrays are picked randomly each time.
- superbatprime
- Dangerous
- Posts: 120
- Joined: Tue Oct 09, 2012 10:09 am
- Location: Location, Location.
Re: Scripters cove
*sigh*
Thanks guys, sheesh I always want to do the thing that can't be done.
At least I've learned enough stuff to get this far.
Okay I'll change tactics.
What if I have all variations of the equipment listed in the equipment plist as separate entries, can I get Oolite to randomly display only one item from the list in the equipment market?
So it would be like this in the equipment plist.
(I'm sure there are brackets to clean up there but you get the gist).
Can I then get the game to select one at random?
Thanks guys, sheesh I always want to do the thing that can't be done.
At least I've learned enough stuff to get this far.
Okay I'll change tactics.
What if I have all variations of the equipment listed in the equipment plist as separate entries, can I get Oolite to randomly display only one item from the list in the equipment market?
So it would be like this in the equipment plist.
Code: Select all
(
(
0,
5000,
"my item serial #001",
"EQ_MY_ITEM",
"mildly humorous description of the item",
{
"available_to_all" = YES;
"portable_between_ships" = yes;
}
)
)
(
(
0,
5000,
"my item serial #002",
"EQ_MY_ITEM",
"mildly humorous description of the item",
{
"available_to_all" = YES;
"portable_between_ships" = yes;
}
)
)
Can I then get the game to select one at random?
So then I says to him, I says "naw dude, Oolite ain't no Space Opera... Oolite is Space Rock and Roll!"
Re: Scripters cove
If you give them TL:99, you can then set mission variables from script to set one, and only one, in each system - on
If you make them all incompatible with each other, that will make this a little easier, too.
shipWillExitWitchspace
, probably - to have the real tech level. (In the next version you will be able to do this much more neatly with a "condition script", but this is the easiest way for now)If you make them all incompatible with each other, that will make this a little easier, too.
- 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:
Re: Scripters cove
The currently best way of selecting which equipment gets offered is through its tech level. That's also the only way I can think of off the top of my head that'll allow you to make sure that every time one (and only one) of several similar items is offered.
First, all your items need a distinct identifier. There may not be two items EQ_MY_ITEM. Thus, you have to name them EQ_MY_ITEM_1, EQ_MY_ITEM_2, and so on.
Second, you have to give all your items a tech level of 99. This is a special tech level, which can be changed to any number you want on the fly (this is expressly not possible for any other tech level).
Then, you need to redefine it in your world script, based on a random selection. If you want a new random each time the player visits the F3-screen,
A shorter way, making use of JS's ability to transform your random choice number into a string, and manipulate strings directly, would be:
First, all your items need a distinct identifier. There may not be two items EQ_MY_ITEM. Thus, you have to name them EQ_MY_ITEM_1, EQ_MY_ITEM_2, and so on.
Second, you have to give all your items a tech level of 99. This is a special tech level, which can be changed to any number you want on the fly (this is expressly not possible for any other tech level).
Then, you need to redefine it in your world script, based on a random selection. If you want a new random each time the player visits the F3-screen,
guiScreenWillChange
is the event you're looking for:
Code: Select all
this.guiScreenWillChange = function(to, from)
{
if(!player.ship.docked) return; // a safety measure, because you could've been launched in the meantime
if(to === "GUI_SCREEN_EQUIP_SHIP")
{
var choice = Math.ceil(Math.random() * 5) // replace with the number of items
switch(choice)
{
case 1:
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = 0; // item available
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = null; // reset TL to 99, not available
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = null;
break;
case 2:
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = 0;
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = null;
break;
case 3:
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = 0;
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = null;
break;
case 4:
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = 0;
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = null;
break;
case 5:
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = null;
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = 0;
}
}
}
Code: Select all
this.guiScreenWillChange = function(to, from)
{
if(!player.ship.docked) return; // a safety measure, because you could've been launched in the meantime
if(to === "GUI_SCREEN_EQUIP_SHIP")
{
var choice = Math.ceil(Math.random() * 5) // replace with the number of items
EquipmentInfo.infoForKey("EQ_MY_ITEM_1").effectiveTechLevel = null; // reset
EquipmentInfo.infoForKey("EQ_MY_ITEM_2").effectiveTechLevel = null; // all
EquipmentInfo.infoForKey("EQ_MY_ITEM_3").effectiveTechLevel = null; // items
EquipmentInfo.infoForKey("EQ_MY_ITEM_4").effectiveTechLevel = null; // to
EquipmentInfo.infoForKey("EQ_MY_ITEM_5").effectiveTechLevel = null; // TL 99
EquipmentInfo.infoForKey("EQ_MY_ITEM_" + choice.toString()).effectiveTechLevel = 0; // set only one to 0
}
}
"EQ_MY_ITEM_" + choice.toString()
obviously resolves to EQ_MY_ITEM_1, EQ_MY_ITEM_2, EQ_MY_ITEM_3, EQ_MY_ITEM_4, or EQ_MY_ITEM_5.Re: Scripters cove
Another way is to set a condition in each piece of equipment requiring a mission variable to be a certain value or range of values if you wish some overlap (a different value for each item variant), and then use a script to pseudo-randomly set that variable to one of the values in the range of your equipment on start-up and witchspace exit.
That works in the current release version, and as Cim says will only get easier when 1.77 comes out.
That works in the current release version, and as Cim says will only get easier when 1.77 comes out.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- superbatprime
- Dangerous
- Posts: 120
- Joined: Tue Oct 09, 2012 10:09 am
- Location: Location, Location.
Re: Scripters cove
Gentlemen thank you, that is doing what it should be doing now and more importantly I understand how it's doing it.
So then I says to him, I says "naw dude, Oolite ain't no Space Opera... Oolite is Space Rock and Roll!"
Re: Scripters cove
If you want an example, look into the mission equipment in Aquatics.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Rese249er
- ---- E L I T E ----
- Posts: 647
- Joined: Thu Jun 07, 2012 2:19 pm
- Location: Well, I WAS in G3...
Re: Scripters cove
Is it possible to display all for weapon temperatures at once? I've a HUD design in mind incorporating all four in a cross-display with the number for the view displayed next to the temperature, as well as a few more concepts to integrate that I may need help with in the future.
Got all turned around, lost my nav connection... Where am I now?
- 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:
Re: Scripters cove
I don't think so.Rese249er wrote:Is it possible to display all for weapon temperatures at once?
- Rese249er
- ---- E L I T E ----
- Posts: 647
- Joined: Thu Jun 07, 2012 2:19 pm
- Location: Well, I WAS in G3...
Re: Scripters cove
*snaps fingers* Back to the drawing board.
Got all turned around, lost my nav connection... Where am I now?
- Wildeblood
- ---- E L I T E ----
- Posts: 2457
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Scripters cove
An arithmetic question. I need a procedure that will take a number between 0 and 36000 (actually 4000 to 40000, but I think I can manage adding and subtracting 4000) and output a number between 0 and 3996000 (4000000-4000), such that there's no distortion at the bottom of the range, but a 100x exaggeration at the top of the range. So 4000 -> 4000, but 40000 -> 4000000, or 0 -> 0, but 36000 -> 3996000. I think this is called a geometric progression, but being the victim of a state school education, my mathematical ability is limited to basic addition and subtraction.
Re: Scripters cove
Is this what you are looking for: f(x)=x*100^((x-4000)/36000), where 4000 <= x <= 40000 ?Wildeblood wrote:An arithmetic question. I need a procedure that will take a number between 0 and 36000 (actually 4000 to 40000, but I think I can manage adding and subtracting 4000) and output a number between 0 and 3996000 (4000000-4000), such that there's no distortion at the bottom of the range, but a 100x exaggeration at the top of the range. So 4000 -> 4000, but 40000 -> 4000000, or 0 -> 0, but 36000 -> 3996000. I think this is called a geometric progression, but being the victim of a state school education, my mathematical ability is limited to basic addition and subtraction.
- Wildeblood
- ---- E L I T E ----
- Posts: 2457
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: Scripters cove
spara wrote:Is this what you are looking for: f(x)=x*100^((x-4000)/36000), where 4000 <= x <= 40000 ?
Last edited by Wildeblood on Tue Dec 04, 2012 9:02 am, edited 1 time in total.
- Rese249er
- ---- E L I T E ----
- Posts: 647
- Joined: Thu Jun 07, 2012 2:19 pm
- Location: Well, I WAS in G3...
Re: Scripters cove
Through experimenting with a hud.plist for the next version of HoloNumHUD, I discovered that only one scanner will be drawn at a time. Is it feasible to remove this restriction? I've an idea that a separate scanner of zero height could be drawn over the crosshairs to aid aiming by 'instruments' in addition to the typical scanner (or a square-boundary scanner.)
Got all turned around, lost my nav connection... Where am I now?