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

@ does not quite work as intended when in UTF8 mode #6

Open
lightbinder opened this issue Apr 11, 2023 · 4 comments
Open

@ does not quite work as intended when in UTF8 mode #6

lightbinder opened this issue Apr 11, 2023 · 4 comments
Assignees
Labels
bug Something isn't working low priority This has been categorized as a low-priority issue question Further information is requested uwu This is a particularly uwu-y issue

Comments

@lightbinder
Copy link
Contributor

lightbinder commented Apr 11, 2023

@ behaves idiosyncratically in UTF8 mode as follows:

If you have a line like

I uwu youwu.@ And I uwu youwu toowu.\

... you will indeed trigger the clickwait, but the rest of the line will be completely cut off.

On the other hand if you have a line like

I uwu youwu.`@`And I uwu youwu toowu.\

... the second half of the line will indeed display, but one line down.

On the final (gripping) hand, this

I uwu youwu.@/
I uwu youwu toowu.\

... works exactly as intended. Praise be to the onsen and onani gods.

@lightbinder lightbinder self-assigned this Apr 11, 2023
@lightbinder lightbinder added the bug Something isn't working label Apr 11, 2023
@lightbinder
Copy link
Contributor Author

lightbinder commented Apr 13, 2023

It turns out that this behavior exists in all of legacy mode.

14 April 2023 Update
Now investigating if the "ignore the rest of the line" behavior is intentional and in line with mainline NScripter. If so, I'm still going to have to make modifications, as the program currently allows you to put a ` after the @ and still have it work, just on a new line. This may well be not orthogonal to the way the program is supposed to work.

@lightbinder
Copy link
Contributor Author

For additional detail and a workaround see here.

@lightbinder
Copy link
Contributor Author

In ONScripter_text.cpp:

        if (textgosub_label){
            saveon_flag = false;

            textgosub_clickstr_state = CLICK_WAIT;
            if (script_h.getStringBuffer()[string_buffer_offset] == 0x0)
                textgosub_clickstr_state |= CLICK_EOL;
            gosubReal(textgosub_label, script_h.getWait(), true);

            event_mode = IDLE_EVENT_MODE;
            waitEvent(0);

            return false;
        }

This block triggers when we see an @. The issue is gosubReal(textgosub_label, script_h.getWait(), true); -- or more specifically the script_h.getWait() part of the equation. It is a small inline function in ScriptHandler.h:

inline char *getWait(){ return wait_script?wait_script:next_script; };

The entire script object is iterated on until we hit the next line to execute. This is why all text after @ is ignored, unless there is a special command token such as ` or / next.

@lightbinder lightbinder added question Further information is requested uwu This is a particularly uwu-y issue labels Apr 16, 2023
@lightbinder
Copy link
Contributor Author

While this is a annoying problem, because of the existence of the functional workaround this bugfix is deprioritized at present.

@lightbinder lightbinder added the low priority This has been categorized as a low-priority issue label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority This has been categorized as a low-priority issue question Further information is requested uwu This is a particularly uwu-y issue
Projects
None yet
Development

No branches or pull requests

1 participant