Quantcast

Jump to content

» «
Photo

Main.scm scripts to cleo

13 replies to this topic
Jacko427
  • Jacko427

    Gangsta

  • BUSTED!
  • Joined: 27 Jul 2011

#1

Posted 18 November 2011 - 05:04 PM

I founded out the spaceeinstein's all in one mod makes my game crash on Vista at certain area's.
I tried the exact same spaceeinstein's mod on XP machine, it didn't crashed once.
Even not at these certain area's.
So it is......OS specific confused.gif
This kinda sucks since I really love that mod.

But, I thought, maybe they could be cleo's?
I just use the original main.scm since that doesn't make the game crash on Vista.
So playing with original main.scm and the spaceeinstein's mods in cleo formats.
There are some missions like the Lowrider missions where the other lowrider cars have paintjobs.
And some other and the removed R* things.
The homebrains, Multimod and modshop I do like them have in cleo too.

From what I understand is that Cleo's opcodes and keys are different from the main.scm.
Am I correct?

gtafan113
  • gtafan113

    Untitled

  • Members
  • Joined: 01 Mar 2009

#2

Posted 18 November 2011 - 06:51 PM

The main difference between the main.scm and CLEO is that each CLEO file can only be one script and most global variables can cause crashes. I think you could convert some of the scripts by changing the global variables to local ones if possible.

I converted a simple main.scm mod to CLEO once so it is possible, but I'm not sure if all of the scripts can be converted because each CLEO script is limited to 32 local variables and 2 timers and many main.scm scripts are complex.

Jacko427
  • Jacko427

    Gangsta

  • BUSTED!
  • Joined: 27 Jul 2011

#3

Posted 18 November 2011 - 07:08 PM

QUOTE (gtafan113 @ Friday, Nov 18 2011, 18:51)
The main difference between the main.scm and CLEO is that each CLEO file can only be one script and most global variables can cause crashes. I think you could convert some of the scripts by changing the global variables to local ones if possible.

I converted a simple main.scm mod to CLEO once so it is possible, but I'm not sure if all of the scripts can be converted because each CLEO script is limited to 32 local variables and 2 timers and many main.scm scripts are complex.

Thanks for reply and explaination smile.gif
I thoughts so it's complex about Cleo variables.

Can you convert a simple scripts from main.scm to cleo.
The Home Brains seems a small thing.
I can just copy and paste that into a new document beginning with the cleo.cs.
But it probably not gonna work.

gtafan113
  • gtafan113

    Untitled

  • Members
  • Joined: 01 Mar 2009

#4

Posted 18 November 2011 - 07:21 PM

QUOTE (Jacko427 @ Friday, Nov 18 2011, 15:08)
Thanks for reply and explaination smile.gif
I thoughts so it's complex about Cleo variables.

Can you convert a simple scripts from main.scm to cleo.
The Home Brains seems a small thing.
I can just copy and paste that into a new document beginning with the cleo.cs.
But it probably not gonna work.

If it is a small script, then you probably can convert it. Not only must you put it in a new file and start it with CLEO.cs, but you also have to change the global variables used to local ones. Make sure to keep track of which local to assign to each global when you are changing them. This is all I did when I converted a simple script.
  • FunnySynchro likes this

Jacko427
  • Jacko427

    Gangsta

  • BUSTED!
  • Joined: 27 Jul 2011

#5

Posted 18 November 2011 - 07:28 PM

QUOTE (gtafan113 @ Friday, Nov 18 2011, 19:21)
QUOTE (Jacko427 @ Friday, Nov 18 2011, 15:08)
Thanks for reply and explaination smile.gif
I thoughts so it's complex about Cleo variables.

Can you convert a simple scripts from main.scm to cleo.
The Home Brains seems a small thing.
I can just copy and paste that into a new document beginning with the cleo.cs.
But it probably not gonna work.

If it is a small script, then you probably can convert it. Not only must you put it in a new file and start it with CLEO.cs, but you also have to change the global variables used to local ones. Make sure to keep track of which local to assign to each global when you are changing them. This is all I did when I converted a simple script.

Ok, that's gonna be hard.
Can you explain the global and local variables?

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#6

Posted 18 November 2011 - 07:56 PM

Global variable:

CODE
$***


Local variable:

CODE
***@


Replace "***" with number. The number can be between 0 and 32 for locals and local variables can be used for both Cleo and main.scm.

For global variables, the number can be anything between 0 and infinity, even text. It can be only used in main.scm.

Number in front of variable, for example "32@", is used to identify the variable from many others, and you can store numbers in variables.

chaosislife
  • chaosislife

    Member title?

  • Members
  • Joined: 01 Feb 2006

#7

Posted 06 January 2012 - 09:31 PM

Would it be possible to use unused stat values as if they were globals?
then you could set the unused stat's value to 1 for when you're on a mission and 0 when off the mission instead of using $on_mission or w/e. you'd have to change all the missions to set the stat when they start and change it back when they finish tho.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#8

Posted 06 January 2012 - 10:41 PM Edited by Deji, 06 January 2012 - 10:46 PM.

QUOTE (oksa8 @ Friday, Nov 18 2011, 19:56)
For global variables, the number can be anything between 0 and infinity, even text. It can be only used in main.scm.

Misguided wink.gif

Sanny Builder causes a lot of confusion by how friendly it is with global vars.

For starters, $PLAYER_CHAR is $2 which is the lowest global variable used in the SCM and the lowest global variable Sanny Builder will let you use! The highest global var is $16383 (explanation).

