Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
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
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 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
Problem mit Item-Panel.(GER&ENG) #412945
12/05/12 12:22
12/05/12 12:22
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline OP
Member
HellThunder  Offline OP
Member

Joined: Nov 2005
Posts: 204
Bavaria
Code:
GERMAN:


Hallo. Ich versuche gerade ein dynamisches Item Menü bzw. eine Anzeige zu basteln, die mir Items auflistet. Hierfür möchte ich einmal ein var Array und ein String Array verwenden.
Die Werte sollen über ein Panel angezeigt werden.
Mein Problem ist folgendes: Mit der Verwendung der oben angegebenen Arrays, werden mir keine Werte bzw Buchstaben ausgegeben. Ich vermute syntaktische Fehler, da die Ausgabe einer var Variable bzw eines Strings einwandfrei ausgegeben wird.
Der Code ist unten angehängt. Außerdem habe ich ein paar Screens hinzugefügt, um mein Problem zu verdeutlichen.

Danke schon mal für Hilfe.

Code:
ENGLISH:


Hi. I'm trying to create a dynamic item menu or something like an item list.
For this I want to use var and string arrays.
My problem – If I use array variables, the panel shows me nothing.
I suspect syntactical errors because the output with a var is displayed correctly.
I included the code with some screens below.
Thx in advance.


Versuch mit STRING und var Arrays - keine Ausgabe.
Try with STRING and var Array - no resualt.

Versuch mit STRING und var - Werte werden ausgegeben.
Try with simple STRING and var - values are displayed



Ach ja. Nicht über den Font wundern. Ich arbeite mit einem Linux System.
Don't be surprised about the ingame Font. I'm working with a Linux distribution.

Code:
//////////////////////////////////////////////
///Deklaration Variablen///////////
//////////////////////////////////////////////
STRING **item_StringID[5];   
int x;
var item_ID[3];  ///Aus Testgründen erst drei Indexpositionen
item_ID[1] = 0;
item_ID[2] = 0;
item_ID[3] = 0;

//////////////////////////////////////////////
///Anzeige der Items im Menü//
//////////////////////////////////////////////
PANEL* item_ID_Pan =
{
  pos_x = 10;
  pos_y = 10;
  layer = 10;
  digits(140,50,"%s","Arial#30b",1,item_StringID[1]);  ///String an der ersten Itemposition
  digits = (310, 50, 3, "Arial#30b", 1, item_ID[1]);	///Anzahl Items der ersten Itemposition
  		
  		…............. ///Weitere Itempositionen
}

//////////////////////////////////////////////
///Auflistung des Testitems///////
//////////////////////////////////////////////
function write_Items(){

	if (Heiltrank >= 1)
	{
		item_ID[1]  = Heiltrank;   ///Menge der Items, die ID 1 zugeordnet wird         
		str_cpy(item_StringID[1],"Heiltrank"); 	//Leerer String wird überschrieben
	}
	
	
…................
	

set(item_ID_Pan,SHOW | OUTLINE); 

}


