EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::LUA (https://www.eqemulator.org/forums/forumdisplay.php?f=680)
-   -   Simple Lua Concatenation (https://www.eqemulator.org/forums/showthread.php?t=39869)

Osiris.Envy 07-20-2015 12:24 PM

Simple Lua Concatenation
 
How can I concatenate a charid into a Lua string? (I'll use a simple example to illustrate my question)


The following Lua script works great to output "NPC says, Osiris_rueda_status"

Code:


function event_say(e)
        if (e.message:findi("hail")) then
                e.self:Say("" .. e.other:GetName() .."_rueda_status");       
        end
end

How can I get the Lua output to use the charid and not the char name?

The desired output would be, "NPC says, 147_rueda_status" (where 147 is the id from the character_data table)

I can do this with Perl

Code:


sub EVENT_SAY {

if ($text=~/hail/i){
$client->Message($TextColor, " ");
                plugin::Whisper($charid.'_rueda_status');
        }
}

However, for what I want to accomplish I need the desired output to come from a Lua script


Thanks,

Osiris

NatedogEZ 07-20-2015 02:47 PM

Code:

e.self:Say("" .. e.other:CharacterID() .."_rueda_status");

You just want character ID?


You can get more lua info here as well. :)

https://github.com/EQEmu/Server/wiki/Lua-Parser

http://wiki.eqemulator.org/p?Lua_Parser&frm=Main

demonstar55 07-20-2015 04:53 PM

Code:

e.self:Say(tostring(e.other:CharacterID()) .. "_rueda_status")
That should work.

Osiris.Envy 07-22-2015 01:49 AM

thx for the replies - I am now getting the desired output


All times are GMT -4. The time now is 05:51 AM.

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