SWITCH Statement with No Cases Error

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm

SWITCH Statement with No Cases Error

Post by Exar Kun »

I'm getting the error when I try to compile my function into my script. Is there a problem with putting a case statement in a function call?

Here's a copy of the function:

Code: Select all

function StatIncrease ( character, attribute )

case ( attribute )

	ALCHEMY:
	ANATOMY:
	DETECTHIDDEN:
	LEADERSHIP:
	INVOCATION:
	MAGERY:
	MAGICRESISTANCE:
	MEDITATION:
	NECROMANCY:
	TACTICS:
	TRACKING:
	VETERINARY:

		var currentInt := GetObjProperty ( character, "int" );
		var rawCurrentInt := BaseToRaw ( currentInt * 10 );

		rawCurrentInt := ( rawCurrentInt + 1 );

		var newCurrentInt := RawToBase ( rawCurrentInt );

		newCurrentInt := ( newCurrentInt / 10 );
		SetObjProperty ( character, "int", newCurrentInt );

		var unmod_Int := CInt ( GetAttributeBaseValue ( character, "Intelligence" ) / 10 );

			if ( ( CInt ( newCurrentInt ) ) > unmod_Int )
				SetAttributeBaseValue ( character, "Intelligence", unmod_Int * 10 + 10 );
				RecalcVitals ( character );
			endif

	ARCHERY:
	FENCING:
	LOCKPICKING:
	STEALING:
	STEALTH:
	PARRY:
	TINKERING:
	TAILORING:
	CARTOGRAPHY:
	HIDING:
	MUSICIANSHIP:
	POISONING:
	INSCRIPTION:

		var currentDex := GetObjProperty ( character, "dex" );
		var rawCurrentDex := BaseToRaw ( currentDex * 10 );

		rawCurrentDex := ( rawCurrentDex + 1 );

		var newCurrentDex := RawToBase ( rawCurrentDex );

		newCurrentDex := ( newCurrentDex / 10 );
		SetObjProperty ( character, "dex", newCurrentDex );

		var unmod_Dex := CInt ( GetAttributeBaseValue ( character, "Dexterity" ) / 10 );

			if ( ( CInt ( newCurrentDex ) ) > unmod_Dex )
				SetAttributeBaseValue ( character, "Dexterity", unmod_Dex * 10 + 10 );
				RecalcVitals ( character );
			endif

	LUMBERJACKING:
	MINING:
	WRESTLING:
	BLACKSMITHY:
	CARPENTRY:
	FISHING:
	MACEFIGHTING:
	SWORDSMANSHIP:
	CAMPING:
	DRUIDRY:

		var currentStr := GetObjProperty ( character, "str" );
		var rawCurrentStr := BaseToRaw ( currentStr * 10 );

		rawCurrentStr := ( rawCurrentStr + 1 );

		var newCurrentStr := RawToBase ( rawCurrentStr );

		newCurrentStr := ( newCurrentStr / 10 );
		SetObjProperty ( character, "str", newCurrentStr );

		var unmod_Str := CInt ( GetAttributeBaseValue ( character, "Strength" ) / 10 );

			if ( ( CInt ( newCurrentStr ) ) > unmod_Str )
				SetAttributeBaseValue ( character, "Strength", unmod_Str * 10 + 10 );
				RecalcVitals ( character );
			endif

	default:

		DohEth ( character );

endcase

Thanks.
Last edited by Exar Kun on Fri Apr 21, 2006 7:50 am, edited 1 time in total.
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

What is charAttribute? It's not defined anywhere.
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm

Post by Exar Kun »

Der, sorry.

I was trying something to get it to work. Replace charAttribute with attribute.
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm

Post by Exar Kun »

Thanks to Tritan for pointing out that my case statements have to be in quotes because they're strings!

You da man!
User avatar
tekproxy
Forum Regular
Posts: 352
Joined: Thu Apr 06, 2006 5:11 pm

Post by tekproxy »

Thank you for posting your solution to the forums. You'd be suprised how many people don't think to do stuff like that. :?
Exar Kun
Novice Poster
Posts: 42
Joined: Wed Apr 19, 2006 12:29 pm

Post by Exar Kun »

No problem. I'm in technical support where I work, so I'm all about documentation of issues.
Post Reply