Actions

Data Types: Difference between revisions

From RuneWiki

No edit summary
No edit summary
Line 1: Line 1:
==Types==
== Nomenclature ==
{| class="wikitable"
 
!Name
=== Endianness ===
!Length
(none) - big (DCBA)
!Notes
 
|-
i - "inverse" (little) (ABCD)
|Byte
 
|1
m - "middle" (CDAB) - not an authentic name, no clue on original
|<nowiki>0 to 255 unsigned | -128 to +127 signed</nowiki>
 
|-
im - "inverse-middle" (reverse) (BADC) - not an authentic name, jagex may call this "_alt3"
|Word
 
|2
=== Operations ===
|<nowiki>0 to 65,535 unsigned | -32,768 to +32,767 signed</nowiki>
g - get
|-
 
|SWord*
p - put
|3
 
|<nowiki>0 to 16,777,215 unsigned | −8,388,608 to 8,388,607 signed</nowiki>
=== Types ===
|-
number of bytes - fixed size
|DWord
 
|4
smart - 0 to 32768 (unsigned), -16384 to +16383 (signed)
|<nowiki>0 to 4,294,967,295 unsigned | -2,147,483,648 to 2,147,483,647 signed</nowiki>
 
|-
float - standard 32-bit floating point number
|QWord
 
|8
jstr - NUL-terminated / Newline-terminated (depending on revision) string
|<nowiki>0 to 18,446,744,073,709,551,615 unsigned | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 signed</nowiki>
 
|-
jstr2 - version-prefixed jstr (unused)
|String
 
|1+
data - raw data (size known ahead of time/elsewhere)
|Newline-terminated, not null-terminated like C
 
|}
VarSmart - variable-length smart
<nowiki>*</nowiki>SWord means sesqui word, or one and a half words.
 
VarInt - variable-length int
 
VarLong - variable-length long
 
=== Signedness ===
(none) - unsigned, depending on exact circumstances with Java's int/long implementation
 
signed - explicitly signed, allowed to overflow
 
=== Transformation ===
(none) - no change
 
add - add 128 to the lowest byte
 
sub - subtract lowest byte from 128


==Special Types==
neg - negate, only used on byte types
{| class="wikitable"
!Name
!Base
!Notes
|-
|Base37
|QWord
|Base37 hash of a string
|-
|Interface Color
|Word
|5-bits per channel
|-
|Model Color
|Word
|
|-
|Smart
|Byte/Word
|1 or 2 byte value (-16384 to +16383)
|-
|Unsigned Smart
|Byte/Word
|1 or 2 byte value (0 to 32768)
|}


==Byte Transformations==
== Operation Table ==
These transformations only apply to the least significant byte, regardless of the endianness.
{| class="wikitable"
{| class="wikitable"
!Name
!Operation
!Operation
!Description
|-
|-
|Add
|p1
|byte + 128
|Writes a single byte (8-bits).
|-
|-
|Subtract
|p2
|128 - byte
|Writes a short (2 bytes / 16-bits).
|-
|Negate
| -byte
|}
 
==Byte Order==
Also known as Endianness.
{| class="wikitable"
!Name
!Order
|-
|-
|Big
|p3
|4, 3, 2, 1
|Writes a medium (3 bytes / 24-bits).
|-
|-
|Little
|p4
|1, 2, 3, 4
|Writes an int (4 bytes / 32-bits).
|-
|-
|Middle
|p8
|3, 4, 1, 2
|Writes a long (8 bytes / 64-bits).
|-
|-
|Reversed Middle
|pjstr
|2, 1, 4, 3
|Writes a string.
|}
|}
Middle endianness only applies to DWords.

Revision as of 12:53, 7 June 2023

Nomenclature

Endianness

(none) - big (DCBA)

i - "inverse" (little) (ABCD)

m - "middle" (CDAB) - not an authentic name, no clue on original

im - "inverse-middle" (reverse) (BADC) - not an authentic name, jagex may call this "_alt3"

Operations

g - get

p - put

Types

number of bytes - fixed size

smart - 0 to 32768 (unsigned), -16384 to +16383 (signed)

float - standard 32-bit floating point number

jstr - NUL-terminated / Newline-terminated (depending on revision) string

jstr2 - version-prefixed jstr (unused)

data - raw data (size known ahead of time/elsewhere)

VarSmart - variable-length smart

VarInt - variable-length int

VarLong - variable-length long

Signedness

(none) - unsigned, depending on exact circumstances with Java's int/long implementation

signed - explicitly signed, allowed to overflow

Transformation

(none) - no change

add - add 128 to the lowest byte

sub - subtract lowest byte from 128

neg - negate, only used on byte types

Operation Table

Operation Description
p1 Writes a single byte (8-bits).
p2 Writes a short (2 bytes / 16-bits).
p3 Writes a medium (3 bytes / 24-bits).
p4 Writes an int (4 bytes / 32-bits).
p8 Writes a long (8 bytes / 64-bits).
pjstr Writes a string.