Problem with "delete button"

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with "delete button"

pink
so I've already submitted a bug report for this, but I am trying to find a work around in the meantime...

I'm developing a turned based game, on each turn, new buttons get added to the board, and it some buttons will get removed. There in lies the problem, Livecode keeps crashing when I hit the "delete button xxx" command.

So, the only work around I've come up with is to make the buttons invisible, however this means as the game goes on that there are going to be hundreds of invisible buttons cluttering the board.

Will this have an effect on performance as the number of objects increases dramatically?
is there another way to remove buttons besides "delete button"?


FYI:
http://quality.livecode.com/show_bug.cgi?id=19017
---
Greg (pink) Miller
mad, pink and dangerous to code
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Tom Glod
i find livecode very quick at drawing controls..make sure you lock screen
and messages whenever you can.

test it out, you might be surprised at how well LC deals with objects.

invisible objects are excluded from renderer, so they really should not
effect the performance.

but what do i know....i could be wrong..I've pushed livecode in a few
different ways, but never done games.

On Sun, Dec 18, 2016 at 4:50 PM, pink <[hidden email]> wrote:

> so I've already submitted a bug report for this, but I am trying to find a
> work around in the meantime...
>
> I'm developing a turned based game, on each turn, new buttons get added to
> the board, and it some buttons will get removed. There in lies the problem,
> Livecode keeps crashing when I hit the "delete button xxx" command.
>
> So, the only work around I've come up with is to make the buttons
> invisible,
> however this means as the game goes on that there are going to be hundreds
> of invisible buttons cluttering the board.
>
> Will this have an effect on performance as the number of objects increases
> dramatically?
> is there another way to remove buttons besides "delete button"?
>
>
> FYI:
> http://quality.livecode.com/show_bug.cgi?id=19017
>
>
>
> --
> View this message in context: http://runtime-revolution.
> 278305.n4.nabble.com/Problem-with-delete-button-tp4711069.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Dr. Hawkins
In reply to this post by pink
On Sun, Dec 18, 2016 at 1:50 PM, pink <[hidden email]> wrote:

> So, the only work around I've come up with is to make the buttons
> invisible,
> however this means as the game goes on that there are going to be hundreds
> of invisible buttons cluttering the board.
>

1) have you compiled?  Does this also happen in standalone (some crashing
is the IDE).

2) in addition to invisible, you can put them at a negative X or Y.



--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

dunbarxx
In reply to this post by pink
Have I missed most of this thread? Why should LC crash when you delete an object? Is there a handler running at the time? What version is this about?

Craig Nemwan
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

pink
In a nutshell: I have a stack that I've been tinkering with for while. There is a particular handler in which there is a "delete button" command which causes Livecode to crash in 8.1 thru 8.1.3 (I don't have any versions of Livecode prior to 8.1 right now). Everything works fine in 7.1.4 and 6.7, so it is a new problem.

This happens in the IDE and in standalones built. Oddly, there's no crash log, so I guess I would describe it more as "suddenly quits".

If you're familiar with 2048, it is a similar game system. Numbered buttons get moved around a board, and when two alike numbers collide, they get added together and one of the buttons gets removed. Below is the actual handler, the problem line is "delete button tAtom"

command fuseAtoms pStarting,pDestiny,@pGame
     put pGame["hex"][pDestiny]["atom"] into tDAtom
     put pGame["hex"][pDestiny]["value"] into tDValue
     
     put tDValue*2 into pGame["hex"][pDestiny]["value"]
     
     if pGame["keeper"]["best"]<pGame["hex"][pDestiny]["value"]  then put pGame["hex"][pDestiny]["value"]  into pGame["keeper"]["best"]
     
     set the label of the button tDAtom to pGame["hex"][pDestiny]["value"]
     
     put pGame["hex"][pStarting]["atom"] into tAtom
     delete button tAtom
     put empty into pGame["hex"][pStarting]["atom"]
     put 0 into pGame["hex"][pStarting]["value"]
     put empty into pGame["hex"][pStarting]["fused"]
     put empty into pGame["hex"][pStarting]["flavor"]
     put empty into pGame["hex"][pStarting]["new"]
     add tDvalue*2 to pGame["keeper"]["score"]
     put 1 into pGame["hex"][pDestiny]["fused"]
     put 1 into pGame["keeper"]["validMove"]
     set the backgroundColor of graphic pStarting to empty
     if pGame["hex"][pDestiny]["flavor"] is 2 then set the backgroundColor of graphic pDestiny to pGame["settings"]["twoBack"]
     if pGame["hex"][pDestiny]["flavor"] is 3 then set the backgroundColor of graphic pDestiny to pGame["settings"]["threeBack"]
     if pGame["hex"][pDestiny]["flavor"] is 5 then set the backgroundColor of graphic pDestiny to pGame["settings"]["fiveBack"]
     if pGame["hex"][pDestiny]["value"] is 0 then
          set the backgroundColor of graphic pDestiny to pGame["settings"]["gunkBack"]
          add 1 to field "gunkCountShow"
          add 1 to pGame["keeper"]["negativeCount"]
     end if
     if pGame["hex"][pDestiny]["value"] is 0 then set the textColor of button tDAtom to pGame["settings"]["gunkText"]
     
     put 1 into pGame["keeper"]["validMove"]
