Jump to content

lua useing string.format in when chat?


Recommended Posts

  • Premium

hallo

i was wondering how i can make something like this :

quest :

when 20017.chat.(string.format(gameforge.test._10_npcChat, pc.name())) begin

translate :

gameforge.test._10_npcChat = "hallo %s "

 

or something like that :

when 20017.chat.gameforge.test._10_npcChat begin

translate :

gameforge.test._10_npcChat = "hallo "..pc.get_name()

If you're going to do something, then do it right.

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Premium

Actually, your second "code" is a solution. I tested it in the following way:

I wrote this into my questlib.lua:

Spoiler

test_shitty_string = "I think you are "..pc.get_name()

Then I wrote this into my quest:

Spoiler

        when 9005.chat.test_shitty_string begin
            chat("YOLO")
        end

Then the result was:

Spoiler

ab94999152.jpg

(The second option is from my other quest :D)

Edited by Metin2 Dev
Core X - External 2 Internal

The one and only UI programming guideline

Link to comment
Share on other sites

  • Premium

that was a test , but the acticle one is :

when 20017.chat.gameforge.arena_manager._10_npcChat begin

gameforge.warehouse._10_npcChat = pc.get_lang()..gameforge.warehouse._10_npcChat

i also try

gameforge.warehouse._10_npcChat = ""..pc.get_lang()..gameforge.warehouse._10_npcChat

error :

attempt to concatenate field `_10_npcChat' (a nil value)

 

maybe cuz u write it in questlib.lua

try in translate.lua

If you're going to do something, then do it right.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.