Lichcraft2 Crown of Souls Scripting Error

Post » Fri Jan 21, 2011 4:27 pm

For those of us who love Venombyte's lichcraft2 mod there has always been the annoying reality of a few irksome bugs. One of which is the Crown of Souls. Sure the regular crown looks cool but why not use the "Crown of Souls" to further increase your power? The answer is simple, because it DOESN'T work. As an amateur modder it is quite difficult for me to figure out how a complex script works, let alone how to fix it, so I am asking the community to help me out here. I posted a thread about this on the planet elderscrolls forums awhile back with no success.

Here is the link and what I discovered:

http://forumplanet.gamespy.com/morrowind_technical_problems/b49680/20186892/p1/?7

It's a short thread so read it over to find out about the problem at hand.

Thanks for your support. Here is the full script just in case someone who actually knows what they're doing decides to help fix the problem:

Spoiler
begin vn_crown_of_souls_scriptlong powershort hungerlong lasthourlong currentHourfloat timerlong soultypelong tempshort stateshort OnPCEquipshort PCSKipEquipshort buttonfloat maxtimeif ( vn_wearinglich == 0 )	if ( PCSKipEquip == 0 )		set PCSkipEquip to 1	endifelse	if ( PCSKipEquip == 1 )		set PCSKipEquip to 0	endifendifif ( PCSKipEquip == 1 )	returnendifif ( OnPCEquip == 0 )	if ( player ->getspell, vn_crown_gift ==1 )		player -> removespell, vn_crown_gift	endif	return ;don't process anythingelseif ( player -> getspell, vn_crown_gift == 0 )	player ->addspell, vn_crown_giftendifset currentHour to gameHourif ( lasthour != currentHour )	;Messagebox "hour changed to %.2f", currentHour	if ( hunger >= 0 )		set temp to ( hunger - 5 )		if ( temp < 0 )			set hunger to 0		else			set hunger to temp		endif	endif	if ( power > 0 )		set temp to ( power - 2 )		if ( temp < 0 )			set power to 0		else			set power to temp		endif	endif	;Messagebox "hunger now %.2f and power is %.2f", hunger, power	set lasthour to currentHourendifif ( power >= 350 )	Messagebox "The Crown of Souls rewards you. Your Intelligence, luck, and willpower increase."	if ( mlRunOnce != 0 )		Messagebox "Mad leveller detecting: Using alternative stat bonus"		Set Adj_Intelligence To 1		Set Adj_Willpower to 1		Set Adj_Luck to 1		StartScript mlAdjust	else		player ->  modintelligence, 1		player -> modwillpower, 1		player -> modluck, 1	endif	if ( Gals_Natural_Intelligence > 0 )		set Gals_Natural_Intelligence to ( Gals_Natural_Intelligence + 1 )		set Gals_Natural_Willpower to ( Gals_Natural_Willpower + 1 )		set Gals_Natural_Luck to ( Gals_Natural_Luck + 1 )	endif	set temp to ( power - 500 )	set power to tempendifif ( state == 0 )	if ( hunger == 0 )		set timer to ( timer + getsecondspassed )		if ( timer > maxtime )			set state to 1			set timer to 0.0		endif	endifendifif ( state == 1 )	if ( menumode == 0 )		if ( player -> hassoulgem, "ancestor_ghost" )			Messagebox "Allow the crown to feed on the soul of the Ancestor Ghost?" "Yes" "No"			set soultype to 1			set state to 2		elseif ( player -> hassoulgem, "ash_slave" )			Messagebox "Allow the crown to feed on the soul of the Ash Slave?" "Yes" "No"			set soultype to 2			set state to 2		elseif ( player -> hassoulgem, "Dwarven Ghost" )			Messagebox "Allow the crown to feed on the soul of the Dwarven Spectre?" "Yes" "No"			set soultype to 3			set state to 2		elseif ( player -> hassoulgem, "Atronach_flame" )			Messagebox "Allow the crown to feed on the soul of the Flame Atronach?" "Yes" "No"			set soultype to 4			set state to 2		elseif ( player -> hassoulgem, "bonelord" )			Messagebox "Allow the crown to feed on the soul of the Bonelord?" "Yes" "No"			set soultype to 5			set state to 2		elseif ( player -> hassoulgem, "atronach_frost" )			Messagebox "Allow the crown to feed on the soul of the Frost Atronach?" "Yes" "No"			set soultype to 6			set state to 2		elseif ( player -> hassoulgem, "dremora" )			Messagebox "Allow the crown to feed on the soul of the Dremora?" "Yes" "No"			set soultype to 7			set state to 2		elseif ( player -> hassoulgem, "Hunger" )			Messagebox "Allow the crown to feed on the soul of the Hunger?" "Yes" "No"			set soultype to 8			set state to 2		elseif ( player -> hassoulgem, "Daedroth" )			Messagebox "Allow the crown to feed on the soul of the Daedroth?" "Yes" "No"			set soultype to 9			set state to 2		elseif ( player -> hassoulgem, "dremora_lord" )			Messagebox "Allow the crown to feed on the soul of the Dremora Lord?" "Yes" "No"			set soultype to 10			set state to 2		elseif ( player -> hassoulgem, "ash_ghoul" )			Messagebox "Allow the crown to feed on the soul of the Ash Ghoul?" "Yes" "No"			set soultype to 11			set state to 2		elseif ( player -> hassoulgem, "atronach_storm" )			Messagebox "Allow the crown to feed on the soul of the Storm Atronach?" "Yes" "No"			set soultype to 12			set state to 2		elseif ( player -> hassoulgem, "Winged Twilight" )			Messagebox "Allow the crown to feed on the soul of the Winged Twilight?" "Yes" "No"			set soultype to 13			set state to 2		elseif ( player -> hassoulgem, "lich" )			Messagebox "Allow the crown to feed on the soul of the Lich?" "Yes" "No"			set soultype to 14			set state to 2		elseif ( player -> hassoulgem, "lich_profane_unique" )			Messagebox "Allow the crown to feed on the soul of the Profane Acolyte?" "Yes" "No"			set soultype to 15			set state to 2		else			set state to 0		endif	endifendifif ( state == 2 )	set button to getButtonpressed	if ( button = -1 )		return	elseif ( button == 0 )		set maxtime to 10		set state to 3	elseif ( button == 1 )		set maxtime to 300		set state to 0	endifendifif ( state == 3 )	if ( soultype == 1 ) ;hunger = soul/2 + 20 --> so faster to feed on bigger souls.		Messagebox, "The crown consumes the soul of the Ancestor Ghost"		player -> removesoulgem, "ancestor_ghost", 1		set hunger to ( hunger + 70 ) 		set power to ( power + 100 )	elseif ( soultype == 2 )		Messagebox, "The crown consumes the soul of the Ash Slave"		player -> removesoulgem, "ash_slave", 1		set hunger to ( hunger + 70 )		set power to ( power + 100 )	elseif ( soultype == 3 )		Messagebox, "The crown consumes the soul of the Dwarven Spectre"		player -> removesoulgem, "Dwarven Ghost", 1		set hunger to ( hunger + 120 )		set power to ( power + 200 )	elseif ( soultype == 4 )		Messagebox, "The crown consumes the soul of the Flame Atronach"		player -> removesoulgem, "atronach_flame", 1		set hunger to ( hunger + 72 )		set power to ( power + 105 )	elseif ( soultype == 5 )		Messagebox, "The crown consumes the soul of the Bonelord"		player -> removesoulgem, "bonelord", 1		set hunger to ( hunger + 70 )		set power to ( power + 100 )	elseif ( soultype == 6 )		Messagebox, "The crown consumes the soul of the Frost Atronach"		player -> removesoulgem, "atronach_frost", 1		set hunger to ( hunger + 88 )		set power to ( power + 138 )	elseif ( soultype == 7 )		Messagebox, "The crown consumes the soul of the Dremora"		player -> removesoulgem, "dremora", 1		set hunger to ( hunger + 70 )		set power to ( power + 100 )	elseif ( soultype == 8 )		Messagebox, "The crown consumes the soul of the Hunger"		player -> removesoulgem, "hunger", 1		set hunger to ( hunger + 145 )		set power to ( power + 250 )	elseif ( soultype == 9 )		Messagebox, "The crown consumes the soul of the Daedroth"		player -> removesoulgem, "daedroth", 1		set hunger to ( hunger + 117 )		set power to ( power + 195 )	elseif ( soultype == 10 )		Messagebox, "The crown consumes the soul of the Dremora Lord"		player -> removesoulgem, "dremora_lord", 1		set hunger to ( hunger + 120 )		set power to ( power + 200 )	elseif ( soultype == 11 )		Messagebox, "The crown consumes the soul of the Ash Ghoul"		player -> removesoulgem, "ash_ghoul", 1		set hunger to ( hunger + 145 )		set power to ( power + 250 )	elseif ( soultype == 12 )		Messagebox, "The crown consumes the soul of the Storm Atronach"		player -> removesoulgem, "atronach_storm", 1		set hunger to ( hunger + 95 )		set power to ( power + 150 )	elseif ( soultype == 13 )		Messagebox, "The crown consumes the soul of the Winged Twilight"		player -> removesoulgem, "winged twilight", 1		set hunger to ( hunger + 170 )		set power to ( power + 300 )	elseif ( soultype == 14 )		Messagebox, "The crown consumes the soul of the Lich"		player -> removesoulgem, "lich", 1		set hunger to ( hunger + 170 )		set power to ( power + 300 )	elseif ( soultype == 15 )		Messagebox, "The crown consumes the soul of the Profane Acolyte"		player -> removesoulgem, "lich_profane_unique", 1		set hunger to ( hunger + 170 )		set power to ( power + 300 )	endif	set state to 0endif

