Jump to content
  • 0

Quest multilingual x.chat.y?



Dear community,


I wanted to give myself the option with expanding to an international server, so I want to script my quests multilingualable. For this, I wrote a function lang.get_text(string) which searches in a table for the entry and returns the text in the language the user has chosen.

Everything's fine but if I try this:

when npc_list.BIOLOGIST.chat.lang.get_text("test_quest_chat") begin

The compiler arborts with this:


SHLVL=1:25:when doesn't have begin-end clause. (lang)
Abort trap (core dumped)


Someone may help me?



Link to comment

2 answers to this question

Recommended Posts

  • 0

It's not possible to use functiones on that kind of things, e.g:

when XXXXX.chat.text[pc.getf("lang", "lang")][1] begin

The better way (and I guess the unique) to do that is using click event instead of chat. But now with the source I guess all it's possible.

when you return 0 and server doesn't boot:


Link to comment
  • 0

You can allow for functions or variables on chat by tweaking the qc.cc file - Did it first day with source to allow precisely that.

Fair warning, though. As with any parser, at first it's confusing to look at the source xD


You want to change before here:

current_when_argument += os.str();

And what I did was implement a recursive check for parenthesis to allow arguments on said function call (The parenthesis for the func call are the only real problem that needs to be changed). It's not very tested since we didn't end up using it, but I can confirm that my initial tests worked, compiled and displayed ingame.


This is what I added if I recall correctly:

//Accept functions as valid arguments
const char    TK_OPEN_PARENTHESIS = '(',
            TK_CLOSE_PARENTHESIS = ')';

if (lexstate.lookahead.token == TK_OPEN_PARENTHESIS)
    int depth = 0;
    while(lexstate.lookahead.token != TK_CLOSE_PARENTHESIS || depth > 1)
        if(lexstate.lookahead.token == TK_OPEN_PARENTHESIS) //allow function calls inside as well
        else if(lexstate.lookahead.token == TK_CLOSE_PARENTHESIS)

        t = lexstate.t;
        os << t;

May require another change somewhere, but doesn't look like it atm. I don't really remember the original state of the file so I can't say for sure.



  • Love 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.