Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: inkey and key 'end' memory error [Re: ] #456556
11/28/15 13:05
11/28/15 13:05
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Well I use the inkey to edit textboxes etc in the game. Before doing inkey I copy the current string of the textbox to the input string. But when I do that it seems to be byebye to the #100 / 100 characters of the input string.

Re: inkey and key 'end' memory error [Re: Reconnoiter] #456558
11/28/15 14:28
11/28/15 14:28

M
Malice
Unregistered
Malice
Unregistered
M



Yes indeed, inkey is limited to the size of the string. If you change the sting size you clip inkey. But even more copying the textbox->characters into the input is pointless, as inkey, should start at the first character location and overwrite the whole string.

Re: inkey and key 'end' memory error [Re: ] #456559
11/28/15 15:11
11/28/15 15:11

M
Malice
Unregistered
Malice
Unregistered
M




Code:
STRING* str_input;
STRING* str_temp;
STRING* str_flush_buffer="#100";
STRING* str_textbox[10];

function fill_textboxs()
{
  int I;
 for(I=0;i<10;i++)
    {
       str_textbox[I]=str_create("");
     }
}

function str_mod()
{
int int_str_len;

str_cpy(str_input,str_flush_buffer); // Clear the input
int_str_len=str_len(str_textbox[0]); // Find current len of textbox
str_cpy(str_temp,str_textbox[0]);    // move textbox into temp/ or use a textbox_dply[array size of textbox]
str_cat(str_temp,str_flush_buffer);  // add the maximun input len of white spaces
str_trunc(str_temp,int_str_len);     // cut textbox len of white spaces off end of temp
str_cpy(str_input,str_temp);         // fill the input text + white_space trunced to max 
inkey(str_input);                    // Edit text
str_cpy(str_textbox[0],str_input);   // replace text in texbox
int_str_len=str_len(str_textbox[0]); // degubbing only
}




Not sure how this works but it's an idea to work from

Mal

Re: inkey and key 'end' memory error [Re: ] #456621
12/01/15 13:19
12/01/15 13:19
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
lol, I think I found a really funny solution with your help Malice, doing this after having copied content of current textbox string and before doing inkey(...):

Code:
str_cat(input_str, str_flush_buffer); //add spaces
str_trunc(input_str, 1); //removes point of memory error



I am not sure if this is bulletproof though. I mean in the world of memory errors it would be best to not use it blindly. So far after some testing it seems good though.

Re: inkey and key 'end' memory error [Re: Reconnoiter] #456626
12/01/15 17:24
12/01/15 17:24

M
Malice
Unregistered
Malice
Unregistered
M



LOl - That's how it works with my help more often then not. I spit fire blind ideas and smart people find something useful in it.
It is a odd solution, I'd love to hear jcl explain why it works and throws a error without.

Mal

Page 2 of 2 1 2

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