User avatar
Jessica Lloyd
 
Posts: 3481
Joined: Fri Aug 25, 2006 2:11 pm

Post » Fri Jan 21, 2011 3:06 pm

Could you put that code in a code box to preserve the indentation and make it easier to read?

EDIT: left/right eval? Sounds like a missing variable. I'l read through it carefully to find which.

EDIT: it could be vn_wearinglich, which is referred to right at the top. It looks like it's referring to another quest variable but hasn't got the quest name. Or it could be a global variable. Looks like I'm going to have to download it and find out...
User avatar
StunnaLiike FiiFii
 
Posts: 3373
Joined: Tue Oct 31, 2006 2:30 am

Post » Fri Jan 21, 2011 4:50 pm

How do I put it in a code box?
User avatar
Nathan Maughan
 
Posts: 3405
Joined: Sun Jun 10, 2007 11:24 pm

Post » Fri Jan 21, 2011 12:49 pm

Highlight the code and click the right hand button on the forum toolbar, just above where you enter the text. You'll probably have to copy it from source again. It would be nice in a spoiler box too while you're at it.
[spoiler] [/spoiler]

User avatar
Bek Rideout
 
Posts: 3401
Joined: Fri Mar 02, 2007 7:00 pm

Post » Fri Jan 21, 2011 7:13 pm

