SO I'm making a level editor. My rooms are 640x480, and every object snaps to an 8x8 grid. Placing objects in the room works fine, but I want to make it so you can copy the entire map to the clipboard.
Here's my code:
if keyboard_check(vk_control){
if keyboard_check_pressed(ord("C")){
c=0 //the column to start at
r=0 //the row to start at
str_level = "Level"
while(r<room_height){
while(c<room_width){
if position_meeting(c,r,ob_fence) sub="A"
else sub = "0"
string_insert(sub,str_level,string_length(str_level)) //add object to the end of the string
c+=8 //move right one column
}
r+=8 //move down one row..
c=0 //.. and reset column to 0
}
clipboard_set_text(str_level)
}
}
It's supposed to create a string with the word "level" followed by letters or numbers representing each tile, starting at the top-left and working to the right each row until it gets to the bottom.
When I test it out, it only copies the initial string - the word "level". I've also tried saving a text file, and that does the same thing. So it looks like I'm not writing to the string correctly. I can't figure out what I'm doing wrong, though, so maybe somebody here could look at my code and see if there are any obvious mistakes