After spending near two days, trying all possible manipulations i could think off with this code, I would like to ask for help.

What I'm trying to do is get the player to enter a number thats passed back as the return of the function. Its a real simple piece of code, which is why I just for the world of me can't figure out where it goes wrong.
Quote:


STRING* s_t_input = "xx";
TEXT* t_input =
{
layer = 10;
pos_x = 0;
pos_y = 0;
string = s_t_input;
flags = VISIBLE;
}

int number_input(){
inkey((t_input.pstring)[0]);
str_to_int((t_input.pstring)[0]);
return(str_to_int((t_input.pstring)[0]));

}


I have tried using directly a string rather than a text element. Have tried waiting for inkey with wait_for(inkey(x));. Have tried waiting in while for inkey_active to turn to 0 again. Have also tried using inchar along the lines of the snippet in the manual.
Interestingly, when I move the code out of a dedicated function (unpractical but possible) it doesn't crash anymore, but instead of the code being executed multiple times, its executed one time, then never again. I'm baffled and sure its something completely obvious....but what?

Error I get is E1513. "Crash in number_input"

Thanks in advance for any suggestions.


- Mr Wurm