Hello Guest it is May 10, 2021, 01:56:41 PM

Author Topic: No Script Engine Found for ...  (Read 7455 times)

0 Members and 1 Guest are viewing this topic.

Offline TimGS

*
  •  108 108
    • View Profile
Re: No Script Engine Found for ...
« Reply #20 on: June 04, 2015, 07:59:49 AM »
...Yes the code was written as a Flyout...it has its own frame.   I could modify it for a panel...I just need to figure out how to put the code where it needs to be ???

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: No Script Engine Found for ...
« Reply #21 on: June 04, 2015, 08:08:49 AM »
tool box / joystick project example is done

Offline TimGS

*
  •  108 108
    • View Profile
Re: No Script Engine Found for ...
« Reply #22 on: June 04, 2015, 08:16:08 AM »
I tried that exact project from the toolbox on Tuesday...I could not execute that example...let alone see where they place the panel code.

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: No Script Engine Found for ...
« Reply #23 on: June 04, 2015, 08:20:00 AM »
you have to put all bits in the correct spot the code is tyed into the screen set if you still cant get at the codes I will pull them out and send them to you and where i got them from

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: No Script Engine Found for ...
« Reply #24 on: June 04, 2015, 08:23:39 AM »
this is poppabears code from the lua panel
Code: [Select]
------------------------Header Section---------------------------------------
-- Name:        JoyStick Status Bitmap display
-- Author:      S Shafer
-- Modified by:
-- Created:     10/13/2014
-- Copyright:   (c) 2014 S S Systems, LLC, can be freely used, modified, or
-- derived from as long as this header section remains.
-- Licence:     BSD license
-- File Name: (luapanel embedded script, NO FRAME)
------------------------Header Section----------------------------------------

local panel = nil
local m_id = 0
local mInst = 0; --Mach4 instance number
local inst = mc.mcGetInstance(mInst);
local gtimer1 = 0;
local BitMapPanel = 0;
local picToUse = 0;
local KeyPressed = "";
local window = 0;

function GetNextID()
    m_id = m_id+1;
    return m_id;
end

function TimerTick()
    BitMapPanel:Refresh();
end

---the ID and its call to GetNextID has been moved to where the control is made.                          
function main()
    panel = mcLuaPanelParent;
    local window = panel:GetParent();
    window:SetBackgroundColour(wx.wxColour(230, 230, 230));
    --use the same color bg as the panel sits on in screen designer
    window:SetWindowStyleFlag(wx.wxBORDER_NONE);--removes sunken border of lua panel
    window:ClearBackground();
    window:Refresh();
    local wsize = window:GetSize();
    panel:SetSize(wsize);
    gtimer1 = wx.wxTimer(panel);--start a timer to poll IO changes
    panel:Connect(wx.wxEVT_TIMER, TimerTick);
    gtimer1:Start(200); -- set poll rate to 1/5th a second        
    panel:Connect(wx.wxEVT_CLOSE_WINDOW,
        function (event)        
            gtimer1:Stop();                
            event:Skip();
        end);
        
    mainSizer = wx.wxBoxSizer(wx.wxVERTICAL);
    GridSizer  = wx.wxFlexGridSizer( 2, 1, 0, 0 );--2 rows, 1 column, no x/y spacing between  

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory          
    local imagePathJoyCT =  Path .. "\\Wizards\\JoyStickResources\\JoyCenter.bmp";
local imagePathJoyDN =  Path .. "\\Wizards\\JoyStickResources\\JoyDown.bmp";
local imagePathJoyLT =  Path .. "\\Wizards\\JoyStickResources\\JoyLeft.bmp";
local imagePathJoyRT =  Path .. "\\Wizards\\JoyStickResources\\JoyRight.bmp";
local imagePathJoyUP =  Path .. "\\Wizards\\JoyStickResources\\JoyUp.bmp";

imageCT = wx.wxImage();
imageCT:LoadFile(imagePathJoyCT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpCT = wx.wxBitmap(imageCT);
wsizeCT = wx.wxSize(JoyBmpCT:GetWidth(), JoyBmpCT:GetHeight());

imageDN = wx.wxImage();
imageDN:LoadFile(imagePathJoyDN, wx.wxBITMAP_TYPE_BMP);
    JoyBmpDN = wx.wxBitmap(imageDN);
wsizeDN = wx.wxSize(JoyBmpDN:GetWidth(), JoyBmpDN:GetHeight());

imageLT = wx.wxImage();
imageLT:LoadFile(imagePathJoyLT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpLT = wx.wxBitmap(imageLT);
wsizeLT = wx.wxSize(JoyBmpLT:GetWidth(), JoyBmpLT:GetHeight());

imageRT = wx.wxImage();
imageRT:LoadFile(imagePathJoyRT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpRT = wx.wxBitmap(imageRT);
wsizeRT = wx.wxSize(JoyBmpRT:GetWidth(), JoyBmpRT:GetHeight());
  
imageUP = wx.wxImage();
imageUP:LoadFile(imagePathJoyUP, wx.wxBITMAP_TYPE_BMP);
    JoyBmpUP = wx.wxBitmap(imageUP);
wsizeUP = wx.wxSize(JoyBmpUP:GetWidth(), JoyBmpUP:GetHeight());  

    BITMAPPANEL1_ID = GetNextID ();
    BitMapPanel = wx.wxPanel (  panel,
                                BITMAPPANEL1_ID,
                                wx.wxDefaultPosition,
                                panel:GetSize(),
                                wx.wxWANTS_CHARS,'');

    GridSizer:Add(BitMapPanel, 0, wx.wxALIGN_LEFT+wx.wxALL, 2);
    mainSizer:Add(GridSizer, 0, wx.wxALIGN_LEFT+wx.wxALL,2);
    panel:SetSizer(mainSizer);

    picToUse = JoyBmpCT;    
    BitMapPanel:SetFocus();    
    scr.SetProperty('DebugTB', 'Label', '');

    BitMapPanel:Connect(wx.wxEVT_PAINT,
                         function (event)
                            local mInst = 0;
                            local rc = 0; local X = 0; local Y = 1; local DirP = 1; DirN = -1;
                            local iSigVal1 = 0;local iSigVal2 = 0;local iSigVal3 = 0;local iSigVal4 = 0;
                            local hsig1 = 0;local hsig2 = 0;local hsig3 = 0;local hsig4 = 0;                            
                            local inst = mc.mcGetInstance(mInst);
                            hsig1, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1);--LT X-
                            iSigVal1 = mc.mcSignalGetState(hsig1);
                            hsig2, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2);--RT X+
                            iSigVal2 = mc.mcSignalGetState(hsig2);
                            hsig3, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3);--UP Y+
                            iSigVal3 = mc.mcSignalGetState(hsig3);
                            hsig4, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4);--DN Y-
                            iSigVal4 = mc.mcSignalGetState(hsig4);                            
                            if iSigVal1 == 1 then
                                picToUse = JoyBmpLT;--LT X-
                                mc.mcJogVelocityStart(inst, X, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input1 Active');
                                end
                            if iSigVal2 == 1 then
                                picToUse = JoyBmpRT;--RT X+
                                mc.mcJogVelocityStart(inst, X, DirP);
                                scr.SetProperty('DebugTB', 'Label', 'input2 Active');
                                end
                            if iSigVal3 == 1 then
                                picToUse = JoyBmpUP;
                                mc.mcJogVelocityStart(inst, Y, DirP); --UP Y+                            
                                scr.SetProperty('DebugTB', 'Label', 'input3 Active');
                            end  
                            if iSigVal4 == 1 then
                                picToUse = JoyBmpDN;--DN Y-
                                mc.mcJogVelocityStart(inst, Y, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input4 Active');
                            end
                            if iSigVal1 == 0 and iSigVal2 == 0 and iSigVal3 == 0 and iSigVal4 == 0 then
                                picToUse = JoyBmpCT;
                                local IsBtnJog = scr.GetProperty('btnJogLED', 'Value');
                                local val = tonumber(IsBtnJog);
                                if val == 0 then
                                    mc.mcJogVelocityStop(inst, X);
                                    mc.mcJogVelocityStop(inst, Y);
                                end
                                scr.SetProperty('DebugTB', 'Label', '');
                            end
                            local dc = wx.wxPaintDC(BitMapPanel);                            
                            dc:DrawBitmap(picToUse, 0,0, true);
                            dc:delete ();
                         end);
    panel:Fit();
    local window = panel:GetParent();
    window:Connect(wx.wxID_ANY, wx.wxEVT_SIZE,
                        function(event)
                            local wsize = event:GetSize();
                            panel:SetSize(wsize);
                            panel:FitInside();            
                        end);
end
main();
wx.wxGetApp():MainLoop();

 

Offline TimGS

*
  •  108 108
    • View Profile
Re: No Script Engine Found for ...
« Reply #25 on: June 04, 2015, 08:31:03 AM »
What is the correct spot?  ...Screen Edit...Screen Load script?????

Offline DazTheGas

*
  •  753 753
  • DazTheGas
    • View Profile
Re: No Script Engine Found for ...
« Reply #26 on: June 04, 2015, 09:06:04 AM »
add a lua panel within the editor.

DazTheGas
Theres always time for a choccy biccy

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: No Script Engine Found for ...
« Reply #27 on: June 04, 2015, 05:40:46 PM »
when you open poppabears file all the files you open and place them in the same place in mach4 so profile you put inside profile in M4 not the file named profile whats in the folder

so the folder plugins you open it and get the files out and put them in c\M4\plugins folder, same for the other 3 you don't place any code anywhere its all there already

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: No Script Engine Found for ...
« Reply #28 on: June 04, 2015, 05:42:10 PM »
if still not sure just say and I will do some screen shots for you

Offline TimGS

*
  •  108 108
    • View Profile
Re: No Script Engine Found for ...
« Reply #29 on: June 04, 2015, 07:57:32 PM »
No Script Engine Found for ...  SOLVED  ;D

Thank You Steve!!!!!

I opened Mach Plugins and did not even see Lua.....  I was missing "mcLua.m4pw" .... I have know idea how or why....but my problem is solved!!!