Septfox Posted November 21, 2010 Share Posted November 21, 2010 Hey people. On finding that it's nowhere near as hard as it looks (though it's still a bit of a pain), I've started dabbling in scripting.Among others, I decided to make a script that takes some of the stress off my GPU during fights, by toggling TLB when the player's weapon is drawn.The problem is, despite the script looking perfect to me, nothing happens in-game. I THINK it's related to IsWeaponOut. I couldn't get it to report 1 or 0 in the original script, even though I've seen it used in other people's scripts in that way. It just worked as a simple If condition. Maybe I'm doing something else wrong, though? scn aaacombattlbv2 float fquestdelaytime ;declare timing variable for script resolution short tlbtoggle ;setting up variable for true/false checks begin gamemode set fquestdelaytime to 1.0 ;set up script resolution for check/1000ms if ( player.isweaponout == 0 && tlbtoggle == 0 ) ;if weapon isn't out, and the tlb switch is set to false, return ;cease processing script, TLB isn't currently needed elseif ( player.isweaponout == 1 && tlbtoggle == 1 ) ;if weapon is out, and the tlb switch is set to true, return ;cease processing script, combat is presumably in progress elseif ( player.isweaponout == 1 && tlbtoggle == 0 ) ;if the player's weapon is out, and the tlb switch is currently off, set tlbtoggle to 1 ;toggle it on RunBatchScript "tlbtoggle.txt" ;and toggle TLB via batch script return ;again, might as well not process the rest of the script elseif ( player.isweaponout == 0 && tlbtoggle == 1 ) ;if the weapon is put away, but the tlb switch is set to true for whatever reason, set tlbtoggle to 0 ;turn the switch off runbatchscript "tlbtoggle.txt" ;and toggle TLB via batch script endif end My original script (which does work fine, it's just not as fancy): scn combattlb short tlbon begin gamemode If (Player.IsWeaponOut) if ( tlbon = = 0 ) set tlbon to 1 RunBatchScript "tlbtoggle.txt" else ( tlbon == 1 ) message "Combat is continuing" endif else if ( tlbon == 1 ) set tlbon to 0 RunBatchScript "tlbtoggle.txt" endif endif end Any help/advice/etc is appreciated! Link to comment Share on other sites More sharing options...
Fonger Posted November 21, 2010 Share Posted November 21, 2010 out of curiosity, where is the initial value of tlbtoggle set Link to comment Share on other sites More sharing options...
Septfox Posted November 21, 2010 Author Share Posted November 21, 2010 (edited) ...er. I was under the impression that variables were set to 0 when they were declared.And that seemed to be the case with the original script, because...it worked :\ Edit: So, I figured out the problem; IsWeaponOut only works as a basic If condition if it's used in a Quest script, which I was trying to do to make it compatible with everything.Only if it's an Object script attached to something held by the player does it allow 0/1 checks. By sticking it on a token I threw together, I found that my script did indeed work perfectly. w00t and such~ Edited November 21, 2010 by Septfox Link to comment Share on other sites More sharing options...
Recommended Posts