Login

Fancade Wiki

Grammar: miscellaneous improvements

... ...
@@ -1,4 +1,4 @@
1
Fancade has a hard script limit. After a certain number of scripts in the editor, adding anything else will cause a "Too many scripts" error, and the game will refuse to run, as long as the extra scripts are not removed. Games that do not optimise scripts, that affect multiple objects, into loops are most likely to run into this issue.
1
Fancade has a hard script limit. After a certain number of scripts in the editor, adding anything else will cause a "Too many scripts" error. The game will refuse to run as long as the extra scripts are not removed. Games that do not optimise scripts affecting multiple objects into loops are most likely to run into this issue.
2 2
![Too many scripts!](https://cdn.discordapp.com/attachments/852037487987392529/852037576935211018/Too_many_scripts.png)
3 3
4 4
# History
... ...
@@ -16,26 +16,26 @@ The limit is 4096. The value doesn't matter as much as how you decide to use the
16 16
* [Pointer Dereferencing](https://www.fancade.com/wiki/Script/Script%20Limit.md#pointer-dereferencing)
17 17
18 18
### Script Blocks
19
Every script block counts as 1 script towards the total limit. It does not matter which script block it is, as long as it is an inbuilt script block, it adds 1 to the counter. The attached image has 4 script blocks, thus the script consumption is 4/4096 or 0.1%.
19
Every script block counts as 1 script towards the total limit. It does not matter which script block it is, as long as it is an inbuilt script block, it adds 1 to the counter. The attached image has 4 script blocks, thus the script consumption is 4/4096 or roughly 0.1%.
20 20
![4 Script Blocks](https://cdn.discordapp.com/attachments/852037487987392529/855423620397662238/Screenshot_20210618-113130_Fancade.png)
21 21
22 22
### Wire Splits
23 23
A wire split counts as 1 script towards the limit. Thus the script in image A adds 4 scripts (3 script blocks + 1 wire split) to the counter.
24 24
![A - Wire Splitting](https://cdn.discordapp.com/attachments/852037487987392529/855423620692443156/Screenshot_20210618-113313_Fancade.png)
25 25
26
But wire splits are defined as "n to 1" and "1 to n". This basically means, no matter how large the split is, it will add only 1 to the counter. The script in image B adds 10 scripts (9 script blocks + 1 wire split) to the counter.
26
But wire splits are defined as "n to 1" and "1 to n". This basically means, no matter how large the split is, it will add only 1 script to the counter. The script in image B adds 10 scripts (9 script blocks + 1 wire split) to the counter.
27 27
![B - Wire Splitting](https://cdn.discordapp.com/attachments/852037487987392529/855423621173739530/Screenshot_20210618-113424_Fancade.png)
28 28
29
The same applies in case of joining. The script in image C counts as 4, whereas the script in image D counts as 10.
29
The same applies in case of joining. The script in image C counts as 4 scripts, whereas the script in image D counts as 10 scripts.
30 30
![C - Wire Splitting](https://cdn.discordapp.com/attachments/852037487987392529/855423621433393172/Screenshot_20210618-113611_Fancade.png)
31 31
![D - Wire Splitting](https://cdn.discordapp.com/attachments/852037487987392529/855423621639569408/Screenshot_20210618-113747_Fancade.png)
32 32
33 33
### Pointer Dereferencing
34 34
This section will be easier to understand if you are somewhat familiar with the concept of pointers. If you are not, you can think of them as an address to somewhere a value is stored.
35
When a pointer is dereferenced, i.e. converted to value, it counts as one script. In image E, the Get Variable block outputs a pointer, which is then derefernced to a value for the Negate block. Thus the script adds 3 (2 script blocks + 1 pointer dereferencing) to the counter.
35
When a pointer is dereferenced, i.e. converted to value, it counts as 1 script. In image E, the Get Variable block outputs a pointer, which is then derefernced to a value for the Negate block. Thus the script adds 3 scripts (2 script blocks + 1 pointer dereference) to the counter.
36 36
![E - Pointer Dereferencing](https://cdn.discordapp.com/attachments/852037487987392529/855423621933301760/Screenshot_20210618-113952_Fancade.png)
37 37
38
This behaviour, when combined with wire splitting, results in a peculiar quirk where adding another script block can actually consume less script limit than without that block. In the following picture, case 1 adds 8 (4 script blocks + 1 wire splitting + 3 pointer dereferencing) scripts to the counter. Almost half of them are just from dereferencing. To avoid that, in case 2 another script block is added to dereference the pointer before the split. Thus case 2 only adds 7 (5 script blocks + 1 wire split + 1 pointer dereference) scripts to the counter.
38
This behaviour, when combined with wire splitting, results in a peculiar quirk where adding another script block can actually consume less script limit than without that block. In the following picture, case 1 adds 8 scripts (4 script blocks + 1 wire split + 3 pointer dereferences) to the counter. Almost half of them are just from dereferencing. To avoid that, in case 2 another script block is added to dereference the pointer before the split. Thus case 2 only adds 7 scripts (5 script blocks + 1 wire split + 1 pointer dereference) to the counter.
39 39
![Pointer Dereferencing](https://cdn.discordapp.com/attachments/852037487987392529/855440742431064094/Screenshot_20210618-130458_Fancade.png)
40 40
41 41
Known script blocks that output a pointer are all the Get Variable and List Element blocks.
Fancade Wiki