Results 1 to 9 of 9

Thread: GoHome , GoMacro, GoDevice

  1. #1
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    278

    Default GoHome , GoMacro, GoDevice

    Strange things here:

    Execute this Code from the LuaConsole:
    NetRemote.GoMacro("GROUPNAME","PANELNAME")

    Perfekt, it jump to every group and page

    Execute the same Code in my lua file:
    Always comes up with the error: Cant find Device

    Every Page Group is set to the MacroTemplate only Home is MasterTemplate

    Can't explain that!!
    ---Simon

  2. #2
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Does it actually perform the jump?

    And where is this code in your Lua file?
    --Rob

  3. #3
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    278

    Default

    It does not perform the jump! It only show the error message.

    where is the code? Well it's a function in the main lua file which jump to a page when the connection of girder and MB are lost and should jump back to the last page when the connection comes back.

    Code:
    function netcontrol()
    local mediabridge = tonumber(NetRemote.GetVariable("MP.LinkActive"));
    local girder = tonumber(NetRemote.GetVariable("Girder.LinkActive"));
    	if (mediabridge + girder~=2) and NetRemote.GetVariable("NR.PanelName")~="NetControl" then
    	panel = NetRemote.GetVariable("NR.PanelName")
    	group = NetRemote.GetVariable("NR.DeviceName");
    	error()
    	elseif
    	(mediabridge + girder==2) and NetRemote.GetVariable("NR.PanelName")=="NetControl" then
    	back(group,panel)
    	end
    end
    
    function error()
    NetRemote.GoMacro("Service","NetControl")
    nettimer = NetRemote.SetTimer(1000,netcontrol);
    end
    
    function back(g,p)
    nettimer:KillTimer()
    	if p =="Home" then
    	NetRemote.GoHome("Home")
    	else
    	NetRemote.GoMacro('"'..g..'"', '"'..p..'"')
    	print('"'..g..'"')
    	print('"'..p..'"')
    	end
    end
    ---Simon

  4. #4
    Join Date
    Apr 2006
    Location
    Munich
    Posts
    73

    Default

    Quote Originally Posted by Manser View Post
    Code:
    	NetRemote.GoMacro('"'..g..'"', '"'..p..'"')
    should be
    Code:
    	NetRemote.GoMacro(g, p)
    (the qoutes are used to denote string literals).

  5. #5
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    278

    Default

    Yes, I could see that in the manual, but it only works from the interact. lua console with this "'..g..'" Don't ask me why!

    So if I execute from the console:
    Code:
    NetRemote.GoMacro("GROUP", "PAGE")
    that works, but not:
    Code:
    NetRemote.GoMacro(GROUP, PAGE)
    I used that a lot in different scripts, and its always need this ""
    I tried to figure that out. Is it a maby a mistake in the manual

    And I thought that something which works in the console should work in a script too.

    I did it first like this:
    function back()
    nettimer:KillTimer()
    NetRemote.GoBack()
    end

    that's mostly works

    But I'm wasn't sure, if that was the reason that sometime NR crashed, especially after a longer sleeping mode of the PPC,
    so I tried that with the pages and groups
    Last edited by Manser; June 27th, 2007 at 06:08 AM.
    ---Simon

  6. #6
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    Suppose that your group is called MYGROUP and the panel is called PANEL

    The variable group will contain the string [[MYGROUP]] (note I'm using the [[ and ]] notation here because it's easier to see what's happening with quotes).

    When you try to build the string what you end up with is [["MYGROUP"]] and you probably don't have a pagegroup of that name, ie with the embedded quotes.

    So if I execute from the console:
    Code:
    NetRemote.GoMacro("GROUP", "PAGE")
    that works, but not:
    Yes, that will jump to pagegroup GROUP and page PAGE

    Code:
    NetRemote.GoMacro(GROUP, PAGE)
    That will look for Lua variables called GROUP and PAGE and try to use the values in them - I suspect these are always nil. Note that Lua is case sensitive.
    --Rob

  7. #7
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    278

    Default

    What I don't understand is that this works in the console:

    Code:
    NetRemote.GoMacro("GROUP", "PAGE")
    and the same code, "hardcoded" not build with variables will not work in the lua script!
    It's absolutely the same code to execute, not?
    ---Simon

  8. #8
    Join Date
    May 2004
    Location
    Cardigan, UK
    Posts
    9,278

    Default

    So you have a group called GROUP containing a page called PAGE?

    It certainly should work the same whether it's from the console or a script.

    Can you post the CCF and scripts?
    --Rob

  9. #9
    Join Date
    Jun 2005
    Location
    Switzerland
    Posts
    278

    Default

    Don't ask me why, but it works now!!!

    Didn't changed anything, it's just an other day!

    I'll watch for that, and let you now if something is changing!

    thank you
    ---Simon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •