GTA: Modification Area
Would you like to react to this message? Create an account in a few clicks or log in to continue.
GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Scripting function's EmptySun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Scripting function's EmptyThu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Scripting function's EmptyThu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Scripting function's EmptyThu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Scripting function's EmptySat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Scripting function's EmptyFri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Scripting function's EmptyFri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Scripting function's EmptyTue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Scripting function's EmptyMon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))
Log in

I forgot my password



November 2024
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
252627282930 

Calendar Calendar


You are not connected. Please login or register

Scripting function's

Go down  Message [Page 1 of 1]

1Scripting function's Empty Scripting function's Fri Feb 06, 2009 3:51 am

gtasbigfoot

gtasbigfoot
Admin

//---------------------------gosub/return---------------------------//

Sends the read process to a subscript. The subscript must end with 0051: return.
If 0051: was picked up, the read process will go on reading from where it left of.

Example:

Code:

0050: gosub @SubScript
0002: jump @CON

                             
:SubScript
// Something....                         
0051: return // Return to where it last gosub

:CON
//....................



//---------------------------jumps/jf--------------------------//

004D: jumps to a label if the result you're looking for is false. 0002: is just a jump command to jump to a label.
Look heres an example:


Code:

00D6: if
// Something
004D: jump_if_false @Label_1
0002: jump @Label_2

:Label_1
// Something
0002: jump @Label_3

:Label_2
// Something

:Label_3
//............................


Stuff like for example this is useless:


Code:

00D6: if
// Something
004D: jump_if_false @Label_4
0002: jump @Label_5  // This jump is useless, because it goes to Label_5 anyway(it's right after). So there is no need for that jump.

:Label_5
//............................
0002: jump @Label_6


:Label_4
//............................

:Label_6
//............................


//---------------------Then---------------------//
//---------------------Else---------------------//
//---------------------End---------------------//



Code:

if
// Something
then // if result is true
//............................

else // if result is not true
//............................

end // end the loop


//---------------------Break---------------------//
//---------------------Continue---------------------//
//---------------------Repeat---------------------//
//---------------------While--------------------//


Break



The command, Break, causes the flow of the loop to exit. It can be used both as a separate command or parameter (jf break).


Code:

#AK47.Load
while true
if
#AK47.Available
then
    Break // break the loop
  end
wait 0
end


Continue



The command Continue is used to skip the current iteration and proceed to the next. Like Break it can be used both as a separate command or parameter (jf continue).



Code:

:Check
while true
if
// Something
004D: jump_if_false Continue  // goes to label(Loop_End)
//............................ 
0002: jump @Label  // just a jump to the next label (we don't wanna go into the label right after thats for if the result is false)

:Loop_End
end  // "while"

:Label
//...........................


Repeat..until



This loop executes until the condition returns False.
The condition is evaluated after iterations therefore loop has one iteration minimum.

Operator Repeat can accept the logic constants True and False:


Code:

Repeat .. Until True - loop has the only iteration
Repeat .. Until False - loop executes infinitely until it's stopped by Break.


In the current version, the only condition is accessible within the loop but you can check out more conditions inside loop statement and use the commands Break and Continue.

Repeat..until operator syntax:


Code:

repeat
..
until <condition>



Code:

 wait 0
        #HYDRA.Load
        repeat  // repeat here(if not loaded goes back here))
            wait 0
        until #HYDRA.Available    // until model has really loaded if so continue
       



While..end



While..end operator syntax:


Code:

while <condition>
..
end


Loop WHILE is working until the condition returns True. The condition is evaluated before the loop iterations. Therefore, if the condition is false, the statement sequence is never executed.



Code:

$var = -1

while $var > 0
inc($var)
end


As this is false and $var does not equal 0 the command inc($var) will never be executed.


Code:

#AK47.Load

while not #AK47.Available  // while model has not loaded
wait 0
end  // "While"


Operator WHILE may accept the logic constants True and False:


Code:

While True..End - loop executes infinitely until the loop stopped by command Break.

While False .. End - loop is ignored by the compiler.


In the current version the only condition is accessible within the loop but you can check out more conditions inside loop statement and use the commands Break and Continue.


//---------------------Local Timers (32@, 33@)---------------------//
Local timers are local variables, in range of 32@ to 33@ they should not be used or
anything else, other then this, they are like opcode 0001
32@ is mainly script timer, and 33@ used as a loop timer.


Code:

0006: 32@ = 0 // timer set to 0

:Label_1
00D6: if
001B:  5000 > 32@ // if 5 game seconds = 32@ 
004D: jump_if_false @Label_2 
0001: wait 0 ms
0002: jump @Label_1

:Label_2
0006: 32@ = 0 // timer set to 0



Code:

:Label_1
0006: 33@ = 0 // timer set to 0

:Label_2
00D6: if   
0019:  33@ >  7000
004D: jump_if_false @Label_3
//............................
0006: 33@ = 0 // timer set to 0


