Asset - Scripts ATEXT - asset for drawing rich text!

Discussion in 'Marketplace' started by Vishnya, Sep 28, 2018.

  1. Vishnya

    Vishnya Member

    Joined:
    Jul 6, 2016
    Posts:
    65
    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 c=@global.underline_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: Oct 18, 2018
    TinyGamesLab and Mert like this.
  2. Vishnya

    Vishnya Member

    Joined:
    Jul 6, 2016
    Posts:
    65
    Follow this thread to see updates
     
  3. Vishnya

    Vishnya Member

    Joined:
    Jul 6, 2016
    Posts:
    65
    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
     
  4. Vishnya

    Vishnya Member

    Joined:
    Jul 6, 2016
    Posts:
    65
    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.
     
  5. strelokhalfer

    strelokhalfer Member

    Joined:
    Jul 26, 2016
    Posts:
    2
    You should do code refactoring, becouse it does not compile with YYC.
    Add semicolons, brackets, braces, etc...
     
  6. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,321
    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.
     
  7. strelokhalfer

    strelokhalfer Member

    Joined:
    Jul 26, 2016
    Posts:
    2
    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: Dec 9, 2018
  8. YellowAfterlife

    YellowAfterlife ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    2,321
    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.

    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice