Starfinder Playlist
Page 2 of 3 First 123 Last
  1. #11
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    1) Is MC4C an option registered using OptionsManager.registerOption2 like you showed on past #5? If so, just use the OptionsManager.getOption("MC4C") like I said in post #7 - use the OptionsManager public functions that are available to you. This makes it easier for you now and more supportable going forwards.

    And, you should be calling the code from within the window onInit code - not the onInit code of anchor_ctbox_host_header, this is just an anchor control.

    2) attempt to index global 'field' (a nil value) means that it can't find field. Look in your code, where is "field" being used? As I've mentioned before, if you are getting these error messages start putting debug code in the script to report exactly what you can access. Debug code to show window.getClass() is a good one to start with and then work from there. For example, window.getClass() might report combattracker_host - if so, look for <windowclass name="combattracker_host"> in your ruleset and work out how you'd get from there to the control/s you want to hide/show. Then use window.<path to the control> to get to the control.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  2. #12
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Ok - switched to OptionsManager.getOption("MC4C") and that works nicely - thanks.

    Ok - I was running my script in the wrong WindowClass to get access to field_three.
    Moved the script to the correct WindowClass but there is an existing script there and it seems to be only executing the first script there - is that correct?
    Assuming that it is correct I started taking code from ct_columns.lua and putting into ct_entry.lua and OptonsManager works but again it cant find window...
    Code:
    			local sWhereAmI = window.getClass();
    				Debug.console("sWhereAmI:");
    				Debug.console(sWhereAmI);
    Runtime Notice: Reloading ruleset
    Runtime Notice: s'sColumnCount:'
    Runtime Notice: s'1'
    Script Error: [string "ct/scripts/ct_entry.lua"]:30: attempt to index global 'window' (a nil value)
    And I may as well ask the next question - am i using setVisible() correctly because it doesnt seem to work how I have done it.
    Code:
    						if sColumnCount == "1" then Debug.console("One 1.");
    						label_three.setVisible(false);
    						field.three.setVisible(false);
    						label_two.setVisible(false);
    						field.two.setVisible(false);
    						label_one.setVisible(true);
    						field.one.setVisible(true);
    						end;
    or
    Code:
    						if sColumnCount == "1" then Debug.console("One 1.");
    						ct_entry.label_three.setVisible(false);
    						ct_entry.field.three.setVisible(false);
    						ct_entry.label_two.setVisible(false);
    						ct_entry.field.two.setVisible(false);
    						ct_entry.label_one.setVisible(true);
    						ct_entry.field.one.setVisible(true);
    						end;
    Should be hiding 2 labels and 2 fields based on a return value of 1.



    FG Con 6 – April 17-19th 2015 - register at www.fg-con.com for all the latest info.

  3. #13
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    edit:
    When I run this in a different windowclass it works so I believe the syntax is correct:
    Code:
    			local sWhereAmI = window.getClass();
    				Debug.console("sWhereAmI:");
    				Debug.console(sWhereAmI);

  4. #14
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    ct_entry is the code that runs in the ct_entry class - this is each entry within the windowlist within the combat tracker, i.e. a PC or NPC. Don't run the code there as it will run for each entry in the CT, run it once in the combattracker_host windowclass.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #15
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    grnack!

    What am I doing wrong?
    I moved my script back up to combattracker_host but it still errors on window.
    I took that code out and put it in ct_host.xml in <script> tags and it runs.
    But I need to be able to refer to the value from OptionsManager.getOption("MC4C") and the window values in the same place so I moved the OptionsManager.getOption("MC4C") in between the <script> tags and it doesnt work there.

    I cant see to get access to OptionsManager from within XML executing LUA and I cant access Window from within script executed LUA.

  6. #16
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    urk.
    Its not even that.
    Ive done something and I cant work out what.
    No matter where i run
    local sWhereAmI = window.getClass();
    I get attempt to inex global 'window' (a nil value) and I have tried in a LUA file called from combattracker_host and ct_entry and also between script tags in both combattracker_host and ct_entry.
    Something is amiss in paradise...

  7. #17
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    OptionsManager global package calls should work in XML.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  8. #18
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    It was never paradise...
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  9. #19
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Quote Originally Posted by Trenloe View Post
    OptionsManager global package calls should work in XML.
    I hear you - but when I enclose it in script tags in the XML file I get errors - not just with my code - if I copy and paste a similar call from elsewhere in CoreRPG it does the same.

    Quote Originally Posted by Trenloe View Post
    It was never paradise...
    Sure - but no need to rub it in...
    Im already feeling great!

  10. #20
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Are you putting it in an onInit() function within the XML <script> section?
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

Thread Information

Users Browsing this Thread

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

Bookmarks

Posting Permissions

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

Log in

Log in