Jump to content


Photo

Loading grid bizarre behaviour


  • Please log in to reply
1 reply to this topic

#1 aloalouk2004

aloalouk2004

    GMC Member

  • GMC Member
  • 68 posts
  • Version:GM:Studio

Posted 29 March 2016 - 05:01 AM

This is prob just me being an idiot again but it's another one of those problems I just can'y get my head around. Hopefully it' something simple.

 

The following code will save/load tiles onto an isometric grid. This works perfectly for the whole grid with the exception of anything in the 11th column and the 12th column.

 

    case const_save:
    
        ini_open("save.ini");
        
        ini_write_real("TILE_INFO","BACKGROUND",current_background);
        ini_write_real("TILE_INFO","TILESET",current_tileset);
        ini_write_real("TILE_INFO","GRID_SIZE",grid_size);
        ini_write_real("TILE_INFO","GRID_ENABLED",grid_enabled);
        ini_write_real("TILE_INFO","MAX_X_LIMIT",max_x_limit);
        ini_write_real("TILE_INFO","MAX_Y_LIMIT",max_y_limit);
        ini_write_real("TILE_INFO","X_LIMIT",x_limit);
        ini_write_real("TILE_INFO","Y_LIMIT",y_limit);
        ini_write_real("TILE_INFO","X_SCROLL",x_scroll);
        ini_write_real("TILE_INFO","Y_SCROLL",y_scroll);
        ini_write_real("SETTINGS","BACKGROND_ENABLED",background_enabled);
        ini_write_real("SETTINGS","COLOUR_SCHEME",colour_scheme);
        ini_write_real("SETTINGS","MASTER_VOLUME",master_volume);
        ini_write_real("SETTINGS","MUSIC_ENABLED",music_enabled);
        ini_write_real("SETTINGS","SOUND_FX_ENABLED",sound_fx_enabled);
        
        ini_write_real("TILE_INFO","TILE_INDEX",tile_index[0,0]);
        ini_write_real("TILE_INFO","TILE_ANGLE",tile_angle[0,0]);
        
        for (j = 0; j < max_y_limit; j += 1)
        {
            for (i = 0; i < max_x_limit; i += 1)
            {
                ini_write_real("TILE_VISIBLE",string(i) + string(j),tile_visible[i,j]);
                ini_write_real("TILE_ANGLE",string(i) + string(j),tile_angle[i,j]);
                ini_write_real("TILE_XSCALE",string(i) + string(j),tile_xscale[i,j]);
                ini_write_real("TILE_YSCALE",string(i) + string(j),tile_yscale[i,j]);
                ini_write_real("TILE_INDEX",string(i) + string(j),tile_index[i,j]);
            }
        }
        ini_close();
        break;
        
    case const_download:
    
        ini_open("save.ini");
        
        current_background = ini_read_real("TILE_INFO","BACKGROUND",current_background);
        current_tileset = ini_read_real("TILE_INFO","TILESET",current_tileset);
        grid_size = ini_read_real("TILE_INFO","GRID_SIZE",grid_size);
        grid_enabled = ini_read_real("TILE_INFO","GRID_ENABLED",grid_enabled);
        max_x_limit = ini_read_real("TILE_INFO","MAX_X_LIMIT",max_x_limit);
        max_y_limit = ini_read_real("TILE_INFO","MAX_Y_LIMIT",max_y_limit);
        x_limit = ini_read_real("TILE_INFO","X_LIMIT",x_limit);
        y_limit = ini_read_real("TILE_INFO","Y_LIMIT",y_limit);
        x_scroll = ini_read_real("TILE_INFO","X_SCROLL",x_scroll);
        y_scroll = ini_read_real("TILE_INFO","Y_SCROLL",y_scroll);
        background_enabled = ini_read_real("SETTINGS","BACKGROND_ENABLED",background_enabled);
        colour_scheme = ini_read_real("SETTINGS","COLOUR_SCHEME",colour_scheme);
        master_volume = ini_read_real("SETTINGS","MASTER_VOLUME",master_volume);
        music_enabled = ini_read_real("SETTINGS","MUSIC_ENABLED",music_enabled);
        sound_fx_enabled = ini_read_real("SETTINGS","SOUND_FX_ENABLED",sound_fx_enabled);
    
        obj_pallett.sprite_index = current_tileset; //SETS TO CURRENT TILESET
        obj_tile.sprite_index = current_tileset; //MAKES GRID TILES REFLECT CURRENT TILESET
        
        for (j = 0; j < max_y_limit; j += 1)
        {
            for (i = 0; i < max_x_limit; i += 1)
            {
                tile_visible[i,j] = ini_read_real("TILE_VISIBLE",string(i) + string(j),tile_visible[i,j]);
                tile_angle[i,j] = ini_read_real("TILE_ANGLE",string(i) + string(j),tile_angle[i,j]);
                tile_xscale[i,j] = ini_read_real("TILE_XSCALE",string(i) + string(j),tile_xscale[i,j]);
                tile_yscale[i,j] = ini_read_real("TILE_YSCALE",string(i) + string(j),tile_yscale[i,j]);
                tile_index[i,j] = ini_read_real("TILE_INDEX",string(i) + string(j),tile_index[i,j]);
            }
        }
        script_execute(spt_draw_pallett);
        script_execute(spt_refresh_grid,0);
        
        ini_close();
        break;
        
As the you can see it just goes round in a loop so I can't make any sense of this at all.

Edited by aloalouk2004, 29 March 2016 - 05:10 AM.

  • 0

#2 aloalouk2004

aloalouk2004

    GMC Member

  • GMC Member
  • 68 posts
  • Version:GM:Studio

Posted 29 March 2016 - 05:47 AM

I've solved this now. Turns out the key I was using wasn't unique. I wish there was a way to delete these posts. I always solve it within minuets of posting. Sorry guys.


  • 0