Questions to devs and specialists concerning scripts

Please post here for questions and discussion about modding for Strategic Command.
Post Reply
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Questions to devs and specialists concerning scripts

Post by welk »

In this thread, I will post all questions and understanding problems I find in my documentation work about scripting

First is : In CONVOY script (I am studying it), I read that:

#SOURCE_PORT must belong to #SENDER_ID. The total amount of MPP available will be dependant
; upon the amount of MPP belonging to #SENDER_ID. After this, the #MAX_PERCENTAGE value caps the
; max amount transferable, while the #PERCENTAGE value is the current transfer amount.


ok.
But who decides to use PERCENTAGE value in place of max PERCENTAGE value (or reverse) ? I do not undertsand how these 2 parameters work in combination. What is the function of MAX PERCENTAGE value ? To limit sending ? ok. But what are the conditions of the use of a such limitation ? (in other terms : what decides that MAX PERCENTAGE value has to be applied and why ?) Explanation notes are not very clear for this when player has comprehensive pb with english language


EDIT : Possible solution :
=> Percentage value is a % of awailable MPP of the sender
=> Max percentage value is not a % (despite the name), it's a fix limit.
Is this interpretation ok ?

In this case, the terms of MAX AMOUNT should have been used in place of MAX PERCENTAGE
User avatar
BillRunacre
Posts: 6650
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Questions to devs and specialists concerning scripts

Post by BillRunacre »

The amount of MPPs a country could send could vary considerably during a game, as its economy grows, hence it is set at a % so the amount can be sent in proportion.

If a convoy is sailing from a Major like the USA, then having a different minimum and maximum value means that the US can determine how much or how little of its income to send, i.e. we are giving players control of this, and they can modify the % at any point, and as many times as they like.
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Thanks, cool feature.

Another questions :


1°/ in loop event basic structure, I have seen that :
More than one #START_POSITION as well as #FINISH_POSITION can be set

Is it the same for #FRIENDLY_POSITION ? (no precisions are given about that in texte notes, I think it's "yes" but no sure, I prefer to ask)

2°/ In MOBILIZATION 1 script file, i have seen this script :
;REMOVE1941
;
; General surrenders to Axis resulting in a
; random 3-5% increase in Italian mobilization towards Axis:
{
#NAME= General Surrenders To Axis (Italy->Axis)
#POPUP=
#IMAGE=
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#GV= 1[1,100]
#LINK= 600[1]
#LEVEL= 0
#COUNTRY_ID= 59
#TRIGGER= 100
;3-5% mobilization increase towards Axis
#MOBILIZATION= [3,5] [1]
;General surrenders to Axis forces
#CONDITION= 0 [0] [1]

}


What means General surrenders to Axis forces ? Does it means that all Allied countries have surendered to Axis ? In this case, I suppose that game ends... Then, what is the interest to increase mobilization of Italy ?

Perhaps dummy question, but the difficulty of a foreign language is a real problem to understand things with precision.
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Another question (two other questions are in precedent post)

In some scripts, the TYPE command is that :

With all other fields satisfied will this be:
; 0 = Single check regardless if #TRIGGER is satisfied
; 1 = Multiple check until #TRIGGER is satisfied
; 2 = Reoccuring check until end of game

ok, no problem with : it makes sense.

In some other scripts, the TYPE command is that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
1 = Multiple check until #TRIGGER is satisfied
2 = Reoccuring check until end of game
OR
Once the #DATE field is satisfied :
3 = Event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again

MY QUESTIONS ARE: :


QUESTION A : Why did you choiced this curious redaction ?

You could have simply written that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
1 = Multiple check until #TRIGGER is satisfied
2 = Reoccuring check until end of game
3 = Once the #DATE field is satisfied, event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again

Why did you add this "OR" between choice 2 and choice 3 ? Probably is there a specific reason, would be usefull to know it

You could also have written that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
OR
1 = Multiple check until #TRIGGER is satisfied
OR
2 = Reoccuring check until end of game
OR
3 = Once the #DATE field is satisfied, event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again

But you did not : there is just a unic "OR" between choice 2 and choice 3 : it's a little bit confusing (perhaps dummy interrogation, but again : problem of foreign language, that does not facilitate the comprehension)

QUESTION B:

What will happends (for all choices 0,1,2 and 3) if I let the #DATE field empty ?

QUESTION C :

It's a general question : in some scripts, i noticed that some #fields are empty : I suppose that in these cases, it means that no any condition is set (asked) for the concerned #field

Is it right for all #field ? In other termes, may I let empry any #field when I want ?

Sorry for my very "basic english", but it is not easy to combin logic system and foreign language



EDIT : Incidently, after examining the model for National moral script, I noticed a little mistake at the end :

