Author Topic: Setup Scripts  (Read 3516 times)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Setup Scripts
« Reply #15 on: July 26, 2012, 11:40:54 am »
- Campaign types (specifically: the string constants for the various defender mode durations)
Code: [Select]
public enum CampaignType
{
    Conquest,
    Defender15,
    Defender30,
    Defender45,
    Defender60,
    Defender90,
    Defender120,
    Defender240,
    Length
}



Quote
- Unit cap scale types (mostly whether it's "Ultra_Low" or "UltraLow")
Code: [Select]
public enum UnitCapScaleType
{
    Low,
    Normal,
    High,
    UltraLow,
}



Quote
- Fog of War types
Code: [Select]
public enum FogOfWarType
{
    None,
    PlanetOwnershipAlwaysVisible,
    Full,
    Extra
}



Quote
- The accepted parameters for the various SetAccessbility_* functions
Code: [Select]
public enum LobbySettingAccessibility
{
    Normal,
    ShowButLock,
    LockAndDoNotShow
}




Quote
- Data types available for DeclareVariable()
Code: [Select]
public enum TextScenarioVariableType
{
    None,
    Int,
    String
}

As mentioned before, ignore the "None" and "Length" enum values for script purposes.  I would just omit them from these postings but it's faster and more reliable (from the perspective of making sure all the relevant info is included) to just post the enums as defined.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #16 on: July 26, 2012, 12:05:27 pm »
And if there were specific other things you wanted in each bundle (like turning on/off schizo waves, turning on/off Avenger, etc) they could go in the right block.
Um what do you mean by right block?
I tried adding these but didn't work
RemoveOptionalShipCategory("Swallowers");
AddAIModifier("Schizophrenic");
« Last Edit: July 26, 2012, 12:26:27 pm by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Setup Scripts
« Reply #17 on: July 26, 2012, 12:26:22 pm »
And if there were specific other things you wanted in each bundle (like turning on/off schizo waves, turning on/off Avenger, etc) they could go in the right block.
Um what do you mean by right block?
block = a pair of { }'s with stuff in between :)  There are three blocks in the example I gave on how you could specify particular pairs of AI types.

right block = the block you want the other settings to go in.  So if you want the RaidEngine/OneWayDoormaster pair to also have a -20 handicap the first block is the one you want.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #18 on: July 26, 2012, 12:56:12 pm »
And if there were specific other things you wanted in each bundle (like turning on/off schizo waves, turning on/off Avenger, etc) they could go in the right block.
Um what do you mean by right block?
block = a pair of { }'s with stuff in between :)  There are three blocks in the example I gave on how you could specify particular pairs of AI types.

right block = the block you want the other settings to go in.  So if you want the RaidEngine/OneWayDoormaster pair to also have a -20 handicap the first block is the one you want.
I have no idea what I'm supposed to do.
Code: [Select]
{
AddAIModifier("Schizophrenic");
SetFirstAIType("Raid_Engine");
SetSecondAIType("OneWayDoormaster");
}
Like this?? Didn't work.

Just adding it like this..
Code: [Select]
AddAIModifier("Schizophrenic");..didn't work either

Code: [Select]
RemoveOptionalShipCategory("Swallowers");Where do I put this?

Code: [Select]
RemoveOptionalShipCategory();and
Code: [Select]
AddOptionalShipCategory();don't seem to work at all ::)
« Last Edit: July 26, 2012, 01:18:32 pm by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: Setup Scripts
« Reply #19 on: July 26, 2012, 01:21:22 pm »
Below is the code Keith provided, with English commentary on the right explaining what is happening.  The lines "...Specific Settings..." and "...General Settings..." are the places you add new lines.  If you want the settings (such as removing Swallowers) to apply to every AI combination, put it in the place I put "...General Settings...".  If you want it to apply to some but not all combos, put it in the "...Specific Settings..." for each combo.  That means if it applies to all but one combo, you'll have to put it in every single combo except that one you don't want it to apply to.

Code: [Select]
SetIntVariableToRandom("RandomRoll",1,3);    |  Pick a number from 1 to 3
IfLeftIntEqualToRightInt(RandomRoll,1)       |  If that number is a 1 then do this:
{                                            |
  SetFirstAIType("Raid_Engine");             |    Set the First AI to Raid Engine
  SetSecondAIType("OneWayDoormaster");       |    Set the Second AI to One-Way Doormaster
  ...Specific Settings...                    |
}                                            |
IfLeftIntEqualToRightInt(RandomRoll,2)       |  If that number was a 2 then do this instead:
{                                            |
  SetFirstAIType("SpeedRacer");              |    Set the First AI to Speed Racer
  SetSecondAIType("TagTeamer");              |    Set the Second AI to Tag Teamer
  ...Specific Settings...                    |
}                                            |
IfLeftIntEqualToRightInt(RandomRoll,3)       |  If that number was a 3 then do this instead:
{                                            |
  SetFirstAIType("SpireHammer");             |    Set the First AI to Spire Hammer
  SetSecondAIType("SupportCorps");           |    Set the Second AI to Support Corps
  ...Specific Settings...                    |
}                                            |
...General Settings...                       |

If you want more than 3 combos, just change the first line to pick a random number that goes up to the number of combos you want.  Then copy-and-paste one of the sections that begins with "IfLeftIntEqualToRightInt" and that ends with a } symbol.  Update the number on the first line after you paste it in so that it is unique.  Do this for each new combo.  Make sure if the first line is picking a number from 1 to 9, you have an IfLeftIntEqualToRightInt line for each number 1 through 9.  If you miss one then one in nine times your script won't work.

