Message Box doesn't update variables correctly

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Laralyn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Sun Sep 11, 2011 7:13 pm

Message Box doesn't update variables correctly

Post by Laralyn » Tue Nov 08, 2011 12:00 am

I'm new to LiveCode, so point me toward info on this if I've missed it somewhere!

I'm debugging an app, and I can't get Global Variables to update correctly in the Message Box. If I scroll to the variable I want to check and run the game, the variable status on the right side doesn't update until I click another variable, then click back on the one I want to check.

For example, assume I have Variable1 and Variable2. Variable2 should +1 every time I do something correctly in the game. If the listing in the Message Box is sitting on Variable2 and I do two correct actions, there is no update--the variable reads 0. If I click on Variable1's listing in the Message Box, then on Variable2's listing again, it correctly says 2.

That really slows down the kind of debugging where you need to watch variables change over time. Am I missing a better way to do this, or is the window buggy?

Thanks!

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Message Box doesn't update variables correctly

Post by dunbarx » Tue Nov 08, 2011 5:52 am

Hi.

You surely mean the debugger. The message box is a cute gadget where you can enter commands, and see other things.

The debugger is where you stop execution and see the value of variables, global or otherwise. If you place this in a button :

Code: Select all

on mouseUp
   global qq
   put 0 into ww
  breakpoint
   repeat 3
   put random(99) into qq
   add 3 to ww
   end repeat

end mouseUp
Do you not see the value change as you step through? I do. Note I used the hard "breakPoint" command here. I am not sure how experienced you are with soft ones.

Now try this:

Code: Select all

on mouseup
   breakpoint
   repeat 20
      put random(99) & return after temp
   end repeat
end mouseup
After a few passes, note that there is a magnifying glass on the right side of the debugger window on the "temp" line. Click it. Now make a few more passes.

Write back if none of this works out for you, and welcome to the forum.

Craig Newman

Laralyn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3
Joined: Sun Sep 11, 2011 7:13 pm

Re: Message Box doesn't update variables correctly

Post by Laralyn » Wed Nov 09, 2011 1:19 am

Thanks for the info! :-)

I knew about the debugger, but I was hoping to be able to watch variables change while playing, without having to step through code. Is there a way to get that section of the Code window to update without a break point?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Message Box doesn't update variables correctly

Post by dunbarx » Wed Nov 09, 2011 3:02 am

It is common practice to place certain results into the msg box now and then This is convenient on occasion, and simple and accessable. It would be tedious, however, to try to make it a tool that even approaches the debugger.

The debugger is your friend. Play around with it. It is indespensible, comforting, simple and very powerful .

Craig Newman

acidjazz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 93
Joined: Mon Feb 16, 2009 2:37 am

Re: Message Box doesn't update variables correctly

Post by acidjazz » Sat May 26, 2012 4:49 pm

Craig,

I think Laralyn is talking about the "global properties" window in the message box. You have to click on the little icon of the "world" to see it (and you have to click the triangle over at the far right to even see the icons) And yes, Laralyn the message box is about as buggy as it gets. I came across your post because for the past few hours I can't even get the darn thing to respond at all to my commands. It's just ... dead.

Mark

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10320
Joined: Wed May 06, 2009 2:28 pm

Re: Message Box doesn't update variables correctly

Post by dunbarx » Sun May 27, 2012 3:13 am

Mark.

I answered your other post. Click in the lower field in the single line pane of the msg box and type a return. This fixes this intermittant issue, at least for the session you are in.

Craig

Post Reply