From what I can see by just eyeballing the script, try the following corrected lines in this if block:

if ( OnPCEquip == 0 )	if ( player -> getspell, vn_crown_gift == 1 ) ; corrected for eval error		player -> removespell, vn_crown_gift	endif	return ;don't process anythingelseif ( player -> getspell, vn_crown_gift == 0 )	player -> addspell, vn_crown_gift ; corrected for eval errorendif

And this part:

if ( state == 2 )	set button to getButtonpressed	if ( button == -1 ) ; corrected for eval error		return	elseif ( button == 0 )		set maxtime to 10		set state to 3	elseif ( button == 1 )		set maxtime to 300		set state to 0	endifendif


Also, in the if ( power >= 350 ) block there's an extra space after the fix-arrow ( -> ) for
player -> modintelligence, 1
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Fri Jan 21, 2011 10:30 am

Thanks, I'll try that. I've been messing around with the script and I think the problem has something to do with the variable "hunger". Every time hunger reaches 0 the error occurs. I preset hunger to be greater then 0 and waited for it to decrease to 0. When that happened the error came back. Your suppose to be able to "feed" the crown souls to increase the power and hunger but it won't let me. I don't know how to get that part of the script to activate.

Edit:

P.S.

The changes you suggested DID fix the "gift of the crown" spell not being added to the player but the expression and right eval errors were still present. I probably don't know what I'm talking about but as I said before. I think it has something to do with the variable "hunger".
User avatar
Suzie Dalziel
 
Posts: 3443
Joined: Thu Jun 15, 2006 8:19 pm

Post » Fri Jan 21, 2011 7:25 pm

If an expression error has something to do with numerical values then wouldn't "eval" be short for "evaluation"? Maybe the math in the script is faulty?
User avatar
Tha King o Geekz
 
Posts: 3556
Joined: Mon May 07, 2007 9:14 pm

Post » Fri Jan 21, 2011 8:29 pm

It might be the timer reset - try changing it to read: set timer to 0 instead of set timer to 0.0

I've always just used 0 when resetting float timers.


Also just noticed there's no End terminator for the script.
User avatar
louise fortin
 
Posts: 3327
Joined: Wed Apr 04, 2007 4:51 am

Post » Fri Jan 21, 2011 1:12 pm

Left and right eval errors (I know for a fact) appear when a script is run that tries to access variables that have not been declared, or the 37th (or whatever it is) variable. Could someone check the esp and tell me if there is a global variable named 'vn_wearinglich'. If not, you could try adding one and seeing what happens, or declaring one within the script.
User avatar
Arnold Wet
 
Posts: 3353
Joined: Fri Jul 07, 2006 10:32 am

Post » Fri Jan 21, 2011 5:21 am

It might be the timer reset - try changing it to read: set timer to 0 instead of set timer to 0.0

I've always just used 0 when resetting float timers.


Also just noticed there's no End terminator for the script.


The script is suppose to be active so long as the player is wearing the "Crown of Souls". When you aren't wearing it the script doesn't do anything.

Left and right eval errors (I know for a fact) appear when a script is run that tries to access variables that have not been declared, or the 37th (or whatever it is) variable. Could someone check the esp and tell me if there is a global variable named 'vn_wearinglich'. If not, you could try adding one and seeing what happens, or declaring one within the script.


There is a global named "vn_wearinglich". It's a short variable (?) that monitors whether or not the player is in lich form or not.

I tried changing the script to:

if ( hunger >= 0 )
set temp to ( hunger - 5 )
if ( temp <= 0 )
set hunger to 50 <-- prevents hunger from reaching 0
else
set hunger to temp
endif
endif

There were no errors when I tested this. I'm still trying to figure out why the game has such a problem with this variable as well as how to use the part that lets you "feed" the crown souls of various creatures to increase the power and hunger. Hopefully there aren't any problems with that part of the script.

P.S.

I appreciate your help.
User avatar
R.I.P
 
Posts: 3370
Joined: Sat Dec 01, 2007 8:11 pm

Post » Fri Jan 21, 2011 1:06 pm

MWSFD states that right eval errors can be casued by undeclared variables, but left eval errors are usually caused by declaring a Function as a variable. However both are also caused by improper format spacing.

I edited the comments in my first post to specify corrections for eval errors instead of right eval - that was misleading. :sleep:
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Fri Jan 21, 2011 10:54 am

Maybe it isn't the variable itself that's the problem? Maybe the script doesn't know what to do when hunger reaches 0?

Here is the part of the script that is supposed to activate when hunger = 0:

if ( state == 0 )	if ( hunger == 0 )		set timer to ( timer + getsecondspassed )		if ( timer > maxtime )			set state to 1			set timer to 0.0		endif	endifendif


Tetchy said something about the timer not supposed to equal "0.0". I'll change it to 0 and see what happens.

Edit:

I made it so hunger was preset to 0 again after I changed the script to "set timer to 0". The error came back with hunger equaling 0. I'll look for undeclared variables Tetchy. Maybe there is a misspelled variable somewhere that involves hunger.
User avatar
Justin
 
Posts: 3409
Joined: Sun Sep 23, 2007 12:32 am

Post » Fri Jan 21, 2011 2:56 pm

It could be because of another script using the variable 'hunger', becuase I can't see anything wrong with hunger being set to 0 in the current script. Could you explain the perpose of the crown's hunger, and maybe see if you can find any related scripts?
User avatar
Alexander Horton
 
