Construction Set Script Crash with OBSE Functions

Post » Sun Nov 28, 2010 9:57 pm

I seem to have run into a rather odd crash trying to make my first OBSE mod. It's pretty simple, just making keyboard shortcuts for various menus. Using GetMenuFloatValue with a format string longer than 45 characters causes CS to crash when saving the script. If I insert gibberish into the format string I can make it as long as I want, but using the real format string crashes when it goes over 45 characters.

Here's the applicable code (this is repeated for the other buttons, I didn't think it necessary to include all of them). If I cut the format string for GetMenuFloatValue down to 45 characters it saves fine but anything more and it causes CS to crash.

if (isKeyPressed3 25 ) ; Persuade    set buttonVisible to GetMenuFloatValue "dialog_topics\dialog_button_layout\dialog_persuade\visible" 1009    if (buttonVisible == 2)        ClickMenuButton "dialog_topics\dialog_button_layout\dialog_persuade" 1009    endif    set curKey to 25elseif...


Any help would be appreciated. The mod will work without that function but it causes some buggy behavior.
User avatar
matt
 
Posts: 3267
Joined: Wed May 30, 2007 10:17 am

Post » Sun Nov 28, 2010 5:57 pm

It's the so-called 73-Byes Bug which causes the CS to crash when saving the Script if the uncompiled (?) size of the calculation/function/whatever is on the right side of to is greater then 73 Bytes. This also happens if the size of an if-statement is greater then 73 Bytes.

Solution: use http://www.obse.silverlock.org/obse_command_doc.html#Let instead.
If this happens using an if-statement use a dummy-variable and assign the value using let.
User avatar
Carys
 
Posts: 3369
Joined: Wed Aug 23, 2006 11:15 pm

Post » Mon Nov 29, 2010 7:07 am

A buffer overflow occurs when the vanilla expression parser (used by SET and IF) converts an expression to postfix notation and the compiled data exceeds 73 bytes. This has been fixed by CSE.
User avatar
Eve Booker
 
Posts: 3300
Joined: Thu Jul 20, 2006 7:53 pm

Post » Mon Nov 29, 2010 3:34 am

Thank you both, it works great with LET instead of SET.
User avatar
Claire Jackson
 
Posts: 3422
Joined: Thu Jul 20, 2006 11:38 pm


Return to IV - Oblivion