View Full Version : Hello world!
pson
January 19th, 2011, 09:46
I think I want to learn how to create a ruleset, but I don't want to follow the general dictum which seem to be Take the closest ruleset (or possibly a small one) you can find and modify it. I want to start from scratch, start with an empty desktop, add a chatbox, make it handle the rolling dice, one thing at a time.
I got as far as a the empty desktop, and I placed the dice :) I can't get a non-functioning chatbox on it, I have no clue of what parts of a windowclass that is needed etc etc. Where can I find information about how things work? I have found lots of information on how to modify, but none of how to build.
Leonal
January 19th, 2011, 10:57
This might be worth a look https://oberoten.dyndns.org/fgwiki/index.php/Anatomy_of_a_Ruleset as it explains it from the ground up I believe. (I've never attempted ruleset creation myself).
Edit: it does modify the d20 ruleset, but still... :)
Happy gaming!
pson
January 19th, 2011, 11:45
This might be worth a look https://oberoten.dyndns.org/fgwiki/index.php/Anatomy_of_a_Ruleset as it explains it from the ground up I believe. (I've never attempted ruleset creation myself).
Edit: it does modify the d20 ruleset, but still... :)
Happy gaming!Yeah I have read it, and I learned lots but obviously not enough.
This thread about a minimal ruleset (https://www.fantasygrounds.com/forums/showthread.php?t=6081) also seemed like a good lead, but it ended up with a stripped/minimalistic d20 as well.
drahkar
January 19th, 2011, 12:53
Honestly I would recommend grabbing the foundation ruleset and start reading the code from there. It is as basic as you can get, really. Plus it will give you some straightforward information on how to build things.
You won't find much out there that is a 'This is how to build everything from scratch' because that is a massive amount of work and requires a lot of 're-inventing the wheel' which adds a significant amount of time to development.
Its an ambitious idea, but I would recommend fully reading all of the code currently in the foundation ruleset to the point where you are comfortable with it. Once you can say that is the case, then it would be far less of an issue figuring out how to build things from scratch.
pson
January 19th, 2011, 13:25
It the way I've always learned new programming environments, you start small and add a bit at a time. The more you know the bigger the chunks you can add.
I'm not sure I want to reinvent the wheel at all, but I would like to know more than "pin here, wheel here, this is how you connect them". I'm not sure I wouldn't use the Foundation, or d20 or some other rule set as a base. I'm not even sure I want to to write a ruleset, but I want to learn how.
As the title of the thread says, I want to write my "Hello world", but if the Foundation ruleset is the best documentation there is on how to put a chatbox with minimal functionality on an empty desktop there is, I guess I have to go there and rip everything else out.
Honestly I would recommend grabbing the foundation ruleset and start reading the code from there. It is as basic as you can get, really. Plus it will give you some straightforward information on how to build things.
You won't find much out there that is a 'This is how to build everything from scratch' because that is a massive amount of work and requires a lot of 're-inventing the wheel' which adds a significant amount of time to development.
Its an ambitious idea, but I would recommend fully reading all of the code currently in the foundation ruleset to the point where you are comfortable with it. Once you can say that is the case, then it would be far less of an issue figuring out how to build things from scratch.
drahkar
January 19th, 2011, 13:45
That's why I suggested the Foundation Ruleset. Of all the rulesets, its as close to barebones are you are likely to find.
tdewitt274
January 19th, 2011, 14:10
I agree, it is a difficult concept to take something you don't know and deconstruct it. However, drahkar is correct that the foundation ruleset is the lowest common denominator. I would look at foundation, then work up to d20, then d20_JPG, then 4e. This is pretty much the path of progressive functionality with each building off the other.
Also, be sure to read the Library (I know, it needs examples) for Ruleset Modifications and the Ruleset Reference for "chatwindow". While bare bones, it does reference the controls it inherits to backtrack.
Good luck!
SpudmanWP
January 19th, 2011, 17:11
Peon, if it helps any, I have converted the online help documentation into CHM and PDF formats that are easily searchable.
https://www.fantasygrounds.com/forums/showpost.php?p=101843
StuartW
January 20th, 2011, 06:46
You can use either the Base ruleset or the Foundation ruleset, both are on the FG Wiki and were originally built for slightly different purposes: the Foundation ruleset was originally intended to be expanded using extensions only; the Base ruleset was designed to be expanded by being directly modified.
They are also different in content: the Base ruleset is slightly newer and has a few extra elements to it such as shareable notes, player combat tracker and drop-down menus. I don't think Foundation was updated to include these.
Stuart
drahkar
January 20th, 2011, 09:03
They are also different in content: the Base ruleset is slightly newer and has a few extra elements to it such as shareable notes, player combat tracker and drop-down menus. I don't think Foundation was updated to include these.
You're right. None of those features are in the Foundation ruleset.
pson
January 20th, 2011, 09:36
Pson, if it helps any, I have converted the online help documentation into CHM and PDF formats that are easily searchable.
https://www.fantasygrounds.com/forums/showpost.php?p=101843
Thank you! I have that in paper format in my bag (for travel) and on my desktop for easy access.
SpudmanWP
January 20th, 2011, 16:07
What editor (Notepad++, Vim, etc) do you use. I am making a mod for Notepad++ (NPP) that will correctly spell FG2 commands, auto-complete those commands, and link those commands to my CHM helpfile (ie put your cursor on the command and press CTRL-F1).
Here is a demo of NPP auto completion in action.
https://www.youtube.com/watch?v=muJvM-Hz6w4
Bidmaron
January 21st, 2011, 01:09
Spud, you are a stud! First your help files and now this. I use Notepad++ (and visual studio excess [the free one] for my c# work). Thanks a bunch.
SpudmanWP
January 21st, 2011, 01:54
I just posted the instructions to get FG2 spellcheck working in the Workshop.
pson
January 23rd, 2011, 12:26
That looks really nice, I'm a emacs under Linux person though. My desktop machine is a bit convoluted. I run Windows 7 64, for when I play games, and I run a Virtual box (https://www.virtualbox.org/) with a Linux on it for everything else.
Thank you for all the help!
pson
January 23rd, 2011, 17:19
I thought you like to know, I'm getting there :)
(but it feels very convoluted)
https://img233.imageshack.us/img233/5302/gettingthere.png (https://img233.imageshack.us/i/gettingthere.png/)
Uploaded with ImageShack.us (https://imageshack.us)
drvolk
August 16th, 2012, 08:28
Hi,
i am trying to create something like a "Hello World" "ruleset" , as pson did, just to learn more about the fantasygrounds framework.
I want to have only one window opened , with "Hello World" on it, which i can move and resize, but i did not get it to work :(
I could open a static "window" with an assigned panel (the "test" window in my example).
But without panel (the "win" window in my example) it will not be shown ... (the onInit Method seems to be triggert, because when i add "self.setVisible(true) to it, i got an error, something with "nil" value in setVisible ...)
Could anybody tell , what i am doing wrong, or what is missing in my example code ?
Here ist the Code:
gameselements.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<die name="d4">
<icon>d4icon</icon>
<position>370,-78</position>
</die>
<die name="d6">
<icon>d6icon</icon>
<position>320,-78</position>
</die>
<die name="d8">
<icon>d8icon</icon>
<position>270,-78</position>
</die>
<die name="d10">
<icon>d10icon</icon>
<position>220,-78</position>
</die>
<die name="d12">
<icon>d12icon</icon>
<position>170,-78</position>
</die>
<die name="d20">
<icon>d20icon</icon>
<position>120,-78</position>
</die>
</root>
base.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root version="2.9" release="10" logo="logo.png">
<!-- ATTRIBUTES -->
<description>
<text>Fantasy ruleset for playing 3.5E</text>
<author>SmiteWorks USA, LLC</author>
<website>https://www.fantasygrounds.com</website>
</description>
<importinfo>
<acceptfrom ruleset="3.5E" />
</importinfo>
<!-- GAME ELEMENTS -->
<includefile source="gameelements.xml" />
<!-- GRAPHICS -->
<includefile source="graphics/graphics_fonts.xml" />
<includefile source="graphics/graphics_frames.xml" />
<includefile source="graphics/graphics_radial.xml" />
<includefile source="empty.xml" />
</root>
empty.xml
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<windowclass name="win">
<frame>charsheet</frame>
<playercontrol />
<sizelimits>
<dynamic />
</sizelimits>
<script>
function onInit()
self.bringToFront();
end
</script>
<sheetdata>
<stringcontrol>
<bounds>13,53,200,150</bounds>
<font>mini_name</font>
<static>Window</static>
</stringcontrol>
</sheetdata>
</windowclass>
<windowclass name="test">
<frame>charsheet</frame>
<sheetdata>
<stringcontrol>
<bounds>10,50,70,70</bounds>
<font>mini_name</font>
<static>Hello World</static>
</stringcontrol>
</sheetdata>
</windowclass>
<panel name="testpanel" modes="host,client">
<class>test</class>
<bounds>1,1,500,500</bounds>
</panel>
</root>
Moon Wizard
August 17th, 2012, 04:42
drvolk,
I've never really drilled into exactly what are the minimum pieces necessary to get a ruleset up and running, so it's a little bit of a mystery. It's one that can be pieced together, but maybe not worth the effort.
I've always recommended and found it easier to start with an existing ruleset, and modify from there. Since most role-playing games use a lot of the same functionality, it's also generally an easier approach to building a custom ruleset, since you will get a lot of the features automatically.
To get started with ruleset editing, I usually suggest that people make small changes to an existing ruleset, and expand out from there.
Regards,
JPG
Zeus
August 17th, 2012, 23:25
DrVolk, some comments.
Your current ruleset implementation whilst defining the windowclass win, does not instruct FGII on when to open a window of this windowclass. This is probably why you don't see the windowclass unless when you have assigned it as part of a desktop panel.
You can instruct FGII to open windows by either registering the windowclass with a button in the dock (right side) or through another GUI action (click on a button in another window for example or perhaps from a /slash command) using the Interface.openWindow() method.
Interface.openWindow() takes two parameters; windowclass name as a string and database node which is the datasource as a string. e.g.
local wnd = Interface.openWindow("win", ".win");
Your implementation is missing the placement tag which instructs FGII on the initial size of the window to render on initialisation.
e.g.
<placement>
<size>
<width>250</width>
<height>300</height>
</size>
</placement>
Windowclasses that are attached to panels, will automatically be opened when the panel is initialised. Hence why in your implementation the panel windowclasses are being displayed but win is not.
Hope that helps.
drvolk
August 20th, 2012, 12:03
moon_wizird,
thanks for your answer and i think you are right, that for development of a new or modified ruleset, it would be much more effective to take an existing one and modify that. But for learning more about the framework basics in my opinion it is also very helpfull to have a minimal ruleset as "test suite" to understand the functionality of single methods etc.
DrZeus, many thanks for your very helpfull comments !
That was (again ;) ) exactly what i needed to get my "hello wold" running !
Now i have a "playground" with which i can test different szenarios to learn more about the mechanism of the FG2 framework.
If anybody is interested to an "hello world" example, feel free and post me .... i have it now :-)
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.