EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Feature Requests (https://www.eqemulator.org/forums/forumdisplay.php?f=612)
-   -   Lua Mob.Say() optional language parameter (https://www.eqemulator.org/forums/showthread.php?t=38703)

Shendare 08-29-2014 04:17 PM

Lua Mob.Say() optional language parameter
 
A while back an optional Language parameter was added to the Perl function for having an NPC say something, so that NPCs could speak other languages besides common.

When I skimmed over the Lua API reference taking a first look, I didn't see that as an option:

Code:

Mob member functions:

...
Void Say(String message);
...

Would it be possible to add an optional language parameter to the existing Lua function?

Or, alternatively, to add like a SayLang() function that would take a language code as well as the message text?

KLS 08-31-2014 03:41 PM

I'm going to add a way to do this for you.

Shendare 08-31-2014 03:55 PM

You ROCK! \m/

KLS 08-31-2014 11:22 PM

As of next release you'll be able to add something like:

Code:

function eq.Say(msg, lang)
        local owner = eq.get_owner();
        if(owner.null) then
                return;
        end
       
        if(lang == nil) then               
                owner:Say(msg);
        else
                local entity_list = eq.get_entity_list();
               
                entity_list:ChannelMessage(owner, 8, lang, msg);
        end
end

in your lua_modules/general_ext.lua

Then you'll be able to use it in scripts like:

Code:

if(e.message:findi("hail")) then
        eq.Say("Test string 1");
elseif(e.message:findi("there")) then
        eq.Say("Test string in thieve's cant.", 10);
end

In the same way quest::say is used in perl more or less.

Shendare 08-31-2014 11:32 PM

Perfection. Thanks, KLS.

This can add a very nice level of flavor, and means we won't have to revert to Perl for the functionality.

Thanks a ton for the quick turnaround.


All times are GMT -4. The time now is 01:42 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.