DICE PACKS BUNDLE

Thread: Hidden field

  1. #1

    Hidden field

    Hello,
    I'm trying to make an hidden field that will show when an icon is clicked.
    I took an existing code from spell list that work good; when you click on the icon in the circle, the hidden fields appears
    Attachment 12357

    And this is the code I found that (maybe) do that.
    Code:
    <button_toggle name="activatecombat">
    				<anchored>
    					<to>shortcut</to>
    					<position>left</position>
    					<offset>2,0</offset>
    					<size>
    						<width>20</width>
    					</size>
    				</anchored>
    				<icon>indicator_expanddown</icon>
    				<script>
    					function onValueChanged()
    						window.onCombatSectionToggle(getValue());
    					end
    				</script>
    			</button_toggle>
    Code:
    function onCombatSectionToggle(show)
    		speedlabel.setVisible(show);
    		speed.setVisible(show);
    		damagelabel.setVisible(show);
    		damageframe.setVisible(show);
    		damagedice.setVisible(show);
    		damagebonus.setVisible(show);
    end
    But when I try to use in the file that I need (record_char_combat) with the code

    Attachment 12358

    Code:
    			<button_toggle name="weapondetails">
    				<anchored>
    					<to>damagebonus_l</to>
    					<position>right</position>
    					<offset>2,0</offset>
    					<size>
    						<width>20</width>
    					</size>
    				</anchored>
    				<icon>indicator_expanddown</icon>
    				<script>
    					function onValueChanged()
    						window.onWeaponProp(getValue());
    					end
    				</script>
    			</button_toggle>
    Code:
    function onWeaponProp(show)
    		prop.setVisible(show);
    end
    I have this error
    Script Error: [string "weapondetails"]:1: attempt to call field 'onWeaponProp' (a nil value)


    There's something that I miss? I already trying to check in 4E ruleset, but can't find it.

    Thank you

  2. #2
    Hi Larhalt,

    As your code stands at the moment, the FG engine is looking for an object in the current window called "onWeaonProp()" - obviously a function. Do you have the onWeaponProp() function included in the window's <script> tag? If not, that's your problem.

    To put it another way: where do you declare the onWeaponProp() function?

    Incidentally, if onWeaponProp() is only called from that one place, then you're better off simply having (as part of your "weapondetails" object):
    Code:
    function onValueChanged()
    	window.prop.setVisible(getValue());
    end
    Cheers
    Last edited by dulux-oz; December 28th, 2015 at 15:01.
    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

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

    Support Me on Patreon: www.patreon.com/duluxoz

    Past Games, etc, on my YouTube Channel: www.youtube.com/c/duluxoz

  3. #3
    Thank you dulux, it works wonderfully

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
  •  
Starfinder Playlist

Log in

Log in