Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 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 | 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