I've created a missiontext.plist template that consists of three newscasts for each planet in galaxy 1 plus 100 rumour slots plus an "initial_hello" plus a "no_news" slot. These slots are almost all blank but it was designed (i hoped) to be easily populated and easily selectable from the script (and this is where I've come unstuck).
The missiontext.plist starts off like this:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>snoopes_short_desc1</key>
<string>Subscription to gww.snoopes.gal to receive all the latest news and rumours throught the galaxy.</string>
<key>snoopes_initial_hello</key>
<string>---INCOMING MESSAGE\n\nGreetings Commander [commander_name],\n\nWelcome to gww.Snoopes.gal. Through the Snoopes network, you will receive all the news that GalCop has decided you don't need to (or just plain, shouldn't) hear about. Don't worry about finding us. We'll find you. Anywhere Galcop isn't you'll find that we are.\n\n---MESSAGE ENDS.</string>
<key>snoopes_no_news</key>
<string>---INCOMING MESSAGE\n\nGreetings Commander [commander_name],\n\nWelcome to gww.Snoopes.gal. Nothing of interest today - but hey, they say no news is good news...\n\n---MESSAGE ENDS.</string>
<key>snoopes_0_0_news1</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
<key>snoopes_0_0_news2</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
<key>snoopes_0_0_news3</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
<key>snoopes_0_1_news1</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
<key>snoopes_0_1_news2</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
<key>snoopes_0_1_news3</key>
<string>---INCOMING MESSAGE\n\n \n\n---MESSAGE ENDS.</string>
The rumours are similarly laid out but don't need the planet specific description:
Code: Select all
<key>snoopes_rumour1</key>
<string>---INCOMING MESSAGE\n\n1 \n\n---MESSAGE ENDS.</string>
<key>snoopes_rumour2</key>
<string>---INCOMING MESSAGE\n\n2 \n\n---MESSAGE ENDS.</string>
<key>snoopes_rumour3</key>
<string>---INCOMING MESSAGE\n\n3 \n\n---MESSAGE ENDS.</string>
1) The first time you dock at a non-main station (so it doesn't clash with other Missions - cheers LB) you get the "snoopes_initial_hello" text.
2) After this docking at any non-main station rolls a D100, if lessthan 50 you get the "snoopes_no_news" text, if greaterthan 49 you get "snoopes_[galaxy_number]_[planet_number]_news[newscounter]" text and the newscounter gets incremented by 1.
Now I have two problems - the first is that it doesn't look like I can use "galaxy_number" et al in a variable name in any shape or form - I was hoping the scripting would work a bit like tcl/tk and I could concatenate variables together but if you can I have yet to stumble upon correct the methodology! Does anybody know if it is possible?
My second problem is a design flaw that I'm hoping somebody else may be able to do a "stupid boy Pike!" on me and set me off in the right direction again. My plan was that after the newscounter was incremented beyond 3 that there would be no more newscasts from that world but instead you'd get one one the 100 rumours - but I have since realised that newscounter is an overall variable - if it gets set to 2 because you're on the second newscast from one system then visiting another system (for the first time) means that you will get the 2nd newscast for this system not the first and the newscounter will increment again which means when you visit another system you will get news item 3.... ho hum. I think what I'm trying to ask is this: Can the scripting language cope with arrays? If yes, then does anybody know how to implement them? If it can cope with arrays then I need only create a few mission variables that are array based and then I can check in the array to see where the newscounter is for any particular planet_number.
The other way (unless anybody can think of a simpler/smaller way) is to create a mission variable for every single newscast for each planet_number and when the third is displayed then set a RUMOUR flag which means no more newscasts for that system just "no_news" or rumour[rumourcounter] incrementing the rumourcounter inside each test to see if a rumour will be displayed. (and when it gets to 100 putting it back to 1 since rumours do come around again!)
Doing it this way will work I'm sure but will create an enormous number of mission variables (almost 800!) that all will get saved in the save file!
My script.plist starts off like this:
Code: Select all
{
"snoopes" = (
{
conditions = ("galaxy_number equal 0");
do = (
{
conditions = ("dockedAtMainStation_bool equal NO", "status_string equal STATUS_DOCKED");
do = (
{
conditions = (
"mission_snoopes undefined",
"mission_snoopes_newscounter undefined",
"mission_snoopes_rumourcounter undefined");
do = (
"setMissionMusic: none",
"setMissionImage: snoopes2.png"
setGuiToMissionScreen,
"addMissionText: snoopes_initial_hello",
"set: mission_snoopes SUBSCRIBED",
"set: mission_snoopes_newscounter 1"
"setMissionDescription: snoopes_short_desc1"
);
},
Any thoughts or suggestions would be much appreciated - back at work tomorrow - but it'll give me something to do during my lunch hour...
TIA and Happy 2007
DaddyH