Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,709 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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