Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, monk12, TipmyPip, Quad, aliswee), 1,029 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Access string content through another string #473784
08/15/18 00:45
08/15/18 00:45
Joined: Aug 2016
Posts: 15
ChrstphFr Offline OP
Newbie
ChrstphFr  Offline OP
Newbie

Joined: Aug 2016
Posts: 15
Dear fellow developers, I have a question that I can't solve on my own.

Is there a way to access the content of a string through its string name, that is itself the string content of another string?

For example:
STRING* content_str = “This is a test!”;
STRING* name_str = “content_str”;

Is it possible to access or copy “This is a test!” through name_str? I want to use entity.string1 to point to another string.

Maybe someone can point my in the right direction.

Re: Access string content through another string [Re: ChrstphFr] #473785
08/15/18 02:25
08/15/18 02:25
Joined: Feb 2013
Posts: 122
Maysville, Ga
Evo Offline
Member
Evo  Offline
Member

Joined: Feb 2013
Posts: 122
Maysville, Ga
Hi ChrstphFr,

If you're talking about just copying one string into another, you can do that by using :
Code:
str_cpy(name_str, content_str);


This will overwrite "name_str" with whatever string you choose and can be changed at anytime within your code.

Re: Access string content through another string [Re: Evo] #473787
08/15/18 03:54
08/15/18 03:54
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Access string content through another string [Re: Superku] #473788
08/15/18 09:30
08/15/18 09:30
Joined: Aug 2016
Posts: 15
ChrstphFr Offline OP
Newbie
ChrstphFr  Offline OP
Newbie

Joined: Aug 2016
Posts: 15
Thank you Superku! I got it to work with engine_getvar.

Code:
STRING* LookAt_msg = "                                                                ";
STRING* msg_1 = "This is a test.";

...

STRING** temp_msg = (STRING**)engine_getvar(_chr(my.string1),NULL); // entity.string1 is "msg_1"
str_cpy(LookAt_msg,*temp_msg); // LookAt_msg now is "This is a test."


Last edited by ChrstphFr; 08/15/18 09:46.

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