This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Kazza's profile picture

Movie Theater

Started by Kazza, 15 October 2014 - 01:31 PM
Kazza #1
Posted 15 October 2014 - 03:31 PM
So, I'm having a little trouble getting my code to work, I've been using computercraft for a year now, but i still do not know how to remotely terminate a program from within another program.

I'm using an external program that makes images into ones that can be viewed in computercraft, and it works fine, I've converted a few images, but now, I'm trying to put them into a slideshow, and maby a very low fps movie. The program that it uses to display the images is npaintpro.

Right now, the best results I've had using this is with the bg program, that opens another tab, but i need to know how to close these tabs and the programs running within.

Here's the code that you will all facepalm at.

shell.run(bg katy) – Katy is an image of Katy Perry :3
sleep(10)
mon.clear() – I specified what mon is in the startup.
shell.run("bg craftblock")

Unsurprisingly, this does not work, all it leaves is a flashing image of Katy perry and the other image, without deleting the Katy perry image.
Lignum #2
Posted 15 October 2014 - 09:15 PM
You should take a look at paintutils.loadImage and paintutils.drawImage. These will allow you to draw an image from within your program. Never rely on other programs to do your work for you (i.e using shell.run).

Anyway, you should approach this issue with a while loop.
Here's some pseudocode:


while true do
   drawNextImage()
   sleep(10)
end

You could implement drawNextImage with the help of a table, which stores all of your images in the order for them to be displayed.

I'm afraid I don't have enough time to go into greater detail but this should help you get started. If you're having too much trouble, I suggest you make something simpler first to get some practice.
Bomb Bloke #3
Posted 25 October 2014 - 11:35 PM
Where's the rest of the code - what's in the "katy" and "craftblock" script files you referred to?