Okay... what? Block not triggering for no reason


#21

I see no when object is cloned block here
And ofc I was in the project

I’m not entirely sure what you’re trying to make the guy do, which is the problem and maybe why I’m not getting it


#22

It is a softball game. I want to make the batters rotate around the pitch, and then line up. Then rotate again. I haven’t added any other functionality yet. There is a clone block right at the top of the code in the project linked and you can see the clones if you went into the project.


#23

I was in the project, ok? I understand you’re getting impatient but I’m really trying to help.

I’ve looked through Everything, I really can’t find what’s wrong


#24

Sorry.:disappointed: The blue numbers are the clones. This is the make a clone block in the code.


#25

Ok I seriously have no clue, maybe Petrichor or somebody else will come around sometime later and help you, cause I can’t figure out what’s wrong… sorry…


#26

at the end one of them says ‘-0.1’

This doesn’t happen when I play the project. I slowly press the circle to advance the runners, but none ever equal -0.1

And when I force the Batter (self)Base to equal -0.1, the rule runs as expected.

If you could take a screenshot to show when one of the Batters (self)Base equals -0.1 I’ll look into it more (but it would be until later today). And are the steps to reproduce that result repeatable (try it multiple times)?


#27

I don’t think values work when set to negative numbers — i was coding yesterday and a value was set to -1 at the start of the project, and some objects should’ve been invisible when the value didn’t equal 0, but they weren’t invisible.

Unless me only using iPad values makes a difference…

@awesomeonion, @Rodrigo, is it possible for values to go into negative numbers and still work normally?
Or even decimals — when my values went into decimals once, it’d just round to a whole number.


#28

When they line up after everyone has gone round, the one last in the line has a value of -0.1.


#29

@MISSION_IMPOSSIBLE
Ok. I haven’t looked yet to see why but the value in your screenshot isn’t actually -0.1

The Hopscotch Player only displays a certain amount of precision. Meaning it rounds the actual value at some level of precision (number of digits to the right of a decimal point). If we instead display
(self)Base x 10^10 (and make clone index number 5 red), we get this:

Notice the right-most digit is 1? So the value isn’t actually -0.1

Doing this truncates the value to 1 digit to right of the decimal and the rule then works:

I’ll have to look later when I have more time to see why the value wasn’t exactly -0.1 to begin with…


Edit: Don’t feel bad. This nuance of the Player made me nuts on one project until I figured out what was going on. But now I remember to check for this (as will you) :wink:


Lots of small, annoying bugs in Hopscotch
Lots of small, annoying bugs in Hopscotch
#30

Ah. Thanks. That is really annoying. And weird, because I set it -3.1, then it is increased by one three times.


#31

Thank you! It works perfectly!
Now I just have to put in fielders, a bat, a ball, hitting physics, getting out and the pitcher.

Other than that, I’m done.

#32

I’ve spent some more time trouble shooting and the root cause is a bug with the math blocks (I’m going to make a detailed bug report in a new topic).

So I’d actually recommend this as a work around instead of changing the rule as I showed before.


(both formulas are the same)

In this way the (self)Base values actually are set to the value you originally expected. And subsequent references don’t need the rounding. Meaning, for example, the rule inside “This Rule” is just When (self)Base = -0.1


#33

Just FYI. Here’s the bug report: