Your username: t1
What kind of device are you using?: iPad Pro (10.5-inch), iOS 14.1 (18A8395)
Hopscotch version is App Store version 3.44.3
1 sentence description of the problem (I was doing _________, and then __________ happened):
I was broadcasting a message from an object to itself, where the message had included a custom Self variable, and I was trying to add code for when that message is matched. But it matched the value of the text field underneath the variable bubble, and not the self variable.
Is being treated like this (where this is the text underneath that Self variable):
Steps that the Hopscotch team can take to reproduce my problem every time:
- Create an object with a custom Self variable, and set it to some string, such as “apples”.
- Add a broadcast message block under any kind of rule (e.g. when self is tapped) that includes the same string, “apples”
- Add a new When, with “When message matches”, and fill in the default value with some different text. (e.g. “oranges”). Add some code so that later on you will be able to see when this When block triggers.
- Place the Self variable from step 1 into the “When message matches” slot in step 3. Leave the text that you left in step 3 (“oranges” in this example) as it is, underneath the Self variable.
Play the project and get the object to broadcast the message from step 2. (Tapping the object in this example)
Expected behaviour: in the last “When message matches” rule, the variable (Self) Name should convert to ‘apples’, and the message should match. Thus the text should change colour.
Actual behaviour: the “When message matches” bubble is using the text value that you entered in step 3.
To test this, go back into the code, and change the broadcasted message in step 2, to match the value of the text field in step 3 (“oranges” in this example)
What happened when the object was tapped:
I expected this to happen:
The “When message matches” block would trigger if the message matched the Self variable, which it doesn’t, in this case. So the text was not supposed to change colour.
But instead this happened:
The “When message matches” block is triggered when the message matches the value of the text field (that the Self Variable block is in). The text changed colour.
The broken code is in Step 6 — a Self variable is used, but the “matches” block uses the value of the text field that is “underneath” the Self variable, and not the value of the Self variable.
I did a fair amount testing, but it seems specifically when Self custom variables are used (and if the Self custom variables are set to strings. I didn’t test with the default numeric self variables )
I did a quick test with a global variable, and this code works as expected (it changes colour when tapped. And it does not use the “oranges” text in the text field that is underneath the Testing variable):
And the “When I get a message” block has been working fine with custom Self string variables. It appears to be just the “matches” block.