Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow keywords in expressions #243

Closed
Tracked by #277
x87 opened this issue Aug 29, 2023 · 4 comments
Closed
Tracked by #277

allow keywords in expressions #243

x87 opened this issue Aug 29, 2023 · 4 comments
Labels
priority:p3 Low priority scope:compiler type:feature New feature or request
Milestone

Comments

@x87
Copy link
Collaborator

x87 commented Aug 29, 2023

    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 x87 added type:feature New feature or request priority:p3 Low priority scope:compiler labels Aug 29, 2023
@x87
Copy link
Collaborator Author

x87 commented Aug 29, 2023

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)

@MiranDMC
Copy link

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.

@x87 x87 added this to the v4.0.0 milestone Oct 27, 2023
@x87 x87 mentioned this issue Oct 27, 2023
59 tasks
@x87
Copy link
Collaborator Author

x87 commented Oct 31, 2023

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

@x87
Copy link
Collaborator Author

x87 commented Aug 7, 2024

getter syntax is implemented, nested commands moved to #283

@x87 x87 closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:p3 Low priority scope:compiler type:feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants