Set declaration madness

More
19 years 9 months ago #18191 by lo-tekk
Hi all there,

i get mad about being unable to declare a set variable.
A declaration set local_ships; will always generate
a syntax error. If i compile a premade mod like Station Assault
all works fine. The same with group declaration: cannot define
a group like hgroup fighter_group;.
What the hell is wrong with it.

Any ideas welcome. Thanks in advance.

Please Log in or Create an account to join the conversation.

More
19 years 9 months ago #11146 by GrandpaTrout
Welcome to the board lo-tekk. Without seeing the exact error message and a code file the cause of the error is hard to guess, but I will try. The Set and Group types are declared in seperate header files. And you must include those header files in your new program to use those types. Check out the top lines of the station assault pog code for examples.

Also syntax errors in POG are not all ways caught instantly. So it could be that your problem is a few lines up the file, but the compiler does not throw the error until it hits the declaration. Left off a semicolon after an enum or something.

-Gtrout

Please Log in or Create an account to join the conversation.

More
19 years 9 months ago #11151 by Second Chance
Yeah, that's the real trick to the Pog compiler. Always look for your problem one line above where the compiler says it is. And don't forget those include files, they'll getcha every time. :D

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 9 months ago #11160 by lo-tekk
Replied by lo-tekk on topic Set declaration madness
Thank you for the quick reply,

without the set declaration code works fine.
Here the compiler message and source

Compiling source file C:\POG\PROJECT\TEST.POG...

Translating...
C:\POG\PROJECT\TEST.POG(53) : Error: Syntax error ("set")


// Package name
package iTest;
// Imports - the other packages we are using in this script.
uses Sim,
iShip,
iSim,
INIFile,
Debug,
Global,
iHUD,
iHabitat,
iMapEntity,
List,
Set,
Object,
String,
Task,
Text,
iUtilities,
Math,
iPilotSetup,
iFormation,
iAI,
iShipCreation,
iCargoScript,
iScriptedOrders,
iComms,
iInventory,
iEmail;

// Exports
provides Main;

// Enumerators (optional) - Any enumerators for the script defined here.

// Prototypes
prototype Main();
prototype task ShipTracker();
prototype task bounty_spawn();

Main()
{
start ShipTracker();
}

task ShipTracker()
{
hmapentity pos1;
hship player_ship;
hship marauder1;
hfaction marauder_faction;
pos1 = iMapEntity.FindByName("Lucrecia's Base");

set local_fighters; // This is the set

marauder1 = iShip.Cast( Sim.Create( "ini:/sims/ships/marauder/marauder_cutter_weak", "Paule" ) );
marauder_faction = iFaction.Find( "Marauders" );
Sim.PlaceNear( marauder1, pos1, 30000 );
iPilotSetup.Marauder( marauder1 );
iSim.SetFaction( marauder1, marauder_faction );
player_ship = iShip.FindPlayerShip();

schedule {
every 1: {
if( iSim.IsDying( marauder1) == true )
{
iHUD.Print( "Marauder ist tot");
Task.Detach( start bounty_spawn() );
break;
} //endif
} //end every second
} // end schedule
} // end create some ship

task bounty_spawn()
{
hship cargo_pod;
hship player_ship;
hsim marauder1;

player_ship = iShip.FindPlayerShip();
marauder1 = Sim.FindByName( "Paule" );
cargo_pod = iShip.Cast(Sim.Create( "ini:/sims/ships/utility/cargo_pod", "IFF Code" ));

Sim.PlaceNear( cargo_pod, marauder1, 1000 );
schedule {
every 1 : {
if( iSim.IsDockedTo( player_ship, cargo_pod ) == true )
{
iHUD.Print("IFF Code collected");
iInventory.Add(300,1); // Adds IFF_Beacon
break;
}
}
}
}


Thank you for any reply

Please Log in or Create an account to join the conversation.

More
19 years 9 months ago #11163 by Second Chance
Here's your problem right here:

pos1 = iMapEntity.FindByName("Lucrecia's Base");

You can't assign a value to a variable during declaration.

Like I said, one line above.

mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.

Please Log in or Create an account to join the conversation.

More
19 years 9 months ago #11165 by lo-tekk
Replied by lo-tekk on topic Set declaration madness
Hi SecondChance,

that#180;s great, thank you !
Would have never found this.

Bye

Please Log in or Create an account to join the conversation.