Message Board
Message Board > Fenix / Bennu / Gemix / DIV > Strings! why are the annoying me |
April 29, 2007, 23:31 | |
Geuben
Whiskered 11 posts |
Hi, is there something i don't know about strings in fenix? Im trying to read all the files of a certain type (level files), display them in a list and then load the on i select. I can read the files, make the list and select one, but the file won't load. To read the files, display the list i have: Code: WHILE(file_result <> "" AND n <> 10) n+=1; file_result = GLOB("*.lev"); SWITCH (n) CASE 1: save_file1 = file_result; END CASE 2: save_file2 = file_result; END CASE 3: save_file3 = file_result; END CASE 4: save_file4 = file_result; END CASE 5: save_file5 = file_result; END CASE 6: save_file6 = file_result; END CASE 7: save_file7 = file_result; END CASE 8: save_file8 = file_result; END CASE 9: save_file9 = file_result; END CASE 10: save_file10 = file_result; END END WRITE(0,100,(71+f),0,file_result); f+=10; FRAME; END so essentially, each item in the list is saved in a string called "save_filex" with their corresponding number in place of x. If i they select one of the save_filex strings depending on which item in the list i wish to select, i put for example: file_p1 = save_file1 ,(file_p1 is also a string type) and the i want to use load(file_p1,flag); to load the selected file. But it doesnt load it. if i skip the reading of the files, and put for example file_p1 = "AAAA.lev"; then use load(file_p1,flag); it loads the file. and also if i put file_p1 = save_file1; will load the file. ive used the debugger to check that save_file1 gets written with the correct string "AAAA.lev" but it still won't work. Any ideas anyone? ____________ |
# |
April 29, 2007, 23:58 | |
Sandman
F3n!x0r 1194 posts |
Could you put the complete code online at http://pastebin.com/? That would help. Or possibly you could go into the chat (button at the left menu), where people, like me, who can help are mostly available. It seems the 'selecting' goes wrong somewhere, but it's hard to tell; it's a fuzzy problem. Also, have you considered using an array? Code: Private
String save_file[10]; // gives you 11 strings: 0~10 Begin save_file[3] = "This is the fourth string."; save_file[6] = "Seventh!"; save_file[10] = "Last!"; say(save_file[3]); Repeat frame; Until(key(_esc)) End ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
April 30, 2007, 00:14 | |
Geuben
Whiskered 11 posts |
pastebin doesn't seem to want to let me post my code. I did try using an array (then it could allow more than 10 files easily) but when it wasn't working i took the array out at i thought that might have been the cause of the problem. my whole code is: CODE The big structure of coordinates at the beginning is used because i use it in the game that this program is designed to make maps for. Im sure that some of my methods aren't the best, but i do plan on trying to optimize my code when i get everything working. [EDIT by Sandman] Hosted your code, so it's better viewable. [Edited on April 30, 2007 by Sandman] ____________ |
# |
April 30, 2007, 01:58 | |
Sandman
F3n!x0r 1194 posts |
Okay, after some MSN chat it seemed the problem was caused by the following situation: Geuben put FUNCTION where there should have been PROCESS and this causes Fenix 0.84b to think it was a function, while it in fact was not, causing the program to display unwanted behavior. Fenix 0.92a circumvented this and so it did work in that version. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
April 30, 2007, 18:10 | |
yonni
None 420 posts |
You can use "process" when you mean "function" anyway.
____________ |
# |
Message Board > Fenix / Bennu / Gemix / DIV > Strings! why are the annoying me