Advanced Update Order | Difficulty: đŸŸȘ

Yep, that’s basically what AUO is.

7 Likes

Ok so I just found a cool memory save. It’s not enough information to make it’s own post, so I decided to just tack it on here. If you want to set a varible to 0 if something is false, and to 1 if something is true, this code works:


Because Blockly auto sets all varibles to 0, this will set x to 1 if the statement is true, and set x to 0 if the statement is false. Just a quick way to save 2 blocks!

9 Likes

noice

3 Likes

Should we make a new line of guides, like [ :loudspeaker: PSA! ] and [ :newspaper: Resources ], called [ :pinching_hand: Mini-Guide ]? It would be useful for information we thought was too short to make its own guide.

  • Yes
  • No

0 voters

2 Likes

“oh no!”
“that’s right: it’s time to learn things!!”

13 Likes

I would love to have a phrase correlated to my name that means a long, very good, detailed explanation!

5 Likes

Petition to put AUO under concepts in the gimkit docs lol

6 Likes

Lol that would be cool but most gimkit creators wouldn’t really understand lol

2 Likes

Javascript is different from some other coding languages because it’s single-threaded which means that it operates tasks through a sequence of events (an event loop). It’ll go through each task in the sequence and update UI (what appears on the screen) according to it. So like block code, wires, and stuff like that will go through the event loop, but block code runs but also doesn’t block the main thread so while block code runs, other events can happen I assume.

As for why block code is used instead of coding languages, a coding language could block the event loop which would create more lag in a creative game, which could result in breaking the system, while block code runs aside from the event loop and possibly adds the result to the event loop while maybe being in another specific order(? this idea might have to be investigated more)

6 Likes

i might have gotten that so wrong and offended programmers, mb if that’s the case

2 Likes

Right, but for slightly wrong reasons.
(the below is theory based of of programming knowledge and experiments.)

Gimkit stores connections between devices in a list. When its triggering connections, it just loops over the list. Because connections are appended to the list, the first one placed will be the first one appended, and therefore the first one triggered.

8 Likes

Makes sense.

2 Likes

Josh said that he doesn’t even know the update order for gimkit, BUT, he did confirm AUO is correct!

11 Likes

Dang it we should have asked him to list it as a concept in the docs.

5 Likes

Question:

If I made a channel, then wired something to something else, would the wire always act second, even if I deleted and replaced one of the devices that use the channel?

1 Like

Because of the way channels are triggered, it could be either one I think

1 Like

I got my modified popup shop to work. Just a bit of channel shuffling.

1 Like

In one of my recent projects, AUO was actually somewhat useful. I wanted to limit the total number of items a player could hold to 1, dropping any excess items instead of destroying them. This ended up being more challenging than I thought, and the solution I came up with involved giving the player overfill of the excess item and then instantly removing it from their inventory. Without AUO, the small delay between the two actions caused an annoying +1 item popup to appear for the item which was about to be removed from the inventory. Correcting for the update order greatly improved the user experience and simplified the wiring. AUO pulled through big time!

5 Likes

Wait, not trying to discount your solution, but couldn’t you just use an inventory item manager?

3 Likes

Welcome to the forum, @Taxes! Check out the beginner-must-read and forum-tips for more easy help! Read the Community Guidelines for a gist of the rules. If you ever run into a hard problem, talk to anyone in @trust_level_3. They can help you with hard and in-depth concepts and mechanics!

Wow, a new user that already understands AUO. You don’t see that every day.

3 Likes