dev icon indicating copy to clipboard operation
dev copied to clipboard

allow keywords in expressions

Open x87 opened this issue 1 year ago • 3 comments

    0A9F: 0@ = get_this_script_struct
    0@ += 0x10
    0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0

could be rewritten as

    0@ = get_this_script_struct
    0@ += 0x10
    0@ = read_memory 0@ size 4 virtual_protect 0

Rules:

  1. the line must be an assignment expression
  2. keyword must follow the assignment operator (=)
  3. keyword must be a getter (have output as defined in SBL). read_memory is fine, but write_memory can only be used as a standalone command

x87 avatar Aug 29 '23 16:08 x87

0@ = read_memory ((get_this_script_struct) + 0x10) size 4 virtual_protect 0

where (expr) essentially means: take the left-hand side variable and make a new command var = code

another example:

nlvar0 = WEAPONTYPE_SHOTGUN * SIZEOF_CWEAPONINFO
nlvar0 += aWeaponInfo
nlvar0 = Memory.Read(nlvar0, DWORD, false)

nlvar0 = Memory.Read(((WEAPONTYPE_SHOTGUN * SIZEOF_CWEAPONINFO) + aWeaponInfo), DWORD, false)

x87 avatar Aug 29 '23 16:08 x87

I use form read_memory 0@ = from 0@ size 4 virtual_protect 0 Great idea, but the Ctrl+Alt+2 documentation have to propose new syntax too, same with code generated during decompilation.

MiranDMC avatar Aug 29 '23 17:08 MiranDMC

  • [x] support multiple returned values
$x, $y, $z = get_char_coordinates $char

x87 avatar Oct 31 '23 02:10 x87

getter syntax is implemented, nested commands moved to #283

x87 avatar Aug 07 '24 02:08 x87