Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

Trumbles - I hate those things!

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Is there any chance of this aberration to work on the AI?
If not, would you be so kind as to tell me why not and the right way to do it?
:oops:

Code: Select all

    "IDENTIFY_HOSTILES" = {
	  ENTER = (fightOrFleeHostiles),
		    "scanForNearestShipWithRole: slaver",
		    conditions = ("shipsFound_number" greaterthan 0),
		      do = (
			  setTargetToFoundTarget, "commsMessage: [maegil-mark]",
			  "setStateTo: ATTACK_SLAVER"
			); 
		      else = (
			  scanForHostiles,
			  setTargetToPrimaryAggressor,
			  conditions = ("shipsFound_role" equal police),
			    do = ("commsMessage: [maegil-police]"); 
			    else = (
				conditions = ("shipsFound_role" equal pirate);
			        do = ("commsMessage: [maegil-pirate]"); 
			        else = ("commsMessage: [maegil-threat]");
			  "setStateTo: ATTACK_SHIP"
			  );
			);
	  EXIT = ();
	UPDATE = ("scanForNearestShipWithRole: slaver, pirate", "pauseAI: 1.0");
	};
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

don't know the 'shipsFound_role' return message for scanForHostiles...
Riding the Rocket!
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

I know, I made it up as an example of what I wanted to do... :oops:
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Modified code with comments. I don’t know whether it does anything useful, but the syntax at least makes sense.

Code: Select all

"IDENTIFY_HOSTILES" =
{
    ENTER =
    (
        fightOrFleeHostiles,  // Lose the closing paren
        "scanForNearestShipWithRole: slaver",
        {	// Conditions are a dictionary, they need braces
            conditions = ("shipsFound_number greaterthan 0");  // Semicolon, not comma, because we're in a dictionary. Also, quotation marks must surround the whole statement, not just the variable.
            do =
            (
                setTargetToFoundTarget, "commsMessage: [maegil-mark]",
                "setStateTo: ATTACK_SLAVER"
            );
            else =
            (
                scanForHostiles,
                setTargetToPrimaryAggressor,
                {  // Conditions still need braces
                    conditions = ("shipsFound_role equal police");  // Semicolon, not comma, because we're in a dictionary. Also, quotation marks must surround the whole statement, not just the variable.
                    do = ("commsMessage: [maegil-police]");
                    else =
                    (
                        {  // And again
                            conditions = ("shipsFound_role equal pirate");  // Quotation marks must surround the whole statement, not just the variable.
                            do = ("commsMessage: [maegil-pirate]");
                            else = ("commsMessage: [maegil-threat]");
                        }
                    );  // Closing bracket was missing
                },
                "setStateTo: ATTACK_SHIP"  // Not sure if this is in the right place
            );
        }
    );
    
    EXIT = ();
    UPDATE = ("scanForNearestShipWithRole: slaver, pirate", "pauseAI: 1.0");
};
There were a number of systematic property list syntax errors. To create working scripts, you need to understand the property list structure.

Your conditions were not in dictionaries. Key-value pairs (foo = bar) only make sense in dictionaries, i.e. surrounded by {} pairs.

Several of your conditions took the form "method" operator value instead of "method operator value. A condition is a string; it must be surrounded by quotation marks.

The trailing paren after fightOrFleeHostiles near the top makes no sense.

I reccomend finding and learning to use a programmer’s text editor. The single most important function of such an editor is to maintain consistent indentation, i.e. the number of tabs at the beginning of each line. This helps line up the opening and closing parens/brackets as I’ve done above. This makes it much, much easier to keep the structure “balanced” and properly nested, and to understand the structure.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Thanks, Big A!
It's been well over a decade since I last done something in Turbo Pascal, and even if I remembered something I really don't know the local lingo, so...

This was just an experiment, I'll take one of the tools on the wiki and try to do it in a more consistent way with the code sample you posted - but don't expect too much!
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

Don't forget to add other states, so that your character has something to do when there is nothing around.

Maybe add to script.plist something like:

Code: Select all

{
 conditions = ("government_number lessThan 3", "d100_number greaterThan 90");
 do = ("checkForShips: Meagil",
  {
   conditions = ("shipsFound_number equal 1");
   do = ("check for ships: slaver",
    {
      conditions = ("shipsFound_number lessThan 1");
      do = ("add systemShips: slaver 2 0.5");
     } 
    );
    else = ("addShips: meagil 1");
  }
}
more complex offcourse, so that slavers appear not only at that one point.
Or make an independent script for slavers and Meagil.

NOW.
Stop this hijack immediately and start your own "character_OXPs thread"
This one is about thumbles. ;)
Riding the Rocket!
User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2310
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Post by Captain Hesperus »

Arexack_Heretic wrote:
Stop this hijack immediately and start your own "character_OXPs thread"
This one is about thumbles. ;)
And killing me off in proxy......

Captain Hesperus
The truth, revealed!!
Image
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2869
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

Going back to A_H's question, think "become: Explosion" probably would trigger the ship's death actions, but "landonplanet" would take it out of the game without (I think) triggering death_actions.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

