Talk:SCO

From GTAMods Wiki
Jump to navigation Jump to search

Maybe it is a silly question, but if there is a push onto the stack, how the numbers are pop'ed back? Since SCO seems to be similar to ASM (I have not yet took a look to scripts, only to this article) I think it is worth to mention this in the article (if there is an awnser, what I hope ^^). --Aschratt 20:17, 5 February 2009 (UTC)

The list of opcodes is incomplete, there are ones that pop numbers back.Seemann 00:05, 6 February 2009 (UTC)
Well, since they only seem to be used as function parameters, there is no real point in popping them from the stack (since called functions do that internally), is there? Although, how are return values handled? Can there be multiple return values? --Steve-m 00:48, 6 February 2009 (UTC)
Steve I don't think there are multiple return values. CallNative opcode has a parameter that specifies the outputs generated by the native, but that seems to be only 0 and 1. Of course you can always create a structure then output a pointer like in C++. --Sacky

Difference Between 'Local' variables and 'Global' variables

Does anyone know it? The only difference I could possibly see between them is a public declaration in the script so other scripts could access it... I don't see how local variables are even used when function locals are supported.

Hmm, Sacky, what you mean by difference? The locals are usable only within one script (from any of its internal functions), whereas the globals are usable from any script. Seemann 10:13, 14 February 2009 (UTC)
So Local Variables can only be accessed by the host script (but are still global from a 1 script only perspective) and Global Variables can be accessed by other scripts? If so how does 1 script access anothers globals? I suppose this would also indicate an access right change so a 'public' declaration should be the proper way to distinguish a global variable from a local variable? Sacky
There is the global variables buffer (only one) where all global variables store their values. Local variables have a number of buffers (a seperate one for each script). So, the globals could be accessed by any script (using specific globals-only opcodes), and the locals could be accessed only by host script containing that buffer using specific locals-only opcodes. That's what I know, but I dunno the real purpose of the global variables container. Seemann 15:10, 14 February 2009 (UTC)

I think we should also clarify the names of opcodes 54 -> 61 and opcode 62. They don't really deal with local variables, but rather with stack variables!. This distinction is quite important as they are really accessing different things. The names LocalVarPtr/LocalVarPtrEx is confusing and should be avoided. Having -Ptr added to the opcode name further adds to the confusion as opcodes 63/64 also push a ptr onto the stack. Since the rest of the opcodes seem to come from the Scruff/SparkIV list, I'm curious to why you renamed these two? Aru 17:02, 24 February 2009 (UTC)

Here's the list of opcodes listener made for his unreleased tool: