Gamestudio Links
Zorro Links
Newest Posts
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (Petra, AndrewAMD, Quad, VoroneTZ, 1 invisible), 488 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Impossible to call stored AlgoVar2 variables. #476713
03/25/19 19:09
03/25/19 19:09
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
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!

Code:
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: Grant] #476714
03/25/19 19:22
03/25/19 19:22
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
if(1 == 2) automatically means if(false). This means the next code block will be ignored.

Re: Impossible to call stored AlgoVar2 variables. [Re: AndrewAMD] #476715
03/25/19 19:58
03/25/19 19:58
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Originally Posted By: AndrewAMD
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: Grant] #476716
03/25/19 20:04
03/25/19 20:04
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
OK, but it's not clear what you are trying to do. Can you split it into two separate scripts for clarity?

Re: Impossible to call stored AlgoVar2 variables. [Re: AndrewAMD] #476717
03/25/19 20:14
03/25/19 20:14
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Originally Posted By: AndrewAMD
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:

Code:
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.

Code:
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: Grant] #476720
03/26/19 02:17
03/26/19 02:17
Joined: Feb 2017
Posts: 1,725
Chicago
AndrewAMD Online
Serious User
AndrewAMD  Online
Serious User

Joined: Feb 2017
Posts: 1,725
Chicago
It looks like the AlgoVar2 variables don't get saved or loaded at all.

Zorro feature not yet implemented?

Re: Impossible to call stored AlgoVar2 variables. [Re: AndrewAMD] #476721
03/26/19 06:46
03/26/19 06:46
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Yes, according to the manual only the AlgoVars are saved.

Re: Impossible to call stored AlgoVar2 variables. [Re: jcl] #476722
03/26/19 09:11
03/26/19 09:11
Joined: Feb 2015
Posts: 652
Milano, Italy
M
MatPed Offline
User
MatPed  Offline
User
M

Joined: Feb 2015
Posts: 652
Milano, Italy
What do you mean with AlgoVars? Only AlgoVar[] or AlgoVar[] + AlgoVar2[]?

Re: Impossible to call stored AlgoVar2 variables. [Re: MatPed] #476723
03/26/19 11:56
03/26/19 11:56
Joined: Aug 2017
Posts: 294
Netherlands
G
Grant Offline OP
Member
Grant  Offline OP
Member
G

Joined: Aug 2017
Posts: 294
Netherlands
Originally Posted By: AndrewAMD
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.

Originally Posted By: jcl
Yes, according to the manual only the AlgoVars are saved.


Ah interesting, but then what's the use of AlgoVar2 in this context?

Originally Posted By: MatPed
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.
Re: Impossible to call stored AlgoVar2 variables. [Re: Grant] #476724
03/26/19 12:57
03/26/19 12:57
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
I meant only AlgoVars, not AlgoVars2. Saving them too could of course be implemented, but I believe the orginal intention was to leave AlgoVars2 initialized to zero so that they can be used as counters or similar.

Page 1 of 2 1 2

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1