Mod Showroom

 Reply to this postStart new topic

[SRC|Tool] SCRambl

Deji
post Dec 14 2013, 11:59 PM
Post #21


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Guess we might not be having so many restrictions with SCR after all tongue.gif
CODE
0848=SWITCH
0849=ENDSWITCH
084A=CASE
084B=DEFAULT
084C=BREAK


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Dec 16 2013, 03:03 PM
Post #22


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



CODE
SCRIPT_NAME( "Test" )

Main:
{
    LVAR_INT arr[10]
    arr[0] = 0    
}

TERMINATE_THIS_CUSTOM_SCRIPT()

WARNING: No variables declared on line 5
ERROR: '0' : expected operand <arg 2> on line 6
CODE
SCRIPT_NAME( "Test" )

#if defined(HEY)
    WAIT 1000
#endif

TERMINATE_THIS_CUSTOM_SCRIPT()

ERROR: Invalid integer constant expression on line 3
Also, these things are not possible:
CODE
LVAR_INT myVar = 0
WHILE !IS_KEY_PRESSED( 16 )

And MODEL enumeration is not available.

This post has been edited by DK22: Dec 16 2013, 03:10 PM
Go to the top of the page
 
+Quote Post
Wesser
post Dec 16 2013, 03:49 PM
Post #23


The Assistant

Posts: 84
From: Matera, IT
Joined: 16-June 11



QUOTE (DK22 @ Dec 16 2013, 04:03 PM) *
Also, these things are not possible:
CODE
LVAR_INT myVar = 0
WHILE !IS_KEY_PRESSED( 16 )

And MODEL enumeration is not available.

Inline declaration-initialization is not provided for by the standards. The exclamation mark (!) is only available for preprocessor directives, NOT is a valid logical negation. MODEL is an extended type but it should be an enumeration indeed. tongue.gif
Go to the top of the page
 
+Quote Post
Deji
post Dec 17 2013, 07:03 PM
Post #24


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Well, the models are loaded as constants, given MODEL as an extended type, which is a similar manner as to how enumerators are handled... they're also just constants with an extended type that can be used to identify them. The only difference between the two is how they're created. Enums so far can only be declared in the constants.def file, using the identifiers in-order. Constants in the IDE files are very unordered, though. But they're still basically the same thing.

And yeah, stuff like
QUOTE
CODE
WHILE !IS_KEY_PRESSED( 16 )

is overcomplicating the syntax. IS_KEY_PRESSED doesn't return any value in-line that can be treated as an operand. That's what R*N adopted SCO for tongue.gif



SCRambl 1.0.39 (BETA) Released!

1.0.39
+ New directives #pushcfg and #popcfg for temporary changes of parser configuration in-code
* Improved the way non-array types handle subscripts
* Improved error handling - SCRambl now correctly aborts after errors
* Improved stability
* Fixed variable ARRAY declarations
* Fixed bugs in error output
* Fixed bugs in ASM parsing
* Fixes to operand type matching


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Dec 23 2013, 10:14 PM
Post #25


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Started progress on a SCRambl definitions generator: http://gtagmodding.com/opcode-database/generator/

