Skip to content

allow keywords in expressions #243

Closed

Description

@x87
    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

Activity

  1. added
    type:feature
    priority:p3
    on Aug 29, 2023
  2. x87 commented on Aug 29, 2023

    @x87
    CollaboratorAuthor
    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)
    
  3. MiranDMC commented on Aug 29, 2023

    @MiranDMC

    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.

  4. added this to the v4.0.0 milestone on Oct 27, 2023
  5. x87 commented on Oct 31, 2023

    @x87
    CollaboratorAuthor
    • support multiple returned values
    $x, $y, $z = get_char_coordinates $char
    
  6. x87 commented on Aug 7, 2024

    @x87
    CollaboratorAuthor

    getter syntax is implemented, nested commands moved to #283

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:p3scope:compilertype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions