Array values get overwritten between turns

Modders can post their questions on scripting and more.

Moderators: Slitherine Core, BA Moderators

Post Reply
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Array values get overwritten between turns

Post by rf900 »

Was using the arrays (tried the 4 of them) to store some info that I need, but it seems they are getting filled with other values between turns. Is there any other way to use them or do I have to put all data in UniversalVars?
pipfromslitherine
Site Admin
Site Admin
Posts: 9863
Joined: Wed Mar 23, 2005 10:35 pm

Re: Array values get overwritten between turns

Post by pipfromslitherine »

The AI (amongst other things) uses the scratchpad arrays, so as you have found out you cannot rely on them to store non-temporary data. What kind of data do you need to store for extended periods?

Cheers

Pip
follow me on Twitter here
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Array values get overwritten between turns

Post by rf900 »

It was the cost of the units so I could easily look for it with a loop, I will try to do it with normal variables and the WorkingString trick.
rf900
Staff Sergeant - Kavallerie
Staff Sergeant - Kavallerie
Posts: 339
Joined: Fri May 04, 2012 6:59 am

Re: Array values get overwritten between turns

Post by rf900 »

Brrr, simple enough, just need to initialize the array every turn. I was doing it in the panel INIT function which apparently is only called once on creation.
Post Reply

Return to “Battle Academy : Modders Corner ”