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
Test bits/set EmptySun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Test bits/set EmptyThu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Test bits/set EmptyThu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Test bits/set EmptyThu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Test bits/set EmptySat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Test bits/set EmptyFri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Test bits/set EmptyFri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Test bits/set EmptyTue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Test bits/set 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



March 2024
MonTueWedThuFriSatSun
    123
45678910
11121314151617
18192021222324
25262728293031

Calendar Calendar


You are not connected. Please login or register

Test bits/set

2 posters

Go down  Message [Page 1 of 1]

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

gtasbigfoot

gtasbigfoot
Admin

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

http://gtamodding.com

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

Kotton



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

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

Back to top  Message [Page 1 of 1]

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