Creating a text file per rackspace?

Is it possible to have Gig Performer write a specific line of text to a text file when a specific rackspace is selected?
I have never used GPScript before so I am not sure where to start with this.

Much thanks,
Poco

What is the use case for that?

Hi Paul,

The use case would be to interface with streamer.bot for a live stream on Twitch.

For example, a user in Twitch chat could type !vst which sends the command to streamer.bot to read a text file. Inside the text file is the name of whatever plugins I am current using (i.e. my current Rackspace).

Here is a rackspace script

var ergebnis : boolean
on Activate
 ergebnis = SaveStringToTextFile("/Users/Shared/elvis.txt", "Was soll das")
end

Thank you Paul

I apologize, I am an absolute beginner to Gig Performer. What I have tried is to use this script by going to Window >> Gig Script Editor and pasting the script there.

I then hit Compile, and receive the error "Gig (Script Entity: GigScript) - Semantic error in “Main”: Line 2, Col 4: Not valid in this script entity. "

Am I doing this incorrectly? I am trying to understand Rackspace scripts vs Global scripts but this is the only way I can seem to find to get to a script editor window.

Which version of Gig Performer are you using? The function SaveStringToTextFile is experimental and likely only in the latest version of GP.

X

I am on 5.0.28

for the record, when the “Compile” button gave me an error, it highlighted the line that said “On Activate,” not the text writing function below it

Note that the compiler doesn’t always indicate where the real issue is. Sometimes the issue can be something missed either above the reported offending line or after it. It isn’t perfect but continues to improve with every release. Two things:

  1. Are you using the Current Rackspace Script Editor, the Global Rackspace Script Editor or the Gig Script Editor?
  2. With the answer to number 1, are you using the exact script text that @pianopaul provided or a modified version. If modified, please provide your script.

X

I am trying to understand how to access the right Script Editor with regards to #1. Again, I have never scripted before in Gig Performer so I don’t know how to access these windows.
The one I used was by going to Window >> Gig Script Editor.

The only thing I modified in the script was the path:

var ergebnis : boolean
on Activate
 ergebnis = SaveStringToTextFile("C:/Users/Owner/Desktop/T/Gig Performer/vst.txt", "Was soll das")
end

Okay, then the error makes sense. Go to window–>Current rackspace script editor instead. I’m fairly sure that on Activate is not available in the gig script. The gig script runs globally to the entire gig. the On Activate callback is specific to the activation of a rackspace. It has no context in the Gig Script.

X

Fantastic, this worked!

1 Like

It is a rackspace script

1 Like

I have this script (thanks to Paul) working as a Current Rackspace script:

Var
    result : Boolean
    rackspacename : String
    variationname : String
    textforfile: String

On Activate
    rackspacename = GetRackspaceName()
    variationname = GetVariationName(GetCurrentVariation())
    textforfile = "Current VST: " + rackspacename + " - Preset Name: " + variationname
    result = SaveStringToTextFile("C:/Users/Owner/Desktop/T/Gig Performer/vst.txt", textforfile)
End

I am now trying to adapt this into a Global Rackspace script so that this process can be automatic and I don’t need to create a Current Rackspace script for 50 different rackspaces (and new ones I might add in the future). I’m having trouble adapting without getting errors in the compiler, and I don’t know where to find all of the “On” functions like “On Activate”

If I should open a different topic for this, please let me know. I greatly appreciate the help so far.

Try this as a gig script

Var
    result : Boolean
    rackspacename : String
    variationname : String
    textforfile: String
On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
    rackspacename = GetRackspaceName()
    variationname = GetVariationName(GetCurrentVariation())
    textforfile = "Current VST: " + rackspacename + " - Preset Name: " + variationname
    result = SaveStringToTextFile("C:/Users/Owner/Desktop/T/Gig Performer/vst.txt", textforfile)
End
1 Like

Thank you so much, Paul! This worked perfectly!

1 Like

Just a quick addendum - the script above does not write the variation name to the text file (this is because the On Variation listener is not called). I have updated the script to do this in case anyone needs it:

Var
    result : Boolean
    rackspacename : String
    variationname : String
    textforfile : String

On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
    rackspacename = GetRackspaceName()
    variationname = GetVariationName(GetCurrentVariation())
    textforfile = "Current VST: " + rackspacename + " - Preset Name: " + variationname
    result = SaveStringToTextFile("C:/Users/Owner/Desktop/T/Gig Performer/vst.txt", textforfile)
End

On Variation(oldVariationIndex : integer, newVariationIndex : integer)
    rackspacename = GetRackspaceName()
    variationname = GetVariationName(newVariationIndex)  // Use newVariationIndex to get the new variation
    textforfile = "Current VST: " + rackspacename + " - Preset Name: " + variationname
    result = SaveStringToTextFile("C:/Users/Owner/Desktop/T/Gig Performer/vst.txt", textforfile)
End
1 Like

Updating the script again. I combined the duplicate sections for the custom text so it’s all in one place. Also I made the script work on initialization, so it should also write to the file when you open Gig Performer.

Var
    result : Boolean
    rackspacename : String
    variationname : String
    textforfile : String
    Loaded : boolean

Function SaveVSTInfo()
    rackspacename = GetRackspaceName()
    variationname = GetVariationName(GetCurrentVariation())
    textforfile = "Current VST: " + rackspacename + " - Preset Name: " + variationname
    result = SaveStringToTextFile("PATH_TO_TEXT_FILE_HERE", textforfile)
End

initialization
    SaveVSTInfo() 
End

On SystemEvent Matching GigLoaded
    Loaded = True
    SaveVSTInfo() 
End

On Rackspace(oldRackspaceIndex : integer, newRackspaceIndex : integer)
    SaveVSTInfo()
End

On Variation(oldVariationIndex : integer, newVariationIndex : integer)
    variationname = GetVariationName(newVariationIndex)
    SaveVSTInfo()
End

1 Like

You will become a GP script expert.

2 Likes