Thread: Extension not working
-
February 20th, 2011, 20:19 #1
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Extension not working
What am I doing wrong this time? I'm guessing it's in extension.xml, but I'll be damned if I know what it is....
I created a new extension, copied characterlist.lua from the 3.5E ruleset to the scripts subfolder and added just 1 line, just to see if the extension is doing anything at all:
Code:function onUserStateChange(username, statename, state) print("Test"); if username ~= "" and User.getCurrentIdentity(username) then
Here's extension.xml:
Code:<?xml version="1.0" encoding="iso-8859-1"?> <root version="2.0" release="1"> <properties> <name>Extension Test</name> <version>1</version> <author>Nils van Schaik</author> <description>3.5E ruleset test extension</description> <ruleset> <name>3.5E</name> </ruleset> </properties> <base> <script file="scripts/characterlist.lua" /> </base> </root>
Hope anyone can show me what I'm doing wrong.....
-
February 24th, 2011, 10:54 #2
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Anyone? Please?
-
February 24th, 2011, 11:15 #3
first of all, onUserStateChange is handler function not even function. You need to define something the following the make it work:
User.onUserStateChange = handleIt
function handleIt(username, statename, state)
-- content of the function
end
Secondly I think you are using that characterlist.lua in the characterlist window implementation. If this is the case you can't override it like you're doing. You must include the window implementation to your extension as well. On the otherhand if that function is global script you must give name to it so it will be initialized/created at all. For example:
<script name="CharacterList" file="scripts/characterlist.lua" />
Hope this helps!"Alright, you primitive screwheads, listen up: THIS... is my BOOMSTICK!" -- Ash Williams, Army of Darkness
Post your SavageWorlds ruleset feature requests and issue reports here!
-
February 24th, 2011, 12:26 #4
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Thanks for the tips,
As I described, I took the file I want to change from the 3.5E ruleset and just added a line. I assume (can't check right now) that the assignment of onUserStateChange to handle an event is elsewhere in the 3.5E ruleset, and I haven't done anything with that.
I'll try adding the xml that contains the reference to characterlist.lua to the extension, see if that works.
-
February 24th, 2011, 22:03 #5
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
You will need to replace the characterlist window class, which is where that script file is used.
Copy the windowclass definition from desktop_classes.xml, into your extension.xml file. Then, put your new script file into a scripts subfolder under your extension's folder.
Cheers,
JPG
-
February 25th, 2011, 07:53 #6
- Join Date
- Jun 2007
- Location
- Zeist, Netherlands
- Posts
- 286
Thanks guys, I now have a nice "Test" message showing up on my console. I can finally get started rebuilding my extension.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks