Is there a way to access the random inhabitants description in a script? So you could randomly get something like "a Fierce Green Bony Feline"?
I know that A_H experimented with things like [%i3] in Cargo Wrecks Teaser, but these did obviously not work.
So, can we address the inhabitants-array in descriptions.plist in some way?
accessing random inhabitants descriptions?
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:
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
As far as I am aware we cannot. I have just written up a new JS global function called randomInhabitantsDesc(), which can take one argument or no arguments at all. Without arguments, it generates a pseudo-random inhabitants singular form string, with arguments (like randomInhabitantsDesc(1)), it will generate an inhabitants string in plural.
I hope this is OK for now. But I am a bit hesitant to check it in at this moment, given that 1.71 is now very close to release and I don't really want to add any more features without enough time to check that they work properly. I guess that (if it really works as intended) it could maybe be one of the first features of 1.72
I hope this is OK for now. But I am a bit hesitant to check it in at this moment, given that 1.71 is now very close to release and I don't really want to add any more features without enough time to check that they work properly. I guess that (if it really works as intended) it could maybe be one of the first features of 1.72
- 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:
- Arexack_Heretic
- Dangerous Subversive Element
- Posts: 1876
- Joined: Tue Jun 07, 2005 7:32 pm
- Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
- Contact:
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Thanks for reminding me about this. It's now in for 1.72. To use it, you will just have to do in your script something like
The inPlural variable is a boolean type variable that defines whether the description is in plural or singular form. If inPlural is set to true, then an inhabitants description in plural is generated. If it is false, then the description is in singular.
As a shortcut, if you want a description in singular form, you can also write the function call like this:No parameter passed => singular form.
Code: Select all
let myInhabitantsDescription = randomInhabitantsDescription(inPlural);
As a shortcut, if you want a description in singular form, you can also write the function call like this:
Code: Select all
let myLonelyInhabitantDescription = randomInhabitantsDescription();