Gamestudio Links
Zorro Links
Newest Posts
Removing outliers from files
by AndrewAMD. 12/02/26 15:26
SGT_FW
by Aku_Aku. 11/30/26 08:19
Experiences with cTrader
by JeyKey II. 11/27/26 09:04
make a complaint
by EW_bytes. 11/26/26 23:00
FXCM => AVA Trade Plugin???
by Martin_HH. 11/25/26 21:59
No connection to MT4
by Martin_HH. 11/23/26 06:38
MinMax function on History t6 file
by LucasJoshua. 11/21/26 14:28
What are you working on?
by rayp. 11/20/26 18:10
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, Quad, Grant), 8,062 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EvanTJ, rht, MaliceTheMaker, Haitao_Ren, JimSimons
19250 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 | 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