Renamed What are some common problems related to execution order%3F to /Questions/What are some common problems related to execution order%3F
commited
commit
416e6949d4470ff9e1356ea6c055388eb9b09220
... | ... | @@ -146,3 +146,5 @@ Dnjdjddjdjdkdkddud.md: Error.md |
146 | 146 | Why doesn't my game appear on search?.md: Questions/Why doesn't my game appear on |
147 | 147 | search%3F.md |
148 | 148 | What platforms does Fancade support?.md: Questions/What platforms does Fancade support%3F.md |
149 | What are some common problems related to execution order?.md: Questions/What are some |
|
150 | common problems related to execution order%3F.md |
... | ... | @@ -0,0 +1,13 @@ |
1 | Script blocks are executed top-to-bottom, left-to-right, [by default](Execution order). When you need more control over the order, connect them with yellow wires. Here are some examples where it's easy to forget that the default order may not be what you want: |
|
2 | ||
3 | ### Example 1 |
|
4 | This one is common among newbies. In this case, the problem is easy to spot. The variable **A is defined AFTER the Set Position** that has A as an input. Since A is not yet defined when Set Position was run, it simply does nothing resulting in a buggy script. |
|
5 | [[/uploads/NZgn9C7.jpeg]] |
|
6 | A simple solution for this is to **define A before the Set Position**. |
|
7 | [[/uploads/4KJxQG5.jpeg]] |
|
8 | ||
9 | ### Example 2 |
|
10 | Create Object is one of those scripts that has **an output AND execute wires** attached to it. If a scripts has both, output and execute wires, it's usually a good idea to set those outputs into a variable using the After Wire. Else, you'll suffer from an **One Frame Delay**. |
|
11 | [[/uploads/7xNbBVB.jpeg]] |
|
12 | The script shown above will suffer from that One Frame delay, since each frame the object that gets created is set onto the variable A **after** the set position has run. A simple fix would be, is to set the variable via the After Wire. |
|
13 | [[/uploads/4iUV6ZV.jpeg]] |
|
... | ... | \ No newline at end of file |
... | ... | @@ -1,13 +0,0 @@ |
1 | Script blocks are executed top-to-bottom, left-to-right, [by default](Execution order). When you need more control over the order, connect them with yellow wires. Here are some examples where it's easy to forget that the default order may not be what you want: |
|
2 | ||
3 | ### Example 1 |
|
4 | This one is common among newbies. In this case, the problem is easy to spot. The variable **A is defined AFTER the Set Position** that has A as an input. Since A is not yet defined when Set Position was run, it simply does nothing resulting in a buggy script. |
|
5 | [[/uploads/NZgn9C7.jpeg]] |
|
6 | A simple solution for this is to **define A before the Set Position**. |
|
7 | [[/uploads/4KJxQG5.jpeg]] |
|
8 | ||
9 | ### Example 2 |
|
10 | Create Object is one of those scripts that has **an output AND execute wires** attached to it. If a scripts has both, output and execute wires, it's usually a good idea to set those outputs into a variable using the After Wire. Else, you'll suffer from an **One Frame Delay**. |
|
11 | [[/uploads/7xNbBVB.jpeg]] |
|
12 | The script shown above will suffer from that One Frame delay, since each frame the object that gets created is set onto the variable A **after** the set position has run. A simple fix would be, is to set the variable via the After Wire. |
|
13 | [[/uploads/4iUV6ZV.jpeg]] |
|
... | ... | \ No newline at end of file |