2821
Modification Help / Re: Getting the name of a GUI button or a variable within it on click?
« on: May 05, 2013, 06:30:49 PM »
unlocked so you'll get off my ass about it.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

So what function is going wrong at the moment?Nothing, it's all working.
why bitbucket :(Munk pulled me into itttt
("Mine_Grid_Button" SPC %x SPC %y).delete();If you go and look at the addon and it's code, it actually worked fine.
You cannot do that
Either add them to a global variable and then do $MineGridButton[%x, %y].delete(); or do eval("Mine_Grid_Button" @ %x @ "_" @ %y @ ".delete();");


// --attempt 2--
// if(%mine_count == 0 && %button_count != 0)
// {
//
// for(%i=0;%i<8;%i++)
// {
//
// %xc = getWord(%check[%i],0);
// %yc = getWord(%check[%i],1);
// Mines_clickGrid(%xc,%yc);
//
// }
//
// }
// --attempt 1---
// if(%mine_count == 0 && isObject("Mine_Grid_Button" SPC %check[%i]))
// {
//
// %xc = getWord(%check[%i],0);
// %yc = getWord(%check[%i],1);
// if(("Mine_Grid" SPC %check[%i]).mine == 0)
// {
//
// Mines_clickGrid(%xc,%yc);
//
// }
//
// if(isObject("Mine_Grid_Button" SPC %check[%i]))
// {
//
// ("Mine_Grid_Button" SPC %check[%i]).delete();
//
// }
//
// ("Mine_Grid_Button" SPC %x SPC %y).delete();
//
// }
//
// }
I'm trying to do the same command to the surrounding sqaures that also have 0 mines surrounding them, but both of those attempts at coding it just sends BL into an endless loop.What about using buttons instead of swatches so you can actually click on them?I feel like an idiot, completely forgot you could still use %i and %j like that. thanks lol
And then in your loop you can do this when creating the button:
command = "clickGrid(" @ %i @ ", " @ %j @ ");";
Then it will call clickGrid when you click on the button, with the arguments of column and width
I'm not on my pc so I can't tell you how to properly create buttons
for(%i=0;%i<%grid_width;%i++)
{
for(%j=0;%j<%grid_height;%j++)
{
%pos = 1 + (%i*20) SPC 1 + (%j*20);
%grid = new GuiSwatchCtrl("Mine_Grid" SPC %i SPC %j)
{
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = %pos;
extent = "19 19";
minExtent = "19 19";
enabled = "1";
visible = "1";
clipToParent = "1";
color = "255 255 255 64";
mine = "0";
gridX = %i;
gridY = %j;
};
Mines_Area.add(%grid);
}
}