Createing a message tags system

Discussion in 'Development' started by Atomization, Jul 30, 2020.

  1. Atomization

    Atomization Baby Zombie

    Messages:
    120
    Hi, I'm trying to make a system to apply various tags to messages, such as `{player}` and `{faction}`

    I do know how to simply use `str_replace()` to modify the tag in the message to the value, but i cant seem to figure out a efficient system to create tags to replace with...

    here is what im currently doing...
    PHP:
    public static $tags = [];
    public static function 
    updateTag(string $tagstring $value) {
        
    self::$tags[$tag] = $value;
    }
    explanation:
    $tags is a variable that is supposed to hold all the tags registered
    i have to call updateTag() before each message to make sure the values for each tag is send

    while it works... it sucks, very inefficient... i dont wanna call it 10-15 times per command just to change the tags as it goes though the command. any better ideas?
     

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.