IMPORTANT: The lines ...Specific Settings... and ...General Settings... are not real code!  Don't copy and paste them in!  They are just marking the place where you add new lines.

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #20 on: July 26, 2012, 01:39:30 pm »
Code: [Select]
IfLeftIntEqualToRightInt(RandomRoll,1)
{
SetFirstAIType("Raid_Engine");
SetSecondAIType("OneWayDoormaster");
}
IfLeftIntEqualToRightInt(RandomRoll,2)
{
SetFirstAIType("SpeedRacer");
SetSecondAIType("TagTeamer");
}
IfLeftIntEqualToRightInt(RandomRoll,3)
{
SetFirstAIType("SpireHammer");
SetSecondAIType("SupportCorps");
AddAIModifier("Schizophrenic");
}

nor

Code: [Select]
IfLeftIntEqualToRightInt(RandomRoll,1)
{
SetFirstAIType("Raid_Engine");
SetSecondAIType("OneWayDoormaster");
}
IfLeftIntEqualToRightInt(RandomRoll,2)
{
SetFirstAIType("SpeedRacer");
SetSecondAIType("TagTeamer");
}
IfLeftIntEqualToRightInt(RandomRoll,3)
{
SetFirstAIType("SpireHammer");
SetSecondAIType("SupportCorps");
}
AddAIModifier("Schizophrenic");

worked.

Adding "AddAIModifier("Schizophrenic");" anywhere messes up the script and I get some "random" stuff selected in the lobby. I remove "AddAIModifier("Schizophrenic");" and the script works. Same thing with the "RemoveOptionalShipCategory("Swallowers");".

Am I missing something or are these lobby script things bugged?
« Last Edit: July 26, 2012, 01:46:45 pm by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline Hearteater

  • Core Member
  • *****
  • Posts: 2,334
Re: Setup Scripts
« Reply #21 on: July 26, 2012, 01:46:44 pm »
Try using these two lines instead in both places:
Code: [Select]
RemoveOptionalShipCategory("Swallowers");
RemoveOptionalShipCategory("Mines");

That way we can rule out something odd in the AddAIModifier() function.  Sorry I'm not at home to just bang through this myself.

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #22 on: July 26, 2012, 01:57:43 pm »
Nope. Doesn't work.