; #CONDITION_POSITION= Map positions that will serve to trigger the event as well as distance and
; number of Axis/Allied unit ranges as specified by 'alignment' flag
; Format: x,y [min_range, max_range] [min_units, max_units] [alignment] [aligned_country_id]
;
; NOTES:


=> In my install (the last updated), the } symbol is missing at the end of the model, it should have been before "NOTES"

I also made this kind of little error in the scripts learning docs : I have sometimes written a { in place of a }, by careless mistake, I will rectify that in nex update. Evil is in details... :mrgreen:
User avatar
BillRunacre
Posts: 6650
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Questions to devs and specialists concerning scripts

Post by BillRunacre »

welk wrote: Sun Aug 03, 2025 3:26 pm
Another questions :


1°/ in loop event basic structure, I have seen that :
More than one #START_POSITION as well as #FINISH_POSITION can be set

Is it the same for #FRIENDLY_POSITION ? (no precisions are given about that in texte notes, I think it's "yes" but no sure, I prefer to ask)
I'm not sure, best to run a test in Hotseat mode.

welk wrote: Sun Aug 03, 2025 3:26 pm 2°/ In MOBILIZATION 1 script file, i have seen this script :
;REMOVE1941
;
; General surrenders to Axis resulting in a
; random 3-5% increase in Italian mobilization towards Axis:
{
#NAME= General Surrenders To Axis (Italy->Axis)
#POPUP=
#IMAGE=
#SOUND=
#FLAG= 1
#TYPE= 2
#AI= 0
#GV= 1[1,100]
#LINK= 600[1]
#LEVEL= 0
#COUNTRY_ID= 59
#TRIGGER= 100
;3-5% mobilization increase towards Axis
#MOBILIZATION= [3,5] [1]
;General surrenders to Axis forces
#CONDITION= 0 [0] [1]

}


What means General surrenders to Axis forces ? Does it means that all Allied countries have surendered to Axis ? In this case, I suppose that game ends... Then, what is the interest to increase mobilization of Italy ?
This means that any country surrendering to the Axis will trigger this script.
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
User avatar
BillRunacre
Posts: 6650
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Questions to devs and specialists concerning scripts

Post by BillRunacre »

On the questions above, with B I am pretty sure that the date field always has to be completed, and with C, most fields do need to be completed, but some fields can in some scripts be left empty. The default is to fill them.
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Ok, thanks

And for QUESTION A ? (I reproduce it here above )


In some scripts, the TYPE command is that :

With all other fields satisfied will this be:
; 0 = Single check regardless if #TRIGGER is satisfied
; 1 = Multiple check until #TRIGGER is satisfied
; 2 = Reoccuring check until end of game

ok, no problem with : it makes sense.

In some other scripts, the TYPE command is that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
1 = Multiple check until #TRIGGER is satisfied
2 = Reoccuring check until end of game
OR
Once the #DATE field is satisfied :
3 = Event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again


QUESTION A : Why did you choiced this curious redaction ?

You could have simply written that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
1 = Multiple check until #TRIGGER is satisfied
2 = Reoccuring check until end of game
3 = Once the #DATE field is satisfied, event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again


You could also have written that :
With all other fields satisfied will this be:
0 = Single check regardless if #TRIGGER is satisfied
OR
1 = Multiple check until #TRIGGER is satisfied
OR
2 = Reoccuring check until end of game
OR
3 = Once the #DATE field is satisfied, event fires once if all other fields are satisfied, else it will not fire. Either way, event will be removed never to be looked at again


But you did not : there is just a unic "OR" between choice 2 and choice 3 : it's a little bit confusing (perhaps dummy interrogation, but again : problem of foreign language, that does not facilitate the comprehension)


Why did you add this "OR" between choice 2 and choice 3 ? Probably is there a specific reason, would be usefull to know it
User avatar
BillRunacre
Posts: 6650
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Questions to devs and specialists concerning scripts

Post by BillRunacre »

Ah, I think I understand your question now.

Basically, TYPE= 3 can only fire on the turn that matches the date given.

The others can fire on and/or after that date.

Hopefully that makes sense?
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

ok, thanks : it makes also sense with this precision.

Logic of scripts is very interessant but hard to explore with a foreign language, because I use a translator : it's a good tool but sometimes it has incoherent translations :?
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

In quasi all scripts, I found that :

#TRIGGER= Trigger percentage that the event will occur (values range [0, 100])

ok.

And I found also that :

#GV= Ten random Global Variables are assigned at the start of the campaign each with a value between [1,100]
Format: GV [min, max]; GV range [1,10]; min range [1,100]; max range [1,100]

