If SetArray is called,will its value remained active to the next turn

Moderator: rbodleyscott

Post Reply
locustmustdie
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 117
Joined: Fri Mar 05, 2021 11:33 am

If SetArray is called,will its value remained active to the next turn

Post by locustmustdie »

Code: Select all

SetArray(me,value,index);
Will the value of the array remained to the next turn? Is there clearArray() function to handle this?
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28274
Joined: Sun Dec 04, 2005 6:25 pm

Re: If SetArray is called,will its value remained active to the next turn

Post by rbodleyscott »

locustmustdie wrote: Fri Mar 03, 2023 6:09 am

Code: Select all

SetArray(me,value,index);
Will the value of the array remained to the next turn?
There is really only one 256 x 8 system array, and it is likely to be re-used by the vanilla scripts in the interim. So don't try using it. It is rather a fossil leftover from the old STUB engine, anyway. ARCHON supports proper user defined global variables and arrays. The old system Array is only used in the current scripts because it wasn't worth changing them in code carried forward from Pike and Shot when we switched engines.

The cool ARCHON kids are now using proper global arrays for anything that needs to persist outside the function it is in. You can see how these are created in Globals.bsf and LiaisonTools.bsf.

I cannot think of any reason why they cannot be defined in a scenario script.

Make sure you don't use any of the existing global variable names. As far as I recall, they are all in those two files.
Is there clearArray() function to handle this?
ClearArray(value, [array]);

-------------------------

Note that while Attribs and AttribArrays are automatically set to 0 at the start of each battle, global variables and arrays are not, so if you need old data to be cleared from them at the start of each battle, you will need to script that yourself.
Richard Bodley Scott

Image
locustmustdie
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 117
Joined: Fri Mar 05, 2021 11:33 am

Re: If SetArray is called,will its value remained active to the next turn

Post by locustmustdie »

Thanks,Richard! I believe with the help of array,some skyrocket length segments can be avoided.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28274
Joined: Sun Dec 04, 2005 6:25 pm

Re: If SetArray is called,will its value remained active to the next turn

Post by rbodleyscott »

locustmustdie wrote: Fri Mar 03, 2023 9:17 am Thanks,Richard! I believe with the help of array,some skyrocket length segments can be avoided.
I won't pretend to understand that.

As I say, DO NOT USE THE SYSTEM ARRAY! (Can't be clearer than that)
Richard Bodley Scott

Image
locustmustdie
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 117
Joined: Fri Mar 05, 2021 11:33 am

Re: If SetArray is called,will its value remained active to the next turn

Post by locustmustdie »

rbodleyscott wrote: Fri Mar 03, 2023 10:28 am
locustmustdie wrote: Fri Mar 03, 2023 9:17 am Thanks,Richard! I believe with the help of array,some skyrocket length segments can be avoided.
I won't pretend to understand that.

As I say, DO NOT USE THE SYSTEM ARRAY! (Can't be clearer than that)
got it
Post Reply

Return to “Field of Glory II: Medieval - Scenario Design”