Someone Posted December 20, 2012 Share Posted December 20, 2012 Doing some testing to get a grip of how the engine works. content.php <?php SetUserVariable('attack', 1050); TableHeader("Player Stat"); echo 'Attack: '.GetUserVariable('attack').'<br />'; echo 'Defense:'.GetUserVariable('defense').'<br />'; echo 'Speed:'.GetUserVariable('spvvveedfff').'<br />'; TableFooter(); ?> This outputs Player Stat Attack: 1050 Defense:1050 Speed:1050 spvvveedfff is not a real variable at all but it returns the attack value. Here is the config.xml that is used for this module <?xml version="1.0" encoding="UTF-8"?> <configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.nw-engine.com/modules.xsd"> <module name="Abilities" version="0.1" author="Someone" description="blah" /> <variable name="attack" /> <variable name="defense" /> <variable name="speed" /> </configuration> And how do I set a default value for uservariables Quote Link to comment Share on other sites More sharing options...
a_bertrand Posted December 20, 2012 Share Posted December 20, 2012 Because you do it wrong, you should not use a string as first parameter but the define which will be automatically setup for you (during module installation) and stored in config/auto_defines.php Your code should be: <?phpSetUserVariable(attack, 1050); TableHeader("Player Stat");echo 'Attack: '.GetUserVariable(attack).''; echo 'Defense:'.GetUserVariable(defense).''; echo 'Speed:'.GetUserVariable(spvvveedfff).''; TableFooter(); ?> Yet, for me those should be stats and not user variables, for stats it's a bit differently handled. User variable wiki: http://www.nw-engine.com/wiki/index.php/User_variable Stats: http://www.nw-engine.com/wiki/index.php/UserStat Quote Link to comment Share on other sites More sharing options...
Someone Posted December 21, 2012 Author Share Posted December 21, 2012 Aha And your abselutely right, those should be userstats Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.