Advanced Pangoscript

Discussion in 'PangoScript, Universe and Midi Templates' started by Silica, Feb 25, 2013.

  1. Silica

    Silica Beta Tester

    Hi there, this is probably my first post.

    I was wondering if it is possible to do some advanced stuff then only calling commands?
    As example..

    I want to stop the laseroutput when my intensity slider is at 0% on the midi table or software. I know how to write the script but I cant think of any how to figure it out with these commands, I would write it like this.

    if (Masterintensity == 0){
    DisableLaserOutput
    else
    EnableLaserOutput
    }

    Although if statements works, but I don't ether know what I can use with it everything gives me a error except:
    if (1 = 2 ){
    }

    The reason I want to mute the output when there's nothing going on, is because I'm facing problems over a time that my scanners goes into safety, to protect the galvo's and internally puts it on low settings, so only 2kpps would be the max..

    I'm using the scanners DT40pro, with Beyond 1.60-517, scanning on max angle at 20~25kpps, FB3.


    Got any tips or do I have to do this in the hardware manually way?

    Thanks.
     

  2. Wy not use "masterbrightnes (extvalue0,100)"

    And change the setup of your projector in projector settings?
    Which controller are you using? The fb3 or QM?
     
  3. Silica

    Silica Beta Tester

    Hi Bob,

    As I mentioned above, I am using the FB3 controller.
    I think I forgot something on my question, while the laser is at 0% brightness, the scanners are still scanning the pattern without any laser output. I actually want to stop them, stopping the interface from outputting frames.
     
  4. Ahh okay.. that changes the story.

    Are you using the APC40?
    If so, you might be interested in the new template I am developing.
    This allows you to mute zones.

    Can you contact me directly on [email protected]?
     
  5. Silica

    Silica Beta Tester

    Hi Bob,

    I'm also using the APC40, but with my modified template, I've changed a few buttons to my taste. Though I;m intresting in yours aswell.

    I probably found a way to do this in Pangoscript, though some code that I know it works in normal C compilers didnt work out in pangoscript.

    It would be so handy if we can return a value from "Masterbrightness" or from a zone. e.a.

    var a;

    a = masterbrightness;

    if ( a == 0 ){
    DisableLaserOutput
    }

    ofcourse this will trigger continues the DisableLaserOutput, and only one trigger would be need.

    I'll post it furter when I tried it out.
     
  6. Silica

    Silica Beta Tester

    Hmm, well I got it working when my slider is at value 0 on the APC40. Second problem is, executing "DisableLaserOutput" will freeze beyond, if executed in the rightside Pangoscript.
    Do I have to send the zip file, or is this a common problem?


    Also my code to execute two commands when slider is 0 or above 1.

    Code:
    
    CodeName "StopLase"
    // declaring variables
    
    var a1;
    var c1;
    
    // initializing them
    a1 = 0;
    c1 = 0;
    
    // loop a script
    //a1 = value of intensity slider on APC40
    //c1 = boolean that prevents that the command is executed twice. aka spamming. 
    
    loop:
    
    a1 = CC(0, 15, 0, 127); // reads cc message of channel 0, controller 15, 0 to 127.
    
    if ( (a1 > 1) & (c1 = 0) ) clickflash //EnableLaserOutput   // command 1 above intensity
    if   (a1 > 1) c1 = 1;
    
    //sleep 1000 //debug
    
    if ( (a1 = 0) & (c1 = 1) ) clicktoggle //DisableLaserOutput  // command 2 when slider is closed
    if   (a1 = 0) c1 = 0;
    
    //sleep 1000 // debug
    
    
    goto loop
    
    
    toobad { and } didnt work out, but duplicating "if" statements did the job.
    I've changed the two commands by ToggleFlash and Toggle to see if my script actually work.
     
    Last edited by a moderator: Feb 27, 2013
  7. Silica

    Silica Beta Tester

    Ah okay!

    Anyway thanks for the reply's, i've got it solved by myself though.

    Here's the code that I wrote.

    Code:
    CodeName "StopLase"
    // declaring variables
    
    var a1;
    var c1;
    var z1;
    
    // initializing them
    a1 = 0;
    c1 = 0;
    z1 = 0;
    
    // loop a script
    //a1 = value of intensity slider on APC40
    //z1 = value of zoom slider on APC40
    //c1 = boolean that prevents that the command is executed twice. aka spamming. 
    
    
    loop:
    //reading midi cc messages on each slider.
    a1 = CC(0, 15, 0, 127); // reads cc message of channel 0, controller 15, 0 to 127.
    z1 = CC(5, 7, 0, 100); // zoom slider
    
    
    if ( (a1 > 1) & (c1 = 0) ) zoom z1 // z1 is the current value of the zoom slider. so it continue's lasing without having a fixed value, or touching the zoom to reset.
    if   (a1 > 1) c1 = 1;  // this prevents for triggering the command twice if the slider isn't changed for a while.
    
    
    if ( (a1 = 0) & (c1 = 1) ) zoom 0 // makes the laser image as small as possible
    if   (a1 = 0) c1 = 0;
    
    
    goto loop
    
    
    Instead of using DisableLaserOutput and enable.. I swapped them with Zoom, since the picture will still be moving but very small, so my scanners won't go in safety modes.

    Thanks!
     
  8. Hi Cilia,
    The code does work however I advice you not to use it.
    THe commands you use are very heavy on Beyond.

    I have talked it over with our dev team.
    In the future we will release an optimized version which will solve your problem. Please send me an PM on the forum with an email address I can use to contact you. In a few days I will send you an Update of a newer Beyond build which should solve this issue for the most part.

    If you still have questions then, Ill put you in contact with our Lead Programmer.

    Greets,

    Bob
     
  9. Chris-MOS

    Chris-MOS New Member

    Hey Bob - I'd be really interested in seeing this included as an option within Beyond... a simple checkbox in the settings for "Disable scanning when Brightness is below 5%" would be really handy...

    The code way is fun too though! I still havn't found a way to do this without running a loop constantly as the OP suggests - would rather not do it this way due to the performance drain as you point out... Way to think outside the Box though Silica :)
     
  10. Be patient, but its coming.

    It will appear in the configuration dialog box.
    Tab , live control, in a spinbox at the bottom.
    The value range is -1 till 10.
    The value defines the threshold.
    If value <= then its turned off.

    kudos to the development team :)

    Bob.
     

Share This Page