First I copied the Beginner script thing and then I edited it:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<root
GrammarVersion="2"
SortOrder="1"
Name="test2"
Description="test.">
<LobbySetupScriptOperations>
DeclareVariable("Int","RandomRoll");

SetNumberOfPlanets(80);

SetMapStyle("Simple");
SetCampaignType("Conquest");
SetShipDifficulty("Complex");
SetCombatStyle("FastAndDangerous");
SetUnitCapScale("Normal");
SetFogOfWarType("Full");
SetShowUnexploredPlanets(1);
SetAutoAIPMagnitude(0);
SetAutoAIPInterval(0);

SetFirstAIDifficulty(10,0);
SetFirstAIHandicap(0);
SetSecondAIDifficulty(10,0);
SetSecondAIHandicap(0);
SetIntVariableToRandom("RandomRoll",1,3);
IfLeftIntEqualToRightInt(RandomRoll,1)
{
SetFirstAIType("Raid_Engine");
SetSecondAIType("OneWayDoormaster");
}
IfLeftIntEqualToRightInt(RandomRoll,2)
{
SetFirstAIType("SpeedRacer");
SetSecondAIType("TagTeamer");
}
IfLeftIntEqualToRightInt(RandomRoll,3)
{
SetFirstAIType("SpireHammer");
SetSecondAIType("SupportCorps");
}

RemoveAllAIModifiers();
RemoveAllFirstPlayerAIPlots();
RemoveAllSecondPlayerAIPlots();
RemoveAllMinorFactions();

SetFirstAIPlayerAIPlotIntensity("Avenger",1);
SetSecondAIPlayerAIPlotIntensity("Avenger",1);
SetFirstAIPlayerAIPlotIntensity("AstroTrains",1);
SetSecondAIPlayerAIPlotIntensity("AstroTrains",1);
SetFirstAIPlayerAIPlotIntensity("EXP2_Subroutines",3);
SetSecondAIPlayerAIPlotIntensity("EXP2_Subroutines",3);
SetFirstAIPlayerAIPlotIntensity("EXP2_AdvancedSubroutines",7);

SetMinorFactionIntensity("HumanResistanceFighters",2);
SetMinorFactionIntensity("ZenithTraders",1);
SetMinorFactionIntensity("ZenithMiners",6);
SetMinorFactionIntensity("ZenithDysonSphere",2);
SetMinorFactionIntensity("ZenithDevourer",1);
SetMinorFactionIntensity("NeinzulRocketryCorps",10);
SetMinorFactionIntensity("NeinzulRoamingEnclaves",2);
SetMinorFactionIntensity("BrokenGolemsHard",4);
SetMinorFactionIntensity("SpirecraftHard",4);

</LobbySetupScriptOperations>
</root>
THIS works as intended but..

..adding "RemoveOptionalShipCategory("x"); or "AddAIModifier("Schizophrenic");" in those 2 places or anywhere else causes the script to stop working.

I tried removing "RemoveAllAIModifiers();" and "AddAllOptionalShipCategories();" but didn't help. I also tried removing all optional ship categories and adding those I want but Nnnope..
« Last Edit: July 26, 2012, 02:10:47 pm by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Setup Scripts
« Reply #23 on: July 26, 2012, 02:24:46 pm »
Sorry about that, turns out I never added parsing logic for the specific Add/Remove functions for AIModifier and OptionalShipCategory to the new grammar.  Thankfully their implementation was already there and working from the earlier grammar implementation, so I just had to tell it to read those particular command names :)

So in 5.050 (which I hope to have out tonight) the following script will work:

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<root
GrammarVersion="2"
SortOrder="1"
Name="Test"
Description="Test">
<LobbySetupScriptOperations>
DeclareVariable("Int","RandomRoll");

SetNumberOfPlanets(80);

SetIntVariableToRandom("RandomRoll",1,1999999999);
SetMapSeed(RandomRoll);

