Numeric variable limitation?

Q&A about the latest versions
Post Reply
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Is there any limitation to numeric variables?.

I am trying to assign values above 10 to a variable but when I put 11 the variable returns 0, 12 is 1, 13 is 2...etc
User avatar
Hopki
Gnome
Posts: 13018
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Can you explain how you are entering in the numbers?
Which actions are you using?
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

I created a numeric variable.

Then I created buttons. The buttons assign numeric values with the following action:
Mouse click
Set variable value
Set(=)
Value 3, 4, 5... 50...etc

When the values are between 0 and 10 it works fine.
When the value assigned is 11 or higher the variable takes values from 0 to 10 again... 11 is 0, 12 is 1, 13 is 2... etc 50 is 6 ??. Seems like the only aceptable values for numeric variables are between 0 and 10.

I changed the type of variable from numeric to text and then works perfectly fine. The problem appears with numeric variables
User avatar
Hopki
Gnome
Posts: 13018
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi Jose,
I'm not seeing this.
As a test, I set a number variable, default 0.
I then added three buttons that set the value to, 10, 20 and 21.
I also added a text box to display the value in the variable, this displays ok.

ScreenFlow.gif
ScreenFlow.gif (76.61 KiB) Viewed 6316 times

Can you make a simple skin that shows your issue?
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

I have found the problem.
One of the 9 buttons has two actions:

The first one adds 1 to the numeric value.
The second one was:

Variable Changed
varNumber
set variable value
varNumber
Mod(%)
11

The problem was that this action was executed when any button was pressed, so when the variable reaches 10 it resets to 0.
I did not expect this action to be executed when other buttons were pressed.

I have created a simple skin as an example.
Buttons 1 and 2 assign a numeric value.
Button 3 adds 1 and resets to 0 after 3
Button 10 assigns the value 10, but it returns 2
Attachments
Var number.ggsk
(1.14 KiB) Downloaded 136 times
User avatar
Hopki
Gnome
Posts: 13018
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
Button three has the source Mouse click AND a Variable Changed!
So when you click button 10, this changes the variable so the variable change is also activated.

So you set 10, then the Modulo action "Mod(%)", with its Variable changes is resetting the number

1,2,3,0,1,2,3,0,1,2

So 10 becomes 2.

Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Yes, button 3 is mouse click AND variable change , and it is behaving as OR. Because button 3 is not being clicked.

I thought that the mouse click action was restricted to the element that is being clicked, so a mouse click in button 10 shoud not trigger any action of button 3.
User avatar
Hopki
Gnome
Posts: 13018
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Ok, lets work threw this.
What are the actions in button 3?
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
jose maria
Posts: 41
Joined: Mon Jun 01, 2020 11:45 am

Button 3 has two actions:

Mouse click, Set variable value, Add(+) 1, to varNumber (the variable)
AND
Variable Changed varNumber, Set variable Value varNumber Mod(%) 4

Button 10 has one action

Mouse click, Set variable value, Set(=) 10, to varNumber

What I do not understand is why if I click button 10, it activates the actions of button 3.
When I click button 10 it should set the variable value to 10. That is it.
What it does instead is to add 10 to the variable resetting it to 0 when it reaches 3
1, 2, 3, 0 ,1, 2, 3, 0, 1, 2

I just want the Action "Variable Changed varNumber, Set variable Value varNumber Mod(%) 4" of button 3 to activate when I click button 3, not any other button.

There is some kind of interaction between buttons 3 and 10 that I do not see. And it happens with any other button I create with similar actions assigning variable values above Mod(%) 4

The skin attached in the previous message behaves like this
User avatar
Hopki
Gnome
Posts: 13018
Joined: Thu Jan 10, 2008 3:16 pm
Location: Layer de la Haye, Essex UK
Contact:

Hi,
The action in button three does not require a click.
"Variable Changed varNumber, Set variable Value varNumber Mod(%) 4"

So when any button is clicked that changes the variable, the above action will be actioned because the Variable Changed.
Regards,
Garden Gnome Support
If you send an e-mail to support please send a link to the forum post for reference.
support@ggnome.com
https://ggnome.com/wiki/documentation/
Post Reply