integer

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: Klaus, FourthWorld, heatherlaine, kevinmiller

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

Re: integer

Post by dunbarx »

Set a breakpoint at the line:

Code: Select all

if _overDriveBonus is an integer then #do something
Step through the handler and see what the value of the variable "_overDriveBonus" is at that point.

Craig
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: integer

Post by Klaus »

Samuele wrote: Thu Jan 27, 2022 6:19 pm alright, i figured i'd share only the inherent parts of my stack:
OverDriveBonus.zip
Is asking for a LITTLE info (where to click and where to look etc.) too much?
And I can't even SEE the progressbar!? :shock:
Klaus
Posts: 14325
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: integer

Post by Klaus »

OK, I found a way through your stack...

The progressbar works as expected!

Code: Select all

on UpdateOverDriveClickBonus
   add 1 to _sessionClicks
   set the thumbPosition of scrollbar "ProgressOverDrive" to _sessionClicks
...
But you reset it to 0 immediately after that!?
And every time when clicked!?

Code: Select all

on ShowBetterOverDrive
   ## _overDriveBonus IS an INTEGER all the time!
   if _overDriveBonus is an integer then
      set the thumbPosition of scrollbar "ProgressOverDrive" to 0
...
So you shoot your own foot, gratulazione! 8)
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: integer

Post by Samuele »

Klaus wrote: Thu Jan 27, 2022 6:36 pm ## _overDriveBonus IS an INTEGER all the time!
you're right!!! when i realized it i made two functions, one with return trunc and the other a normal return, and that fixed my first problem.
Samuele.
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: integer

Post by Samuele »

the second problem is: how can i reset the progress bar and restart the progress (a solution would be to put 0 into _sessionClikcs but the problem is that if i do that then the bonus will remain always X1)
any other ideas?
Thanks!
Samuele.
Samuele
Posts: 282
Joined: Mon Oct 11, 2021 7:05 pm

Re: integer

Post by Samuele »

Thank you for your help i solved the progress bar problem B"H by setting it to (_sessionClicks - _ClicksAlreadyCounted) and i added 20 to _ClicksAlreadyCounted where i set the progress bar to 0.
Samuele.
dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10508
Joined: Wed May 06, 2009 2:28 pm

Re: integer

Post by dunbarx »

Samuele.

This is always how these things play out, invariably operator malfunction. But that is how we all learn, the hard way. :wink:

Craig
Post Reply