Jump to content

» «

SA ScrDebug

17 replies to this topic
  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 01 July 2011 - 07:55 PM Edited by Deji, 10 September 2012 - 03:11 AM.

SA ScrDebug

(Aside from the missing 's', I actually managed to fit most of the topic description in this time..)

Finally, Rockstar-style SCM Debugging for San Andreas.

During the development of GTA: San Andreas, Rockstar North used many features built-in to their scripting engine to aid debugging of scripts. Hacks, hidden modes, teleportation cheats, mission skippers, they had used them all. Obviously these features had to be locked away before San Andreas was released. This mods purpose is to re-implement them.

Little is known of Rockstars original debugging opcodes aside from what can be found in the GTA IV natives list and their usage within the main.scm and scripts in the script.img archive. However, I believe ScrDebug reimplements most opcodes with near exact functionality (if not, better).

There are several reasons to use this mod. One is that it enables certain "cheats" while playing San Andreas (gaining lives in arcade games, auto-aiming in pool game, skipping missions, increasing stats etc). Another is that, with some edits of SCM, it can be made to output information about SA Levels never before understood (see sapool.log in the ScrDebug folder).

But the best reason is for debugging of your own script mods. You can happily setup debug scripts and leave the debug code in there. The debug code is only enabled for those who have ScrDebug, thus not ruining a mod users gameplay with unexpected happenings. Even if you do want to remove the debug code after, most of these additional opcodes are very handy.


  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 17 July 2011 - 04:35 PM

* Updated *

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 14 March 2012 - 09:02 PM

