Hello, thank you and a few questions...
Moderators: winston, another_commander
- Redspear
- ---- E L I T E ----
- Posts: 2686
- Joined: Thu Jun 20, 2013 10:22 pm
- Location: On the moon Thought, orbiting the planet Ignorance.
Hello, thank you and a few questions...
Hello all ,
I'm a veteran of Spectrum Elite back in the 80's but only ever made it to Dangerous.
Did the nova mission back then (big surprise jumping to a 'coloured' system).
Thought the game was an amazing experience: beyond what I'd previously thought possible on the ol' speccy.
So, many years later I find Oolite! Wow ... Thank you all. Whether you're a developer or your contribution is strictly 'feedback only', I've certainly had some fun with the fruits of your work. If you've contributed even a few oxps then chances are I've downloaded one of them and got something from it.
Just as Elite showed me what was possible on a simple home computer, Oolite has shown me what's possible with an active and supportive online community.
So if I may, (ahem ) "Right On Commanders!"
OK, now for some questions...
I'd like to tweak my game to make systems vary according to their inhabitants.
More specifically:
1. Different docking stations (e.g. Neolite stations for planets inhabited by birds)
2. Different shipyards (e.g. Ghavials only available on 'lizard worlds')
3. Different market prices (e.g. perhaps less demand for furs on feline planets but maybe more for luxuries)
4. Perhaps some other 'placements' (e.g. Wasp-nest station in insect worlds only)
Whilst I appreciate that there may be reasons not to do any one of these things, I think they would each add something to my 'Ooniverse'.
I thought that a 'condition script' would be the way to do this but it seems that 'Inhabitants' cannot be set as a condition in the way that 'Government' or 'Tech Level' can. I also looked at Hoopy Casinos to see if it could be done in similar manner i.e. picking a key word or phrase from a larger piece of text (e.g. 'lizards' from 'large bug-eyed cheese-eating lizards') but no luck as yet.
Is this sort of thing currently possible?
What level of 'coding skill' is it likely to require? (my current level is 'minimal')
Would anyone else like to see these sorts of things in game?
Is this post too long?
As I understand it, each system has a reference number, so I could perhaps use a conditon in the sense of 'any one of these systems', although I'm not sure how to approach that yet...
I may well have missed something simple but my time is limited these days (and my ability level probably even more so...)
I wouldn't want to spend hours working on something that is currently impractical.
Any help / advice would be appreciated.
Thanks again.
I'm a veteran of Spectrum Elite back in the 80's but only ever made it to Dangerous.
Did the nova mission back then (big surprise jumping to a 'coloured' system).
Thought the game was an amazing experience: beyond what I'd previously thought possible on the ol' speccy.
So, many years later I find Oolite! Wow ... Thank you all. Whether you're a developer or your contribution is strictly 'feedback only', I've certainly had some fun with the fruits of your work. If you've contributed even a few oxps then chances are I've downloaded one of them and got something from it.
Just as Elite showed me what was possible on a simple home computer, Oolite has shown me what's possible with an active and supportive online community.
So if I may, (ahem ) "Right On Commanders!"
OK, now for some questions...
I'd like to tweak my game to make systems vary according to their inhabitants.
More specifically:
1. Different docking stations (e.g. Neolite stations for planets inhabited by birds)
2. Different shipyards (e.g. Ghavials only available on 'lizard worlds')
3. Different market prices (e.g. perhaps less demand for furs on feline planets but maybe more for luxuries)
4. Perhaps some other 'placements' (e.g. Wasp-nest station in insect worlds only)
Whilst I appreciate that there may be reasons not to do any one of these things, I think they would each add something to my 'Ooniverse'.
I thought that a 'condition script' would be the way to do this but it seems that 'Inhabitants' cannot be set as a condition in the way that 'Government' or 'Tech Level' can. I also looked at Hoopy Casinos to see if it could be done in similar manner i.e. picking a key word or phrase from a larger piece of text (e.g. 'lizards' from 'large bug-eyed cheese-eating lizards') but no luck as yet.
Is this sort of thing currently possible?
What level of 'coding skill' is it likely to require? (my current level is 'minimal')
Would anyone else like to see these sorts of things in game?
Is this post too long?
As I understand it, each system has a reference number, so I could perhaps use a conditon in the sense of 'any one of these systems', although I'm not sure how to approach that yet...
I may well have missed something simple but my time is limited these days (and my ability level probably even more so...)
I wouldn't want to spend hours working on something that is currently impractical.
Any help / advice would be appreciated.
Thanks again.
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Re: Hello, thank you and a few questions...
Hi and welcome.
It is indeed possible to scan the text of planet descriptions for keywords and act on them based on content, provided that localization is not an issue. Here is an example of searching for the keyword "insect" in planet descriptions using Javascript and regular expressions and using it for doing something (in this particular case, showing an image of an insect on the F7 screen):
Hope this helps. Glad you are enjoying the game and should you need more clarifications, don't hesitate to ask.
It is indeed possible to scan the text of planet descriptions for keywords and act on them based on content, provided that localization is not an issue. Here is an example of searching for the keyword "insect" in planet descriptions using Javascript and regular expressions and using it for doing something (in this particular case, showing an image of an insect on the F7 screen):
Code: Select all
this.guiScreenChanged = function(toGUI)
{
if (toGUI == 'GUI_SCREEN_SYSTEM_DATA')
{
var pat = /insect/i;
if (System.infoForSystem(galaxyNumber, player.ship.targetSystem).inhabitants.match(pat))
{
setScreenOverlay("insectInhabitant.png");
}
}
}
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Hello, thank you and a few questions...
Welcome aboard, Redspear. Interesting ideas - I hope you can cobble something together.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
Re: Hello, thank you and a few questions...
A condition script can do this. But it has to be one of the new Javascript-based condition scripts from 1.77; as you've found, the legacy condition scripts can't check inhabitants.Redspear wrote:I thought that a 'condition script' would be the way to do this but it seems that 'Inhabitants' cannot be set as a condition in the way that 'Government' or 'Tech Level' can. I also looked at Hoopy Casinos to see if it could be done in similar manner i.e. picking a key word or phrase from a larger piece of text (e.g. 'lizards' from 'large bug-eyed cheese-eating lizards') but no luck as yet.
So you could add to the Ghavial entry in
shipyard.plist
the line
Code: Select all
"condition_script" = "ghavial_conditions.js";
ghavial_conditions.js
to the Scripts
folder of the OXP
Code: Select all
this.allowOfferShip = function(shipKey) {
if (shipKey == "ghavial-player") {
var pat = /lizard/i;
if (system.inhabitants.match(pat)) {
return true; // Lizard world, Ghavials allowed
} else {
return false; // Not lizard world, Ghavials not allowed
}
}
return true; // Not a Ghavial, so allow it anywhere
}
condition_script
reference goes in shipdata.plist
instead, and you use the allowSpawnShip
test.-
- Above Average
- Posts: 24
- Joined: Thu Jun 13, 2013 1:18 pm
- Location: Aboard the 'Dream of Wild Horses'
Re: Hello, thank you and a few questions...
G'day all,
I'd like to firmly second these remarks of Redspear's:
"Thank you all. Whether you're a developer or your contribution is strictly 'feedback only', I've certainly had some fun with the fruits of your work. If you've contributed even a few oxps then chances are I've downloaded one of them and got something from it.
Just as Elite showed me what was possible on a simple home computer, Oolite has shown me what's possible with an active and supportive online community.
So if I may, (ahem ) "Right On Commanders!" "
In the last two weeks since discovering Oolite - I've had a lot of fun - & don't tell me to get a life (as if anyone here would). I've already had a long & good'un.
Cheers
Jenko
I'd like to firmly second these remarks of Redspear's:
"Thank you all. Whether you're a developer or your contribution is strictly 'feedback only', I've certainly had some fun with the fruits of your work. If you've contributed even a few oxps then chances are I've downloaded one of them and got something from it.
Just as Elite showed me what was possible on a simple home computer, Oolite has shown me what's possible with an active and supportive online community.
So if I may, (ahem ) "Right On Commanders!" "
In the last two weeks since discovering Oolite - I've had a lot of fun - & don't tell me to get a life (as if anyone here would). I've already had a long & good'un.
Cheers
Jenko
- Redspear
- ---- E L I T E ----
- Posts: 2686
- Joined: Thu Jun 20, 2013 10:22 pm
- Location: On the moon Thought, orbiting the planet Ignorance.
Re: Hello, thank you and a few questions...
Thanks for the warm welcome!
Really appreciate you taking the time to give me some coding examples. That's both improved my understanding and saved me a lot of time and experimentation. Great stuff!
another_commander : It does help, thanks. I'm likely to need my fair share of clarifications, so that's good to know
Cody : Thanks for your interest. Yes, 'cobble' sounds about right for my programming 'skills'
cim : Ahh, so I need to upgrade my thinking to 1.77... Nicely explained .
Jenko : Nice to know that the sentiment is shared . Glad you're enjoying the game.
Thanks everyone!
Looks like I've got some tweaking to do
Really appreciate you taking the time to give me some coding examples. That's both improved my understanding and saved me a lot of time and experimentation. Great stuff!
another_commander : It does help, thanks. I'm likely to need my fair share of clarifications, so that's good to know
Cody : Thanks for your interest. Yes, 'cobble' sounds about right for my programming 'skills'
cim : Ahh, so I need to upgrade my thinking to 1.77... Nicely explained .
Jenko : Nice to know that the sentiment is shared . Glad you're enjoying the game.
Thanks everyone!
Looks like I've got some tweaking to do
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Re: Hello, thank you and a few questions...
And yet another victim one slips closer to the Dark Side..
Welcome aboard, Redspear!
Welcome aboard, Redspear!
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
- Redspear
- ---- E L I T E ----
- Posts: 2686
- Joined: Thu Jun 20, 2013 10:22 pm
- Location: On the moon Thought, orbiting the planet Ignorance.
Re: Hello, thank you and a few questions...
Thanks Diziet Sma!Diziet Sma wrote:And yet anothervictimone slips closer to the Dark Side..
Welcome aboard, Redspear!
I hear it's a slippery slope
- Diziet Sma
- ---- E L I T E ----
- Posts: 6312
- Joined: Mon Apr 06, 2009 12:20 pm
- Location: Aboard the Pitviper S.E. "Blackwidow"
Re: Hello, thank you and a few questions...
It is indeed.. very few can resist its' siren song, once heard..
Cody is one of the rare few who manages to resist.. but even he still hears it calling to him, in the dark of the night.
Cody is one of the rare few who manages to resist.. but even he still hears it calling to him, in the dark of the night.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Hello, thank you and a few questions...
'I was drawn by the Sirens of TitanDiziet Sma wrote:It is indeed.. very few can resist its' siren song, once heard..
Carried along by their call
Seeking for a way to enlighten
Searching for the sense of it all!'
Some nights, I awake suddenly, drenched in cold sweat. Visions of plists and AIs haunt me... and cookies!Diziet Sma wrote:Cody is one of the rare few who manages to resist.. but even he still hears it calling to him, in the dark of the night.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Hello, thank you and a few questions...
The cookies make it worth it
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Fatleaf
- Intergalactic Spam Assassin
- Posts: 1988
- Joined: Tue Jun 08, 2010 5:11 am
- Location: In analysis mode on Phaelon
- Contact:
Re: Hello, thank you and a few questions...
Who mentioned Cookies
Where?
Where?
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
Holds the Ooniversal record for "Thread Necromancy"
- Tricky
- ---- E L I T E ----
- Posts: 821
- Joined: Sun May 13, 2012 11:12 pm
- Location: Bradford, UK. (Anarchic)
Re: Hello, thank you and a few questions...
Mmm... Cookies!
Cookie dispener OXP anyone?
Cookie dispener OXP anyone?
- Redspear
- ---- E L I T E ----
- Posts: 2686
- Joined: Thu Jun 20, 2013 10:22 pm
- Location: On the moon Thought, orbiting the planet Ignorance.
Re: Hello, thank you and a few questions...
Having trouble getting this to work using the allowSpawnShip method for stations...
Here's part of the log report:
You may have noticed that I group oxps in folders to make it easier for me to manage them; such as all of my station oxps within the imaginatively titled, 'Stations.oxp".
I was having all sorts of problems making sense of the log reports until I realised that I was editing them using Notepad
I've since 'fixed' (or have I ) them by simply opening the affected files with wordpad and then saving them.
Any ideas what I might be doing wrong?
I've mucked about with plists aplenty before but scripting is still new to me.
I've created the file example above, swapped allowOfferShip for allowSpawnShip, changed Ghavial-player for the relevant station name and I've even remembered to add the condition script line to the relevant shipdata.plist.cim wrote:So you could add to the Ghavial entry inshipyard.plist
the lineand then add a file calledCode: Select all
"condition_script" = "ghavial_conditions.js";
ghavial_conditions.js
to theScripts
folder of the OXPFor NPC ships or stations, theCode: Select all
this.allowOfferShip = function(shipKey) { if (shipKey == "ghavial-player") { var pat = /lizard/i; if (system.inhabitants.match(pat)) { return true; // Lizard world, Ghavials allowed } else { return false; // Not lizard world, Ghavials not allowed } } return true; // Not a Ghavial, so allow it anywhere }
condition_script
reference goes inshipdata.plist
instead, and you use theallowSpawnShip
test.
Here's part of the log report:
Some things that may be relevant :[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (zocto_conditions.js.anon-script): TypeError: system.inhabitants is undefined
13:44:58.300 [script.javaScript.exception.unexpectedType]: ../AddOns/Stations.oxp/Z_GrOovy_System_Stations.oxp/Scripts/zocto_conditions.js, line 4.
You may have noticed that I group oxps in folders to make it easier for me to manage them; such as all of my station oxps within the imaginatively titled, 'Stations.oxp".
I was having all sorts of problems making sense of the log reports until I realised that I was editing them using Notepad
I've since 'fixed' (or have I ) them by simply opening the affected files with wordpad and then saving them.
Any ideas what I might be doing wrong?
I've mucked about with plists aplenty before but scripting is still new to me.
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: Hello, thank you and a few questions...
Do get Notepad++ - it's free and excellent. Grouping OXPs should be no problem - I've done similar for ages.
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!