How to get BBCode to change when key is pressed?

I have a BBCode called AutoFire that displays AUTO FIRE in the top-left in blue.
When I click on AUTO FIRE it goes a brighter colour. This is what I want.
Unfortunately, when I press the Enter key, it does not go a bright colour. The colour does not change. Why not?

I added a DebugText object to display AutoFire is ON or AutoFire is OFF in the middle of the screen so that I could see in both cases the variable was changing fine, so I’m confused why the BBCode colour change only occurs on the mouse click and not when Enter is pressed?

I’ve uploaded a simple game.json that demonstrates the problem: https://www.sendspace.com/file/qh6fzh. Try clicking on the text in the top-left vs. hitting the Enter key. This seems broken on GDevelop 5.0.0-beta105 on Windows 10.

You just need “if one this conditions is true”
Delete “if all these conditions are true”
Your link is broken

No, his use of or+and is correct.

It’s the trigger once that’s wrong.
You need 2, 1 under mouse is down, the other under key is pressed

I guess the code says he needs put the mouse over the text and press, and at the same time hit Enter key for the code works and change the text color. Only this way all conditions would be true.
Or I am wrong?

You are wrong
It says
If ether
Mouse is down and on autofire
Or key is pressed

My bad. I just noticed the" key is pressed" is outside of condition.

I think perhaps I didn’t explain the problem clearly enough.

The scene variable AutoFireOn always changes. That works fine. If I click the AutoFire text object, or if I press Enter, both are fine, the variable AutoFireOn will change as expected as you see the DebugText change from AutoFire is ON to AutoFire is OFF. That works fine.

The problem is that the Set base color of AutoFire only works if I click on the AutoFire text object. Set base color of AutoFire is not working if I press the Enter key.

So it can’t be to do with the conditional logic, or where I place the Trigger once or how many of those I place, otherwise the scene variable would not change either. And I have tried all of the suggestions made in this thread, but nothing has made any difference.

It doesn’t make sense to me. How is this even possible?

(btw the link to game.json I provided above seems to work fine for me?)

Click works, because then you specify the object.
Use object variable, instead of a scene variable

link works fine infact im gonna send a updated version that has the bug fixed

https://github.com/derric-young/updated/archive/refs/heads/main.zip

its for direct download

Ok, so this fixed it, by adding Pick all instances:

image

Not sure why I needed it though, given I only have one AutoFire object in the scene.

Thanks everyone for the suggestions and pointing me in the right direction!

You might want to check your list of scene instances.
Sounds like you have it twice (overlapping?)

Good suggestion, I checked in debug mode but no, there is only one instance of AutoFire.

I think the problem is a bit more weird than that, it’s another strange bug, because if I separate out the Return key is pressed action below repeating all the same stuff, it works fine:

So the question is, if it works fine when separated out like that, why is it not possible to combine them as I originally did above?

somehow, the object gets singled out, using the or condition.
not surewhy.

my assumption is, that GD check if cursor is on object, and if it is not, it gets singled out of the selector.

I remember a very old threat. It has to do with how it works internally
and yes it’s confusing. I don’t know what the exact explanation and solution was, but I just figured out a simple one.
01

Sorry Jack, but that only works if your mouse is hovering over the text when the Return key is pressed.

Hm no.
https://www.sendspace.com/file/01eyn0

But I won’t trigger if mouse is on object.
Maybe another or with is on button and is not on button?

Anyway, the best solution would be to just have 2 separate events.

I could say if mouse is on the object or not on the object, but I agree that’s getting silly.

I’ll leave it as two separate events.