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

about get string #53

Open
qux-bbb opened this issue Aug 13, 2020 · 0 comments
Open

about get string #53

qux-bbb opened this issue Aug 13, 2020 · 0 comments

Comments

@qux-bbb
Copy link

qux-bbb commented Aug 13, 2020

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant