Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Solved - Where have I messed merging a variable and text?

If you have a question or need help, this is the place to be.
Post Reply
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Solved - Where have I messed merging a variable and text?

Post by Mastiff »

I have tried this code, adapted from a 7 year old post by Bitmonster to send a command that triggers a LUA command in Girder:

Code: Select all

import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("127.0.0.1", 20007)) # Specify the target device and port number
print s.recv(1024)  # Writes anything it tells you when it first connects to the log for troubleshooting.  If there's no initial connect string, you can probably remove this line
s.send("print('test')\n")  # You could also do eg.event.payload[0] and pass commands to this script from other events.
print s.recv(1024)  # Writes anything it tells you after your command is sent to the log for troubleshooting
s.close()
That works, I can get Girder to run LUA code based on that. But when I tried actually using it to something useful, it crashed and burned. I replaced the s.send line with this:

Code: Select all

eg.globals.ToGirder1 = (("print"))
eg.globals.ToGirder2 = eg.event.payload[0]
eg.globals.ToGirder3 = (("\n")
eg.globals.ToGirder = eg.globals.TilGirder1 + eg.globals.TilGirder2 + eg.globals.TilGirder3
s.send(eg.globals.TilGirder)  
That gives me an error. But I'm guessing that it's because the way I'm using ( and " in the scripts. Right? So how should it actually be done?
Last edited by Mastiff on Thu Jan 16, 2014 12:37 pm, edited 1 time in total.
Mastiff
Experienced User
Posts: 872
Joined: Thu May 03, 2012 10:43 am

Re: Where have I messed merging a variable and text?

Post by Mastiff »

Never mind that one above. I found the problem myself!
Post Reply