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
Tricks with some scripting functions EmptySun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Tricks with some scripting functions EmptyThu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Tricks with some scripting functions EmptyThu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Tricks with some scripting functions EmptyThu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Tricks with some scripting functions EmptySat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Tricks with some scripting functions EmptyFri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Tricks with some scripting functions EmptyFri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tricks with some scripting functions EmptyTue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Tricks with some scripting functions 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

Tricks with some scripting functions

Go down  Message [Page 1 of 1]

1Tricks with some scripting functions Empty Tricks with some scripting functions Fri Mar 20, 2009 7:27 am

gtasbigfoot

gtasbigfoot
Admin

So in the topic "Scripting functions" we spoke about the gosub commands, and I think most scripter's know how to use gosub's, but not many know that gosub's CAN be used as a condition, well, in-fact they can; and it's useful if you're making a long script with lots of memory hacking tricks.

But what is the trick? Are you starting to wonder now? Have I got your attention? Well then let us continue.

Well, using gosub in such way requires special design results in the script, you need to tell the script to return false if the result is NOT true, or if IS true then you need to return it TRUE. (0485: return_true or 059A: return_false).




Code:

if
  gosub @Check_Type
jf @__False
// result is true, continue...


If the gosub returned false, then so it jump to the label "__False" if it HAS returned true, then it continues where it says "result is true, continue..."



Code:

:Check_Type
if
  03A3:  actor 0@ is_male
jf @RetFalse
0485: return_true
return


:RetFalse
059A: return_false
return


As you can see(?), it checks if the actor is a male, if he IS a male then it returns true, and this means the gosub IS true, if the actor is not a male, then it goes to the label "RetFalse" and returns false, BOTH codes end with a normal "return" command, this is of course so the script can go back to check if the gosub is TRUE or FALSE.

--

Sanny Builder supports storing a label name to a varible then jumping using that varible. For example:

Store it:


Code:

0@ = @Label


Then you can jump like this:


Code:

jump 0@


Like that:


Code:

:Script
if
 1@ == 0
jf @Script1

0@ = @Script2
jump 0@

Script1
//.....

:Script2


Same trick apply's to gosubs, and jump_if_false

--

With just one condition there is no need at all for an if command, in-fact, it's better without it, as it's saving more space, if there IS more then one condition THEN if(AND/OR) is needed, but if you are only using one condition, then if can be omitted from the script, and you can leave it out.


Code:


:Label
wait 0
0248:    model #INFERNUS available
jf @Label





Code:

var
$PLAYER_CHAR: Player
$PLAYER_ACTOR: Actor
end


If you declare the player or actor to the game engine using var..end, we can now do this kind of stuff:


Code:

$PLAYER_CHAR.Defined


The game knows that $PLAYER_CHAR means the player, so now all is necessary is the varible, then what your doing, like for example above I'm checking if the player is defined.
($2 is equal to $PLAYER_CHAR, and $3 is equal to $PLAYER_ACTOR, so you can use these instead of). When you decompile $2 will = $PLAYER_CHAR, and $3 = $PLAYER_ACTOR.

http://gtamodding.com

Back to top  Message [Page 1 of 1]

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