Why wouldn't this block code work?

I’m trying to make a two option difference voting system, and I just ran into my last problem
I think this should’ve worked, maybe it did? But my text property value counter didn’t show it.
Maybe because this is my 3rd time using block code, everything here is wrong?
But also the last two images are the things not working.
So I retreat to the question
“Why doesn’t this block code work? And how would I fix it?”

Here are the properties
Property 1


Property 2

If the button for Option 1 is clicked, it triggers this block code.


If the button for Option 2 is clicked, it triggers this block code.

This checks for votes

This does not work
This is activated upon receiving on “Option 1 was elected”


This does not work
This is activated upon receiving on “Option 2 was elected”

Are your properties’ scope on global?

2 Likes

it is because you only subtracting by the other option but they could win the vote by two so it wouldnt reset

Hmmm, yes, but I need them to be global so the voting system works, and I forgot to say that it’s only the last 2 images that don’t work.
All the other images worked and I provided them to give you background information.

1 Like

When you say they don’t work, do you mean they don’t activate? Or do they not subtract?

1 Like

to fix it you would subtract the option by iteslf so it equals 0

Actually come to think of it, it should activate, but for some reason they don’t subtract.

Elaborate.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

When you tested the system, perhaps the option 2 was equal to 0? Then subtracting it wouldn’t do anything, right?

1 Like

Maybe try adding debugging(activity feed) to check where the program goes, and what it returns after each operation.

1 Like

No, I know that isn’t the case, since I have a text showing me the property values, and I tried to subtract when it was more than one.

Can you please explain more, I barely know how my system works, and maybe please add pictures to what the block code would look like?

1 Like


All the activity feed items are meant to help debug the program by showing you where the code goes, and what results are returned.
PS:
Don’t copy all my code, it’s just an example.

1 Like

I will implement that because I need it for something else…
But I think I found the problem, the text that provides me with the property values only updates when I press a button, how can I make it so that it is being updated all the time without me pressing the button for voting on the property it is responsible for?

What are the last 2 images doing? Like what purpose are they holding?

Properties have this setting:


Set that to your specific channel and have the overlay update based on that channel.

1 Like

The purpose they have is to be subtracted from if greater than or the other property will experience that if it was greater than.

Well I ran into another problem, why isn’t the property value who’s value is being subtracted from, not going to zero?

Why can’t you just go set property: option 1 == 0?

Because it’s taking 2 different numbers.

If option 1 had 4 votes and option 2 had 2 votes it would do set property: option 1 == (option 1 - option 2), which then option 1 would equal 2.

2 Likes

Thanks slim, that worked, but it lead to me to the problem that now it didn’t subtract but I was able to work around by connecting some channels.