Example A) #GV= 1[1,100] will always trigger because Global Variable #1 will always have a value between [1,100]
Example B) #GV= 4[71,100] will trigger 30% per game

Due to the fact that the 10 awailable #GV are just abstractive %, the unic goal of these #GV in comparrison with #trigger seems to more randomize the fire of a script (#GV allows to have more than one unic %).

Is it the good interpretation or am I wrong ?

Additionnal question : May I have more than one #GV in the same script ?

EDIT : And incidently, would be interessant to have a VICTORY SCRIPT based on a difference of losses between the 2 sides (and independant of map positions)
User avatar
BillRunacre
Posts: 6650
Joined: Mon Jul 22, 2013 2:57 pm
Contact:

Re: Questions to devs and specialists concerning scripts

Post by BillRunacre »

You are right that it increases the randomization.

Essentially it can be used to make a script fire in some games but not all games, even if the same conditions are met.

Only one #GV can be used per script.
Follow us on Twitter: https://twitter.com/FurySoftware

We're also on Facebook! https://www.facebook.com/FurySoftware/
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Ok, thanks Bill, I will include this info in my doc tool scripts
https://forums.matrixgames.com/viewtopic.php?t=412294

If you have some tips, precisions, etc about scripting, they are welcome. The goal is to centralize in a public doc all tips, infos, precisions about scripting
rmelvin
Posts: 222
Joined: Wed Apr 06, 2022 1:41 am
Location: Tucson, Arizona

Re: Questions to devs and specialists concerning scripts

Post by rmelvin »

I use GV in many different ways. Given GV number is set at the beginning of the game.
I use GV for #Amphibious & #Amphibious_minor so the buildup can be the same, but different landing zones.
Example GV 1[1,50] land zone A and GV 1[51,100] land zone B.

Use GV for #Purchase and #Research. I have three different GV for each major country (example GV 1{1,30], GV 1[31,60], GV 1[61,100]).
With three different GV for each major country. Each major country #Purchase and #Research can product one of three different scenarios for each major country per game.
My GV are.
Infantry, Armour and Air/Naval, means #Purchase and #Research concentrate on those elements not at the exclude of the others.
One game Italy is Infantry and UK is Air/Naval.
Next game Italy is Armour and UK Armour. Tanks clash in the desert.
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Example GV 1[1,50] land zone A and GV 1[51,100] land zone B.

Use GV for #Purchase and #Research. I have three different GV for each major country (example GV 1{1,30], GV 1[31,60], GV 1[61,100]).


How can you have 3 GV with same N° ? It's curious, I do not understand. Seems there are only 10 allowed GV per campaign, each with a different n° (1 to 1O)

Or perhaps is it that : There are 1 to 10 max GV in a game (campaign), and each GV may have only one unic N°. But each GV may have different values in different scripts. Is my interpretation correct ? Things are not easy to understand in a foreign language (frenchies frogs and subtilities of english language are not friends :mrgreen: )
rmelvin
Posts: 222
Joined: Wed Apr 06, 2022 1:41 am
Location: Tucson, Arizona

Re: Questions to devs and specialists concerning scripts

Post by rmelvin »

I assign a GV to each major country. Like UK is GV 1[1,100] then with #Amphibious I wrote script for land zone A using GV 1[1,50] and land zone B using GV 1[51,100]. This way there is a 50% per game the UK will land in either Landing Zone A or Landing B. Now the Axis must defend both areas or hold in reserve and wait. To see were the UK lands.

In #Purchase and #Research the UK is set to
GV 1[1,40] = Infantry -> Concentrates on Infantry type unit and research per game
GV 1[41,80] = Armour -> Concentrates on Armour type unit and research per game
GV 1[81,100] = Air/Naval -> Concentrates on Air/Naval type units and research per game.
If UK gets a GV 1[53] at the start of the game
A higher percent for #Purchase and #Research is assigned to Armour type unit and research for that game.
This way each major AI country has one of three possible ways AI conducts the game.

France is GV 2[1,100]
USA is GV 3[1,100]
USSR is GV 4[1,100]
Poland is GV 5[1,100]
Germany is GV 6[1,100]
Italy is GV 7[1,100]
not assigned GV 8..10[1,100]
welk
Posts: 995
Joined: Sun Sep 17, 2006 6:41 pm
Location: France

Re: Questions to devs and specialists concerning scripts

Post by welk »

Ok, I understand what you means, very interresting way to ramdom game.

I suppose (is it ok ?) that the "assignement" (GV 1=Uk, GV2= France etc) is only in your "private" doc gestion, there is no any "declaration of value" like in programmation (= I suppose you have not to "declare" assignement to the engine)
Post Reply

Return to “Scenario Design and Modding”