:Label_3
//............................




Code:

// using it a different way
:Label
0001: wait 0 ms
005A: 31@ += 32@ // (int)
0006: 32@ = 0
00D6: if
0019: 31@ > 5000
004D: jump_if_false @Label
//............................
//............................
0006: 31@ = 0



For..end



For..end operator sets the loop with a strictly certain number of iterations.
It has the following syntax as shown:


Code:

for <counter> = <initial value> TO/DOWNTO <final value> [step <int> = 1]
...
end




  • <counter> - variable that is used as the loop iterations (repeats) counter.

  • <initial value> - starting value of the counter (any value including the model identifiers).

  • TO/DOWNTO - using TO the counter is increased, using DOWNTO - it is decreased.

  • <final value> final value of the loop when finished.



<step> - value of an increment or reduction of the counter after iteration.
(optional). By default its value is equal to 1.


Const..end



A constant or const is an identifier with a predefined value. As against a variable the value of the constant can't be changed in the games run-time. At compilation the name of the constant is replaced with the value set to it. The constants can be numeric (numerals) and string (string literals), and contain an expression.

The syntax of const..end looks like the following:


Code:

const
<constant name> = <constant value>
end


The constant name is any allowed identifier (letters, numbers and a common dash sign). There are reserved names that can't be used, as Continue, True, And and so on.
The constant value may be a number (a model identifier, a label); a string; an expres​sion(for example class or variable); another constant.

Here is an example:


Code:

const
Money = 100
PlayerMoney = $PLAYER_CHAR.Money
end

if
    PlayerMoney > Money
then
    PlayerMoney += -1
end


The constant Money will be replaced with a number 100 and PlayerMoney with $PLAYER_CHAR.Money.

The compiler also uses 2 internal constants True and False which values are equals to 1 and 0 accordingly.

You can use the constant elsewhere except the case:


Code:

const
VarName = $Var
IndexName = 100
end

VarName[IndexName] = 0


To comple such expression you must write the opcode, for example:



Code:

0004: VarName[IndexName] = 0


Also there are the limits with using of a complex expression as a constant.

The list of the constants could be called at any place of the code by pressing Ctrl + [space] in Sanny Builder, (Strg + [space] on a German keyboard).

Var..end



var..end allows to declare variables and their types for advanced use.

As an example copy & paste these into a new page in Sanny Builder:


Code:

var
  $IntVar1 : Integer
  $IntVar2 : Integer
end


Then you can use this, without there opcodes(data-type):


Code:

$IntVar1 = $IntVar2
$IntVar2 *= $IntVar2


Initialization is allowed for the variables only.


And much more...

Sanny Builder supporters the following types:


  • Integer, Int - integer values

  • Float - floating-points values

  • String, ShortString - fixed length string variable
    (only for the arrays, use s$, @s for the variables)

  • LongString - Variable length string variable
    (only for the arrays, use v$, @v for the variables)



You can redeclare any variables as many times as you need.

Also you can set an initial value for the variable when declaring it.
For this purpose write symbol = and after that, the initial value:


Code:
 
var
$fVar: float = 1.0
end


Variable $fVar will be remembered as Float and also the compiler will write an opcode in the SCM.


Code:

0005: $fVar = 1.0


hex..end



Sanny Builder supports direct hexadecimal code input, this can be very useful when it comes to very hard scripts, this feature should only be used
by a experienced user- thus, meaning that you have at least some knowledge in memory handling.


Code:

hex
04 00 03 0800 04 01
end


This is equal to:


Code:

0004: $3 = 1


This construct can accept labels and global variables.
They will be compiled as numbers (their hex representation as after a compilation) without the data type.


Code:

:get_offset
hex
04 00 02 $PLAYER_CHAR 01 @get_offset
end


It will be compiled as this:


Code:

0004: $PLAYER_CHAR = @get_offset


Also you can use the aDMA data type within this statement. It's very handy when you need to write the numbers.
The number after the & sign can be both positive and negative;
in decimal format or in hexadecimal one.


Code:

hex
&1000 &-0xA33500
end


You can compile the strings using this statement. In order to do this enclose the word with double quotes and write a single space before and after them.

Here is an example:


Code:
 
hex
09 "Word1" 20 "Word2"
end


The only word is allowed to enclose. To compile the phrase (a number of words) enclose each word separately and put a single space between them. To compile a space char, write the number 20 (ascii code of space char).
* Recommended for advanced users only. Any mistakes will make the file incapable of being decompiled &/or render it unreadable by the game.


See also the Mathematical and Arithmetic Expressions

http://gtamodding.com

2Scripting function's Empty Re: Scripting function's Thu Apr 09, 2009 1:34 am

gtasbigfoot

gtasbigfoot
Admin

^ Updated! If there is any others which I did not bring-up, and wish me to talk about them, please say so.

http://gtamodding.com

Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum