• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Table problem

Ezzz

Developer of Nostalrius and The Violet Project
Joined
Feb 26, 2010
Messages
2,012
Solutions
3
Reaction score
841
Location
Europe
Hey,

i'm trying to interpret a LUA npc scripting system, but I can't seem to be allowed to do this.

This is pretty much how my code looks like;

LUA:
function onCreatureSay(cid, type, msg)
    Address = {
        -- { {"key1|key2|...", {booleans} }, { functions or booleans}, {texts} }
        { {"hello|hi", {false} }, { selfSay("nop"), false }, {"Hello there, " .. getCreatureName(cid) } }
    }
    if getDistanceToCreature(cid) <= 3 then
    
        for id, Adr in ipairs(Address) do
        
            if isMsg(Adr[1][1], msg) then
                for x, curBool in ipairs(Adr[1][2]) do
                    if curBool == false then
                        return false -- suposed to exit
                    end
                end
                Say(Adr[3][1])
            end
        end--end loop
        
    end


end

That piece of code is inside onCreatureSay function, however whenever the player speaks it will trigger any function that is inside. How can I skip this?, I'm actually trying to reproduce Cip NPC Files scripting and somekind of revscriptsys npc scripting aswell.

Help me please! :(

- - - Updated - - -

NVM i fixed it;

Code:
    Address = {
        -- { {"key1|key2|...", {booleans} }, { functions or booleans}, { {text, delay} } }
        { {"hello|hi", { (getNpcFocus() == 0)} }, { AddFocus=cid, EffectOpp=11 }, { {"Hello there, " .. getCreatureName(cid), 1000} } },
        { {"hello|hi", { (getNpcFocus() ~= cid) } }, { Queue=cid }, { {"Hang on a moment, " .. getCreatureName(cid), 1000} } }
    }
 
Last edited:
Back
Top