Community

SCI Programming => SCI Development Tools => Topic started by: gumby on April 30, 2012, 10:10:57 PM

Title: SCI Studio & switch statements
Post by: gumby on April 30, 2012, 10:10:57 PM
I don't expect anyone else to hit this limitation, but the implementation of the 'switch' statement in SCI Studio only supports up to 48 case statements within it.
Title: Re: SCI Studio & switch statements
Post by: Collector on April 30, 2012, 10:19:48 PM
Have you found a limit in Companion?
Title: Re: SCI Studio & switch statements
Post by: gumby on May 01, 2012, 08:47:31 AM
I'll check.  May have also been a character limit I hit within a switch statement, rather than the number of cases within it.
Title: Re: SCI Studio & switch statements
Post by: gumby on May 01, 2012, 07:22:25 PM
For Studio, it's definitely the number of case statements in a switch - 48.  It won't even compile the script.  Companion doesn't have any obvious limit, I went over 1000 case statements within a switch & it happily compiled it.
Title: Re: SCI Studio & switch statements
Post by: Collector on May 01, 2012, 08:37:46 PM
I think most have turned to Companion for similar reasons.
Title: Re: SCI Studio & switch statements
Post by: Cloudee1 on May 02, 2012, 12:12:32 AM
If I remember correctly, studio won't compile more than 12 succesfully. It  acts like it does but run time is a different story. Companion is the way to go when it comes to switch cases. This was one of my first problems I  ran into back in the day with Spongebob adventurepants... Studio  won't even think about compiling the black cauldron because of all the case statements in the inventory script.
Title: Re: SCI Studio & switch statements
Post by: gumby on May 02, 2012, 08:49:56 AM
In my instance, I can get away with just using if statements instead (each case resulted in a return, so I don't need nested if/else logic).  I guess I'll avoid using switches in Studio entirely.