end fuseAtoms
---
Greg (pink) Miller
mad, pink and dangerous to code
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

panagiotis merakos-2
Hi all,

This issue is now confirmed and fixed. The fix is planned to be included in
LC 8.1.3 RC-1.

http://quality.livecode.com/show_bug.cgi?id=19017

Best,
Panos
--

On Mon, Dec 19, 2016 at 12:38 PM, pink <[hidden email]> wrote:

> In a nutshell: I have a stack that I've been tinkering with for while.
> There
> is a particular handler in which there is a "delete button" command which
> causes Livecode to crash in 8.1 thru 8.1.3 (I don't have any versions of
> Livecode prior to 8.1 right now). Everything works fine in 7.1.4 and 6.7,
> so
> it is a new problem.
>
> This happens in the IDE and in standalones built. Oddly, there's no crash
> log, so I guess I would describe it more as "suddenly quits".
>
> If you're familiar with 2048, it is a similar game system. Numbered buttons
> get moved around a board, and when two alike numbers collide, they get
> added
> together and one of the buttons gets removed. Below is the actual handler,
> the problem line is "delete button tAtom"
>
> command fuseAtoms pStarting,pDestiny,@pGame
>      put pGame["hex"][pDestiny]["atom"] into tDAtom
>      put pGame["hex"][pDestiny]["value"] into tDValue
>
>      put tDValue*2 into pGame["hex"][pDestiny]["value"]
>
>      if pGame["keeper"]["best"]<pGame["hex"][pDestiny]["value"]  then put
> pGame["hex"][pDestiny]["value"]  into pGame["keeper"]["best"]
>
>      set the label of the button tDAtom to pGame["hex"][pDestiny]["value"]
>
>      put pGame["hex"][pStarting]["atom"] into tAtom
>      delete button tAtom
>      put empty into pGame["hex"][pStarting]["atom"]
>      put 0 into pGame["hex"][pStarting]["value"]
>      put empty into pGame["hex"][pStarting]["fused"]
>      put empty into pGame["hex"][pStarting]["flavor"]
>      put empty into pGame["hex"][pStarting]["new"]
>      add tDvalue*2 to pGame["keeper"]["score"]
>      put 1 into pGame["hex"][pDestiny]["fused"]
>      put 1 into pGame["keeper"]["validMove"]
>      set the backgroundColor of graphic pStarting to empty
>      if pGame["hex"][pDestiny]["flavor"] is 2 then set the backgroundColor
> of graphic pDestiny to pGame["settings"]["twoBack"]
>      if pGame["hex"][pDestiny]["flavor"] is 3 then set the backgroundColor
> of graphic pDestiny to pGame["settings"]["threeBack"]
>      if pGame["hex"][pDestiny]["flavor"] is 5 then set the backgroundColor
> of graphic pDestiny to pGame["settings"]["fiveBack"]
>      if pGame["hex"][pDestiny]["value"] is 0 then
>           set the backgroundColor of graphic pDestiny to
> pGame["settings"]["gunkBack"]
>           add 1 to field "gunkCountShow"
>           add 1 to pGame["keeper"]["negativeCount"]
>      end if
>      if pGame["hex"][pDestiny]["value"] is 0 then set the textColor of
> button tDAtom to pGame["settings"]["gunkText"]
>
>      put 1 into pGame["keeper"]["validMove"]
> end fuseAtoms
>
>
>
>
> --
> View this message in context: http://runtime-revolution.
> 278305.n4.nabble.com/Problem-with-delete-button-tp4711069p4711075.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



--
Panagiotis Merakos <[hidden email]>
LiveCode Software Developer

