Skip to content

about get string #53

@qux-bbb

Description

@qux-bbb

Maybe these two functions can be put into library functions. I'm not sure where to put them.

import scriptapi


def get_ansi_str(addr):
    final_str = ''
    i = 0
    while True:
        c = scriptapi.Memory.read(addr+i, 1)
        if c == '\x00':
            break
        final_str += c
        i += 1
    return final_str


def get_wide_str(addr):
    final_str = ''
    i = 0
    while True:
        c = scriptapi.Memory.read(addr+i, 2)
        if c == '\x00\x00':
            break
        final_str += c
        i += 2
    return final_str

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions