This script works well enough except for at or leading up to the block if ( state == 12) edit: I mean to say something connected to if ( state == 12 ) is causing a problem whether it leads up to it or it comes after. Something connected to that part.
I get the messages:
Script Error: EXPRESSION in vn_power_ritual_success
Left eval
Now most of the time it makes it through states 12, 13, and 14 but I've never seen the bolded Messagebox (edit can't figure out how to bold code, its the first messagebox in state == 12) unlike the similar sections above it where I have gotten those Messageboxes to show. So I think for some reason the code can't loop all thirty times in order to fail and get that message. Maybe one of the powers in block 14 is bad and whenever it hits that one it crashes, but I've gotten most of those to work. In fact I'm pretty sure I have gotten all those things in block 14 to work by random chance. I think it is when it can't find a power it crashes. The only things I notice is that there aren't commas after the addtopics like the other blocks but they are consistently missing in block 14 so I don't know. I tried looking to left of == but I just can't see anything.
Any help would be great. Thank you.
begin vn_power_ritual_success short state short button short count short accum_limit float power float timer set timer to ( timer + getsecondspassed ) if ( timer < 2 ) return endif if ( state == 0 );Messagebox "Power gain initiated" set vn_power_ritual_available to 0 set state to 1 endif if ( state == 1 ) if ( vn_lich_vamp == 1 );if you're a vampire lich, you get to choose vamprism Messagebox "Which avenue will you seek power in?" "Psionics" "Necromancy" "Sorcery" "Vampirism" set accum_limit to 3 else Messagebox "Which avenue will you seek power in?" "Psionics" "Necromancy" "Sorcery" set accum_limit to 2 endif set state to 2 endif if ( state == 2 ) set button to getButtonPressed if ( button == -1 ) return elseif ( button == 0 );Messagebox "You chose Psionics" set vn_avenue_psionics to ( vn_avenue_psionics + 1 ) set vn_av_psi_accum to ( vn_av_psi_accum + 1 ) if ( vn_av_psi_accum == accum_limit );Messagebox "decreasing other skills to compensate" set vn_avenue_necromancy to ( vn_avenue_necromancy - 1 ) set vn_avenue_sorcery to ( vn_avenue_sorcery - 1 ) if ( vn_avenue_vampirism > 0 ) set vn_avenue_vampirism to ( vn_avenue_vampirism - 1 ) endif set vn_av_psi_accum to 0 endif set state to 3 elseif ( button == 1 );Messagebox "You chose Necromancy" set vn_avenue_necromancy to ( vn_avenue_necromancy + 1 ) set vn_av_nec_accum to ( vn_av_nec_accum + 1 ) if ( vn_av_nec_accum == accum_limit );Messagebox "decreasing other skills to compensate" set vn_avenue_psionics to ( vn_avenue_psionics - 1 ) set vn_avenue_sorcery to ( vn_avenue_sorcery - 1 ) if ( vn_avenue_vampirism > 0 ) set vn_avenue_vampirism to ( vn_avenue_vampirism - 1 ) endif set vn_av_nec_accum to 0 endif set state to 6 elseif ( button == 2 );Messagebox "You chose Sorcery" set vn_avenue_sorcery to ( vn_avenue_sorcery + 1 ) set vn_av_sor_accum to ( vn_av_sor_accum + 1 ) if ( vn_av_sor_accum == accum_limit );Messagebox "decreasing other skills to compensate" set vn_avenue_necromancy to ( vn_avenue_necromancy - 1 ) set vn_avenue_psionics to ( vn_avenue_psionics - 1 ) if ( vn_avenue_vampirism > 0 ) set vn_avenue_vampirism to ( vn_avenue_vampirism - 1 ) endif set vn_av_sor_accum to 0 endif set state to 9 elseif ( button == 3 );Messagebox "You chose Vampirism" set vn_avenue_vampirism to ( vn_avenue_vampirism + 1 ) set vn_av_vmp_accum to ( vn_av_vmp_accum + 1 ) if ( vn_av_vmp_accum == accum_limit );Messagebox "decreasing other skills to compensate" set vn_avenue_necromancy to ( vn_avenue_necromancy - 1 ) set vn_avenue_psionics to ( vn_avenue_psionics - 1 ) set vn_avenue_sorcery to ( vn_avenue_sorcery - 1 ) set vn_av_vmp_accum to 0 endif set state to 12 endif set button to -1 Messagebox "Your skills are now P %.2f N %.2f S %.2f", vn_avenue_psionics, vn_avenue_necromancy, vn_avenue_sorcery endif if ( state == 3 );Messagebox "State 3 - Now assigning random number" set power to ( Random100 / 8.0 ) set count to ( count + 1 ) if ( count > 30 ) Messagebox "You are granted no power this time. Perhaps your dedication hasn't been great enough." "Ok" set state to 20 return endif set state to 4 endif if ( state == 4 ) if ( vn_avenue_psionics < 7 ) if ( power >= 4 ) set state to 3 return endif elseif ( vn_avenue_psionics < 9 ) if ( power >= 7 ) set state to 3 return endif elseif ( vn_avenue_psionics < 11 ) if ( power >= 9 ) set state to 3 return endif endif set state to 5 endif if ( state == 5 );Messagebox "Accepted power was %.2f at psi skill of %.2f", power, vn_avenue_psionics if ( power < 1 ) if ( player -> getspell, vn_pp_peace == 0 ) Messagebox "You have been granted the first order psionic power of 'Pacify'" "Ok" addtopic, "Psionic 1 - Pacify" set vn_lichspelladd.ppf_pacify to 1 set state to 20 return else set state to 3 return endif elseif ( power < 2 ) if ( player -> getspell, vn_pp_beast_detect == 0 ) Messagebox "You have been granted the first order psionic power of 'Beast Detection'" "Ok" addtopic, "Psionic 2 - Beast Detection" set vn_lichspelladd.ppf_beast_detect to 1 set state to 20 return else set state to 3 return endif elseif ( power < 3 ) if ( player -> getspell, vn_pp_reduce_notoriety == 0 ) Messagebox "You have been granted the first order psionic power of 'Reduce Notoriety'" "Ok" addtopic, "Psionic 3 - Reduce Notoriety" set vn_lichspelladd.ppf_reduce_bounty to 1 set state to 20 return else set state to 3 return endif elseif ( power < 4 ) if ( player -> getspell, vn_pp_packrat == 0 ) Messagebox "You have been granted the first order psionic power of 'Summon Packrat'" "Ok" addtopic, "Psionic 4 - Summon Packrat" set vn_lichspelladd.ppf_packrat to 1 set state to 20 return else set state to 3 return endif elseif ( power < 5 ) if ( vn_pp_fear_aura == 0 ) Messagebox "You have been granted the second order psionic power of 'Fearful Aura'" "Ok" addtopic, "Psionic 5 - Fearful Aura" set vn_pp_fear_aura to 1 set state to 20 return else set state to 3 return endif elseif ( power < 6 ) if ( player -> getspell, vn_pp_beast_mastery == 0 ) Messagebox "You have been granted the second order psionic power of 'Beast Mastery'" "Ok" addtopic, "Psionic 6 - Beast Mastery" set vn_lichspelladd.ppf_beast_mastery to 1 set state to 20 return else set state to 3 return endif elseif ( power < 7 ) if ( player -> getspell, vn_pp_voice == 0 ) Messagebox "You have been granted the second order psionic power of 'Voice Of The Lich'" "Ok" addtopic, "Psionic 7 - Voice Of The Lich" set vn_lichspelladd.ppf_voice_of_the_lich to 1 set state to 20 return else set state to 3 return endif elseif ( power < 8 ) if ( player -> getspell, vn_pp_terror == 0 ) Messagebox "You have been granted the third order psionic power of 'Terror'" "Ok" addtopic, "Psionic 8 - Terror" set vn_lichspelladd.ppf_terror to 1 set state to 20 return else set state to 3 return endif elseif ( power < 9 ) if ( player -> getspell, vn_pp_fame == 0 ) Messagebox "You have been granted the third order psionic power of 'Fame'" "Ok" addtopic, "Psionic 9 - Fame" set vn_lichspelladd.ppf_fame to 1 set state to 20 return else set state to 3 return endif elseif ( power < 10 ) if ( player -> getspell, vn_pp_command == 0 ) Messagebox "You have been granted the fourth order psionic power of 'Commanding Touch'" "Ok" addtopic, "Psionic 10 - Commanding Touch" set vn_lichspelladd.ppf_command to 1 set state to 20 return else set state to 3 return endif else set state to 3 return endif endif if ( state == 6 );Messagebox "State 6 - Now assigning random number" set power to ( Random100 / 8.0 ) set count to ( count + 1 ) if ( count > 30 ) Messagebox "You are granted no power this time. Perhaps your dedication hasn't been great enough." "Ok" set state to 20 return endif set state to 7 endif if ( state == 7 ) if ( vn_avenue_necromancy < 7 ) if ( power >= 4 ) set state to 6 return endif elseif ( vn_avenue_necromancy < 9 ) if ( power >= 7 ) set state to 6 return endif elseif ( vn_avenue_necromancy < 11 ) if ( power >= 9 ) set state to 6 return endif endif set state to 8 endif if ( state == 8 );Messagebox "Accepted power was %.2f at psi skill of %.2f", power, vn_avenue_psionics if ( power < 1 ) if ( player -> getspell, vn_pn_fake_death == 0 ) Messagebox "You have been granted the first order necromancy power of 'Fake Death'" "Ok" addtopic, "Necromancy 1 - Fake Death" set vn_lichspelladd.pnf_fake_death to 1 set state to 20 return else set state to 6 return endif elseif ( power < 2 ) if ( player -> getspell, vn_pn_heal_undead_horde == 0 ) Messagebox "You have been granted the first order necromancy power of 'Heal Undead Horde'" "Ok" addtopic, "Necromancy 2 - Heal Undead Horde" set vn_lichspelladd.pnf_heal_undead to 1 set state to 20 return else set state to 6 return endif elseif ( power < 3 ) if ( vn_pn_reduce_decay == 0 ) Messagebox "You have been granted the first order necromancy power of 'Reduce Decay'" "Ok" addtopic, "Necromancy 3 - Reduce Decay" set vn_pn_reduce_decay to 1 set state to 20 return else set state to 6 return endif elseif ( power < 4 ) if ( player -> getspell, vn_pn_turn_undead == 0 ) Messagebox "You have been granted the first order necromancy power of 'Turn Undead'" "Ok" addtopic, "Necromancy 4 - Turn Undead" set vn_lichspelladd.pnf_turn_undead to 1 set state to 20 return else set state to 6 return endif elseif ( power < 5 ) if ( player -> getspell, vn_pn_reanimate == 0 ) Messagebox "You have been granted the second order necromancy power of 'Reanimate Dead'" "Ok" addtopic, "Necromancy 5 - Reanimate Dead" set vn_lichspelladd.pnf_reanimate to 1 set state to 20 return else set state to 6 return endif elseif ( power < 6 ) if ( player -> getspell, vn_pn_dissolve_flesh == 0 ) Messagebox "You have been granted the second order necromancy power of 'Dissolve Flesh'" "Ok" addtopic, "Necromancy 6 - Dissolve Flesh" set vn_lichspelladd.pnf_dissolve_flesh to 1 set state to 20 return else set state to 6 return endif elseif ( power < 7 ) if ( player -> getspell, vn_pn_raise_dead == 0 ) Messagebox "You have been granted the second order necromancy power of 'Raise Dead II'" "Ok" addtopic, "Necromancy 7 - Raise Dead II" set vn_lichspelladd.pnf_raise_dead2 to 1 set state to 20 return else set state to 6 return endif elseif ( power < 8 ) if ( player -> getspell, vn_pn_regeneration == 0 ) Messagebox "You have been granted the third order necromancy power of 'Regeneration'" "Ok" addtopic, "Necromancy 8 - Regeneration" set vn_lichspelladd.pnf_regeneration to 1 set state to 20 return else set state to 6 return endif elseif ( power < 9 ) if ( player -> getspell, vn_pn_undead_legion == 0 ) Messagebox "You have been granted the third order necromancy power of 'Summon Undead Legion'" "Ok" addtopic, "Necromancy 9 - Summon Undead Legion" set vn_lichspelladd.pnf_undead_legion to 1 set state to 20 return else set state to 6 return endif elseif ( power < 10 ) if ( player -> getspell, vn_pn_unholy_animation == 0 ) Messagebox "You have been granted the fourth order necromancy power of 'Unholy Animation'" "Ok" addtopic, "Necromancy 10 - Unholy Animation" set vn_lichspelladd.pnf_unholy_animation to 1 set state to 20 return else set state to 6 return endif else set state to 6 return endif endif if ( state == 9 );Messagebox "State 9 - Now assigning random number" set power to ( Random100 / 8.0 ) set count to ( count + 1 ) if ( count > 30 ) Messagebox "You are granted no power this time. Perhaps your dedication hasn't been great enough." "Ok" set state to 20 return endif set state to 10 endif if ( state == 10 ) if ( vn_avenue_sorcery < 7 ) if ( power >= 4 ) set state to 9 return endif elseif ( vn_avenue_sorcery < 9 ) if ( power >= 7 ) set state to 9 return endif elseif ( vn_avenue_sorcery < 11 ) if ( power >= 9 ) set state to 9 return endif endif set state to 11 endif if ( state == 11 );Messagebox "Accepted power was %.2f at psi skill of %.2f", power, vn_avenue_psionics if ( power < 1 ) if ( vn_ps_lunar_magicka == 0 ) Messagebox "You have been granted the first order sorcery power of 'Lunar Magicka'" "Ok" addtopic "Sorcery 1 - Lunar Magicka" set vn_ps_lunar_magicka to 1 set state to 20 return else set state to 9 return endif elseif ( power < 2 ) if ( player -> getspell, vn_ps_explosive_rat == 0 ) Messagebox "You have been granted the first order sorcery power of 'Explosive Rat'" "Ok" addtopic "Sorcery 2 - Explosive Rat" set vn_lichspelladd.psf_explosive_rat to 1 set state to 20 return else set state to 9 return endif elseif ( power < 3 ) if ( vn_ps_enchant_mastery == 0 ) Messagebox "You have been granted the first order sorcery power of 'Enchant Mastery'" "Ok" addtopic "Sorcery 3 - Enchant Mastery" set vn_ps_enchant_mastery to 1 set state to 20 return else set state to 9 return endif elseif ( power < 4 ) if ( player -> getspell, vn_ps_detect == 0 ) Messagebox "You have been granted the first order sorcery power of 'Enchantment Detection'" "Ok" addtopic "Sorcery 4 - Enchantment Detection" set vn_lichspelladd.psf_detection to 1 set state to 20 return else set state to 9 return endif elseif ( power < 5 ) if ( player -> getspell, vn_ps_resist_weapons == 0 ) Messagebox "You have been granted the second order sorcery power of 'Resist Normal Weapons'" "Ok" addtopic "Sorcery 5 - Resist Normal Weapons" set vn_lichspelladd.psf_resist_weapons to 1 set state to 20 return else set state to 9 return endif elseif ( power < 6 ) if ( player -> getspell, vn_ps_magicka_boon == 0 ) Messagebox "You have been granted the second order sorcery power of 'Magicka Boon'" "Ok" addtopic "Sorcery 6 - Magicka Boon" set vn_lichspelladd.psf_magicka_boon to 1 set state to 20 return else set state to 9 return endif elseif ( power < 7 ) if ( player -> getspell, vn_ps_consume_soul == 0 ) Messagebox "You have been granted the second order sorcery power of 'Consume Soul'" "Ok" addtopic "Sorcery 7 - Consume Soul" set vn_lichspelladd.psf_consume_soul to 1 set state to 20 return else set state to 9 return endif elseif ( power < 8 ) if ( player -> getspell, vn_ps_godmode == 0 ) Messagebox "You have been granted the third order sorcery power of 'Invulnerability'" "Ok" addtopic "Sorcery 8 - Invulnerability" set vn_lichspelladd.psf_godmode to 1 set state to 20 return else set state to 9 return endif elseif ( power < 9 ) if ( player -> getspell, vn_ps_petrify == 0 ) Messagebox "You have been granted the third order sorcery power of 'Petrify'" "Ok" addtopic "Sorcery 9 - Petrify" set vn_lichspelladd.psf_petrify to 1 set state to 20 return else set state to 9 return endif elseif ( power < 10 ) if ( player -> getspell, vn_ps_chicken == 0 ) Messagebox "You have been granted the fourth order sorcery power of 'Turn To Chicken'" "Ok" addtopic "Sorcery 10 - Turn To Chicken" set vn_lichspelladd.psf_chicken to 1 set state to 20 return else set state to 9 return endif else set state to 9 return endif endif if ( state == 12 );Messagebox "State 12 - Now assigning random number" set power to ( Random100 / 8.0 ) set count to ( count + 1 ) if ( count > 30 );this means that after 30 randomizations, it couldn't find a power to give you. Messagebox "You are granted no power this time. Perhaps your dedication hasn't been great enough." "Ok" set state to 20 return endif set state to 13 endif if ( state == 13 ) if ( vn_avenue_vampirism < 7 ) if ( power >= 4 ) set state to 12 return endif elseif ( vn_avenue_vampirism < 9 ) if ( power >= 7 ) set state to 12 return endif elseif ( vn_avenue_vampirism < 11 ) if ( power >= 9 ) set state to 12 return endif endif set state to 14 endif if ( state == 14 );Messagebox "Accepted power was %.2f at psi skill of %.2f", power, vn_avenue_psionics if ( power < 1 ) if ( player -> getspell, vn_pv_vampbite == 0 ) Messagebox "You have been granted the first order vampirism power of 'Improved Vampire Bite'" "Ok" addtopic "Vampirism 1 - Improved Vampire Bite" set vn_lichspelladd.pvf_vampbite to 1 set state to 20 return else set state to 12 return endif elseif ( power < 2 ) if ( player -> getspell, vn_pv_blood_conv_bonus == 0 ) Messagebox "You have been granted the first order vampirism power of 'Enhanced Blood Conversion'" "Ok" addtopic "Vampirism 2 - Enhanced Blood Conversion" set vn_pv_blood_conv_bonus to 1 set state to 20 return else set state to 12 return endif elseif ( power < 3 ) if ( player -> getspell, vn_pv_consume == 0 ) Messagebox "You have been granted the first order vampirism power of 'Consume Soul'" "Ok" addtopic "Vampirism 3 - Consume Soul" set vn_lichspelladd.pvf_consume to 1 set state to 20 return else set state to 12 return endif elseif ( power < 4 ) if ( player -> getspell, vn_pv_absorbmagicka == 0 ) Messagebox "You have been granted the first order vampirism power of 'Absorb Magicka'" "Ok" addtopic "Vampirism 4 - Absorb Magicka" set vn_lichspelladd.pvf_absorbmagicka to 1 set state to 20 return else set state to 12 return endif elseif ( power < 5 ) if ( player -> getspell, vn_pv_brainwash == 0 ) Messagebox "You have been granted the second order vampirism power of 'Brainwash'" "Ok" addtopic "Vampirism 5 - Brainwash" set vn_lichspelladd.pvf_brainwash to 1 set state to 20 return else set state to 12 return endif elseif ( power < 6 ) if ( player -> getspell, vn_pv_frenzy == 0 ) Messagebox "You have been granted the second order sorcery power of 'Feeding Frenzy'" "Ok" addtopic "Vampirism 6 - Feeding Frenzy" set vn_lichspelladd.pvf_frenzy to 1 set state to 20 return else set state to 12 return endif elseif ( power < 7 ) if ( vn_pv_daywalker == 0 ) Messagebox "You have been granted the second order sorcery power of 'Daywalker'" "Ok" addtopic "Vampirism 7 - Daywalker" set vn_pv_daywalker to 1 set state to 20 return else set state to 12 return endif elseif ( power < 8 ) if ( player -> getspell, vn_pv_stealskills == 0 ) Messagebox "You have been granted the third order vampirism power of 'Steal Skills'" "Ok" addtopic "Vampirism 8 - Steal Skills" set vn_lichspelladd.pvf_stealskills to 1 set state to 20 return else set state to 12 return endif elseif ( power < 9 ) if ( player -> getspell, vn_pv_superspeed_ON == 0 ) Messagebox "You have been granted the third order vampirism power of 'Super Speed'" "Ok" addtopic "Vampirism 9 - Super Speed" set vn_lichspelladd.pvf_superspeed to 1 set state to 20 return else set state to 12 return endif elseif ( power < 10 ) if ( player -> getspell, vn_pv_bloodrage == 0 ) Messagebox "You have been granted the fourth order vampirism power of 'Blood Rage'" "Ok" addtopic "Vampirism 10 - Blood Rage" set vn_lichspelladd.pvf_bloodrage to 1 set state to 20 return else set state to 12 return endif else set state to 12 return endif endif if ( state == 20 ) set button to getbuttonpressed if ( button == -1 ) return endif startscript, vn_lichlevelup set count to 0 set power to 0 set timer to 0 set state to 21 endif if ( state == 21 ) set state to 0 stopscript, vn_power_ritual_success endif end