SetWidgetHideOnPresentation

What is the Semantic error with the following Scriptlet statement?

SetWidgetHideOnPresentation(P3Pos, false)

Error msg: Scriptlet (Scriptlet) - Semantic error in “Main”: Line 52, Col 37: Types are not compatible

Where P3Pos has been defined as:

Please show the entire script, not just one line

Var 

    MaxNotesInChord : Integer = 16
    NumberOfChannels : Integer = 5

    P1 : Parameter := 1.0
    P2 : Parameter := 1.0
    P3 : Parameter := 1.0
    P4 : Parameter := 1.0
    P5 : Parameter := 1.0
    DIVISI_Button : Parameter  := 1.0
    i : Integer
   
    P1Pos : parameter 1..5 = 1;
    P2Pos : parameter 1..5 = 1;
    P3Pos : parameter 1..5 = 1;
    P4Pos : parameter 1..5 = 1;
    P5Pos : parameter 1..5 = 1;

    
    nt : NoteTracker
    NoteArray : Integer[127]
    ChannelArray : Integer[127]
    Note : Integer
    NoteCount : Integer
    ChannelMap : Integer Array = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]


Initialization
    
        P1Pos = 1
        P2Pos = 2
end
    

Function PrintChanneMap()

    For i = 0; i < NumberOfChannels; i = i + 1 Do

 //       Print("ChannelMap["+i+"]:  "+ChannelMap[i])

    End

end

Function PrintPositions()

    Print("Positions: "+P1Pos+"   "+P2Pos+"   "+P3Pos+"   "+P4Pos+"   "+P5Pos)


end


On ParameterValueChanged matching P1

    if P1 == 0.0 then
        SetWidgetHideOnPresentation(P1Pos, false)
   end
 

end

You should specify a widget: for instance a button or a knob or a switch. You cannot specify a parameter of a plugin. Scriptlets are to be considered as plugins in this respect.

Something like this should work (typed by hand, cause I don’t have my computer to my disposal):

var
    someKnob : widget


on initialization

    SetWidgetHideOnPresentation(someKnob, true)
end

I hope this clarifies it a little

So you have declared P1Pos as a parameter and you are invoking a function that requires a widget.

So of course there is a type mismatch

P1Pos is a widget within the Sciprtlet:

No, you declared it as a parameter. Look at your script

P1Pos : parameter 1…5 = 1;

1 Like

Maybe give the listing of the script…?
Update: sorry you already did

No, you have declared it as a parameter in your scriptlet.

1 Like

Maybe P1Pos is both.

This ambiguity would be clearer when you would have declared a var P1Pos as a widget first.

After that give the parameters different names, for instance PP1Pos. (Don’t know if can use widgets in a scriptlet anyway. See also the comment of @David-san )

Furthermore, a Scriptlet is not the right place to refer to a widget, that’s not the spirit of the Scriptlet which is a plugin. Declare a parameter and map a widget to it.

2 Likes

Oh… right: A scriptlet doesn’t know anything about any widgets in a rackspace - it’s just like any other third party plugin (they don’t know of your widgets either).
If the scriptlet would “see” it, it would most probably be made impossible to have the same name for two diffrent things (here: a widget and a parameter variable called “PP1Pos”) and you surely would have earned an error message for using the same name twice.

I think I see what you mean … but I am still confused as to what a widget is. Let me give you my racksapce, so you can see the whole thing. :slight_smile:

Preface: I had finally developed my Brand New “Super DIVISI Scriplet” which I had planned to give to the GP Community when it was perfect. So, go ahead a load the rackspace and play with it, you will love it when you get to the variation “DIVISI Jello etc.”! For me, this Scriptlet changes everything!

So, today, I showed it to my son and he said, “You have to add the capability for the user to specify the note order EG: which note is on top, and which note is on the bottom, etc.”

I said, " You are right, what a great feature that would be." So, I started out to solve the problem. My thinking for the GUI is - if the blue button which enables/disables an instrument, is set to off, I want to hide the position selector for that instrument because it cannot be in the DIVISI mix.

DIVISI - WHo’s FIRST.rackspace (574.5 KB)

A widget lives on a panel of a rackspace and can be mapped to a parameter on one side and (optionally) mapped to a physical MIDI control on the other side.

I’m not quite sure what is the confusion.

Those objects on the panel shown are widgets … but because they refer to a parameter of the Scirptlet, I can’t use them in the way I intended. So what are my options?

I must be missing something LOL!

Here is my Rackspace Script as you suggested and I get an error when I say, “on initialization”?

//$
// DO NOT EDIT THIS SECTION MANUALLY
Var
Button2 : Widget
Button3 : Widget
Button4 : Widget
DIVISI_Button : Widget
Button5 : Widget
Button1 : Widget
P1Pos : Widget
P2Pos : Widget
P3Pos : Widget
P4Pos : Widget
P5Pos : Widget
Bootsie : Widget
//$

on initialization

SetWidgetHideOnPresentation(Bootsie, false)

end

I found the problem with the error msg*** You don’t say, “on initialization”, you just say “initialization”. … but this doesn’t hide the widget?

What error?

1 Like

I was trying to remember. It should be

Initialization


End

When you right-click in the editor window, you get small templates for several languages elements, including initialization.

@pianopaul My mistake. I gave ‘On Initialization’ as example

BTW: Widgets cannot be used in scriptlets

"DIVISI - WHo’s FIRST (Rackspace) - - Syntax Error in “Main”: Line 21, Col 4: Unexpected or unrecognized token: ‘initialization’
Mismatched input ‘initialization’ expecting {Timeline, Activate, Deactivate, Variation, TimerTick, GeneratorRunning, GeneratorEndCycle, TempoChanged, DeviceStatusChanged, Rackspace, Song, Songpart, SystemEvent, BeatChanged, NoteOnEvent, NoteOffEvent, NoteEvent, ControlChangeEvent, PitchBendEvent, AftertouchEvent, ProgramChangeEvent, PolytouchEvent, MidiEvent, SysexEvent, ScriptletEnabled, Keystrokes, ParameterValueChanged, WidgetValueChanged, OSCMessageReceived}
"

Using “Initialization” instead of “On initialization” cures this.

You say ‘hide’ must be false. You are saying ‘do not hide’ → ‘do not not show’ → ‘do show’

To hide, give the argument ‘true’

3 Likes