Jump to content

Johnathon

Premium Member
  • Posts

    12
  • Joined

  • Last visited

Posts posted by Johnathon

  1.  

    EDIT: it compiles, the error was in another place.

    ScriptName JSTexasRangersRadioSCRIPT
    
    short nStory;
    short bDoTransition;
    short NextSonga;
    short nTracksPlayed;
    short playNextNow;
    short RandGen;
    short TrackCount;
    array_var aPlayedSongs
    
    
    Begin _GameMode
        if aPlayedSongs == 0;
            set TrackCount to 92;
            set playNextNow to 1
            let aPlayedSongs := Ar_Construct "array"
            set NextSonga to 1;
        endif
        if playNextNow == 0; Not time to play the next track yet. Exit the script.
            return
        elseif playNextNow; Time to randomly select the next track.
            if eval (Ar_Find NextSonga, aPlayedSongs) == Ar_BadNumericIndex; THIS IS THE LINE WITH ISSUES
                ; It's not in the array. We need to add it.
                Ar_Append aPlayedSongs, NextSonga
                if eval (Ar_Size aPlayedSongs) == TrackCount           ; HERE WAS THE ERROR
                    Ar_Resize aPlayedSongs 0
                endif
            endif
            ; Time to generate a random number.
            set RandGen to rand 1, TrackCount;
            if eval (Ar_Find RandGen, aPlayedSongs) == Ar_BadNumericIndex
                set playNextNow to 0
                set NextSonga to RandGen
            else
                return
            endif
        endif
    End
    

     

    I still get the same cannot parse on line 23. The error seems to be in using a variable that's a short rather than a ref for the search value, which is odd since it works fine if I use an actual number and the scripting examples all say it can be a number for an array search.

  2. What about splitting the condition in two

    Let iMyTempResult := Ar_Find NextSonga, aPlayedSongs
    if iMyTempResult > -1
       ... ; I guess it's in the array

    Pretty sure you can avoid to use Compiler Override.

     

    The compiler override was something I tried to see if it would fix the issue. Forgot to remove it when that didn't fix it. Thanks.

     

    I tried to do it separate as well and the error occurs on the let line saying it couldn't compile it still. Not sure why it is doing that.

  3. I'm working on a mod (or more specifically a script for a mod) that will better randomize songlists more like a normal media player where it won't repeat a song until every song in the playlist has already been played. For some reason, I can't get the NVSE array functions to work and I can't for the life of me figure out why it is.

     

    This is the script (not complete, but should function-ish)

    ScriptName JSTexasRangersRadioSCRIPT
    
    short nStory;
    short bDoTransition;
    short NextSonga;
    short nTracksPlayed;
    short playNextNow;
    short RandGen;
    short TrackCount;
    array_var aPlayedSongs
    
    
    Begin _GameMode
        if aPlayedSongs == 0;
            set TrackCount to 92;
            set playNextNow to 1
            let aPlayedSongs := Ar_Construct "array"
            set NextSonga to 1;
        endif
        if playNextNow == 0; Not time to play the next track yet. Exit the script.
            return
        elseif playNextNow; Time to randomly select the next track.
            if eval (Ar_Find NextSonga, aPlayedSongs) == Ar_BadNumericIndex; THIS IS THE LINE WITH ISSUES
                ; It's not in the array. We need to add it.
                Ar_Append aPlayedSongs, NextSonga
                if eval Ar_Size aPlayedSongs == TrackCount
                    Ar_Resize aPlayedSongs 0
                endif
            endif
            ; Time to generate a random number.
            set RandGen to rand 1, TrackCount;
            if eval (Ar_Find RandGen, aPlayedSongs) == Ar_BadNumericIndex
                set playNextNow to 0
                set NextSonga to RandGen
            else
                return
            endif
        endif
    End

    I cannot get this script to compile. When I try to save it, it tells me that line 23 cannot be parsed.

     

    Now, if I replace "NextSonga" with a number, then the compiler doesn't complain about the line anymore, but I need it to check if the variable's value exists in the array.

     

    Any advice would be greatly appreciated.

  4. This is not so much an error message you're seeing pop up, but rather a configuration page for the mod.

     

    Per the mod's description:

     

     

    Options
    =======
    When you first load the mod a Configuration Menu will appear with the following options:
    Show/Hide Map Markers
    Change Patrol Leaders Essential
    Configure Patrol Size

    If the patrols are in internal cells (metro tunnels) the Map Markers may not show up. Also these map markers can be very hard to find due to Map Marker saturation in the DC area.

     

    The display error may be one of your other mods causing the actual options to overlap. Try disabling a few mods at a time to figure out which mod it is that is causing that issue. Once you figure it out, disable it until you've done the initial configuration for all the mods and you should be okay.

  5. There is no odd dark circle on my screen. I changed my gamma settings to check and indeed it does show up. Change your in game brightness settings in Settings>Display>Brightness and you should be able to see just fine.

     

    Let me know if that doesn't help.

  6. I'm working on a mod (or more specifically a script for a mod) that will better randomize songlists more like a normal media player where it won't repeat a song until every song in the playlist has already been played. For some reason, I can't get the NVSE array functions to work and I can't for the life of me figure out why it is.

     

    This is the script (not complete, but should function-ish)

    ScriptName JSTexasRangersRadioSCRIPT
    
    short nStory;
    short bDoTransition;
    short NextSonga;
    short nTracksPlayed;
    short playNextNow;
    short RandGen;
    short TrackCount;
    array_var aPlayedSongs
    
    
    Begin _GameMode
    	if  aPlayedSongs == 0;
    		set TrackCount to 92;
    		set playNextNow to 1
    		let aPlayedSongs := Ar_Construct "array"
    		set NextSonga to 1;
    	endif
    	if playNextNow == 0;                Not time to play the next track yet. Exit the script.
    		return
    	elseif playNextNow;   Time to randomly select the next track.
    		if eval (Ar_Find NextSonga, aPlayedSongs) == Ar_BadNumericIndex; THIS IS THE LINE WITH ISSUES
    			; It's not in the array. We need to add it.
    			Ar_Append aPlayedSongs, NextSonga
    			if eval Ar_Size aPlayedSongs == TrackCount
    				Ar_Resize aPlayedSongs 0
    			endif
    		endif
    		; Time to generate a random number.
    		set RandGen to rand 1, TrackCount;
    		if eval (Ar_Find RandGen, aPlayedSongs) == Ar_BadNumericIndex
    			set playNextNow to 0
    			set NextSonga to RandGen
    		else
    			return
    		endif
    	endif
    End
    

    I cannot get this script to compile. When I try to save it, it tells me that line 23 cannot be parsed.

     

    Now, if I replace "NextSonga" with a number, then the compiler doesn't complain about the line anymore, but I need it to check if the variable's value exists in the array.

     

    Any advice would be greatly appreciated.

×
×
  • Create New...