• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

Item Teleporter Help

Status
Not open for further replies.

Ladrek

Enthusiast
ok so ive been working on a teleport and now that im done its not working please check this image out 7fGOBKT.jpg below is my coding

Code:
Local UnitEntry = 63022

Local t = {
    [1] =  { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176)
    [2] =  { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890)
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
          
          local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)
 

slp13at420

Mad Scientist
ok so ive been working on a teleport and now that im done its not working please check this image out View attachment 388 below is my coding

Code:
Local UnitEntry = 63022

Local t = {
    [1] =  { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176[COLOR="#FF0000"])[/COLOR]
    [2] =  { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890[COLOR="#FF0000"])[/COLOR]
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
          
          local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)

the errors in red. change those to '}'
 

slp13at420

Mad Scientist
Code:
          }[COLOR="#FF0000"],[/COLOR]<-- change to [COLOR="#ADD8E6"];[/COLOR]
          
          local function OnGossipHello(event, player, unit)

Code:
Local UnitEntry = 63022

local t = {
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          }; [COLOR="#ADD8E6"]<--[/COLOR]

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)
 
Last edited:

Ladrek

Enthusiast
Code:
          }[COLOR="#FF0000"],[/COLOR]<-- change to [COLOR="#ADD8E6"];[/COLOR]
          
          local function OnGossipHello(event, player, unit)

Code:
Local UnitEntry = 63022

Local t = {
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          }; [COLOR="#ADD8E6"]<--[/COLOR]

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)

most like last error 535YhTT.jpg
 

Tommy

Founder
did you change `Local` to `local`?
I just copied your original post and pointed where the error was.

Either that or he copied and pasted the code in your reply and it still has " <--" in it and the L is still capped in 'local'.

Try this: (I removed the <-- and set the capital L to lowercase via local)
Code:
local UnitEntry = 63022

local t = {
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          };

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)
 

♠Spade♠

Enthusiast

Code:
local UnitEntry = 63022

local t = {
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
}

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)

Comfirmed and working, no errors.


What I did:

Orig code part:

Code:
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          };

Now it looks like this:

Code:
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
}

Notice the
}, then the } right below.
 

Ladrek

Enthusiast
it isnt fixed, not to be rude but im still a little lost to why its still not working
7rlLGgr.jpg
 
Last edited:

Jpp

Administrator
it isnt fixed, not to be rude but im still a little lost to why its still not working
View attachment 393

Take a look at what I marked red and the ipairs part.

Code:
local UnitEntry = 63022

local [COLOR="#FF0000"]t[/COLOR] = 
{
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
}

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)
 

Ladrek

Enthusiast
Take a look at what I marked red and the ipairs part.

Code:
local UnitEntry = 63022

local [COLOR="#FF0000"]t[/COLOR] = 
{
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
}

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs(T) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs(T[sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)

do i need to remove that?
 

Tommy

Founder
do i need to remove that?

No. You didn't read or do what Jpp said to. Look at the "local t" variable name and then look at the variable in OnGossipSelect & OnGossipHello via the for loop and you'll solve your problem.
 

Jpp

Administrator
do i need to remove that?

No.

Look at the parts I have marked red and read this line until you understand the error.

Lua is case sensitive.

Code:
local UnitEntry = 63022

local [COLOR="#FF0000"]t[/COLOR] = 
{
    [1] = { "Transmog", 0,
          {"Mall",530,-3594.909668,-132.460449,238.504929, 0.062176},
          },
    [2] = { "Twink Mall", 0,
          {"Mall",1,-1650.029419,-4372.638672,10.235728, 1.60890},
          },
    [3] = { "Horde Cities", 1,
          {"Orgrimmar", 1, 1503, -4415.5, 22, 0},
          {"Undercity", 0, 1831, 238.5, 61.6, 0},
          {"Thunderbluff", 1, -1278, 122, 132, 0},
          {"Silvermoon", 530, 9484, -7294, 15, 0},
          },
    [4] = { "Alliance Cities", 0,
          {"Stormwind", 0, -8905, 560, 94, 0.62},
          {"Ironforge", 0, -4795, -1117, 499, 0},
          {"Darnassus", 1, 9952, 2280.5, 1342, 1.6},
          {"The Exodar", 530, -3863, -11736, -106, 2},
          },
}

local function OnGossipHello(event, player, unit)
    -- Show main menu
    for i, v in ipairs([COLOR="#FF0000"]T[/COLOR]) do
        if (v[2] == 2 or v[2] == player:GetTeam()) then
            player:GossipMenuAddItem(0, v[1], i, 0)
        end
    end
    player:GossipSendMenu(1, unit)
end    
 
local function OnGossipSelect(event, player, unit, sender, intid, code)
    if (sender == 0) then
        -- return to main menu
        OnGossipHello(event, player, unit)
        return
    end
 
    if (intid == 0) then
        -- Show teleport menu
        for i, v in ipairs([COLOR="#FF0000"]T[/COLOR][sender]) do
            if (i > 2) then
                player:GossipMenuAddItem(0, v[1], sender, i)
            end
        end
        player:GossipMenuAddItem(0, "Back", 0, 0)
        player:GossipSendMenu(1, unit)
        return
    else
        -- teleport
        local name, map, x, y, z, o = table.unpack(T[sender][intid])
        player:Teleport(map, x, y, z, o)
    end
   
    player:GossipComplete()
end
 
RegisterItemGossipEvent(UnitEntry, 1, OnGossipHello)
RegisterItemGossipEvent(UnitEntry, 2, OnGossipSelect)
 
Last edited:

Tommy

Founder
ohhhh wow.... ok rofl

It is important to look at the smallest things when programming. We tried to let you solve the issue (I didn't at first) on your on since we want you to learn how to fix errors when they come up, instead of us immediately giving you a fix ourselves and explaining what we did. If we did that all the time, you wouldn't learn a thing and would come on EmuDevs just to be spoon fed. :p
 
Status
Not open for further replies.
Top