* Updated *
(If anyone cares... It seems people don't want to keep their mods bugless tounge2.gif)

  • Kalvin

  • Members
  • Joined: 06 Apr 2011
  • United-Kingdom


Posted 14 March 2012 - 09:25 PM

Ha, i bet people are/will be using it biggrin.gif as always, magnificent job Deji icon14.gif

  • bammargera

    Just Call Me Rob, Its Easier That Way

  • Members
  • Joined: 24 Sep 2006


Posted 14 March 2012 - 09:33 PM

Could you maybe explain a little more what it helps do? I would imagine that is the reason of the lack of response smile.gif

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 14 March 2012 - 10:00 PM Edited by Deji, 14 March 2012 - 10:17 PM.

"Everything explained in the readme file. It took me ages, so read it..."

All the information I could possibly tell is on the download page. But I'll save people 1 click by putting the main description in the first post.

Also, a few of the opcodes:

0662: printstring "OUTPUT_TEXT_OFF"
R*N had this nifty opcode to output text in-game. I gave ScrDebug the ability to output these in a list of the last 12 (which is the max, but you can specify less in the INI file) messages. As the screenshot shows, it can be used to print helpful debug messages which you can leave in the script without the end-user seeing them, unless they have ScrDebug (in which case they're opting to see the info).

0663: printint "IGFIDX" $GIRLFRIEND
In this example, R*N probably wanted to output the current 'integer girlfriend index'. You can use it to output whatever text you want, followed by an integer, as seen in the screenshot. A space is auto-added (cause that's how it would've originally worked).

0736: is_keyboard_key_just_pressed 0x20
One of the greatest things to re-enable... It was used for debug keypresses by R*N. This can be evidenced by installing ScrDebug, going into a game of pool and pressing the spacebar (0x20) key. The cue will automatically be aimed according to what the 'AI' thinks is the best ball for the shot. Unlike 0735 (is_keyboard_key_pressed) this only returns true when the key is JUST pressed.

03A7: save_int_to_debug_file $CURRENT_WANTED_LIST
There are also a few opcodes to save values to a debug file. A file entitled "pool.log" comes with ScrDebug as a demo of is outputted when these opcodes are enabled and the Pool game is played. A lot of info in that file, which R*N would have found useful during development.

So this is basically a mod for those who wanna develop as good as (or preferably better than) Rockstar North.

As a bonus, ScrDebug can also add 00CC. This is a completely new opcode which R*N didn't have. Usage:

So what does that do? Well, it's a breakpoint. When encountered, a html file with information about the script will be created (as well as listing all local variables and a handful of global variables). I'm still working on adding more to this opcode. A message box will pop up which allows you to disable the breakpoint or just continue. This is opcode is powerful in the right hands.

  • HeresOtis

    Mark Chump

  • Members
  • Joined: 29 Apr 2011


Posted 16 March 2012 - 05:45 AM

So this will find the cause of a crash from a modded main.scm?

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 16 March 2012 - 11:45 AM

Yes, of course. It will automatically scan your entire main.scm file and find the exact line that crashes tounge2.gif

Of course not. It's merely gives you more power when debugging your scripts and also allows you to play around with R*'s main.scm debug scripts, which have the ability to skip missions and such. If you don't know how to use this tool efficiently, you can look for the opcodes in the main.scm and see how R* used them.

  • elMarcoPL


  • Members
  • Joined: 14 Mar 2011


Posted 17 March 2012 - 07:10 PM

I don't know what to say, cause I can't understand way to use this tool, but I can say that it is awesome.

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 03 September 2012 - 02:17 AM

An interesting bit of code I noticed in the main.scm...

$BJACK_Flag_Card_Cheat += 1
 $BJACK_Flag_Card_Cheat > 1
$BJACK_Flag_Card_Cheat = 0


Press U during a Blackjack game to activate a card hack!

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 10 September 2012 - 03:05 AM Edited by Deji, 10 September 2012 - 03:09 AM.

ScrDebug update!

Download the version 0.4 on the mod page: http://gtag.gtagamin...81-sa-scrdebug/

Additions: 091A (gets cheat input), 091B (clears cheat input)
Used for debugging the girlfriend agent. There are plenty of commands to teleport to different GF's, increase stats, enter certain situations (girlfriend driving CJ around the block was something I'd never seen/done before).

Also updated a lot of the information on the page, though it looks nicer in the readme.txt file cause for a web designer, I suck at designing topics tounge.gif

Will try to add some more screenshots and make a list of GFAGNT commands tomorrow. Tired.

  • TheGodfather.

    Nobody likes me here...I think...

  • Members
  • Joined: 19 Jun 2012


Posted 10 September 2012 - 05:06 AM

Will it help me in completing my TC ?
I guess it will be useful for me for completing & debugging my TC.Good job..

  • methodunderg


  • Members
  • Joined: 23 May 2008
  • None


Posted 10 September 2012 - 09:22 AM

QUOTE (Deji @ Monday, Sep 10 2012, 03:05)
(girlfriend driving CJ around the block was something I'd never seen/done before).

Could be useful for your Black Market mod ..

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 10 September 2012 - 10:51 PM

This was meant to be more informal then it turned out, but I ran out of disk space for footage so I thickened the whole thing up with a hint of humor.

ScrDebug: A GFAGNT Story

A bit more relevant...

A full list of GFAGNT debug commands:
DOCOOCHIE - Sets the current girlfriend to Denise
DOMICHELLE - Sets the current girlfriend to Michelle
DOKYLIE - Sets the current girlfriend to Helena
DOBARBARA - Sets the current girlfriend to Barbara
DOSUZIE - Sets the current girlfriend to Katie
DOMILLIE - Sets the current girlfriend to Millie
FASTDATE - Skips the next date and goes straight to the coffee invite.
GOCOOCHIE - Teleports to Denise's house
GOMICHELLE - Teleports to Michelle's house
GOKYLIE - Teleports to Helena's house
GOBARBARA - Teleports to Barbara's house
GOMILLIE - Teleports to Millie's house
DATEFOOD - Makes the girlfriend want to go for a meal for the next date
DATEDRIVE - Makes the girlfriend want to be driven around the block for the next date
DATEDANCE - Makes the girlfriend want to go dancing for the next date
DATESPANK - Makes the girlfriend want some freaky sh*t for the next date
DATESHEDRIVES - Makes the girlfriend drive CJ around the block for the next date
MEETMICHELLE - Teleports near Michelle's meeting location
MEETKYLIE - Teleports near Helena's meeting location
MEETBARBARA - Teleports near Barbara's meeting location
MEETSUZIE - Teleports near Katie's meeting location
GIMPSUIT - Dresses CJ in gimp suit
TWOTIMING - Causes jealous girlfriend scenario?
ELEGANTMAN - Minimises the desired sex appeal of all girlfriends
SHOWENTRY - Shows date location entrances
HIDEENTRY - Hides date location entrances
UNCENSORED - Enables Hot Caffeinated Drinks
STATSUP - Increases stats for current girlfriend
STATSDOWN - Decreases stats for current girlfriend
DUMPME - Minimises stats for current girlfriend

  • lpgunit

    It's L, as in Lpgunit, not I.

  • Members
  • Joined: 24 May 2008


Posted 11 September 2012 - 11:46 AM

Are the cheats mentioned present (albeit hidden) in vanilla SA?

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 11 September 2012 - 12:10 PM

If by vanilla you mean plain, yeah tounge2.gif Else there would've been no way for me to determine what these opcodes originally did.

Here's the topic where I was originally posting my discoveries: http://gtag.gtagamin...p?showtopic=529

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 11 September 2012 - 04:28 PM

Made a stability update for 0.4. So the 5 of you who downloaded it may wish to go back and download 0.4r2 tounge2.gif

Oh, and here's another topic much earlier on in the development of ScrDebug, when it was a CLEO called "Project: R.A.O.R.O.S.O.A.F.S.W.C.U.M.S.". I've come a long way: http://gtag.gtagamin...p?showtopic=462

As well as some debug keys I'd found already in the SA main.scm at that point: https://pastebin.com/ZtvYVJmh

  • Deji

    Coding like a Rockstar!

  • Members
  • Joined: 24 Dec 2007


Posted 20 September 2012 - 12:45 AM

ScrDebug Update!

(Triple post!)

At the usual place: http://gtag.gtagamin...81-sa-scrdebug/

If anyone has an idea what any of the NOP's I've not implemented might've done, please let me know as I've run out of ideas now. Especially here:
{1588618} IF
{1588622} IS_CAR_STOPPED 244@
{1588627} ELSE_GOTO @SYN2_21601
{1588634} IF
{1588638} 06AA:   NOP_false 244@    // wtf? debug opcode that checked something about the car?
{1588643} ELSE_GOTO @SYN2_21601
{1588650} 0752: NOP 244@   // debug opcodes that did something with the car?
{1588669} GET_CAR_HEADING 244@ $tempvar_Angle
{1588681} 05B6: 100 // RICH CAR STOPPED AT
{1588824} SAVE_FLOAT_TO_DEBUG_FILE $tempvar_Angle

Who knows...

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users