Jump to content

Lua not working in fight class editor


Recommended Posts

Hey all
I tried to make an in-game frame using lua just the way i would with lua in-game in any other way (macros etc).
So in the "spellname" area in the creator i wrote in my code, and i set it to "not spell, is lua script"
Ending up with this:

      <SpellName>if not FrameCreated then
  FrameCreated = true

    StatusFrame = CreateFrame("Frame")
      StatusFrame:ClearAllPoints()
    StatusFrame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",})
    StatusFrame:SetBackdropColor(0,0,0,.4)
    StatusFrame:SetHeight(60)
    StatusFrame:SetWidth(122)
    StatusFrame:SetPoint("TOPLEFT",ChatFrame1, 0,90)
	StatusFrame:SetMovable(true)
	StatusFrame:EnableMouse(true)
	StatusFrame:RegisterForDrag("LeftButton")
	StatusFrame:SetScript("OnDragStart", frame.StartMoving)
	StatusFrame:SetScript("OnDragStop", frame.StopMovingOrSizing)
    StatusFrame:Show()
end</SpellName>


Is there any reason why this does not work?

Note: I did try removing the

StatusFrame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",})


In case it just couldn't find the BgFile, no difference. :) Also tried writing it like this:
 

StatusFrame:SetBackdrop({bgFile = [[Interface\Buttons\WHITE8X8]],})

Any help would be appreciated cheers! :)

 

Edit: I even tried changing it to use lua script as a condition and then just leave the spellname empty liket his:
 

<LuaScript>if not FrameCreated then
	StatusFrame=CreateFrame("Frame");
	StatusFrame:ClearAllPoints();
	StatusFrame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",});
	StatusFrame:SetBackdropColor(0,0,0,.4);
	StatusFrame:SetHeight(60);
	StatusFrame:SetWidth(122);
	StatusFrame:SetPoint("TOPLEFT",ChatFrame1, 0,90);
	StatusFrame:SetMovable(true);
	StatusFrame:EnableMouse(true);
	StatusFrame:RegisterForDrag('LeftButton');
	StatusFrame:SetScript('OnDragStart', frame.StartMoving);
	StatusFrame:SetScript('OnDragStop', frame.StopMovingOrSizing);
	FrameCreated = true
end</LuaScript>
Link to comment
Share on other sites

After hours and hours of doing this and that, i finally figured the error lies within wrobot. Apparently it dones't translate \\ into /
So as soon as i changed

StatusFrame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",});

into

StatusFrame:SetBackdrop({bgFile = "Interface/Buttons/WHITE8X8",});

Everything worked.

Link to comment
Share on other sites

Not sure if you saw my answer on Discord, but I recommend getting Bugsack and Buggrabber, you'll still see the Lua errors of injected code that way.
That usually can put you on the right path.

Link to comment
Share on other sites

7 hours ago, Matenia said:

Not sure if you saw my answer on Discord, but I recommend getting Bugsack and Buggrabber, you'll still see the Lua errors of injected code that way.
That usually can put you on the right path.

I saw your post, and i have both. Thing is, it's not lua errors, it's a 'compile' bug from wrobot to lua output @ wow. Which means the errors you get in-game say nothing about the error. An error that i would get as an example would be you are missing an \ in front of n (It would never be this specific.) Where when reading my code i'd be like "I have a \ in front of n, what are you talking about?". So most of the errors i have been encountering, has been because i'm using advanced lua instead of just small snippets. So it's not as thoroughly tested and fixed. :)

Link to comment
Share on other sites

22 hours ago, Ordush said:

After hours and hours of doing this and that, i finally figured the error lies within wrobot. Apparently it dones't translate \\ into /
So as soon as i changed


StatusFrame:SetBackdrop({bgFile = "Interface\\Buttons\\WHITE8X8",});

into


StatusFrame:SetBackdrop({bgFile = "Interface/Buttons/WHITE8X8",});

Everything worked.

Why should wrobot translate \\ to / ? :blink:

Link to comment
Share on other sites

Just now, iMod said:

Why should wrobot translate \\ to / ? :blink:

 

"translate" was just a rough term. In lua \\ = backslash but for some reason when you use wrobot \\ turns into \ wen it spits out the code. Just like when you wanna do \n for newline you have to do \\n :)

Link to comment
Share on other sites

4 minutes ago, forerun said:

Maybe is time for some education here.:P https://msdn.microsoft.com/en-us/library/h21280bw.aspx

 

Yes and it clearly states: \\ represents backslash in the post you just posted.

Anyway it's beside the point i made it work. You guys should rather focus on trying to help me with the other issues i have :P
 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...