Page 1 of 1

help - building "snoopes.oxp"

Posted: Tue Jan 02, 2007 10:09 pm
by DaddyHoggy
Ok, I've scoured the wiki, I've gone over everybody else's mission based oxp's (LittleBear Assassins is HUGE! :) ) and I'm stuck. I've only been at it for two days and yesterday doesn't really count coz I had a minger of a hangover but this is what I've tried so far...

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>
This pattern (snoopes_[galaxy_number]_planet_number]_news[newscounter]) is repeated for all 255 planets.

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>
I was hoping that my script would simply do the following:

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"
                            ); 
                        }, 
After I got the number of close brackets sorted out I flew to the tianve pulsar station and when I dock I get the "initial_hello" text, it only goes horribly wrong when I start adding the rest of my plan!

:cry: :cry:

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

Posted: Wed Jan 03, 2007 12:19 am
by LittleBear
:D Assassins may be huge, but only about 1K per breifing, so a respectable snoopers.oxp with 100 (expandable) briefings should only chew up 100K (less than a single ship texture or modle). Just needs a optimisted code. Reckon a 3 or 4 segment code (maybe 30K tops) should do it. Will post an idea when not drunk! :shock:

Posted: Wed Jan 03, 2007 7:57 pm
by LittleBear
Hhm had a think about this. I don't think there is a way, short of having 800 odd variables to do it. As you say this would make loading the game take ages and might even bugger up the save file. :roll:

Think you might have to go for a single counter and a givenews variable, so the news isn't system specific. (Snoopers is Galaxy wide so report
events all over.

1) After the hello brief set the give_news to yes and news_counter to 1.
2) After a witchspace jump (just a status = exiting witchspace, do set give_news to yes). Your gonna need this as otherwise (as Oolite scanns the script ever 10 seconds or so), you gonna get all of the news coming up one after another. Player presses space after seing the first news brief, flicks to the Shipyard and 10 secs later, there is another broadcast (as the status docked and not at the main station conditions are still true).

3) Now to give the news have a segment that sets the screen to the mission screen (just like the one you have for the hello brief), but as an extra condition that give_news = yes. Once the brief is given set the give_news to no and incremeant the news_counter. That way the player won't see another breif until he has made a jump and docks somewhere else. Now to give the variety have a series of:-

conditions = ("news_counter equal 1");
do = (
{ "addMissionText: snoopes_brief1"

repeat for news_counter equal 2 addMissionText: snoopers_brief2 and so on.

This should work and mean:-

1) A new brief is given everytime the dice pick the chance of there being some news.
2) No further briefs will appear until a hyperspace jump has been made.
3) A new item appears next time.

The only downside is the News would appear in a pre-set order. However, only you the author would know what was comming next, but to the player it would have no idea what will happen next (which is the coolest feature of the OXP!). Also, this would allow you to develop stories over time, as item 5 will happen 5 jumps (5 weeks of game time) after item1. Eg the Stewards Enquiry results into the Mud Tennis Galatic cup being reported.

PS : You might also want to loose the Galaxy =0 condition at the start, so the stories unravel slowly which ever Galaxy the player is in.

PPS : Once you get a basic script going, Contributers should PM you the news to that the surprise won't be spoiled by reading the news on the BB first!

Posted: Wed Jan 03, 2007 11:05 pm
by DaddyHoggy
:shock: LB you really are the god of oxps! Thanks for mulling this over and coming up with a sensible plan.

I will start building the script tomorrow and hopefully will ask for contributions via PMs shortly after!

I'm really looking forward to doing this - I hope others are looking forward to the end result!

:wink: PS Nice idea of the result of the steward's enquiry coming up some point after your report from the mud tennis game.

My original use of galaxy_number = 0 was I had in mind to do one for each galaxy but now with a rolling news then contributers could entice ooliters to travel to different galaxies with their news items - inspired by and/or based on oxps that have already been written (or have yet to be written!).

Oh yes - this could be really good - will just have to not stuff it up and keep it entertaining and "oolitish" (<gringes at voice of English Teacher from school: "You can't turn that word into an adverb Hoggard!">)