Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (NnamueN, 1 invisible), 1,489 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19054 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Problem with Panel/Strings #230019
10/02/08 10:49
10/02/08 10:49
Joined: Oct 2008
Posts: 10
Italy
Romeoxbm Offline OP
Newbie
Romeoxbm  Offline OP
Newbie

Joined: Oct 2008
Posts: 10
Italy
Hi all!
I've got a little question about panels.
I declared a struct containing 3 vars and one string pointer,

Code:
typedef struct { 
	STRING * animName;
  	int startFrame; 
  	int endFrame; 
  	int framesCount;
} animationData;


and an array of animationData

Code:
animationData animations[20];


So i need to show in a panel the content of these strings.
I've tried to do this with the following code line

Code:
digits (50,50,"Anim1:%s", #14, 1, animations[0].animName);


but i obtain this error message..."Too many parameters".

Any suggestion??

P.s. I'm sorry for my bad english

Re: Problem with Panel/Strings [Re: Romeoxbm] #230025
10/02/08 11:28
10/02/08 11:28
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
I remember that it is not possiblem to display STRINGs in digits, you'll have to use a TEXT instead.

Re: Problem with Panel/Strings [Re: PadMalcom] #230027
10/02/08 11:41
10/02/08 11:41
Joined: Oct 2008
Posts: 10
Italy
Romeoxbm Offline OP
Newbie
Romeoxbm  Offline OP
Newbie

Joined: Oct 2008
Posts: 10
Italy
I think that the problem is in the use of the array, 'cause i usually use strings in digits, and it works

Code:
STRING* test = "Hello World";

PANEL* animation_pan =
{
	pos_x = 100;
	pos_y = 100;
	digits (50,50,"Anim1:%s", #14, 1, test);

...


This works..

Re: Problem with Panel/Strings [Re: Romeoxbm] #230030
10/02/08 12:47
10/02/08 12:47
Joined: Oct 2008
Posts: 10
Italy
Romeoxbm Offline OP
Newbie
Romeoxbm  Offline OP
Newbie

Joined: Oct 2008
Posts: 10
Italy
I've tried with TEXT*, as suggested by PadMalcom...but the result is still the same...it doesn't works

Code:
TEXT* animation_Text =
{
	pos_x = 100;
	pos_y = 100;
	string (animations[0].animName);
	flags = VISIBLE;
}


Last edited by Romeoxbm; 10/02/08 12:48.
Re: Problem with Panel/Strings [Re: Romeoxbm] #230035
10/02/08 13:25
10/02/08 13:25
Joined: Jul 2008
Posts: 894
T
TechMuc Offline
User
TechMuc  Offline
User
T

Joined: Jul 2008
Posts: 894
Code:
TEXT* animation_Text =
{
	pos_x = 100;
	pos_y = 100;
	string ((animations[0]).animName);
	flags = VISIBLE;
}


you have to use the brackets around animatiion and "]"

If this does not work (is there an error message?) how do you fill the strings?

Re: Problem with Panel/Strings [Re: TechMuc] #230039
10/02/08 13:35
10/02/08 13:35
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
Thats interesting, thanks for the hint Remopxmb!

Re: Problem with Panel/Strings [Re: TechMuc] #230044
10/02/08 13:49
10/02/08 13:49
Joined: Oct 2008
Posts: 10
Italy
Romeoxbm Offline OP
Newbie
Romeoxbm  Offline OP
Newbie

Joined: Oct 2008
Posts: 10
Italy
i've tried with brackets...with both panel* and text*...but nothing...T_T
The error message is still the same ("Too many parameters").
How do i fill the strings? Simply reading from a text file with thess code lines:

Code:
fhandle = file_open_read ("test.txt");
	
	while (file_str_read (fhandle,animations[counter].animName)!=-1)
	{
		animations[counter].startFrame 	= file_var_read (fhandle);
		animations[counter].endFrame 		= file_var_read (fhandle);
		animations[counter].framesCount 	= file_var_read (fhandle);
		counter++;
	}
	
	file_close(fhandle);


Re: Problem with Panel/Strings [Re: Romeoxbm] #230046
10/02/08 14:00
10/02/08 14:00
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
You fill strings using str_cpy(TargetString, SourceString);

Re: Problem with Panel/Strings [Re: PadMalcom] #230052
10/02/08 14:14
10/02/08 14:14
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
The problem is that PANELS (and I assume TEXTs too)are only able
to display globally created non-structured strings.
Arrays count as structs in this case.
AND any string you use cannot be re-created with str_create either,
it just keeps using the old string from stored memory.
This applies ti BMAPs used on buttons in panels too.

All you can do us create global variables and do a str_cpy(globalstr,datastr);
to populate them when changed.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1