Thread Tools Display Modes
11-12-05, 02:41 PM   #1
ninmonkeys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 9
Problem with an OnLoad function

Has anyone had trouble with this, or see what I've done wrong? I'm not sure if this is my fault, or possibly a bug.

I've created a xml file that <OnLoad>, will call MyMod_OnLoad(); and didn't have any problems.

I tried it with the mod created using wowuides, and I keep getting "attempt to call global MyMod_OnLoad (a nil value)"

The root frame in wowuides, I have the onload property set to
Code:
MonkeyNote_OnLoad();
And in MyMod.lua, the function exists
Code:
function MonkeyNote_OnLoad()
	--register events
	this:RegisterEvent("VARIABLES_LOADED");
	
	--slash command
	SlashCmdList["MONKEYNOTE"] = MonkeyNote_SlashCommandHandler;
	SLASH_MONKEYNOTE1 = "/monkeynote";
	SLASH_MONKEYNOTE2 = "/mnote";
	
	--loaded message
	DEFAULT_CHAT_FRAME:AddMessage("ninmonkey's "..MONKEYNOTE_MOD_NAME.." loaded.");

end
__________________
--
monkey
  Reply With Quote
11-12-05, 04:26 PM   #2
Nulkris
A Cobalt Mageweaver
 
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214
Is that an error you are getting in WoW itself, or just in the designer? The designer will not execute the OnLoad handler at all, so is it being referenced elsewhere? If you like, attach the whole files and I will check it out.
__________________
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote
11-12-05, 05:42 PM   #3
ninmonkeys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 9
Yes it is from in game. Here's the exact wording of the error:
Code:
[string "MonkeyNoteFrame:OnLoad"]:2: attempt to call global `MonkeyNote_OnLoad` (a nil value)
I attached the file.
Attached Files
File Type: zip MonkeyNote_OnLoad_error.zip (4.3 KB, 781 views)
__________________
--
monkey
  Reply With Quote
11-12-05, 06:23 PM   #4
Nulkris
A Cobalt Mageweaver
 
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214
Ok, its a load order issue, you need the lua file to load before the frame (it obviously calls OnLoad before loading the next file in the toc). You can right-click on MonkeyNote.lua and select Load Earlier and resave the project.

As for the edit box, you may need to place down a panel and the edit box from the Basic skin on top to not have it resize like it does. And the text rendering on the designer is still a bit out, so you need to have bigger Label boxes than you might think.

Good luck
__________________
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote
11-13-05, 01:27 AM   #5
ninmonkeys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 9
1) Thanks, the load order fixed it.

2) I tried what you suggested, but it still doesn't work. (A frame(panel) is the child of the root frame, and an edit box is the child of the frame(panel))

The only difference is since the textedit isn't using a texture now, the texture stays in place. But, the text is still going out of bounds like the example that was attached.

I've tried setting MinimumSize, MaximumSize, but they appear to have no effect.

3) I had thought that maybe a scrollbar would fix the problem, but I don't see any scrollframe, or scrollbar objects. Would a slider be able to work as a scrollbar, or would it require a new object type to be created?

I've seen others examples of a textedit that can scroll require an <ScrollFrame />, <Frame />, <EditBox /> (So all that is missing is a ScrollFrame object)
Code:
-- simplified example
<ScrollFrame name="ScrollFrame">
	<ScrollChild>
		<Frame name="$parent_ScrollChild" >
			<Frames>
				<EditBox name="$parent_EditBox">
				</EditBox>
			</Frames>
		</Frame>
	</ScrollChild>
</ScrollFrame>
__________________
--
monkey
  Reply With Quote
11-13-05, 01:41 AM   #6
Nulkris
A Cobalt Mageweaver
 
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214
Yeah, I didn't really understand how multi-line edit controls worked (never looked . You could create a new component in the skin that had a scrollframe and another that is a vertical scrollbar, and link them together. I will have a look when I can, probably wont be until tomorrow though. Probably possible to create a rich multi-line edit component to do the whole job.
__________________
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote
11-13-05, 07:29 PM   #7
ninmonkeys
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 9
I'll try to get an example working, however edittext's have been giving me nothing but problems :P

To create a componet, do I just edit "wow ui/Skins/BasicSkin.xml and DefaultSkin.xml"? (I wasn't exactly sure which the differences were, I think that BasicSkin has more properties, but some components are not availible for both.

The textedit does allow colored strings, but only through escaped color codes since it only uses one FontString. You can also choose SimpleHTML, which allows some HTML tags, as well as multiple font strings. (I think only 3, one for each header, <h1-3>)

I'm not sure if you'd need color code strings in the program, but they are pretty simple.

Color code start: "|cff"
Color code end: "|r"
color (hex): 6666ff (6 characters of [0-10,a-f] )

So a red string would be: local str_red = "|cffff0000red text|r";
__________________
--
monkey
  Reply With Quote
11-13-05, 08:56 PM   #8
Nulkris
A Cobalt Mageweaver
 
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214
You are best to create your own skin for new components, that way it wont get overwritten on updates, and you can share what you create easily. See http://www.wowinterface.com/forums/s...ead.php?t=2018 for details on creating a skin from scratch. You just place any new skin files in the Skins directory and it will be recognised on next start up.
__________________
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote
11-14-05, 12:11 AM   #9
Nulkris
A Cobalt Mageweaver
 
Nulkris's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2005
Posts: 214
Ok, I uploaded a new beta to the main website (http://wowuides.wowinterface.com/beta.html) that has a multi-line edit component in it (in the Default skin). It is basically a ScrollFrame with an embedded EditBox. It inherits from FauxScrollFrameTemplate so it already includes a vertical scroll bar, and uses all the blizzard functions to manipulate it all, so it seems to work pretty good. It is pretty basic though, with few properties exposed, but should work for what you want.
__________________
Nulkris - A80 Rogue - Proudmoore
(Also Drukris, Hamkris on Proudmoore; Hulkris on Jubei'Thos & Khaz Modan)
  Reply With Quote
11-14-05, 05:55 AM   #10
dafire
Premium Member
AddOn Author - Click to view addons
Join Date: Jun 2005
Posts: 216
It would be great to have some more skins shared with others .. I try to make some myself but since my wow-xml-gui knowledge is bad it'll take some time until I have something usefull to share
  Reply With Quote
11-21-05, 05:42 AM   #11
mikezter
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 5
oha, thanks for the info on load order. i manually editet the xml-file to include a <script file="mylua.lua"/> everytime i saved the project. (:
  Reply With Quote
11-21-05, 08:45 AM   #12
Beladona
A Molten Giant
 
Beladona's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 539
this is a perfect example of why loading the lua from within the xml might be served better than loading it from the toc. If your xml file depends on functions declared within the lua file, load it as a script element in the xml file, that way you can be sure it is fully loaded before proceeding with anything in the xml.

Introducing the ability to load lua only from the toc, also introduced the load order issue...
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Problem with an OnLoad function


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off