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
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon 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



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

Tricks with some scripting functions

View previous topic View next topic Go down  Message [Page 1 of 1]

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

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.

View user profile http://gtamodding.com

View previous topic View next topic Back to top  Message [Page 1 of 1]

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