New scripting questions

Post new scenarios and mods here to share with other gamers.

Moderator: AlvaroSousa

Post Reply
User avatar
stjeand
Posts: 2669
Joined: Sun Jan 10, 2021 1:14 pm
Location: Aurora, NC

New scripting questions

Post by stjeand »


Dates and flag...

I know that if_date works as equal,= only....Would it be possible to have < and > ? That would be nice.


And flag...

From what I read you can only turn a flag on...is there a way to make it so that if you set the flag and it is true it switches to false?



Desperately trying to not add 100 events to the file when I could add just 5 or 6 with the above changes.


User avatar
AlvaroSousa
Posts: 12076
Joined: Mon Jul 29, 2013 7:13 pm
Contact:

RE: New scripting questions

Post by AlvaroSousa »

if_Date + lifeSpan=tilltrigger -- on or after that date
if_Date + lifeSpan=once -- on or after that date but only check ONCE so effectively it is only on that date.
if_Date + lifeSpan=tilltrigger + XYControl or if_Alliance or other conditions -- can be made into a before incident.

Like Spain joining the Axis as long as the USA is neutral.

For flag=true or false just set the inverse. True or false is just a binary symbol.
Read the flag as false before the condition and set it as true to not have it happen.... it's just wording.

But you can't toggle back and forth the flag.

WP2 will have better scripting features.




Creator Kraken Studios
- WarPlan
- WarPlan Pacific

Designer Strategic Command
- Brute Force (mod) SC2
- Assault on Communism SC2
- Assault on Democracy SC2
- Map Image Importer SC3
User avatar
stjeand
Posts: 2669
Joined: Sun Jan 10, 2021 1:14 pm
Location: Aurora, NC

RE: New scripting questions

Post by stjeand »

if_Date + lifeSpan=once -- on or after that date but only check ONCE so effectively it is only on that date.

Alvaro thanks for the info...

Sadly I am not sure I will be able to do much with the current events then.


I had gotten a good feeling for the Date command...but would have liked to say for example that before 1943 Japan has to own Rabul to be in supply in Australia...after that they don't.

I can do that with a check every 2 weeks throughout 1941 and 1942 but that is a LOT of work.



Let me give a better example...

I am forcing the Japanese to take Borneo in order to be in supply in the DEI.
That appears to work great and is exactly what the Japanese had to do historically to keep in supply.
It keeps the DEI from falling until Feb 42 which goes perfectly in line with history.

BUT once the DEI falls the Japanese should not be required to hold every port in Borneo to keep it in supply.

I have been staring at what I can do but can not see a way to get it to work.

Was hoping to set a flag once taken and if flag is set NOT suppress ports but there is no "not" suppress command or check if flag is false suppress ports and it flag it true to do not suppress ports.


I suspect there is something I am not seeing...I will keep digging in.
User avatar
AlvaroSousa
Posts: 12076
Joined: Mon Jul 29, 2013 7:13 pm
Contact:

RE: New scripting questions

Post by AlvaroSousa »

Borneo.... Then add just more conditions like if_Country=38 (I think for NEI)... if_Surrender=false.

Which means it will only suppress the NEI ports if the NEI is not surrendered.
Creator Kraken Studios
- WarPlan
- WarPlan Pacific

Designer Strategic Command
- Brute Force (mod) SC2
- Assault on Communism SC2
- Assault on Democracy SC2
- Map Image Importer SC3
User avatar
stjeand
Posts: 2669
Joined: Sun Jan 10, 2021 1:14 pm
Location: Aurora, NC

RE: New scripting questions

Post by stjeand »

ORIGINAL: AlvaroSousa

Borneo.... Then add just more conditions like if_Country=38 (I think for NEI)... if_Surrender=false.

Which means it will only suppress the NEI ports if the NEI is not surrendered.

Perfect thanks...

Not sure why my brain did not see it...I can now come up with a few other ideas around Aus supply.

User avatar
AlvaroSousa
Posts: 12076
Joined: Mon Jul 29, 2013 7:13 pm
Contact:

RE: New scripting questions

Post by AlvaroSousa »

It's just practice. I code all the time so thinking in different ways with programming logic is just natural to me now.

Creator Kraken Studios
- WarPlan
- WarPlan Pacific

Designer Strategic Command
- Brute Force (mod) SC2
- Assault on Communism SC2
- Assault on Democracy SC2
- Map Image Importer SC3
User avatar
stjeand
Posts: 2669
Joined: Sun Jan 10, 2021 1:14 pm
Location: Aurora, NC

RE: New scripting questions

Post by stjeand »

So with the historical scenario I ran into a small issue...

With the DEI staying Allied until Feb the UK gets a LOT of oil...too much actually.

So I was trying to find a way to stop the oil until March of 42...

First attempt was to set the DEI in the editor to do not trade. That did not work.

Second attempt was to reduce the UK oil every turn by 30...but that is a pain.

Third attempt is to change the rail line to Pelembang to a road the back to a rail if Japan captures the DEI or the Allies still have it in March of 42.
But that does not seem to be working either.

//DEI rail to Palembang is added so that Japan can receive oil upon capture
$ChangeLogistics
//if_Date=2/1/1942
if_Date=1/1/1939
if_Country=18
if_Surrender=true
lifespan=tillTrigger
actionCountry=8
//Change road to rail
xyArea=41,36,22
addReportTo=Axis
text=With the surrender of the DEI the oil pipeline is rebuilt and oil starts to flow to the empire.
$End

//DEI rail to Palembang is added so that UK can receive oil if it has not fallen by Feb 3/1/42
$ChangeLogistics
if_Date=3/1/1942
if_Country=18
if_Surrender=false
lifespan=tillTrigger
actionCountry=18
//Change road to rail
xyArea=41,36,22
addReportTo=Allies
text=DEI engineers have repaired the oil lines near Palembang. Oil production is at full capacity.
$End


I thought the last number was a sprite but that does not appear to be the case it appears to be a logistics number.

Where can I find those? When I check the editor I don't see that anywhere.
Post Reply

Return to “Scenario Design and Modding”