Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (AndrewAMD, Ayumi, NewbieZorro), 14,141 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
str_create and inkey #118347
03/19/07 21:26
03/19/07 21:26
Joined: Aug 2005
Posts: 343
Germany
HPW Offline OP
Senior Member
HPW  Offline OP
Senior Member

Joined: Aug 2005
Posts: 343
Germany
hello world.

If I create a string with str_create, copy another string into it then it can't be edited in the same length like created before.
If the string was created with a length of 6 chars I can only edit 1 char after I copied the second string into it.

Code:

string_pointer = str_create("#6");
str_cpy(string_pointer, "0");
inkey(string_pointer);



Does anyone know how I can edit the whole string with the length it was created?


Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: str_create and inkey [Re: HPW] #118348
03/21/07 20:21
03/21/07 20:21
Joined: Aug 2005
Posts: 343
Germany
HPW Offline OP
Senior Member
HPW  Offline OP
Senior Member

Joined: Aug 2005
Posts: 343
Germany
Is there no known solution?


Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: str_create and inkey [Re: HPW] #118349
03/21/07 20:53
03/21/07 20:53
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Code:
STRING string_pointer = "#6";

TEXT view_string
{
layer = 1;
pos_x = 10;
pos_y = 10;
size_y = 40;
strings = 1;
string = string_pointer;
flags = visible;
}

FUNCTION main()
{
//string_pointer = str_create("#6");
screen_color.blue = 100;
str_cpy(string_pointer, "0");
inkey(string_pointer);
}



I get string read only when I use str_create


smile
Re: str_create and inkey [Re: D3D] #118350
03/22/07 18:58
03/22/07 18:58
Joined: Aug 2005
Posts: 343
Germany
HPW Offline OP
Senior Member
HPW  Offline OP
Senior Member

Joined: Aug 2005
Posts: 343
Germany
Really? Hmmm, ok. What I exactly do is this:

Code:

var string_array[500];
string* string_pointer;

function init_strings()
{
var i = 0;
while (i<500)
{
string_array[i] = handle(str_create("#6"));
i += 1;
}
}

function reset_strings()
{
var i = 0;
while (i<500)
{
string_pointer = ptr_for_handle(string_pointer[i]);
str_cpy(string_pointer, "0");
i += 1;
}
}

function on_button_click(button_number)
{
string_pointer = ptr_for_handle(string_pointer[button_number-1]);
inkey(string_pointer);
}



If I don't use str_cpy(string_pointer, "0"); then it works with inkey an the string is 6 chars long to edit. But after str_cpy it's only 1 char long.


Evil Blood (v. 0.52) RPG
Commport.de (Social Network Community)
Re: str_create and inkey [Re: HPW] #118351
03/23/07 15:13
03/23/07 15:13
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Hmm. Yes well, actualy you are a better coder then I am, and I didn't expected it to be so easy for finding solution to your problem. When I get home i'll try again although i'm not at your level of scripting yet.

Oh and I remember this problem with strings from some time ago when I tried working with chat script.


smile

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