W
Wraithious
Guest
Hi, I've been fighting with this for 3 days and can't figure it out, basically I have a text file that holds user inputted strings, which are read and shown on the game screen. for some reason all of the inputted strings from my array get put on the first line in the file, not the end of the line either, every new index of the array gets put at the beginning of the line! how is that even possible?????? If it's the first text being saved it works normally because that is done seperatly. Heres the code to what I have:
This script is run at game beginning, then called after adding text to update the game screen-
Script getinfo:
Step event:
Alarm event:
I have tried so many different combinations of things and nothing seems to work, any help with what I'm doing wrong would greatly be appreciated!
This script is run at game beginning, then called after adding text to update the game screen-
Script getinfo:
Code:
if(argument[0]=0)
{
var findit="top"+string(global.forum);
if(file_exists(working_directory+"\"+findit+".txt"))//load the topics, get how many blocks and topics
{
var num=0;
gtfile=file_text_open_read(working_directory+"\"+findit+".txt");
while(!file_text_eof(gtfile))
{
global.blocks[global.forum]=floor(num*(1/14));
global.topstr1[num]=file_text_read_string(gtfile);//Get each line of text from the file
global.topic[global.forum]=num;//get how many lines of text that are in the file
file_text_readln(gtfile);
num+=1;
}
file_text_close(gtfile);
}
}
Code:
if global.bchoi=4 && string_width(keyboard_string)<=632 global.topstr1[(global.topic[global.forum]+1)]=keyboard_string;//get new topic text
Code:
if(global.bchoi=4)
{
var datim=date_datetime_string(date_current_datetime());//get the headder info and open the file to write to
var memid="";
if global.memli=1 memid=global.guest;
if global.memli>1 memid=global.memna[global.memli];
finder="top"+string(global.forum);
setget=file_text_open_write(working_directory+finder+".txt");
if(global.topstr1[0] !="")
{
for(i=0;i<(global.topic[global.forum]+1);i+=1;)
{
file_text_write_string(setget,("Post by "+memid+" "+datim+"#"+global.topstr1[i]));
file_text_writeln(setget);//This is not working at all, it writes every index of topstr1[i] to the first line in the text file
}
file_text_close(setget);
}
if(global.topstr1[0] ="")
{
file_text_write_string(setget,("Post by "+memid+" "+datim+"#"+keyboard_string));
file_text_close(setget);
}
getinfo(0);//call the getinfo script to update how many topics there are
}