Difference between revisions of "031B"

From GTAMods Wiki
Jump to navigation Jump to search
(Created page with "{{OpCode | games = {{Icon|3}} | command = IS_FIRST_CAR_COLOUR | description = Checks if the vehicle's primary color is equal to the color | syntax1 = 031B: &nbsp...")
 
(code snippet)
 
Line 7: Line 7:
 
| p1d        = The handle of the vehicle
 
| p1d        = The handle of the vehicle
 
| p2t        = [''int'']
 
| p2t        = [''int'']
| p2d        = [[Carcols.dat#GTA3|Color]]
+
| p2d        = [[Carcols.dat#GTA3|Car color]]
 
}}
 
}}
  
 
This conditional opcode returns true if the vehicle's primary color is equal to the color. This opcode was never called in the [[Main.scm|original script]] of GTA III.
 
This conditional opcode returns true if the vehicle's primary color is equal to the color. This opcode was never called in the [[Main.scm|original script]] of GTA III.
 +
 +
== For Vice City ==
 +
This opcode does not exist in Vice City but it possible to get the vehicle's primary color. The following example, using Sanny Builder with [[CLEO]] for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:
 +
{{Pre|class=sb-code|1=
 +
<span class="nl">:opcode_031B</span>
 +
<span class="c1">// 0@ - input param (car handle)</span>
 +
<span class="c1">// 1@ - input param (color)</span>
 +
05E7: <span class="nv">0@</span> = car <span class="nv">0@</span> struct
 +
<span class="nv">0@</span> += <span class="m">0x1A0</span>  <span class="c1">// primary color offset</span>
 +
05E0: <span class="nv">0@</span> = read_memory <span class="nv">0@</span> size <span class="m">1</span> virtual_protect <span class="m">0</span>
 +
003B:    <span class="nv">0@</span> == <span class="nv">1@</span>
 +
05F6: ret <span class="m">0</span>
 +
}}
 +
 +
Use this line as a substitute for opcode 031B. This can be placed anywhere within the external script as a conditional statement.
 +
{{Pre|class=sb-code|1=
 +
<span class="c1">// ...</span>
 +
<span class="k">if</span>
 +
    05F5: call_scm_func <span class="nl">@opcode_031B</span> inputs <span class="m">2</span> car_handle [car handle] color [int]
 +
<span class="k">then</span>
 +
    <span class="c1">// [RETURNED TRUE]</span>
 +
<span class="k">else</span>
 +
    <span class="c1">// [RETURNED FALSE]</span>
 +
<span class="k">end</span>
 +
<span class="c1">// ...</span>
 +
}}
  
 
== Keywords ==
 
== Keywords ==

Latest revision as of 11:06, 26 November 2016

GTA III IS_FIRST_CAR_COLOUR


Description
Checks if the vehicle's primary color is equal to the color
Syntax
031B:   car [car handle] primary_color [int]
Parameter
[car handle]
The handle of the vehicle
[int]
Car color

This conditional opcode returns true if the vehicle's primary color is equal to the color. This opcode was never called in the original script of GTA III.

For Vice City

This opcode does not exist in Vice City but it possible to get the vehicle's primary color. The following example, using Sanny Builder with CLEO for Vice City in an external script (not the main one) and tested on US v1.0, should work similarly to this opcode. Place this at the end of the file:

:opcode_031B
// 0@ - input param (car handle)
// 1@ - input param (color)
05E7: 0@ = car 0@ struct
0@ += 0x1A0  // primary color offset
05E0: 0@ = read_memory 0@ size 1 virtual_protect 0
003B:    0@ == 1@
05F6: ret 0

Use this line as a substitute for opcode 031B. This can be placed anywhere within the external script as a conditional statement.

// ...
if
    05F5: call_scm_func @opcode_031B inputs 2 car_handle [car handle] color [int]
then
    // [RETURNED TRUE]
else
    // [RETURNED FALSE]
end
// ...

Keywords

check, first, primary, car, vehicle, color, colour

See also

  • GTA III 031C, checks if the vehicle's secondary color is equal to the color