May I derail this thread once again and for a second return to Maegils question?

I wouldn't work with conditions at all in an AI. I'm not even sure it's possible. At least AFAIK there is no AI like this out there.

What you want to do can be achieved much easier with the usual set of AI methods. You just have to define three states instead of your single state and roll between them.

So: first state "IDENTIFY_SLAVER" has "scanForNearestShipWithRole: slaver" in the ENTER-part. Then it needs a "TARGET_FOUND" with whatever you want to do to that target, e.g. setTargetToFoundTarget, "commsMessage: ...". Then it needs a "NOTHING_FOUND", which serves as the else-part of your condition and contains a "setStateTo: IDENTIFY_POLICE".

Second state would be said "IDENTIFY_POLICE", having "scanForNearestShipWithRole: police" in the ENTER-part, then "TARGET_FOUND" with whatever you want to do to the police, e.g. setTargetToFoundTarget, "commsMessage: ...", then "NOTHING_FOUND" as the else-part of that condition and containing a "setStateTo: IDENTIFY_PIRATE".

Third state is called "IDENTIFY_PIRATE" (you wouldn't have guessed, would you?) and looks the same. In the "NOTHING_FOUND" it has (guess!) "setStateTo: IDENTIFY_SLAVER".

You probably should insert some pauseAI before rolling to the next state, so that the AI won't be continuously busy, using system resources continuously.

Generally you should have a look into stations' and rock hermits' AI for getting examples of how to scan for various items interchangingly rather than at the same time.
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

Oo scary. I just had a BSoD experience.
Turns out a sector on my OS-HDD died.
In the process trashing a few jpg's and somehow corruption firefox.
Fresh install worked thankfully and the files lost not critical.
Hopefully this is all the damage done.

Coming back to McL's:
What he is saing about the states is right. You want seperate stages for this, as well as a pause to give the gameengine time to process the request before scanning again.

I seem to recall scripting in an AI...or rather a shipdata.plist's *_actions section,
it involves calling the method 'performScriptAction' <array> IIRC.
However generally using script in the AI is not recomended as this only updates every 'somany' seconds.
Riding the Rocket!
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

Just want to say I created a new thread in the Expansions forum conserning this Get_Hesperus.oxp.

It starts out fairly codeheavy, as you may expect from me by now, but I would highly appreciate ideas and suggestions.

I have one doubt about the way I set up the whole premiss of the OXP.
I have used the trumble mission as a trigger for the script, and added code to reset that in-built mission a few times.
Q: Should I at all interfere with and rely on the inbuilt mission or code a mirrored occasion myself, independent of the trumble mission.

Q2: Do I need to trick players into buying a trumble?
If everyone refuses to buy one, the OXP would never be activated. :(

Reasons I reset the trumblemision on several occasions:
Buying the trumble activates the script.
Many hardcore players (that are not affraid of trumbles) have already bought and exterminated theirs.
These are exactly the people that would enjoy hunting Hesperus and thus the target-audience of this OXP.
Thus the need to reset the trumble mission.
The trumble mission re-offers itself 1/100jumps of itself if turned down, so that is fine.
Riding the Rocket!
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

I've never done the trumble thingy, my original Amstrad version never had it, and I'd read on this BBS that they were a real pain in the bum, so whenever I was offered one for sale, I always refused. Now I'm never offered any, so something has kicked in somewhere to stop them being offered.
I guess I ought to have a crack at the little blighters at some stage and perhaps Get Hesperus is the answer. Mind you I suppose I ought to try the real thing, in which case how would I go about that, can I advertise somewhere?

Trumbles Wanted best prices paid - clear out your space lockers.

Or are there any ship boot sales I could visit?
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

lol.

IIRC the trumble script goes into NOTNOW mode when you refuse the offer.
This rolls a d100 everytime you dock at the mainstation at D100<2 it offers you again.
....given the odds you are overdue for an offer.

GetHesperus (currently) will actively reset the trumble at 500-1000score intervals, if you already bought one....If not, then you'll need to be patient untill the native-mission kicks in.


....I was just thinking of a junkyard sale for a second encounter option.

... In some galaxies I may just script H to appear and dissapear at certain planets.
Riding the Rocket!
User avatar
Wiggy
Deadly
Deadly
Posts: 222
Joined: Fri Jan 21, 2005 1:12 pm
Location: London, Engerland

Post by Wiggy »

Arexack_Heretic wrote:
Q2: Do I need to trick players into buying a trumble?
If everyone refuses to buy one, the OXP would never be activated.
Well, I've always turned them down, but they seem to be breeding in my saved character's plist anyway, even though they don't appear on screen.

Is this normal?
You came in that? You're braver than I thought!
User avatar
Arexack_Heretic
Dangerous Subversive Element
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:

Post by Arexack_Heretic »

If you have Aegidian's X-ships (Cobra2 etc) installed, then yes.

Otherwise your computer has been hacked and a malicious agent has edited your commanders' savefile to have EQ_TRUMBLE. ;)
Riding the Rocket!
Post Reply