JujuAdams / Scribble

Efficient, internationalized, multi-effects text renderer for GameMaker
https://www.jujuadams.com/Scribble/
MIT License
322 stars 47 forks source link

[help]About the conflict between setting colors and #macro #499

Closed Nanyuting closed 8 months ago

Nanyuting commented 8 months ago

I followed your tips and wrote the color settings //Here are some example colours c_yuhong : make_color_rgb(192,72,81), This is running fine, the text is beautifully drawn! But it causes problems with #macro of the same name. //#macro c_yuhong make_color_rgb(192,72,81) The code with the same name will only work correctly if the program is commented out Otherwise, you'll get a prompt like this “Script: __scribble_config_colours at line 10 : malformed assignment statement Script: Scr_struct at line 3 : Expected id Script: Scr_struct at line 3 : got 'make_color_rgb' expected ':' Script: Scr_struct at line 3 : got 'make_color_rgb' expected ',' or '}' Script: Scr_struct at line 3 : got 'make_color_rgb' expected '}' ” I don't quite understand what the conflict is here. I want to be able to use both the colors defined in scribble, and outside of that, the colors of a macro with the same name can be used to color the sprite. Hopefully I can get pointers to see how to resolve this conflict. If for some reason it's not possible, I could also use two sets of names to define the colors and it would just add a little bit of hassle. Thanks to Juju

JujuAdams commented 8 months ago

A regretable quirk of GameMaker's compiler.

In your colour definition struct, write

static _colours = {
        ...
        "c_yuhong": c_yuhong,
        ...
}

This should solve your problem.

Nanyuting commented 8 months ago

Great! Thanks! I'll report back with good news when my game comes out in English.