PDA

View Full Version : Addon (duh)


Kanicasta
13-03-2007, 06:30 AM
well hi.

i'm trying to make an adon that acts like a picture viewer in game. i have some stuff written so far, though its probally horrible. i get the error of "[<dir>.lua]:16 <eof> expected near end"
what does that mean? i was thinking end Of Function, but :undecided:

here's the lua
PicturesV = {}
function PicturesV.OnLoad()
SlashCmdList["PICTURES"] = PicturesV.show
SLASH_PICS1 = "/pic"
end
function PicturesV.show(msg)
if(msg == "1") then
local text = string.gsub(msg, "");
if(text == "s") then
pic1:Show();
end
elseif(text == "h") then
pic2:Hide();
end
end
end
end

and xml

<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<Script file="pics.lua"/>
<Frame name="pic1" movable="true" hidden="true" parent="UIParent">
<Size>
<AbsDimension x="400" y="400"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent" relativePoint="TOP">
<Offset>
<AbsDimension x="0" y="-14"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentHeaderTexture" file="Interface\AddOns\pics\pics\1">
<Size>
<AbsDimension x="256" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
</Ui>

so far there's only one picture in it, because i didn't wanna go far with it crashing.
thanks for the help. (yes i got a toc and everything, it works)

Jumpy
13-03-2007, 07:42 AM
PicturesV = {}
function PicturesV.OnLoad()
SlashCmdList["PICTURES"] = PicturesV.show
SLASH_PICS1 = "/pic"
end
function PicturesV.show(msg)
if(msg == "1") then
local text = string.gsub(msg, "");
if(text == "s") then
pic1:Show();
elseif(text == "h") then
pic2:Hide();
end
end
end

You had a few too many end statements. When you use elseif after the first if you only need one end after the elseif statements. I didn't look at the logic, just the syntax related to your error message.

Rowaa
13-03-2007, 10:37 AM
Your command line parsing is badly broken. None s/h comparsions will ever match. string.gsub requires at least three arguments as well.

Kanicasta
14-03-2007, 01:28 AM
i see, thanks for the help. i'll get to this when i can.