Back our Kickstarter Campaign going on Now
  1. #1
    Octavious's Avatar
    Join Date
    Oct 2015
    Location
    Reno Nevada United States Pacific time
    Posts
    218

    Just trying to learn

    Hi ,
    I am trying to learn a little on the rulesets.. going thru it all I have lots of questions and maybe someone can point me to some documentation to help..

    here is snippit of code I have a question about.

    <buttoncontrol name="button_global_effects">
    <anchored to="header_toggles" position="insidetopleft" offset="50,8" width="20" height="20" />
    <state icon="button_effect" />
    <state icon="button_effect_down" />
    <script>
    function onValueChanged()
    window.list.toggleEffects();
    end
    </script>
    </buttoncontrol>

    This xml snippit is defining a button control I assume , and the script code has the function onValueChanged which is called when a field value is changed for the button. Im assuming it toggles the down and up icon for the button .


    My question is .. about window.list.toggleEffects(); my experience is in C++ so to me "window" would be a defined Class with "list" a defined member of "window" which" toggleEffects()" would be a function member of "list".

    so.. where would I find documentation of these members (if that is actually what they are?) so I could begin my learning process. I see this a lot in the rules coding but have no idea where to find the info I need and ill be danged if I can find it being defined anywhere .

    any help here would be greatly appreciated..

    thanks in advance ..
    Last edited by Octavious; April 22nd, 2019 at 00:41.


    *************** The only constant in the universe is change. *****************

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    18,366
    Blog Entries
    1
    Start by search the wholeruleset + corerpg (using find in files) for buttoncontrol
    and then search that file you are in now for toggleEffects

    The doco lists the inbuilt functions/routines
    How you implement/use them and build on them is not doco'd - use the existing rulesets as guides

    Forgive me if Ive mangled/mis-used terminology - Im no programmer!

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  3. #3
    Octavious's Avatar
    Join Date
    Oct 2015
    Location
    Reno Nevada United States Pacific time
    Posts
    218
    Quote Originally Posted by damned View Post
    Start by search the wholeruleset + corerpg (using find in files) for buttoncontrol
    and then search that file you are in now for toggleEffects

    The doco lists the inbuilt functions/routines
    How you implement/use them and build on them is not doco'd - use the existing rulesets as guides

    Forgive me if Ive mangled/mis-used terminology - Im no programmer!
    Hi Damned thanks for your reply .. is this the documentation you are talking about ? https://www.fantasygrounds.com/refdoc/
    ..and is that the only source of information

    I actually did a search of "window.list" of all the files in corerpg but came up with nothing to do with any definitions of those members. I also found that there are function members of "window" and function members of "list" so I am assuming all that is derived from some sort of library if its not defined anywhere in the corerpg. Things like that is what I am trying to determine if there is any docs or SDK on all that ?

    Thanks for any help .
    Last edited by Octavious; April 22nd, 2019 at 01:27.


    *************** The only constant in the universe is change. *****************

  4. #4
    I'm running to take care of something but one thing I can suggest you do first is check out the page where they give you an overview of "scripting"
    https://www.fantasygrounds.com/modguide/scripting.xcp
    And the whole FG API page: https://www.fantasygrounds.com/refdoc/DB.xcp

    As damned said, next is trace objects and how they are created from a ruleset to the base CoreRPG in some cases.

    These are not really "classes" in the same sense you and I use with C++.
    You should definitely skim read the Lua reference book to get a feel for it - but be aware to skip all the stuff that discusses using meta-tables (basically class prototypes) to create instances. The first link I gave explains why.
    If you can find a short Lua fast tutorial that should be good enough for a dev to start with with the ref book for lookups.

    Note that sometimes things are referred to (like windowclasses "instances") by the value in their [name="foo"] field. It got me a few times trying to find a template by that name instead. Yeah, forget everything about templates in C++, it isn't the same thing. It's probably an XML thing, but I never did C++ UI work and my configs were usually message based or in early days ini. So I don't know if template is an xml standard thing.

    And yeah, damned is a source of damned good advice and helpful to the extreme.


    Quote Originally Posted by Octavious View Post
    Hi ,
    I am trying to learn a little on the rulesets.. going thru it all I have lots of questions and maybe someone can point me to some documentation to help..

    here is snippit of code I have a question about.

    <buttoncontrol name="button_global_effects">
    <anchored to="header_toggles" position="insidetopleft" offset="50,8" width="20" height="20" />
    <state icon="button_effect" />
    <state icon="button_effect_down" />
    <script>
    function onValueChanged()
    window.list.toggleEffects();
    end
    </script>
    </buttoncontrol>

    This xml snippit is defining a button control I assume , and the script code has the function onValueChanged which is called when a field value is changed for the button. Im assuming it toggles the down and up icon for the button .


    My question is .. about window.list.toggleEffects(); my experience is in C++ so to me "window" would be a defined Class with "list" a defined member of "window" which" toggleEffects()" would be a function member of "list".

    so.. where would I find documentation of these members (if that is actually what they are?) so I could begin my learning process. I see this a lot in the rules coding but have no idea where to find the info I need and ill be danged if I can find it being defined anywhere .

    any help here would be greatly appreciated..

    thanks in advance ..

  5. #5
    dulux-oz's Avatar
    Join Date
    Jan 2012
    Location
    Brisbane, Australia
    Posts
    3,839
    Blog Entries
    14
    So, the key word "window" is is used to represnt the window object (duh!) just as you suspect. The "list" is the name of a child object of the window, and Moon's(?) coding style is to name all windowlists as "list" (you learn that from playing around with the code as much as I do ).

    So, you're looking for a windowlist object named "list" defined as a child of the window (windowclass object).

    Once you've found the correct "list" - and the full definition for windowlist objects are often in a corresponding "template" file - there will be a script with the "toggleEffects()" function - which is what you're after. This script could be embedded in the "list" windowlist definition, or it could be is a separate lua file referenced from the "list" object.

    That should get you where you need to go - if you have any other question ask away
    Dulux-Oz

    √(-1) 2^3 Σ Π
    ...And it was Delicious!


    Alpha-Geek
    ICT Professional
    GMing Since 1982
    NSW, Australia, UTC +10
    LinkedIn Profile: www.linkedin.com/in/mjblack

    Read my FG Blog here.

    Watch our games on Twitch: www.twitch.tv/dulux_oz

    Support Ongoing Video, Ruleset & Extension Development: via PayPal (Send To: [email protected])

    YouTube Channel/Tutorial Playlists: www.youtube.com/c/duluxoz

  6. #6
    Octavious's Avatar
    Join Date
    Oct 2015
    Location
    Reno Nevada United States Pacific time
    Posts
    218
    Varsuuk and Dulux-Oz .. thank you so much for the reply and help that will get me going in the right direction.. I really appreciate the help ..

    thanx again !


    *************** The only constant in the universe is change. *****************

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in