Calling external program from script?

Author Topic: Calling external program from script?  (Read 1529 times)

How do I call external executables (including arguments) in my script?

Python uses subprocess.call([dir, args]). Anything similar available for Torque? And no, I don't need to feed the output back into Blockland.


you can't call executables or any other programs in blockland, this is great because you won't be royally forgeted over by people's addons who download viruses and run them, be glad you can't do this


you can't call executables or any other programs in blockland, this is great because you won't be royally forgeted over by people's addons who download viruses and run them, be glad you can't do this

be glad you can't do this
I guess. Some people will always be richards, and thats why the majority can't have cool stuff. Was this functionality removed by Badspot, or wasn't it implemented in Torque to begin with?

I guess. Some people will always be richards, and thats why the majority can't have cool stuff. Was this functionality removed by Badspot, or wasn't it implemented in Torque to begin with?
it was never there

it's implemented in torque but not accessible by add-ons

WinExec was the function used to execute Windows programs.

WinExec was the function used to execute Windows programs.

It's locked and we can't use it.

What you can do though is have a program listening on a localhost TCP port and then connect to it from Blockland.

It's locked and we can't use it.

What you can do though is have a program listening on a localhost TCP port and then connect to it from Blockland.

I saw that was an option, but I didn't quite understand how to do it. But it's not really worth it, anyway. I guess I'll find a workaround.

what are you trying to do

what are you trying to do
Use an external text-to-speech converter to convert player names etc. to .wav and play them ingame. The other problem that this poses is that I would have to update the sound list every time a new player is added, which would maybe cause lag.   

I saw that was an option, but I didn't quite understand how to do it.

Python uses subprocess.call([dir, args]).

import socket, subprocess

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('127.0.0.1', 5000))
sock.listen(True)

conn = sock.accept()[0]

while True:
    data = conn.recv(1024)

    if not data:
        break

    # parse ´dir´ and ´args´ from ´data´ in whichever fashion you want
    # don't call it ´dir´ btw because that's the name of a default function

    subprocess.call([dir, args])

conn.close()