Everyone Can Create Apps <https://livecode.com>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

pink
So am I the only one who gets excited when bugs are confirmed?  It's like "Yay! It's not me this time!"
---
Greg (pink) Miller
mad, pink and dangerous to code
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Bob Sneidar-2
I'm a little odd. My Mom called me "different". I like it when I am the one who actually FINDS the bugs.

Bob S


> On Dec 19, 2016, at 06:27 , pink <[hidden email]> wrote:
>
> So am I the only one who gets excited when bugs are confirmed?  It's like
> "Yay! It's not me this time!"
>
>
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Richard Gaskin
In reply to this post by pink
pink wrote:

 > So am I the only one who gets excited when bugs are confirmed?  It's
 > like "Yay! It's not me this time!"

Far from alone.  And the team's been offering plenty of that sort of
excitement with super-rapid turnaround once a solid recipe's been submitted.

Thanks for reporting that, and thanks to the team for the quick resolution.

--
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  [hidden email]                http://www.FourthWorld.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Quentin Long
In reply to this post by pink
sez pink <[hidden email]>:
> I'm developing a turned based game, on each turn, new buttons get added to
> the board, and it some buttons will get removed. There in lies the problem,
> Livecode keeps crashing when I hit the "delete button xxx" command.
>
> So, the only work around I've come up with is to make the buttons invisible,
> however this means as the game goes on that there are going to be hundreds
> of invisible buttons cluttering the board.
Assuming that button-deletion continues to be a problem, one possible workaround would be to figure out the maximum number of buttons that can ever be on the board at any one time; give the game-board that many buttons to start with; and re-assign button-characteristics (visibility, icons, position, etc) "on the fly" as needed.

If you need to deal with specific characteristics of a button on the board, you may want to use indirection. I of course don't know any of the details of your game, but let's consider the case of a game that involves a 10-by-10 grid, with buttons appearing and disappearing on the grid-positions during the course of the game. You could have a global variable whose name is "Grid-1-1", and every time you move a button into the 1,1 space on the grid, put the name of that button into the Grid-1-1 variable. If/when you need to fuss with specific properties of the button at (grid-space 1,1), you should be able to do things like this:

set the [name of property] of button Grid-1-1 to [value]
put the [name of property] of button Grid-1-1 into [name of variable]

Since the string "Grid-1-1" is a variable, and the value of that variable is the name of a button, LiveCode should interpret "button Grid-1-1" as a reference to the button whose name is stored in the variable "Grid-1-1". You'll want to be careful about quote-marks in your code, of course. A variable name in quote-marks will be interpreted as a literal string, which is not what you want.

Hope this helps…
   
"Bewitched" + "Charlie's Angels" - Charlie = "At Arm's Length"
   
Read the webcomic at [ http://www.atarmslength.net ]!
   
If you like "At Arm's Length", support it at [ http://www.patreon.com/DarkwingDude ].

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

Peter Bogdanoff
In reply to this post by Dr. Hawkins
I’m working on an application that does something similar, but instead of creating buttons, I have graphics or images where the buttons would be, and I have one large button over the whole thing. There is a list of rects where the buttons should be… the large button gets the mouseLoc and checks the list to see if the mouseLoc is “within the rect” of a line of the rects. Not much creation or deletion of buttons.

However, I’m creating and deleting graphics and fields, and a few buttons, right and left with absolutely no problem, and Livecode is really fast doing this. LC 8.1.1

Peter Bogdanoff


On Dec 18, 2016, at 5:39 PM, Dr. Hawkins <[hidden email]> wrote:

> On Sun, Dec 18, 2016 at 1:50 PM, pink <[hidden email]> wrote:
>
>> So, the only work around I've come up with is to make the buttons
>> invisible,
>> however this means as the game goes on that there are going to be hundreds
>> of invisible buttons cluttering the board.
>>
>
> 1) have you compiled?  Does this also happen in standalone (some crashing
> is the IDE).
>
> 2) in addition to invisible, you can put them at a negative X or Y.
>
>
>
> --
> Dr. Richard E. Hawkins, Esq.
> (702) 508-8462
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Problem with "delete button"

pink
In reply to this post by Quentin Long
the identified issue that was causing the crash involved the fact that the buttons were moving just prior to being deleted... so what I've done in the meantime was to turn the visible flag to false and then on the beginning of the next turn, I delete all the invisible buttons... works well
---
Greg (pink) Miller
mad, pink and dangerous to code