I have taken GBRPlusss main menu randomizer script and tried to expand it so it can randomize more than 6 menus, provided they're named correctly, with OBSE's FileExists function. It's boolean, so you'd think it would be easy to just increment a counter in a loop. This is the first script I've tried to modify, so it could be a glaringly obvious screwup. So why won't it write the values to ini, and why wont it print any messages anywhere? Edit: D'oh! I put the counter/iterator's let statement in the beginning of the loop when it should be outside. :psyduck:
scn zzZovoctRNDMenu
string_var type
string_var file
short loopen
short filecount
short randmen
short iterator
Begin MenuMode 1044
let loopen :=1
DebugPrint loopen
while loopen==1
let iterator := 1
if FileExists "Video\Map loop%g.bik" iterator == 1
let iterator := iterator + 1
else
set loopen to 0
break
endif
loop
set loopen to 0
let filecount := iterator
set randmen to rand 1 filecount
Message "Results of filecount and randmen: %g , %g" filecount randmen 20
set type to sv_construct "SMainMenuMovie:General"
set file to sv_construct "Map loop%g.bik" randmen
SetStringINISetting "%z|%z" type file
set type to sv_construct "SMainMenuMovieIntro:General"
set file to sv_construct "Oblivion iv logo%g.bik" randmen
SetStringINISetting "%z|%z" type file
set type to sv_construct "SMainMenuMusic:General"
if FileExists "Special\TES4Title%g.mp3" randmen
set file to sv_construct "TES4Title%g.mp3" randmen
else
set file to sv_construct "TES4Title.mp3"
endif
SetStringINISetting "%z|%z" type file
con_SaveINI
End
;<CSEBlock>
;<CSECaretPos> 302 </CSECaretPos>
;</CSEBlock>