Hi! I am just getting started with Wick. It seems like a wonderful tool for making simpler games.
I am wondering how to use scripting to change text inside a button or clip, from outside that button/clip.
So, let’s say I’m making a magic-the-gathering-style card game, with a card that starts out with “HP: 20” in the upper left corner.
I’m binding all the bits of a card together by making them a button, so that I can EG change the x,y coordinates of the whole card at once. I guess binding them together this way is the best way to go, since it is also what allows me to give it a name so that I can tell it to do things with scripts. And of course, making it a button rather than a clip means it is clickable, which is going to be useful.
Let’s say I’ve made a card called “ralph”.
Then I want to change the HP of ralph; let’s say, from the default script of frame 1 for simplicity (but eventually this is something which would happen from various events).
So I try:
ralph.setText("HP 19")
This of course doesn’t work; I get an error saying that I cannot setText something which isn’t a text box. It doesn’t know to look for the text box inside ralph. Plus even if it did, then I couldn’t have multiple different text boxes for different things, obviously.
I also tried making the text within the button into a button, so that I can give it a name. Let’s say I name it “hp”.
ralph.hp.setText("HP 19")
Also does not work, probably because “hp” is just added as a new field of ralph, rather than modifying the HP text. (no error message for this one)
- How do I change text fields within a button?
- If different, how do I change text fields within a clip?
- Do I actually have to turn things into either a clip or a button, in order to give them a name so that I can reference them with scripts? Or is there another way to do that?
- How do I reference things inside of things, in general? Apparently it’s not like ralph.hp; but there must be a way, I guess?
I am using the current wick editor, 1.19.3.
Thanks for any help!