Posts: 3318
Joined: Thu Oct 11, 2007 9:19 pm

Post » Fri Jan 21, 2011 4:20 pm

It could be because of another script using the variable 'hunger', becuase I can't see anything wrong with hunger being set to 0 in the current script. Could you explain the perpose of the crown's hunger, and maybe see if you can find any related scripts?


If it was because of the name of the variable wouldn't it cause errors even if it didn't equal 0? I think I've found the problem. You guys got my brain juices pumping. The problem isn't the variable itself. Hunger is supposed to keep track of how "hungry" the crown is. Once it gets to 0 you have to "feed" it a soul to keep it's powers going. Hunger decreases by 5 every game hour. When hunger = 0 this part of the script takes effect:

if ( state == 0 )	if ( hunger == 0 )		set timer to ( timer + getsecondspassed )		if ( timer > maxtime )			set state to 1			set timer to 0		endif	endifendif


It is that part that is causing problems. I could be wrong but isn't "getsecondspassed" supposed to be a variable? That isn't a function that came with the game right? If "getsecondspassed" IS a variable then it is why there are problems with the script because there is no declared variable of that name.
User avatar
Sammykins
 
Posts: 3330
Joined: Fri Jun 23, 2006 10:48 am

Post » Fri Jan 21, 2011 2:34 pm

-clip-
It is that part that is causing problems. I could be wrong but isn't "getsecondspassed" supposed to be a variable? That isn't a function that came with the game right? If "getsecondspassed" IS a variable then it is why there are problems with the script because there is no declared variable of that name.

GetSecondsPassed is a function, it doesn't need to be declared like OnPCEquip or PCSkipEquip. It's being used properly in that block.

Are you seeing a line at the end of the script that says End or End vn_crown_of_souls_script? That's what I meant by End terminator.
User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm

Post » Fri Jan 21, 2011 5:28 pm

GetSecondsPassed is a function, it doesn't need to be declared like OnPCEquip or PCSkipEquip. It's being used properly in that block.

Are you seeing a line at the end of the script that says End or End vn_crown_of_souls_script? That's what I meant by End terminator.


Yes, there is an "end" at the bottom of the script.

Also, when I added "float getsecondspassed" to the variable list the script stopped having problems as far as I can tell. I'm still testing the "feeding" the crown part of the script but right now everything is fine. Will this cause problems elsewhere in the game?
User avatar
Roanne Bardsley
 
Posts: 3414
Joined: Wed Nov 08, 2006 9:57 am

Post » Fri Jan 21, 2011 7:49 am

Also, when I added "float getsecondspassed" to the variable list the script stopped having problems as far as I can tell. I'm still testing the "feeding" the crown part of the script but right now everything is fine. Will this cause problems elsewhere in the game?

Yes. The timer (whatever it did) won't work anymore. I can't understand why that would be causing it. I've used GetSecondsPassed like that for ages but never had a problem. Try this. Change the float variable you declared to SecondsPassed, changed the 'Set Timer to ( Timer + GetSecondsPassed )' line to 'Set Timer to ( Timer + SecondsPassed )' and just above it enter the line 'set SecondsPassed to GetSecondsPassed'.

Can't understand why that could possibly be the problem, but from what you've suggested it may be :wacko: .
User avatar
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am

Post » Fri Jan 21, 2011 10:07 am

I changed it to:

if ( state == 0 )	if ( hunger == 0 )		set secondspassed to ( getsecondspassed )		set timer to ( timer + secondspassed )		if ( timer > maxtime )			set state to 1			set timer to 0		endif	endifendif


I still got the same errors. I set secondspassed as a float. Should it be something different? I think that, for whatever reason, the script is treating getsecondspassed as a variable.
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Fri Jan 21, 2011 7:10 am

I changed it to:

if ( state == 0 )	if ( hunger == 0 )		set secondspassed to ( getsecondspassed )		set timer to ( timer + secondspassed )		if ( timer > maxtime )			set state to 1			set timer to 0		endif	endifendif


I still got the same errors. I set secondspassed as a float. Should it be something different?

