0 registered members (),
677
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Impossible to call stored AlgoVar2 variables.
#476713
03/25/19 19:09
03/25/19 19:09
|
Joined: Aug 2017
Posts: 296 Netherlands
Grant
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 296
Netherlands
|
Hello, I'm able to define AlgoVar2 variables, but unlike the AlgoVar variables, they return 0 after I call them from a .trd file. Did I made a mistake in my code? I also tried to store the AlgoVar2 variables to a second .trd file, but no luck. Thanks for any feedback!
function run()
{
If(Bar >= 1)
{
//Run this code only once with 1 == 1
if(1 == 2)
{
AlgoVar[0] = 1;
AlgoVar[1] = 2;
AlgoVar[2] = 3;
AlgoVar[3] = 4;
AlgoVar[4] = 5;
AlgoVar[5] = 6;
AlgoVar[6] = 7;
AlgoVar[7] = 8;
AlgoVar2[0] = 9;
AlgoVar2[1] = 10;
AlgoVar2[2] = 11;
AlgoVar2[3] = 12;
AlgoVar2[4] = 13;
AlgoVar2[5] = 14;
AlgoVar2[6] = 15;
AlgoVar2[7] = 16;
saveStatus("Log\a.trd");
}
loadStatus("Log\a.trd");
printf("n %.0f", AlgoVar[0]);
printf("n %.0f", AlgoVar[1]);
printf("n %.0f", AlgoVar[2]);
printf("n %.0f", AlgoVar[3]);
printf("n %.0f", AlgoVar[4]);
printf("n %.0f", AlgoVar[5]);
printf("n %.0f", AlgoVar[6]);
printf("n %.0f", AlgoVar[7]);
printf("n %.0f", AlgoVar2[0]);
printf("n %.0f", AlgoVar2[1]);
printf("n %.0f", AlgoVar2[2]);
printf("n %.0f", AlgoVar2[3]);
printf("n %.0f", AlgoVar2[4]);
printf("n %.0f", AlgoVar2[5]);
printf("n %.0f", AlgoVar2[6]);
printf("n %.0f", AlgoVar2[7]);
quit();
}
}
|
|
|
Re: Impossible to call stored AlgoVar2 variables.
[Re: AndrewAMD]
#476715
03/25/19 19:58
03/25/19 19:58
|
Joined: Aug 2017
Posts: 296 Netherlands
Grant
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 296
Netherlands
|
if(1 == 2) automatically means if(false). This means the next code block will be ignored. Hello Andrew, I did that on purpose. My goal is to call these variables, once they are stored. This works fine for the AlgoVar, but not for the AlgoVar2 variables and I wonder why.
|
|
|
Re: Impossible to call stored AlgoVar2 variables.
[Re: AndrewAMD]
#476717
03/25/19 20:14
03/25/19 20:14
|
Joined: Aug 2017
Posts: 296 Netherlands
Grant
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 296
Netherlands
|
OK, but it's not clear what you are trying to do. Can you split it into two separate scripts for clarity? OK, first I define the AlgoVar and AlgoVar2 variables and store them to a .trd file:
function run()
{
if(Bar >= 1)
{
AlgoVar[0] = 1;
AlgoVar[1] = 2;
AlgoVar[2] = 3;
AlgoVar[3] = 4;
AlgoVar[4] = 5;
AlgoVar[5] = 6;
AlgoVar[6] = 7;
AlgoVar[7] = 8;
AlgoVar2[0] = 9;
AlgoVar2[1] = 10;
AlgoVar2[2] = 11;
AlgoVar2[3] = 12;
AlgoVar2[4] = 13;
AlgoVar2[5] = 14;
AlgoVar2[6] = 15;
AlgoVar2[7] = 16;
saveStatus("Log\a.trd");
quit();
}
}
Then I call these variables and only the AlgoVar variables return their value.
function run()
{
if(Bar >= 1)
{
loadStatus("Log\a.trd");
printf("n %.0f", AlgoVar[0]);
printf("n %.0f", AlgoVar[1]);
printf("n %.0f", AlgoVar[2]);
printf("n %.0f", AlgoVar[3]);
printf("n %.0f", AlgoVar[4]);
printf("n %.0f", AlgoVar[5]);
printf("n %.0f", AlgoVar[6]);
printf("n %.0f", AlgoVar[7]);
printf("n %.0f", AlgoVar2[0]);
printf("n %.0f", AlgoVar2[1]);
printf("n %.0f", AlgoVar2[2]);
printf("n %.0f", AlgoVar2[3]);
printf("n %.0f", AlgoVar2[4]);
printf("n %.0f", AlgoVar2[5]);
printf("n %.0f", AlgoVar2[6]);
printf("n %.0f", AlgoVar2[7]);
quit();
}
}
|
|
|
Re: Impossible to call stored AlgoVar2 variables.
[Re: MatPed]
#476723
03/26/19 11:56
03/26/19 11:56
|
Joined: Aug 2017
Posts: 296 Netherlands
Grant
OP
Member
|
OP
Member
Joined: Aug 2017
Posts: 296
Netherlands
|
It looks like the AlgoVar2 variables don't get saved or loaded at all.
Zorro feature not yet implemented? I thought that there might be a limit to the number of variables a .trd file can store, so I saved the AlgoVar2 vars to a second file, but no luck. Yes, according to the manual only the AlgoVars are saved. Ah interesting, but then what's the use of AlgoVar2 in this context? What do you mean with AlgoVars? Only AlgoVar[] or AlgoVar[] + AlgoVar2[]? My bad, I meant multiple AlgoVar variables.
Last edited by Grant; 03/26/19 12:01.
|
|
|
|