Gamestudio Links
Zorro Links
Newest Posts
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Trading Journey
by 7th_zorro. 04/27/24 04:42
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 747 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
showing part of an array in digit #377322
07/12/11 08:02
07/12/11 08:02
Joined: May 2011
Posts: 46
kleines Kaff irgendwo in Hesse...
Kitsu Offline OP
Newbie
Kitsu  Offline OP
Newbie

Joined: May 2011
Posts: 46
kleines Kaff irgendwo in Hesse...
Hi,
i have a little problem with showing a part of an array in a digit.


while definination and declaration seems to work
Code:
STRING * res[6];
	res[0] = "640 x 480";
	res[1] = "800 x 600";
	res[2] = "1024 x 768";



but as i want to show it via
Code:
digits(0, 0, " %s", "Arial#16", 1, res[1]);

it shows only "(null)"

also unfortunately
Code:
str_cpy(resolution, res[num]);


gives me an malfunction says: "Empty pointer in set_res" (set_res is the function called by the button from the panel with the digits above)

what i have to do to use the part of the array in the digits and iin other functions without exactly know thwat the player wants and witout writing a new function for each possibility?
i hope you can help me with it smirk

greetings
~kitsu


fogman: "Hint: Itīs useful to learn to read before you try to write games."
Re: showing part of an array in digit [Re: Kitsu] #377326
07/12/11 09:32
07/12/11 09:32
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
STRING * res[6]; //Ok
res[0] = "640 x 480"; //No
res[1] = "800 x 600"; //No
res[2] = "1024 x 768";//No

You need to make a function that inits the strings:

res[0] = str_create("640 x 480");
res[1] = str_create(..);
..
Then, the digits will work wink

Re: showing part of an array in digit [Re: Rei_Ayanami] #377328
07/12/11 10:07
07/12/11 10:07
Joined: May 2011
Posts: 46
kleines Kaff irgendwo in Hesse...
Kitsu Offline OP
Newbie
Kitsu  Offline OP
Newbie

Joined: May 2011
Posts: 46
kleines Kaff irgendwo in Hesse...
hmm anyhow the global declared string array isn't grey as the other global strings (and not shown in the code jumper on the right side)
also str_create isn't highlighted (?) and if i now call the function which shows the panel containing the digits the engine crashes (also it crahes instantly if the panel is shown at the beginning)

Last edited by Kitsu; 07/12/11 10:08.

fogman: "Hint: Itīs useful to learn to read before you try to write games."
Re: showing part of an array in digit [Re: Kitsu] #377337
07/12/11 11:46
07/12/11 11:46
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////

FONT* fnt_test = "arial#20";
STRING* str_res[6];

PANEL* pnl_res = {
//	digits(10, 10, "%s", *, 1, str_res[0]); //wont' work, string is not yet initialised!
	flags = SHOW;
}

void main(){
	
	str_res[0]= str_create("600x480");
	str_res[1]= str_create("800x600");
	pan_setstring(pnl_res, 0, 10, 10, fnt_test, str_res[0]);
	pan_setstring(pnl_res, 0, 10, 30, fnt_test, str_res[1]);
}

though you'd be better off using TEXT instead of PANEL
Code:
TEXT* txt_res = {
	font = fnt_test;
	pos_x = 300;
	strings = 6;
	string("600x480", "800x600", "1024x768");
	flags = SHOW;
}




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