Page 1 of 1

Livecode client for Caspar CG - Connecting but nothing else

Posted: Wed Nov 18, 2015 12:52 pm
by TechTaylor
Hi all,

So I'm very new to all of this, both live code and Caspar CG, so far so good I've managed to get Caspar working with it's client and with Telnet commands. I've started to create a client in Livecode to allow me to control the server, and it connects. I see that a connection has been made server side, however then I created a button to play a video on the server, just as a test, and nothing happens server side. I don't see the command come in.
The code for my connection button looks like this:

Code: Select all

global casparServer
-- if casparServer is not among the lines of opensockets then
   
   -- end if
on mouseUp
   if field "Server2" is empty then
      set the backgroundcolor of button "Server2" to "Gray "
         else
            put field "Server2" into casparServer
            if casparServer is among the lines of the opensockets then
      close socket casparServer
      set the backgroundcolor of button "Server2" to "Gray "
   else
      open socket to casparServer
      set the backgroundcolor of button "Server2" to "green"
   end if
end if
end mouseUp
And the code for the Play button looks like this:

Code: Select all

on mouseUp
  write "play 1-1 pure" to socket casparServer
end mouseUp
Can anyone shed some light on where I'm going wrong? I would understand if the server recieved the command but couldn't understand it due to poor syntax or formating however the fact the server doesn't see anything is leaving me perplexed without much of an idea as to how to check if anything is actually being sent from the livecode app.
Any help would be really appreciated

Re: Livecode client for Caspar CG - Connecting but nothing e

Posted: Wed Nov 18, 2015 5:43 pm
by jacque
You need to include the global declaration in every script that uses it. Put "global casparserver" at the top of the button script.

Re: Livecode client for Caspar CG - Connecting but nothing e

Posted: Wed Nov 18, 2015 6:46 pm
by TechTaylor
Hi jacque

Thanks for the response, just tried that and still no joy... any other ideas as to where I might be going wrong?

Thanks,

TT

Re: Livecode client for Caspar CG - Connecting but nothing e

Posted: Thu Nov 19, 2015 7:53 pm
by jacque
Not really, but if the global variable is declared in all scripts that need to use it, then that part should work. Unfortunately I'm not familiar with Caspar or the commands it expects, so I can't help much there, but it may be that your socket implementation is incorrect. This lesson may help:

http://lessons.livecode.com/m/4071/l/12 ... ng-sockets