Quantcast

Jump to content

» «
Photo

SCM functions in main.scm

13 replies to this topic
HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#1

Posted 03 August 2014 - 02:42 AM

Are scm functions (0AB1) functional in main.scm scripting? It seems to crash my game if I try, so I need confirmation if this is correct?


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#2

Posted 03 August 2014 - 05:50 AM Edited by fastman92, 03 August 2014 - 05:50 AM.

They should work unless the CLEO creator would screw up something.

Show me your function and how you call it.
  • HeresOtis likes this

HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#3

Posted 03 August 2014 - 05:02 PM

They should work unless the CLEO creator would screw up something.

Thanks for the insight. I just recreate a simple script to test this fact and it worked. So my other script is screwed up. I will review and fix it.


HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#4

Posted 04 August 2014 - 03:03 AM

Any way to get a CLEO script to read the value of a custom global variable defined in main.scm? I have a global defined in main.scm as $PLAYER_Name, but my CLEO script returns that value as null, even though it isn't null.


DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#5

Posted 04 August 2014 - 06:07 AM

You need to define your var inside CustomVariables.ini.


HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#6

Posted 04 August 2014 - 04:17 PM

You need to define your var inside CustomVariables.ini.

When I release my mod to the public, will they have to do the same?


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None

#7

Posted 04 August 2014 - 04:29 PM Edited by fastman92, 04 August 2014 - 04:29 PM.

Global variable may be referred to by:
$name - ID of variable must be assigned in CustomVariables.ini
$62 - ID of variable

When compiled, the code will contain the ID of global variable.

HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#8

Posted 04 August 2014 - 06:18 PM

Okay, I did it and it works. Thanks.


Seemann
  • Seemann

    Ruhe

  • Members
  • Joined: 03 Sep 2004
  • Russia
  • Best Tool 2013 "Sanny Builder"

#9

Posted 05 August 2014 - 04:19 AM

You may also use the Alloc() command to define your global variable.

 

alloc($var, 63) // $var is now $63
$63 = 10 // $var = 10

  • HeresOtis likes this

HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#10

Posted 05 August 2014 - 06:33 PM

You may also use the Alloc() command to define your global variable.

 

alloc($var, 63) // $var is now $63
$63 = 10 // $var = 10

This will be simpler.  :cookie:


HeresOtis
  • HeresOtis

    The SCM Undergrad

  • Feroci
  • Joined: 29 Apr 2011
  • United-States

#11

Posted 20 August 2014 - 11:29 PM

Can different scripts call a SCM function in main.scm?

:IMCOOL
03A4: script_name 'IMCOOL'
// do stuff
0AB1: call @TickleMe 1 10 store_to 0@
// do stuff

:NOYOUNOT
03A4: script_name 'NOYOUNOT'
// do stuff
0AB1: call @TickleMe 1 10 store_to 0@
// do stuff

:TickleMe
// I'm a scm function
0AB2: ret 1 0@

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#12

Posted 21 August 2014 - 01:26 AM Edited by LINK/2012, 21 August 2014 - 01:40 AM.

Yes, as long as the function itself is in the main block not the mission block.

DK22Pac
  • DK22Pac

    Playing SA on my lovely PS2. Y'all bums.

  • Feroci
  • Joined: 12 Apr 2009
  • Brazil

#13

Posted 22 August 2014 - 08:18 PM

Not sure about SA, but for III and VC SCM functions work only for custom scripts.
That's because it's not possible to store information about them into save file (so if SCM functions are executed and you saving a game in this time, loading this save could crash your game).

LINK/2012
  • LINK/2012

    LIVIN' IN CODE

  • Feroci
  • Joined: 30 Jan 2011
  • Brazil

#14

Posted 23 August 2014 - 02:06 AM

Not sure about SA, but for III and VC SCM functions work only for custom scripts.
That's because it's not possible to store information about them into save file (so if SCM functions are executed and you saving a game in this time, loading this save could crash your game).

Just avoid WAITs





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users