Could a good scripter please review this script?

Post » Fri Aug 20, 2010 1:24 am

Here it is. Based off of another script. It is supposed to restore enchantments as you walk and as time passes:

scn zzEnchantRestoreScriptfloat fQuestDelayTimefloat timerref weapfloat strengthshort dayshort hourshort hour2short waitfloat xfloat yfloat zbegin menumode 1012 ;sleep wait menu	set wait to 1endbegin GameModeif fQuestDelayTime != .001	set fQuestDelayTime to .001endifif GetGameLoaded == 1RunBatchScript "Data\EnchantmentRestore.ini"endifif wait	set hour2 to gamehour	if hour2 > hour		set strength to hour2 - hour	elseif hour2 < hour		set strength to 23 - hour + hour2	elseif day > gamedayspassed		set strength to 23	else		set strength to 0	endif	set weap to player.getequippedobject 16	if timescale > 0		set strength to strength * 3600 / Timescale ;How many seconds passed	else		set strength to strength * 3600	endif	if EnchantRestoreTimer > .1		set strength to strength / EnchantRestoreTimer	else		set strength to strength / .1	endif	if EnchantRestoreMysticism		set strength to player.getav mysticism / 10 * strength	else		set strength to EnchantRestorePower * strength	endif	if strength + player.getequippedcurrentcharge 16 > getobjectcharge weap		set strength to getobjectcharge weap - player.getequippedcurrentcharge 16	endif;	printtoconsole "Wait Restore Strength = %.0f" strength	if player.getequippedcurrentcharge 16 < getobjectcharge weap		player.ModEquippedCurrentCharge strength 16	endifendifset wait to 0set hour to gamehourset day to gamedayspassedif EnchantNPCRef.getparentcell != player.getparentcell	EnchantNPCRef.moveto playerendifset timer to timer + getsecondspassedif timer < EnchantRestoreTimer	returnendifset timer to 0set x to player.getpos xset y to player.getpos yset z to player.getpos z + 100EnchantNPCRef.setpos x xEnchantNPCRef.setpos y yEnchantNPCRef.setpos z zEnchantNPCRef.cast zzEnchantRestoreNPCSpell playerset weap to player.getequippedobject 16if player.getequippedcurrentcharge 16 >= getobjectcharge weap	returnendifif EnchantRestoreMysticism	set strength to player.getav mysticism / 10else	set strength to EnchantRestorePowerendifif strength + player.getequippedcurrentcharge 16 > getobjectcharge weap	set strength to getobjectcharge weap - player.getequippedcurrentcharge 16endif;printtoconsole "Restore Strength = %.0f" strengthif player.getequippedcurrentcharge 16 < getobjectcharge weap	player.ModEquippedCurrentCharge strength 16endifend


And here is the .ini:

set zzEnchantRestoreQuest.EnchantRestoreTimer to 0.5set zzEnchantRestoreQuest.EnchantRestoreMysticism to 0set zzEnchantRestoreQuest.EnchantRestorePower to 50


It's not working right though. I know one problem. I need to declare a few variables. That's no problem. But I don't think that's why it's not working.
User avatar
Jesus Sanchez
 
Posts: 3455
Joined: Sun Oct 21, 2007 11:15 am

Post » Thu Aug 19, 2010 6:32 pm

Nevermind. It works. Declaring the variables was the problem. lol. Scripting is fun.
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am


Return to IV - Oblivion