Difference between revisions of "Category:Code Snippets"
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
0051: return | 0051: return | ||
+ | <Here is where the code will start> | ||
008B: 1@ = $index //if we want the second value then $index = 1 (because for the first value $index = 0) | 008B: 1@ = $index //if we want the second value then $index = 1 (because for the first value $index = 0) | ||
0012: 1@ *= 9 //9 * 1 = 9 (9 because the 0006 + 0051 opcodes take up 9 bytes in this case) | 0012: 1@ *= 9 //9 * 1 = 9 (9 because the 0006 + 0051 opcodes take up 9 bytes in this case) |
Revision as of 17:24, 13 December 2005
A collection of code snippets often used in the mission script, or to accomplish certain tasks.
Note: Don't just post your code, also give an explanation what it does and in which context it has to be used.
Arrays in Vice City
:label 0006: 0@ = 10 //these are the values we want to return from the array 0051: reutrn 0006: 0@ = 78 //the space that the 0006 and the 0051 opcodes take up in total is 9 bytes because: 0051: return //opcode(2 bytes) + ptype(1 byte) + var(2 bytes) + ptype(1 byte) + smallint(1 byte) + opcode(2 bytes) = 9 0006: 0@ = 36 0051: return <Here is where the code will start> 008B: 1@ = $index //if we want the second value then $index = 1 (because for the first value $index = 0) 0012: 1@ *= 9 //9 * 1 = 9 (9 because the 0006 + 0051 opcodes take up 9 bytes in this case) 000A: 1@ += ££label //add the value of ££label to 1@ 0050: gosub 1@ //gosub to ££label + 9, so 0@ returns 78
Pages in category "Code Snippets"
The following 32 pages are in this category, out of 32 total.