If you see "CustomVariables.ini" in Sanny's data files, it will list the global vars it knows and what their relevant numbers are. By using a global var name not in this list in a main.scm file, Sanny will automatically assign the new var to $10947 (something like that, anyway). The next custom var not in CustomVariables.ini that you use will be $10948 and so on...

This "global vars can only be used in the main.scm" has never been proved to me. Yes, you shouldn't use global variables in a CLEO Script (main.scm called dibs!) but not because you'll get a crash. It's actually a compiler issue.

So if new vars are set to $10947 in the main.scm, what happens in a CLEO Script? The same thing. So that's the problem. Everyone script that uses any custom global var name is using the same global var, $10947. So that's very likely to cause some problems. By declaring the global vars in CustomVariables.ini, we can specify that we want, say, $CAR, to become $10999 instead of $10947, but there's still the unsure factor of other people using the same technique and choosing the same var space. So as a rule of thumb, avoid globals in CLEO!

But don't forget that they can be used in CLEO. The only reason $PLAYER_ACTOR is usable and custom names aren't is because $PLAYER_ACTOR is in the CustomVariables.ini. I'd say that if you want to use a global var for temporary space, that's fine. Just anticipate other scripts using it too. Or try to avoid it altogether since there are always better ways.

Kay, done tounge.gif

@chaosislife
Why do you need global variables at all? Do you need to share data between a CLEO Script and the main.scm? Stats wouldn't be such a good replacement...

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#9

Posted 06 January 2012 - 10:45 PM

Hmm, good to know that. Never really payed much attention to global variables and main.scm modding and I've always avoided global variables in CLEO-scripting. smile.gif

OrionSR
  • OrionSR

    Chain Game Development Team

  • Feroci
  • Joined: 23 May 2007
  • None
  • Helpfulness Award [GTA & Modding]

#10

Posted 07 January 2012 - 01:26 AM Edited by OrionSR, 07 January 2012 - 01:34 AM.

QUOTE (Deji @ Friday, Jan 6 2012, 15:41)
If you see "CustomVariables.ini" in Sanny's data files, it will list the global vars it knows and what their relevant numbers are. By using a global var name not in this list in a main.scm file, Sanny will automatically assign the new var to $10947 (something like that, anyway). The next custom var not in CustomVariables.ini that you use will be $10948 and so on...

IIRC, I read a note by Seeman that reported that the first custom global variable name will use the first global variable that is not named in CustomVariables.ini, which is $4. Notes in this file would seem to indicate that a script that uses this variable would have problems with the "gym bike." So it's pretty easy to imagine how undefined custom variable names will have serious consequences as standard game variables start getting trampled.

I'm not sure what happens when multiple CLEO scripts try to use custom variable names. Perhaps they both use $4 for the first named global, or perhaps the 2nd script would use the next unnamed variable. The latter would imply that removing the first script might change which variable number was used by the 2nd script. Either way, it seems like lots of trouble.

I frequently use global variable in CLEO scripts and have never had a problem. However, I never create custom variable names, always use the global variables in the same way they are used in the script, use checks to make sure the game isn't going to use any "temporary" global variables at the same time as my script/mission, and usually don't share these scripts with other players.

That being said, I also will not use scripts written by other players that use global variables and will encourage authors to look for other methods to accomplish their goals.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#11

Posted 07 January 2012 - 03:56 AM

Ah, nice I can still learn every once in a while.

chaosislife
  • chaosislife

    Member title?

  • Members
  • Joined: 01 Feb 2006

#12

Posted 07 January 2012 - 05:13 AM

QUOTE (Deji @ Friday, Jan 6 2012, 17:41)

@chaosislife
Why do you need global variables at all? Do you need to share data between a CLEO Script and the main.scm? Stats wouldn't be such a good replacement...

That and for sharing between cleo threads I suppose, right now I'm trying to figure out how to do it as a way to run a thread just once regardless of how many times the required keys are pressed (tho i just now thought that maybe not looping the thread might handle that) the idea was to set the stats value to 1 and then just have the code check what the value is. Problem is I can't think of just how to check the value..... I was also thinking of it some time ago when I was playing with SCJ, i was trying to set up an alternate method of acceleration/deceleration and i was thinking that if I used the stats values i could set up some sort of a gearing check so that i could add 1 to the value of the stat each time I pressed the keypress and either accelerated or decelerated and then set the speed value according to the value of the stat. It didn't seem to work properly tho as it either failed to set the stat or failed to check the stat or both.

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#13

Posted 07 January 2012 - 12:18 PM

QUOTE (OrionSR @ Saturday, Jan 7 2012, 02:26)
I'm not sure what happens when multiple CLEO scripts try to use custom variable names. Perhaps they both use $4 for the first named global, or perhaps the 2nd script would use the next unnamed variable.

Yeah, every CLEO starts its custom variables from $4, Sanny can't recognize which ones are used in other CLEO scripts in any way. Also, CLEO doesn't have any custom global vars handling, so they're just compiled-in.

chaosislife
  • chaosislife

    Member title?

  • Members
  • Joined: 01 Feb 2006

#14

Posted 08 January 2012 - 03:22 AM

What if they calculated how many globals are used in total in the original scm and externals and then put in custom variable names for every global higher than that number? Assuming the global var numbers aren't assigned randomly, scripters could then use those global var names in their cleos. They could put in comments on what each var is meant to represent. This wouldn't however solve the problem of different cleos using the same var for different values of course. Tho being able to change the variables in the cs would solve that for folks who can be bothered to edit a bit. I'm assuming that the cs doesn't have some idiotic "lock" in it of course.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users