Haxe set ui image location

I’m struggling to get my first script done. :confused:
At each value, an image (“selected”) should get to a certain point in the UI.
I’ve got a Property called (“qb_selected”) with an int value from 0-8. The values get assigned with a node system.

I’ve tried it for the first to values, but obviously, it won’t work.

My current script:

Does someone know what I’m doing wrong and how to fix it?

Quados

Although I don’t really understand HaxeUI, I would like the integration of *.UI files (at least .Qt), In my opinion that would be a nicer way around these problems.

That would require integration with native C/C++ libraries and it probably wouldn’t be easy/possible for Web and maybe Krom.

@Quados As far as the problems you’re having, you quite a few misunderstandings of how the scripts work. Don’t feel bad though, its pretty close for your first one! :slight_smile: Also a warning, this particular section of Armory isn’t the easiest to work with at the moment and probably not a good thing for a beginner, but I’ll still try to give you a helpful example.

I don’t have time to do any testing, but here is an example that demonstrates more what the script should look like. This script has to be put in your myGameFolder/Sources/arm and it has to be applied to the object that has the qb_selected property that you are checking for.

2 Likes

Thank you a lot, for taking the time and helping me.
It looks like it does almost what I’m looking for, or maybe I just haven’t understood it yet.
At the end, where you’ve set the image location you use an else. How can I use an else for more than 2 values of the property?

Thanks again

Some nodes like these would be very nice

Ah, I missed that. You can do that like this:

if (this.object.properties["qb_selected"] == 0) {
    img.x = 510;
} else if (this.object.properties["qb_selected"] == 1) {
    img.x = 610;
} else if (this.object.properties["qb_selected"] == 2) {
    img.x = 710; // or whatever it is
}
1 Like

Thanks a lot!!! I will try it out as soon as possible.

@ zicklag Thanks a lot.

Your script is the solution to my question: Armory Props: How to use?

1 Like

Added set canvas’s element location and some other at https://github.com/armory3d/armory/commit/3bf9feac8f4ea3b8fb86f579f0fb043cf720b629

4 Likes