Parsing error?

Timbatim

New member
I looked up parsing errors in the mafia wiki, but honestly, I do not understand why I have a parsing error in the last line with the "}".
Could someone enlighten me, please?


Code:
void overdrink1() {
	outfit( "Overdrink" );
	
	while ( item_amount($item[Frosty's frosty mug])< 1 )//' {
	buy(1 ,$item [Frosty's frosty mug]);//'
}

	while ( item_amount($item[jar of fermented pickle juice]) < 1 ) {
	buy(1 ,$item [jar of fermented pickle juice]);
}
	use_skill(1 ,$skill [The ode to booze] );
	drink(1, $item[Frosty's frosty mug]);//'
	overdrink(1, $item[jar of fermented pickle juice]);
	
	chew(1, $item[coffee pixie stick]);
	chew(1, $item[octolus oculus]);
	
	outfit( "Rollover" );
}
 

fronobulax

Developer
Staff member
I'm not sure what //' is intended to do and I'm not sure what it will actually do, but it bothers me that the opening curly brace appears to be between the single quotes and the closing brace is not. If, as I suspect, the opening brace appears in a comment then everything past that will be mismatched and no error actually occurs until the closing brace is encountered, without a corresponding opening brace.

I would consider deleting

Code:
while ( item_amount($item[Frosty's frosty mug])< 1 )//' {
	buy(1 ,$item [Frosty's frosty mug]);//'
}

or rewriting as

Code:
while ( item_amount($item[Frosty's frosty mug])< 1 ) {
	buy(1 ,$item [Frosty's frosty mug]);
}

Pro Tip. It is often helpful to go over the code manually and see which { match up with which }. At last that seems to catch one of my common mistakes.
 

lostcalpolydude

Developer
Staff member
I knew there was a reason I used vi (or vim) ;-)

Notepad++ is fine on its own. The error is likely in the syntax parsing extension (or whatever it's called) that was posted on this forum somewhere. If you start with the idea that you don't care about any syntax highlighting, then it shouldn't matter much which editor you use.
 

Timbatim

New member
Hey thank you guys. I changed the comments to /* ' */ and now it works, or at least lets itself get verified.
Tomorrow I can test the script including everything :)

And the highlighting from notepad ++ is truly the reason I need the /* ' */
In almost all the scripts I wrote for myself I avoided items with apostrophes until I thought about a "cheatcomment".
Otherwise I have no overview.
 

ckb

Minion
Staff member
You can also remove the ' as a string highlighter and use only " instead to avoid this problem
 
Top