Not finished yet, but a commands.def file can be generated. I just needed to make sure zipping works on this server (it doesn't - had to work around it). I'll try to make it able to generate all definitions with optional type extensions and enums.


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Dec 27 2013, 02:24 PM
Post #26


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Okay, you can generate the .XML for SCR definitions here: http://gtagmodding.com/notepadpp-scr.xml
And for syntax highlighting here: http://gtagmodding.com/notepadpp-scr-lex.xml

Most commands in SA range should now all have their real keywords. Still gotta find the best way to implement the CLEO ones, however.

EDIT: updated these again

This post has been edited by Deji: Jan 4 2014, 12:35 AM


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Jan 1 2014, 04:26 AM
Post #27


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Autocompleting working strange ohmy.gif
For example, with typing "CREATE_" you'll see just CREATE_CHAR.

This post has been edited by DK22: Jan 1 2014, 04:27 AM
Go to the top of the page
 
+Quote Post
Deji
post Jan 1 2014, 02:21 PM
Post #28


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Yeah, I could really do with alphabetically ordering the keywords. Shouldn't be too hard, thinking about it, let me try...

Done...

Should make it easier to find commands when you don't exactly know the name now smile.gif


EDIT: Improved the XML generators further and fixed problem where the last group of commands wouldn't be generated.

This post has been edited by Deji: Jan 4 2014, 01:44 AM


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 12 2014, 02:00 AM
Post #29


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



SCRambl 1.0.40 (BETA) Released!

1.0.40
+ Added new inline preprocessor feature - use brackets [ ] in SCR code to treat code inside as for the preprocessor
* Huge improvements to preprocessor expression evaluations - now much more C-like
* Improvements to macro use in code
* Improved list generation performance (slightly)
* Fixed operators being processed in strings, causing an error when they occur (notably '~')

Thanks to LINK for help with ideas implementing inline preprocessing.

As usual, the manual has been updated. Check out the section on inline preprocessing:
https://dl.dropboxusercontent.com/u/4669320...rocessor.Inline


--------------------
Go to the top of the page
 
+Quote Post
Deji
post Jan 24 2014, 09:50 PM
Post #30


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Finally, the generator has an option for SCRambl definitions, with updated commands.def: http://gtagmodding.com/opcode-database/generator/


--------------------
Go to the top of the page
 
+Quote Post
Santos AbaCox
post Feb 23 2014, 12:28 AM
Post #31


The New Guy!

Posts: 2
Joined: 28-December 13



I love this updates smile.gif
Go to the top of the page
 
+Quote Post
badboy
post Sep 18 2014, 01:57 PM
Post #32


Trained Member

Posts: 76
From: Nederland, NL
Joined: 1-May 12



After some time I've written another script for San Andreas and I used your compiler this time. I ran into some issues you should take a look at. At first I tried to compile some code with /* */ as comments in it. It obviously didn't work because ; are comments now, but the compiler didn't show any error and just crashed. I assume this is not by design. And the second issue is that it doesn't handle file endings correct. When I compiled a simple script without an empty line at the end I got the following error: "unexpected string 'TERMINATE_THIS_CUSTOM_SCRIPTM_SCRIPT". When I placed an empty last line the code compiled fine.
Go to the top of the page
 
+Quote Post
Deji
post Sep 19 2014, 11:37 AM
Post #33


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (badboy @ Sep 18 2014, 02:57 PM) *
After some time I've written another script for San Andreas and I used your compiler this time. I ran into some issues you should take a look at. At first I tried to compile some code with /* */ as comments in it. It obviously didn't work because ; are comments now, but the compiler didn't show any error and just crashed. I assume this is not by design. And the second issue is that it doesn't handle file endings correct. When I compiled a simple script without an empty line at the end I got the following error: "unexpected string 'TERMINATE_THIS_CUSTOM_SCRIPTM_SCRIPT". When I placed an empty last line the code compiled fine.

Hm, comments aren't ;

"unexpected string 'TERMINATE_THIS_CUSTOM_SCRIPTM_SCRIPT" and there's an M after SCRIPT, making it 'SCRIPTM'. That's not a valid command so it assumes it is a string, but it's in an inappropriate script.


--------------------
Go to the top of the page
 
+Quote Post
Haf
post Oct 7 2014, 11:31 AM
Post #34


Newbie In Training

Posts: 12
Joined: 14-April 14



why?
Screenshot
Go to the top of the page
 
+Quote Post
Deji
post Oct 7 2014, 12:44 PM
Post #35


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (Haf @ Oct 7 2014, 12:31 PM) *
why?


You need to specify a file path for the main source file you want to compile. You do this after the -o(pen) option.

e.g.
CODE
SCRambl.exe -o source_file.sc -c -p
SCRambl.exe -o subfolder\source_file.sc -c -p
SCRambl.exe -o "source file.sc" -c -p
SCRambl.exe -o "C:\sub folder\source_file.sc" -c -p


--------------------
Go to the top of the page
 
+Quote Post
Haf
post Mar 27 2015, 07:38 AM
Post #36


Newbie In Training

Posts: 12
Joined: 14-April 14




Why doesn't always work pinch.gif
plz give me a tutorial
Go to the top of the page
 
+Quote Post
Deji
post Mar 27 2015, 11:20 AM
Post #37


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (Haf @ Mar 27 2015, 07:38 AM) *

Why doesn't always work pinch.gif
plz give me a tutorial


Because your script is written in the wrong language. As the error says, "0001" is not a valid identifier/command.


--------------------
Go to the top of the page
 
+Quote Post
Haf
post Mar 28 2015, 05:04 AM
Post #38


Newbie In Training

Posts: 12
Joined: 14-April 14



Can you give an example? or tutorial to open the script using SCRambl

This post has been edited by Haf: Mar 28 2015, 05:19 AM
Go to the top of the page
 
+Quote Post
Deji
post Mar 29 2015, 09:14 AM
Post #39


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



QUOTE (Haf @ Mar 28 2015, 06:04 AM) *
Can you give an example? or tutorial to open the script using SCRambl

You can find an example in main.sc in the installation files (/data/main.sc)...
CODE

// Test script for Industrial level

VAR_INT player scplayer
VAR_INT TEST_CAR test_char
VAR_FLOAT x_float_m y_float_m z_float_m player_heading_debug debug_car_heading
VAR_INT magic_car button_press_flag car_colour car_colour2
VAR_INT flag_create_car initial_create_car initial_car_selected counter_create_car

x_float_m = 0.0
y_float_m = 0.0
z_float_m = 0.0
player_heading_debug = 0.0
debug_car_heading = 0.0

magic_car = 0
button_press_flag = 0
car_colour = 0
car_colour2 = 0
flag_create_car = 0
initial_create_car = 0
initial_car_selected = 0
counter_create_car = 151 //CAR_CHEETAH


SCRIPT_NAME mainscr

// SET_INTRO_IS_PLAYING FALSE

CREATE_PLAYER 0 1498.8 -1661.3 12.5 player
GET_PLAYER_CHAR player scplayer

DO_FADE 0 FADE_OUT

LOAD_SCENE 137.0 -1574.0 11.0

/*
REQUEST_MODEL CAR_CHEETAH

WHILE NOT HAS_MODEL_LOADED CAR_CHEETAH

WAIT 0

ENDWHILE

CREATE_CAR CAR_CHEETAH -1138.406f -661.471f -100.0f TEST_CAR

MARK_MODEL_AS_NO_LONGER_NEEDED CAR_CHEETAH
*/

REQUEST_MODEL male01

WHILE NOT HAS_MODEL_LOADED male01

WAIT 0

ENDWHILE

CREATE_CHAR PEDTYPE_CIVMALE male01 1500.0 -1660.0 13.0f test_char

// MARK_MODEL_AS_NO_LONGER_NEEDED male01


DEBUG_ON

//LAUNCH_MISSION debug.sc

DO_FADE 1000 FADE_IN

MainLoop:

WAIT 0


IF IS_PLAYER_PLAYING player
IF IS_BUTTON_PRESSED PAD2 RIGHTSHOULDER1
AND flag_create_car = 0
AND button_press_flag = 0
GET_CHAR_COORDINATES scplayer x_float_m y_float_m z_float_m
GET_CHAR_HEADING scplayer player_heading_debug
IF player_heading_debug < 45.0
AND player_heading_debug > 0.0
y_float_m += 5.0
debug_car_heading = 90.0
ENDIF
IF player_heading_debug < 360.0
AND player_heading_debug > 315.0
y_float_m += 5.0
debug_car_heading = 90.0
ENDIF
IF player_heading_debug < 135.0
AND player_heading_debug > 45.0
x_float_m -= 5.0
debug_car_heading = 180.0
ENDIF
IF player_heading_debug < 225.0
AND player_heading_debug > 135.0
y_float_m -= 5.0
debug_car_heading = 270.0
ENDIF
IF player_heading_debug < 315.0
AND player_heading_debug > 225.0
x_float_m += 5.0
debug_car_heading = 0.0
ENDIF
z_float_m = z_float_m + 0.6
GET_GROUND_Z_FOR_3D_COORD x_float_m y_float_m z_float_m z_float_m
REQUEST_MODEL counter_create_car
WHILE NOT HAS_MODEL_LOADED counter_create_car

WAIT 0

PRINT_NOW LOADCAR 100 1 //"Loading vehicle, press pad2 leftshoulder1 to cancel"

IF IS_BUTTON_PRESSED PAD2 LEFTSHOULDER1
//++ counter_create_car
GOTO next_carzzz
ENDIF

ENDWHILE

CREATE_CAR counter_create_car x_float_m y_float_m z_float_m magic_car
SET_CAR_HEADING magic_car debug_car_heading

LOCK_CAR_DOORS magic_car CARLOCK_UNLOCKED

MARK_MODEL_AS_NO_LONGER_NEEDED counter_create_car
MARK_CAR_AS_NO_LONGER_NEEDED magic_car

next_carzzz:
IF initial_create_car = 0

IF counter_create_car = 151
AND initial_car_selected = 0
counter_create_car = 105 //BIKE_BIKE
initial_car_selected = 1
ENDIF

IF counter_create_car = 105
AND initial_car_selected = 0
counter_create_car = 110 //CAR_TAXI
initial_car_selected = 1
ENDIF

IF counter_create_car = 110
AND initial_car_selected = 0
counter_create_car = 128 //CAR_CABBIE
initial_car_selected = 1
ENDIF

IF counter_create_car = 128
AND initial_car_selected = 0
counter_create_car = 116 //CAR_POLICE
initial_car_selected = 1
ENDIF

IF counter_create_car = 116
AND initial_car_selected = 0
counter_create_car = 97 //CAR_FIRETRUCK
initial_car_selected = 1
ENDIF

IF counter_create_car = 97
AND initial_car_selected = 0
counter_create_car = 106 //CAR_AMBULANCE
initial_car_selected = 1
ENDIF

IF counter_create_car = 106
AND initial_car_selected = 0
counter_create_car = 119 //CAR_BANSHEE
initial_car_selected = 1
ENDIF

IF counter_create_car = 119
AND initial_car_selected = 0
counter_create_car = 101 //CAR_INFERNUS
initial_car_selected = 1
initial_create_car = 1
ENDIF

IF counter_create_car = 101
AND initial_car_selected = 0
counter_create_car = 92 //CAR_STINGER
initial_car_selected = 1
initial_create_car = 1
ENDIF

ELSE
++ counter_create_car

IF counter_create_car > 153
counter_create_car = 90
ENDIF

IF counter_create_car = 140 //PLANE_AIRTRAIN
OR counter_create_car = 141 //PLANE_DEADDODO
counter_create_car = 142
ENDIF

IF counter_create_car = 124 //TRAIN_SUBWAY
OR counter_create_car = 125 //HELI_POLICE
counter_create_car = 126
ENDIF

IF counter_create_car = 131 //CAR_RCBANDIT
counter_create_car = 132
ENDIF

IF counter_create_car = 147 //HELI
counter_create_car = 148
ENDIF

ENDIF
flag_create_car = 1
button_press_flag = 1
ENDIF

IF IS_BUTTON_PRESSED PAD2 LEFTSHOULDER1
AND flag_create_car = 1
IF NOT IS_CAR_DEAD magic_car
GENERATE_RANDOM_INT_IN_RANGE 0 88 car_colour2
CHANGE_CAR_COLOUR magic_car car_colour car_colour2 // 0 - 88
++car_colour
IF car_colour > 87
car_colour = 0
ENDIF
ENDIF
ENDIF

IF NOT IS_BUTTON_PRESSED PAD2 RIGHTSHOULDER1
AND button_press_flag = 1
button_press_flag = 0
ENDIF

IF IS_BUTTON_PRESSED PAD2 RIGHTSHOULDER1
AND flag_create_car = 1
AND button_press_flag = 0
IF IS_CAR_DEAD magic_car
DELETE_CAR magic_car
ELSE
IF NOT IS_CHAR_IN_CAR scplayer magic_car
DELETE_CAR magic_car
ELSE
MARK_CAR_AS_NO_LONGER_NEEDED magic_car
ENDIF
ENDIF
flag_create_car = 0
initial_car_selected = 0
button_press_flag = 1
ENDIF
ENDIF


GOTO MainLoop

TERMINATE_THIS_SCRIPT



--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: