A8.10.1 Lite-C Commercial

Hi Folks,
some time now i try to create a textsystem as matchable as possible. For this i would like to standardise all stringnames by numbers and calculate the right string by mean of variables in a 2nd string. The CONTEND of this 2nd string should be usable as a pointer to the string to chose. Despite i searched for days, i unfortunately couldn’t figure out how to use a string as a pointer.
"engine_getobj" seems promising first, but it didn’t do what i want (perhaps I overlooked something?). Does anyone know how to make this work?
Ps: I know about "text.pstring" but the functionality isn’t quite what i need.
________________________________________________________________

Hallo Leute,
ich versuche mich jetzt schon länger an einem möglichst anpassungsfähigen Textsystem. Hierzu würde ich gerne alle Stringnamen per Nummern standardisieren und den zu wählenden String mit Hilfe von Variablen in einem 2. String zu berechnen. Der INHALT dieses 2. String soll also als Pointer des zu wählenden Strings fungieren. Leider konnte ich auch nach tagelangem Durchsuchen des Internets keine Lösung finden einen String als Pointer zu verwenden.
Einige Hoffnung hatte ich in "engine_getobj" gesetzt, hatte aber leider auch keinen Erfolg (oder ich habe da etwas übersehen?). Kennt jemand eine Möglichkeit?
Ps: Mir ist klar, dass es "text.pstring" gibt, doch die Funktionsweise ist nicht ganz das, was ich möchte.
________________________________________________________________

Example:

Code:
var got_key = 0;	// did the player find the key?
STRING* dia_str = "";	// this String will be showen while talking

/////// First entity ///////
// First dialog (while player haven't find the key)
STRING* dia_1_1_1 = "Hello little man.";
STRING* dia_1_1_2 = "I lost my key.";
STRING* dia_1_1_3 = "Would be nice if you find him.";

// Second dialog (the player had found the key)
STRING* dia_1_2_1 = "Wow, you have found the key.";
STRING* dia_1_2_2 = "Thanks a lot.";

/////// Second entity ///////
// First dialog
STRING* dia_str_2_1_1 = "What do you want???";
STRING* dia_str_2_1_2 = "Don't bend my ears!";
//(...)

function talk(C, D)  // C = ID for NPC, D = Dialoggroup
{
	var S = 1;  		// S = current string to show
	STRING* my_string = "";	// this string should contain the pointer of the string

	str_cpy(my_string, "dia_");		// Prefix
	str_cat_num(my_string, "%.0f_", C);	// add the NPC-ID and a _
	str_cat_num(my_string, "%.0f_", D);	// add the ID for the dialoggroup and a _
	str_cat_num(my_string, "%.0f", S);	// add the ID for the current string

/*!!!*/	while(str_to_ptr(my_string) != NULL)  // ptr_for_str don't exist, this is what i'm seraching for!
	{
		str_cpy(dia_str, str_to_ptr(my_string));  // by the first time my_string contains dia_str_1_1_1
		wait(-1);	// display the text at minimum 1 second...
		while(key_space != 1){wait(1);}  // ...then wait till space is pressed
		S += 1;	// raise for next string

	// this is same like before whith new value of S
	// existence will be checked at the top of the loop
	str_cpy(my_string, "dia_");
	str_cat_num(my_string, "%.0f_", C);
	str_cat_num(my_string, "%.0f_", D);
	str_cat_num(my_string, "%.0f", S);
	}
}

action anyone()
{
//	(...)
	if(got_key == 0)	{talk(1,1);}	// first dialog
	else			{talk(1,2);}	// second dialog
//	(...)
}


Last edited by Kaaron; 11/07/12 13:15.

Gamestudio Commercial A8.45 - Lite-C