function main() {
…..
/////////////////////////////////////////////////////////////////////////////
///Allokierung des Speichers für das String Array//////
////////////////////////////////////////////////////////////////////////////
	item_StringID = sys_malloc(sizeof(STRING**) * 5);
	for( x = 0; x < 5; x++)
	{
		item_StringID[x] = sys_malloc(sizeof(STRING*) * 5);
      	item_StringID[x] = str_create("");  
   
   }
…..


Last edited by HellThunder; 12/05/12 13:36.

Create your own JRPG and join our community: https://www.yrpgtoolkit.com
Re: Problem mit Item-Panel.(GER&ENG) [Re: HellThunder] #413004
12/06/12 08:08
12/06/12 08:08
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
The thing that jumps out to me immediatly is, that you are setting string_ID[1]..[2]..[3], shouldnt that be string_ID[0]..[1]..[2]? the index goes from 0, not from 1 (Are you not getting any errors in GameStudio on this?).

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: Problem mit Item-Panel.(GER&ENG) [Re: HellThunder] #413005
12/06/12 08:34
12/06/12 08:34
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline OP
Member
HellThunder  Offline OP
Member

Joined: Nov 2005
Posts: 204
Bavaria
Ouch - you are right. It's a mistake, but not the reason of my problem.
Actually, I think it's not really important if I write something on index position 0 or not.

My panel expects a value of "item_StringID[1]"
The "write_Items" function also changes the variable of item_StringID[1].

But I've also tried to write on item_StringID[0]. No changes. =/

Compiling runs without any problems. There are no errors, when i call the item Menu.
I think there must be another syntactic error inside the script.


Create your own JRPG and join our community: https://www.yrpgtoolkit.com
Re: Problem mit Item-Panel.(GER&ENG) [Re: HellThunder] #413006
12/06/12 08:38
12/06/12 08:38
Joined: Apr 2005
Posts: 274
austria
Ascalon Offline
Member
Ascalon  Offline
Member

Joined: Apr 2005
Posts: 274
austria
Ich glaube das Problem ist, dass in einem Panel keine Arrays ausgegeben werden können. Du müsstest mit pan_setdigits dann den aktuellen Arraywert an das Panel übermittelen, denke ich


my webside : www.ascalon.jimdo.de
Re: Problem mit Item-Panel.(GER&ENG) [Re: HellThunder] #413010
12/06/12 09:44
12/06/12 09:44
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline OP
Member
HellThunder  Offline OP
Member

Joined: Nov 2005
Posts: 204
Bavaria
Okay - problem was the wrong output format inside the Panel definition.
Panel wanted to get a float.
Code:
digits = (310, 50, "%02.0f", "Arial#30b", 1, item_ID[1]);



But my String still has the value NULL.


Okay - Problem war das falsche Ausgabeformat innerhalb der Paneldeklaration.
Panel wollte einen float haben.
Code:
digits = (310, 50, "%02.0f", "Arial#30b", 1, item_ID[1]);



Aber mein String hat trotzdem noch den Wert NULL.



Create your own JRPG and join our community: https://www.yrpgtoolkit.com
Re: Problem mit Item-Panel.(GER&ENG) [Re: HellThunder] #413091
12/07/12 20:43
12/07/12 20:43
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Ich weiß nicht, ob ein Array mit Strings geht, aber Text ist im Grunde ein String-Array.
http://www.conitec.net/beta/atexte-intro.htm
http://www.conitec.net/beta/atext-string.htm

Re: Problem mit Item-Panel.(GER&ENG) [Re: Pappenheimer] #413122
12/08/12 10:38
12/08/12 10:38
Joined: Nov 2005
Posts: 204
Bavaria
HellThunder Offline OP
Member
HellThunder  Offline OP
Member

Joined: Nov 2005
Posts: 204
Bavaria
Pappenheimers Vorschlag hat die Lösung des Problems gebracht.
Die Art der Initialisierung des String Arrays war der Schlüssel.

Pappenheimers suggestion was the solution of my problem.
The way of initializing the String Array was the key.

Code:
TEXT* item_Text =
{
  pos_x = 120;
  pos_y = 20;
  font = "Arial#30b";
  string (id01, id02, id03, id04, id05, id06, id07, id08, id09, id10, id11, id12); // Array von 12 String pointers 
  flags = SHOW | OUTLINE | SHADOW;
  layer = 14;
}

function write_Items(){

if (Heiltrank >= 1)
	{		
	item_ID[1]  = Heiltrank;          
str_cpy((item_Text.pstring[1],"Heiltrank");		  
	}





Ist zwar noch nicht dynamisch - dank des Arrays stehen mir jetzt jedoch alle Wege offen.
Danke für die Hilfe aller!
regards-


After all it's still not dynamic - but because of the Array, the solution isn't far away.
Thanks for the help to all.
Grüße-

Last edited by HellThunder; 12/08/12 10:49.

Create your own JRPG and join our community: https://www.yrpgtoolkit.com

Moderated by  adoado, checkbutton, mk_1, Perro 

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