Haxe set ui image location

question

#1

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


#2

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.


#3

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.


Armory Props: How to use? Where are informations/documentations?
#4

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


#5

Some nodes like these would be very nice


Opensource developer
#6

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
}

#7

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


#8

@ zicklag Thanks a lot.

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