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

Test bits/set

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

1 Test bits/set on Mon Mar 23, 2009 1:25 am

Most people who having at least a little knowledge in computer programming, should know that the computer code is in the form of zeros and ones, which is called the binary numeral system. The smallest unit of information in computer bits. Bits can be either off, then its value is zero, or turned, then its value is equal to one.

The processor in the PC still use 32-bit architecture (Intel and AMD produce processors with 64-bit architecture, but at the moment operating system plainly does not support it).

Bits are numbered from 0 to 31 (right to left):
31 30 29 28 27 ... ... ... .. 5 4 3 2 1 0.

Anyway, lets get back to the real topic


Code:

08BA: set 1@ bit 0


You need to set the bit, then the game will know which bit *it* is, so when you use the opcode below, if it does not = 0 for example then, let the script move on to the next.


Code:

00d6: if
08B4: test 1@ bit 0
004d: jump_if_false @next


We could check if the bit is 0, if not then we could move on to the next bit, and so on, (if your using one than one that is).


Code:

08C0: clear 1@ bit 0


A bit should always be cleared when not needed anymore, look at the script, it's very easy to understand you should get the idea:


Code:

{$CLEO}
0000:
0006: 1@ = 0

:EAX_01
while true
wait 250
  if
    Player.Defined($PLAYER_CHAR)
then
    break
    end
end
   

if
  00E1:  player 0 pressed_key 10 // no key
then
    08BA: set 1@ bit 0
    jump @EAX_02
end

if
  00E1:  player 0 pressed_key 11 // yes key
then
    08BA: set 1@ bit 1
    jump @EAX_02
end


if
  00E1:  player 0 pressed_key 19 // look behind
    08BA: set 1@ bit 2
end

:EAX_02
if
    08B4: test 1@ bit 0
then
    0AA5: call 0x43A0B6 num_params 1 pop 1 0x19B // Infernus
    jump @EAX_03
end


if
    08B4: test 1@ bit 1
then
    0AA5: call 0x43A0B6 num_params 1 pop 1 0x21D // Bullet
    jump @EAX_03
end

if
    08B4: test 1@ bit 2                   
then
    0AA5: call 0x43A0B6 num_params 1 pop 1 0x1C3 // Turismo
end

:EAX_03
08C0: clear 1@ bit 0
08C0: clear 1@ bit 1
08C0: clear 1@ bit 2
jump @EAX_01

View user profile http://gtamodding.com

2 Re: Test bits/set on Thu Mar 26, 2009 5:25 pm

hmm.. so like binary itself, they're mainly used as switches?

yet another kick ass tutorial big- keep it up man!

View user profile

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