I float should be fine, but you don't need those brackets around GetSecondsPassed. Try removing them.
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Fri Jan 21, 2011 6:48 am

I float should be fine, but you don't need those brackets around GetSecondsPassed. Try removing them.


They weren't there before. I originally didn't have the brackets but I got a SYNTAX error. When I put the brackets in the syntax error went away.
User avatar
jennie xhx
 
Posts: 3429
Joined: Wed Jun 21, 2006 10:28 am

Post » Fri Jan 21, 2011 8:28 am

Declaring that function as a variable should throw a LeftEval error - I think you're just getting lucky there, but it will probably cause problems down the road.

The Morrowind script language is a fickle mistress, you'll think you've fixed an elusive error just to mask it with a new error instead. :P


Are you using Mad Leveler or GCD? Maybe try a test with those lines commented out since either of the global variables mlRunOnce or Gals_Natural_Intelligence could be the source of undeclared variables if those mods are not in use:

Spoiler
if ( power >= 350 )	Messagebox "The Crown of Souls rewards you. Your Intelligence, luck, and willpower increase.";	if ( mlRunOnce != 0 );		Messagebox "Mad leveller detecting: Using alternative stat bonus";		Set Adj_Intelligence To 1;		Set Adj_Willpower to 1;		Set Adj_Luck to 1;		StartScript mlAdjust;	else		player ->  modintelligence, 1		player -> modwillpower, 1		player -> modluck, 1;	endif;	if ( Gals_Natural_Intelligence > 0 );		set Gals_Natural_Intelligence to ( Gals_Natural_Intelligence + 1 );		set Gals_Natural_Willpower to ( Gals_Natural_Willpower + 1 );		set Gals_Natural_Luck to ( Gals_Natural_Luck + 1 );	endif	set temp to ( power - 500 )	set power to tempendif

User avatar
Cheville Thompson
 
Posts: 3404
Joined: Sun Mar 25, 2007 2:33 pm

Post » Fri Jan 21, 2011 8:00 pm

I wouldn't know if I was using them or not. Does Vampire Realism/Embrace/Hunger use either of those?

Also, could it be because it is spelled as "getsecondspassed" instead of "GetSecondsPassed"? Does it need to be capitalized?
User avatar
CRuzIta LUVz grlz
 
Posts: 3388
Joined: Fri Aug 24, 2007 11:44 am

Post » Fri Jan 21, 2011 7:33 am

Also, could it be because it is spelled as "getsecondspassed" instead of "GetSecondsPassed"? Does it need to be capitalized?

It's not caps sensitive, don't worry.

Well, I'm thoroughly confused, especially as to why replacing GetSecondsPassed with a variable fixes the problem. I have no more suggestions unfortunately.
User avatar
lucile davignon
 
Posts: 3375
Joined: Thu Mar 22, 2007 10:40 pm

Post » Fri Jan 21, 2011 12:15 pm

That makes two of us. I'm pretty sure that this part of the script is causing the problem since this problem only occurs when hunger equals 0 and this is the part that activates when that happens:

if ( state == 0 )	if ( hunger == 0 )		set timer to ( timer + GetSecondsPassed )		if ( timer > maxtime )			set state to 1			set timer to 0		endif	endifendif


As far as I can tell, there isn't ANYTHING wrong with that part of the script. Obviously something is wrong but I don't know what it is. Thanks for your help Greatness. At least I've narrowed down the problem.
User avatar
Mario Alcantar
 
Posts: 3416
Joined: Sat Aug 18, 2007 8:26 am

Post » Fri Jan 21, 2011 4:56 pm

I wouldn't know if I was using them or not. Does Vampire Realism/Embrace/Hunger use either of those?

Also, could it be because it is spelled as "getsecondspassed" instead of "GetSecondsPassed"? Does it need to be capitalized?

They're alternate leveling mods separate from VR/VE/VH AFAIK. You could check in-game via the console to see if the mlRunOnce or Gals_Natural_Intelligence global variables are present - open the console and type SV.

Capitalization shouldn't matter for functions, it's more for readability.
User avatar
Kat Stewart
 
Posts: 3355
Joined: Sun Feb 04, 2007 12:30 am

Next

Return to III - Morrowind