[I]Before I begin, Yes I am a narb at Lua, and yes I am wanting to learn but from the amount that I know (Which is very sparse) I understand that in order to learn you can not be spoon-fed the answer but I am clueless as to where to start with this.[/I]
I am attempting to fix the ThreeD addon ([url]http://www.garrysmod.org/downloads/?a=view&id=130075[/url]) and update it from Gmod 12 to 13. (I believe it's coded for Gmod 12) However, I am unsure of where to start with repairing it. Any help would be appreciated. I know that I may get flamed in case this is the wrong section to post this in, or because I'm a general scrub at lua in general.
The error:
[CODE][ERROR] addons/threed/lua/weapons/gmod_tool/stools/threed.lua:48: attempt to index global 'threed' (a nil value)
1. LeftClick - addons/threed/lua/weapons/gmod_tool/stools/threed.lua:48
2. unknown - gamemodes/sandbox/entities/weapons/gmod_tool/shared.lua:251[/CODE]
The threed.lua:
[CODE]// ThreeD, a 3d text thingamabob for Garry's Mod
// By Sergiusz Bazañski, a.k.a. q3k.
// This code is released under the do-whatever-you-want-but-don't-be-a-douche license.
// www.q3k.org, 2010
//Modified and Maintained by Ugleh since 1.1
TOOL.Category = "Render"
TOOL.Name = "ThreeD Text"
TOOL.Command = nil
TOOL.ConfigName = ""
TOOL.ClientConVar["text"] = "Some Stupid Text"
TOOL.ClientConVar["size"] = 10
TOOL.ClientConVar["color_r"] = 255
TOOL.ClientConVar["color_g"] = 255
TOOL.ClientConVar["color_b"] = 255
TOOL.ClientConVar["color_a"] = 255
TOOL.ClientConVar["font"] = "ThreeD_Coolvetica"
TOOL.ClientConVar["fadecheck"] = 0
TOOL.ClientConVar["fadedistance"] = 512
function TOOL:GetClientBool( cvar ) return self:GetClientNumber(cvar) != 0 end
if CLIENT then
language.Add("Tool_threed_name", "ThreeD Text Tool")
language.Add("Tool_threed_desc", "Places a 3D text at the hit position.")
language.Add("Tool_threed_0", "Primary: Place text. Secondary: Remove text near hit position.")
end
function TOOL:LeftClick(Trace)
if CLIENT then return end
local Text = self:GetClientInfo("text")
local Size = self:GetClientNumber("size")
local Color_r = self:GetClientNumber("color_r")
local Color_g = self:GetClientNumber("color_g")
local Color_b = self:GetClientNumber("color_b")
local Color_a = self:GetClientNumber("color_a")
local Font = self:GetClientInfo("font")
local FadeCheck = self:GetClientBool("fadecheck")
local FadeDistance = self:GetClientNumber("fadedistance")
local Position = Trace.HitPos + (Trace.HitNormal * 2)
local Angles = Trace.HitNormal:Angle()
Angles:RotateAroundAxis(Angles:Forward(), 90);
Angles:RotateAroundAxis(Angles:Right(), 270);
threed.AddText(Text, Position, Angles, Size, Color(Color_r, Color_g, Color_b, Color_a), Font, self:GetOwner():SteamID(), FadeCheck, FadeDistance)
return true
end
function TOOL:RightClick(Trace)
if CLIENT then return end
local Position = Trace.HitPos
for Index, Item in pairs(threed.Stored) do
if Item.Position:Distance(Position) < 200 then
threed.RemoveText(Index)
return true
end
end
return false
end
function RemoveAllTexts(ply, command, arguments)
endint = table.Count(threed.Stored)
for i=endint,1, -1 do
if threed.Stored[i].CreatorSteamID == ply:SteamID() then
threed.RemoveText(i)
end
end
end
function RemoveLastTexts(ply, command, arguments)
endint = table.Count(threed.Stored)
for i=endint,1, -1 do
if threed.Stored[i].CreatorSteamID == ply:SteamID() then
threed.RemoveText(i)
i = 0
break
end
end
end
concommand.Add("threed_remove_all", RemoveAllTexts)
concommand.Add("threed_remove_last", RemoveLastTexts)
function TOOL.BuildCPanel(Panel)
Panel:AddControl("Header", {Text = "ThreeD Text", Description = "Allows you to place 3D text in-game"})
Panel:AddControl("TextBox", {
Label = "Text",
Command = "threed_text",
MaxLength = "200"
})
Panel:AddControl("ComboBox", {
Label = "Select a Font",
Options = {
["Akbar"] = { threed_font = "ThreeD_Akbar" },
["Arial"] = { threed_font = "ThreeD_Arial" },
["Arial Black"] = { threed_font = "ThreeD_ArialBlack" },
["Comic Sans MS"] = { threed_font = "ThreeD_ComicSans" },
["Coolvetica"] = { threed_font = "ThreeD_Coolvetica" },
["Courier New"] = { threed_font = "ThreeD_CourierNew" },
["Georgia"] = { threed_font = "ThreeD_Georgia" },
["Impact"] = { threed_font = "ThreeD_Impact" },
["Times New Roman"] = { threed_font = "ThreeD_Times" },
["Typenoksidi"] = { threed_font = "ThreeD_Typenoksidi" },
["TF2 Build"] = { threed_font = "ThreeD_TF2Build" },
["BalladeShadow"] = { threed_font = "ThreeD_BalladeShadow" },
["Balthazae Regular"] = { threed_font = "ThreeD_BalthazaeRegular" },
["Baloney"] = { threed_font = "ThreeD_Baloney" },
["French Grotesque"] = { threed_font = "ThreeD_FrenchGrotesque" },
["Babe Bamboo"] = { threed_font = "ThreeD_BabeBamboo" },
["Showcard Gothic"] = { threed_font = "ThreeD_ShowcardGothic" },
["TF2 Secondary"] = { threed_font = "ThreeD_TF2Secondary" },
["TF2"] = { threed_font = "ThreeD_TF2" },
["3 theHard way RMX"] = { threed_font = "ThreeD_3theHardwayRMX" },
["Coneria Script"] = { threed_font = "ThreeD_ConeriaScript" }
}
})
Panel:AddControl("Color", {
Label = "Color",
Red = "threed_color_r",
Blue = "threed_color_b",
Green = "threed_color_g",
Alpha = "threed_color_a",
ShowHSV = 0,
ShowRGB = 1,
Multiplier = 255
})
Panel:AddControl("Slider", {
Label = "Text Size",
Command = "threed_size",
Type = "Float",
Min = 1,
Max = 50
})
Panel:AddControl("CheckBox", {Label = "Should the text Fade into the Distance? (And if so:)", Command = "threed_fadecheck"})
Panel:AddControl("Slider", {
Label = "Fade Distance",
Command = "threed_fadedistance",
Type = "Integer",
Min = 200,
Max = 5000
})
Panel:AddControl("Button", {
Label = "Remove My Last Text",
Command = "threed_remove_last"
})
Panel:AddControl("Button", {
Label = "Remove All of My 3D Text's",
Command = "threed_remove_all"
})
end
[/CODE]
[URL=https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit]Extremely useful[/URL]
Other than that, if I'm trying to fix an addon I just follow the error messages and try to fix or replace it as they rise
Sorry, you need to Log In to post a reply to this thread.