SetMapStyle("Simple");
SetCampaignType("Conquest");
SetShipDifficulty("Simple");
SetCombatStyle("FastAndDangerous");
SetUnitCapScale("Normal");
SetFogOfWarType("Full");
SetShowUnexploredPlanets(1);
SetAutoAIPMagnitude(1);
SetAutoAIPInterval(30);

SetFirstAIDifficulty(6,0);
SetFirstAIHandicap(0);

SetSecondAIDifficulty(6,0);
SetSecondAIHandicap(0);

AddAllOptionalShipCategories();
RemoveAllAIModifiers();
RemoveAllFirstPlayerAIPlots();
RemoveAllSecondPlayerAIPlots();
RemoveAllMinorFactions();

AddAIModifier("Schizophrenic");
AddAIModifier("DoubleWaves");

RemoveOptionalShipCategory("Swallowers");
RemoveOptionalShipCategory("Teleporting");

SetIntVariableToRandom("RandomRoll",1,3);
IfLeftIntEqualToRightInt(RandomRoll,1)
{
SetFirstAIType("Raid_Engine");
SetSecondAIType("OneWayDoormaster");
RemoveAIModifier("DoubleWaves");
}
IfLeftIntEqualToRightInt(RandomRoll,2)
{
SetFirstAIType("SpeedRacer");
SetSecondAIType("TagTeamer");
AddOptionalShipCategory("Teleporting");
}
IfLeftIntEqualToRightInt(RandomRoll,3)
{
SetFirstAIType("SpireHammer");
SetSecondAIType("SupportCorps");
RemoveAIModifier("Schizophrenic");
AddOptionalShipCategory("Swallowers");
}
</LobbySetupScriptOperations>
</root>
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #24 on: July 26, 2012, 02:43:43 pm »
Sorry about that, turns out I never added parsing logic for the specific Add/Remove functions for AIModifier and OptionalShipCategory to the new grammar.
Aahha! I knew it!


So in 5.050 (which I hope to have out tonight) the following script will work:
Yay!
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!

Offline _K_

  • Full Member Mark III
  • ***
  • Posts: 219
Re: Setup Scripts
« Reply #25 on: July 27, 2012, 10:01:01 am »
Alright, i have done some playing around with the scripts. Got more questions:

How do i go about using matemathical operations between variables?

For example i want to use something like

x:=  x*y

How do i do that? So far i have only seen "SetIntVariableToSum", which obviously only works for sums.

At the very least i need multiplication, division, and, uh difference, hopefully squaring and rooting.

For difference i tried using "SetIntVariableToSum("x",x, -10), but the parser reads the "-" as a string, resulting in an error.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Setup Scripts
« Reply #26 on: July 27, 2012, 10:13:30 am »
At the very least i need multiplication, division, and, uh difference, hopefully squaring and rooting.
There's no multiply, divide, or root (considering squaring as a case of multiply).  I'm having a hard time seeing where one would need root, and even multiply and divide seem like they wouldn't be needed by what's basically a relatively simple set of operations.  But I can put it on my list to add multiply and divide.

Quote
For difference i tried using "SetIntVariableToSum("x",x, -10), but the parser reads the "-" as a string, resulting in an error.
Hmm, that might work with two variables (one which happened to be negative) but the operation I defined for that purpose is: SetIntVariableToLeftMinusRight("x",x,10);

Some of the operation names are way more verbose than I'd like, but they obviate the need for any lookahead on the syntactic parsing, which is of great help to keeping the parsing simple.  One function name = one purpose :)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Kahuna

  • Core Member
  • *****
  • Posts: 2,222
  • Kahuna Matata!
Re: Setup Scripts
« Reply #27 on: July 29, 2012, 06:38:09 am »
All commands and stuff put together in a text file. Handy when making your own scripts.
« Last Edit: July 29, 2012, 06:39:53 am by Kahuna »
set /A diff=10
if %diff%==max (
   set /A me=:)
) else (
   set /A me=SadPanda
)
echo Check out my AI War strategy guide and find your inner Super Cat!
echo 2592 hours of AI War and counting!
echo Kahuna matata!