Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (degenerate_762, AndrewAMD), 846 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
please make it possible to change entity.string1 / 2 #451841
05/23/15 13:03
05/23/15 13:03
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi JCL and co,

It would be really nice if entity.string1 and entity.string2 could be changed realtime. I am making a realtime map editor and it would be nice to save 2 actions/strings; 1 for in the editor itself (also for the entity action when opening a saved map in the editor) and 1 for the game (script). But the manual points out the it is read-only.

Quote:
entity.string1 ... entity.string2
Two general-purpose 32 character strings. Can be set by WED's entity properties panel and can be read in the script by the str_cpy or str_cat functions, but must not be altered.
Type:
char* pointer, read-only


Is it possible to bypass the read-only thingy?

Thanks in advance.

Re: please make it possible to change entity.string1 / 2 [Re: Reconnoiter] #451842
05/23/15 14:08
05/23/15 14:08
Joined: Jul 2014
Posts: 49
Romania,vaslui
A
AceX Offline
Newbie
AceX  Offline
Newbie
A

Joined: Jul 2014
Posts: 49
Romania,vaslui
You can use a entity skill as a string too grin

Re: please make it possible to change entity.string1 / 2 [Re: AceX] #451845
05/23/15 15:33
05/23/15 15:33
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Forget the read only stuff...
Nothing in memory is really read-only (just when the process constantly writes to the address which is not the case here).
So you either just call str_cpy and if it fails you can use VirtualProtect to change the page protections because it might be protected (ReadOnly).

Re: please make it possible to change entity.string1 / 2 [Re: Ch40zzC0d3r] #451850
05/23/15 18:52
05/23/15 18:52
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
if you need to store data on creating a wmb, I use it in MapBuilder, just save the info in the editor into a skill over 20 (the 1st 20 skills are saved into wmb), then get the string when you write the 2 strings into the new wmb. check my source, it is easy (I use it for storing decal shadow file name needed for free/extra license users).

Last edited by sivan; 05/23/15 18:53.

Free world editor for 3D Gamestudio: MapBuilder Editor
Re: please make it possible to change entity.string1 / 2 [Re: sivan] #451864
05/24/15 10:01
05/24/15 10:01
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Thanks for all the quick responses;

Originally Posted By: AceX
You can use a entity skill as a string too grin
, true but that would be sacrificing 1 one of the 20 skills the user otherwise can use for e.g. stats like hit points to save in a .wmb map file.

Originally Posted By: Ch40zzC0d3r
Forget the read only stuff...
Nothing in memory is really read-only (just when the process constantly writes to the address which is not the case here).
So you either just call str_cpy and if it fails you can use VirtualProtect to change the page protections because it might be protected (ReadOnly).
, oh nice, ty for the tip.


Originally Posted By: sivan
if you need to store data on creating a wmb, I use it in MapBuilder, just save the info in the editor into a skill over 20 (the 1st 20 skills are saved into wmb), then get the string when you write the 2 strings into the new wmb. check my source, it is easy (I use it for storing decal shadow file name needed for free/extra license users).
, with source you mean your Map Builder source? I try to download it but both the mirrors don't work. But why actually not directly save the string into entity.string?

Re: please make it possible to change entity.string1 / 2 [Re: Reconnoiter] #451871
05/24/15 17:47
05/24/15 17:47
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Code:
if ( my->string1 )
   my->string1 = str_create ( my->string1 );


Last edited by txesmi; 05/24/15 17:47.
Re: please make it possible to change entity.string1 / 2 [Re: txesmi] #451872
05/24/15 18:14
05/24/15 18:14
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Of course, all of this is going to break the second the strings are used internally. Or hashed and that hash is used internally.

Has none of you guys mothers told you that you don't just walk into your neighbours house and take their bread? You keep your grabby fingers off of memory that isn't yours.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: please make it possible to change entity.string1 / 2 [Re: WretchedSid] #451874
05/24/15 20:05
05/24/15 20:05
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Neighbour's house was left empty and is slowly falling apart. So it is the perfect playground.

Re: please make it possible to change entity.string1 / 2 [Re: FBL] #451877
05/24/15 21:50
05/24/15 21:50
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Rumour has it there is a ghost still living there, not being able to find a final resting place. Also, don't eat moldy bread found in your neighbours rotten house. Chances are that the stuff growing on it is not in fact penicillin.


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: please make it possible to change entity.string1 / 2 [Re: WretchedSid] #451879
05/25/15 03:33
05/25/15 03:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I see two separate questions/ things in this thread/ OP. The first thing is to be able to modify string1/2, but as stated by others you can just create a string and save it in one of the 100 skills.
The second thing is that you want to attach 2 actions to your entities because of editor/ ingame differences. Alternatively, I think it would be a better way to save additional data in a *.txt file from which you then load map editor related actions for each entity if necessary (and suppress the execution of the actual entity action).


"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
Page 1 of 2 1 2

Moderated by  old_bill, Tobias 

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