MWEdit Script Error

Post » Sat Dec 10, 2011 1:27 pm

For some reason MWEdit spits out following error:

Error (6 / 0): Invalid input was received!
User Message: Error: Line 10 (8): Syntax Error: Expected 'end' but found 'elseif' (elseif)!

Why would it expect the end of the script there? I am lost.

begin testshort stateshort triggerdistif ( MenuMode == 1 )	returnendifelseif ( state == 0 )    ;This is line 10	set state to Random 3		if ( state == 0 )			set triggerdist to 50		elseif ( state == 1 )			set triggerdist to 100		else			set triggerdist to 200		endifset state to 1setHealth 0		elseif ( state == 1 )	if ( OnActivate == 1 )		;Do nothing	endif		if ( GetDistance Player < triggerdist )	PlaySound3D "skeleton roar"	Resurrect	set state to 2endifendifend



Thanks
User avatar
Tyrone Haywood
 
Posts: 3472
Joined: Sun Apr 29, 2007 7:10 am

Post » Sat Dec 10, 2011 4:09 am

Line 10 should be an IF, not an Elseif statement because it's not preceded by an If statement. Also, I wouldn't reuse the state variable in your script. Use a different variable for your random number testing.
User avatar
Dan Stevens
 
Posts: 3429
Joined: Thu Jun 14, 2007 5:00 pm

Post » Sat Dec 10, 2011 7:40 am

That fixed it. Thanks.

I am also trying to optimize the Immersive Char Gen scripts and this is the message I get:

3) ICMQ_State8RoomRiot4: Failed to compile script!
4) Error: Line 13 (1): Syntax Error: Expected '->' but found 'End-of-Line' ()!
Invalid input was received!

Here's the script:

Begin ICMQ_State8RoomRiot4short statefloat timerif ( MenuMode == 1 )     returnendifif ( state == 7 )	if ( ICMQState >= 9 )	StopCombat "ICMQ_RPRisoner8"	ICMQ_RPrisoner6->disable	ICMQ_RPrisoner8->disable	set state to -1	endifendifif ( state == 6 )StartCombat "ICMQ_RPrisoner8"set state to 7endifif ( state == 5 )	if ( ICMQState == 6 )	set state to 6	endifendifif ( state == 4 )set timer to timer + GetSecondspassed	if ( timer > 3 )	say, "vo\d\m\Atk_DM001.mp3", "Now you die!"	set timer to 0	set state to 5	endifendifif ( state == 3 )set timer to timer + GetSecondsPassed	if ( timer > 1 )	say, "vo\w\m\Atk_WM006.mp3", "You chose the wrong Bosmer to mess with!" ; Bosmer speaking	set timer to 0	set state to 4	endifendifif ( state == 1 )set timer to timer + GetSecondspassed	if ( timer > 2 )	say, "vo\d\m\Hlo_DM021.mp3", "Bothersome creature."	set timer to 0	set state to 3	endifendifif ( ICMQState == 5 )    if ( state == 0 )    set timer to timer + GetSecondsPassed		if ( timer > 0 )		say, "vo\d\m\Hlo_DM019.mp3", "I don't wish to be seen with you."		set timer to 0		set state to 1		endif	endifendifend


Is this a valid complaint? I does not seem to go away no matter what I do.
User avatar
Sanctum
 
Posts: 3524
Joined: Sun Aug 20, 2006 8:29 am

Post » Sat Dec 10, 2011 2:30 am

Here's a much simpler example:

begin ICMQ_State8RoomRiotif ( MenuMode == 1 )returnelseif ( ICMQState == 8 )StartCombat "ICMQ_CensusRope1"elseif ( ICMQState >= 9 )StopCombat "ICMQ_CensusRope1"ICMQ_RPrisoner10->disableICMQ_CensusRope1->disableendifend

User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Fri Dec 09, 2011 10:58 pm

I'd check to have Strong syntax checking enabled if you don't have it enabled aready, it may find more things. Also, StopCombat does not need parameters, it's a generalized action.
User avatar
Dalton Greynolds
 
Posts: 3476
Joined: Thu Oct 18, 2007 5:12 pm

Post » Fri Dec 09, 2011 10:49 pm

I'd check to have Strong syntax checking enabled if you don't have it enabled aready, it may find more things. Also, StopCombat does not need parameters, it's a generalized action.


Well yeah, I have it enabled which is why I get this error message. I just do not know how to fix it. (Removing the parameter from StopCombat does not help.)
User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am

Post » Sat Dec 10, 2011 3:51 am

Removing the parameter from StopCombat does not help.
strange. It works for me.
User avatar
OJY
 
Posts: 3462
Joined: Wed May 30, 2007 3:11 pm

Post » Sat Dec 10, 2011 3:13 am

If this is a global script, try "ICMQ_CensusRope1"->StopCombat. If it's a script on an NPC that's called "ICMQ_CensusRope1", then you don't need the id. Either way, like Abot said, StopCombat doesn't need parameters. You do, however, need an NPC id if you're either using a global script (one not attached to anything) or a local script that's attached to an NPC, but you're telling another NPC to stop combat.
User avatar
Rob Smith
 
Posts: 3424
Joined: Wed Oct 03, 2007 5:30 pm


Return to III - Morrowind