Messagebox Syntax Error

Post » Fri Jul 01, 2011 5:19 am

So, here i am, be-bopping along, and I get this error when I compile my script.
Syntax Error Line 10
Could not find varaible "Who.. What is this?".

I don't know what that means and wanted some help?
Heres the script
begin stc_thevoidwhisperstoyoushort stateshort buttonif ( CellChanged == 1 )	DisablePlayerControls	if ( state == 0 )			Messagebox, "Shhhh.. I am here, %pcname. Shar watches and protects.", "Who.. What is this?"	     Set Button to GetButtonPressed				if ( Button == 1 )					Messagebox, "I am Shar, your mother, the whisper in the void.", "I... I am at a lost for words.."					set state to 1				endif	endifendifif ( state == 1 )	if ( button == 1 )		Messagebox, "Shush, Don't say anything my child. You desired to understand so I will teach. Come, let me embrace you, let you understand the coldness, darkness, emptiness of the void.", "I.. wish to understand."		set state to 2	endifelseif ( state == 2 )	if ( button == 1 )		Messagebox, "- You feel cold arms wrap you, and an emptiness spreads throughout your body. You feel like dying.-", "Ahhh!"		player->addspell, "stc_sharsteachings"		set state to 3	endifelseif ( state == 3 )	if ( button == 1 )		Messagebox, "There my child, now you should better understand the whispers in the darkness.", "I understand mother."		set state to 4	endifelseif ( state == 4 )	if ( button == 1 )		Messagebox, "Good, now begone my child. Go back to the realm you belong in."		Journal, "stc_templeofshar" 110		player->PositionCell, 4765, 3856, 6313, 0, "Sharran Temple"		set state to 5	endifelseif ( state == 5 )	returnendifend

User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Fri Jul 01, 2011 2:04 am

When a error message points to a line, often it is the right one, and your error message is luckily a good hint.
% symbol is often used as variable prefix in dialog text. When you use it in text for the MessageBox command though, it is used to define numeric variable format (for instance MessageBox "myVariable = %g" myVariable), hence the engine is expecting a variable there at runtime.
Instead of %, you have to use the ^ as variable prefix in dialogs (you can use it in text dialog also, by the way)
So, try changing
Messagebox, "Shhhh.. I am here, %pcname. Shar watches and protects.", "Who.. What is this?"[(code]tp[code]Messagebox, "Shhhh.. I am here, ^pcname. Shar watches and protects.", "Who.. What is this?"
You can find more details on MSFD, page 105.

[EDIT]typos
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm


Return to III - Morrowind