Asset - Scripts ATEXT - asset for drawing rich text!

Vishnya

Member
If you want to draw text with different colours, fonts, images and effects - this asset for you!

Easy to write:
Code:
text="<shadow>Hello</shadow>, this is GAME"
Easy to customize tags:
Code:
text="<shadow: x=4, y=8>Shadow is big"
Use variables or scripts in tags:
Code:
text[0]="<shadow c=@c_red><underline [email protected]_colour>Look at hos face:</shadow> <pic: @o_boss.sprite_index>"
text[1]="Your distance: <text @script_get_distance.@exe>"
Use one tag several times!
Code:
text="<underline: c=@c_white>Text <underline: c=@c_white?h=25> with </underline> underlines</underline>!"
Tutorial inside

And all it for free!

Marketplace page: ATEXT
This is new version of ATEX asset. I rewritten it for new opportunities and convenient use.
 
Last edited:

Vishnya

Member
Version 6.0:
  • More freedom in tags:
    Code:
    <tag: property = value, argument0>, <tag argument0; property=value>, <tag|argument0 | property: value>
    instead
    Code:
    <tag|argument0?property=value>
  • Optimized tag parser
  • Some changes in tutorial
 

Vishnya

Member
Version 7.0:
  • Variables. Using:
    Code:
    Hello, ${username}!
  • Typewriter (works only with ATEX_fast functions)
  • New tags: style, return and props
  • Functions:
    Code:
    ATEX_variable_set("variable_name", value)
    ATEX_variable_get("variable_name")
    
    ATEX_fast_get_symbol_number(id)
    ATEX_fast_set_symbol_drawing(id, symbols_number)
  • Include sublime-text syntax in included files for easy text editing
  • Now you can write tag color, font and halign without arguments for set default value. Example:
    Code:
    <col @c_red>ATTENTION<col>
  • Alternative names for tags. You can write col instead color, prop instead props and etc.
 
S

strelokhalfer

Guest
You should do code refactoring, becouse it does not compile with YYC.
Add semicolons, brackets, braces, etc...
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
You should do code refactoring, becouse it does not compile with YYC.
Add semicolons, brackets, braces, etc...
All of the listed things are irrelevant to whether the code will work on YYC.

Consider the following: this code works exactly the same on VM and YYC
Code:
var i:=0while not(i:=10){show_debug_message(i)(i)-=-1end
You could write your entire game like this (not that you should)

It might have been wise to point out exact errors instead of making a blanket statement that's of no help aside of identifying that there's some issue.
 
S

strelokhalfer

Guest
I meant that the code should be reduced to the same standard, otherwise there are different things mixed up, which makes me wonder how the interpreter does not choke.
Like this:
Code:
if type=="position" {
    return [0, 0] // first value - width, second - height. You can write your values
}
else
if type=="draw" {
    //var text=argument4, X=argument5, Y=argument6; - for "drawer" tags
    var X=argument4, Y=argument5;
    /*
            ...DOING SOMETHING...
    */
    return true
}
else
if type=="start" {
    var poslist=argument4, textlist=argument5;
    /*
            start of the tag, it calling when "position" event return text
    */
}
else
if type=="end" {
    var poslist=argument4, textlist=argument5; // array with text coordinates. You can use it to detect collision with cursor
    /*
            end of the tag, it calling when text returned in "position" event already drawn
    */
}
else
if type=="init" {
    /*
        initialization, usually in CREATE event
    */
}
should be

Code:
if (type=="position") {
    return [0, 0] // first value - width, second - height. You can write your values
} else {
    if (type=="draw") {
        //var text=argument4, X=argument5, Y=argument6; - for "drawer" tags
        var X=argument4, Y=argument5;
        /*
                ...DOING SOMETHING...
        */
        return true;
    } else {
        if (type=="start") {
            var poslist=argument4, textlist=argument5;
            /*
                    start of the tag, it calling when "position" event return text
            */
        } else {
            if type=="end" {
                var poslist=argument4, textlist=argument5; // array with text coordinates. You can use it to detect collision with cursor
                /*
                        end of the tag, it calling when text returned in "position" event already drawn
                */
            } else {
                if type=="init" {
                    /*
                        initialization, usually in CREATE event
                    */
                }
            }
        }
    }
}
OR in this case it MUST be switch statement

Code:
switch (type) {
    case "position":
        return [0, 0];
    case "draw":
        var X=argument4, Y=argument5;
        return true;
    case "start":
        var poslist=argument4, textlist=argument5;
        break;
    case "end":
        var poslist=argument4, textlist=argument5;
        break;
    case "init":
        break;
}
 
Last edited by a moderator:

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
makes me wonder how the interpreter does not choke.
Only a really poorly written interpreter/compiler would choke on that.

Even if you wrote your parser following a tutorial (part1, part2 preview), it would not choke on that.

OR in this case it MUST be switch statement
Valid point, but will not save you that much performance in a 5-case switch statement, and wouldn't be the source of compilation errors.
 
Top