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

Any tutorials to how to make a multitasking terminal and movable window?

Started by IsaacTBeast, 30 May 2014 - 03:58 AM
IsaacTBeast #1
Posted 30 May 2014 - 05:58 AM
Hello guys! can you make a tutorial or suggest a tutorial to how to make a multitasking windows.. I want to make a movable window after the Window API has come out.. Please make a tutorial to teach me to the new api :)/>
Blue #2
Posted 30 May 2014 - 06:25 AM
I don't think the new API can do that,you will have to make some advanced code.
IsaacTBeast #3
Posted 30 May 2014 - 07:08 AM
Ok?? but can you show me how to use the API?
Blue #4
Posted 30 May 2014 - 09:17 AM
Sorry,I don't know ANYTHING about the API :(/> .You could wait for someone else to help you,or check out it's wiki page and the term API.I don't think it does movable windows,multitasking etc… I think it just draws a box and limits the space a program
can use.Sorry if I'm wrong.
Edited on 30 May 2014 - 07:20 AM
H4X0RZ #5
Posted 30 May 2014 - 12:15 PM
After looking at the wiki page I think it's like this:

--# you create a new window
--# with the actual term as parent terminal, it starts at 5,5 and ends at 15,8
local window1 = window.create(term,5,5,10,3)

--# write in the window
window1.write("Some Text")
--# As you can see, it's like the term API. The only difference is that you don't use term.*, you use window_name.*

--# you can also redirect to the window you've created
--# then you don't have to use window_name.* because then the term.* functions redirect to you window object
term.redirect(window1)
term.write("Some other text written using redirection")
Hope you understand it a bit better now ^^
KingofGamesYami #6
Posted 30 May 2014 - 01:08 PM
He wants to move the windows.
1) look at mouse_click
2) look at mouse_drag
3) http://computercraft.info/wiki/Window.reposition
Bomb Bloke #7
Posted 30 May 2014 - 03:41 PM

This.

Read a tutorial or two about using monitors (and ideally peripherals too). Apply that to using windows. They're pretty much the same, only a window is a space within an existing display, and a monitor is a space outside your existing display. You command them in much the same way, however.

That reposition command, in particular, takes whatever has been rendered through the window and draws it at the new location you specify.

It's well worth reading the code of the "chat" script included with 1.6+, as this uses the window API to divide up areas of the screen. My card game API (at least, the current version) also uses it for the purpose of re-rendering stacks of cards (and for preventing renders of drawings that include lots of overlaps until they're completed) - if you read it, just look for the bits that deal with windows and ignore the rest. Note that the window API, while useful for the purposes of multi-tasking, is not in itself geared towards multi-tasking - the best way to do that depends on what it is you're trying to accomplish, but either way you'll need a decent understanding of events to start off with.

I would like to think that the examples I put on each of these pages would be sufficient to understand how to use windows, but you will need some fore-knowledge, and monitors are the best place to start. Perhaps try writing a script that uses multiple monitors first - windows will likely make perfect sense once you've done that.
IsaacTBeast #8
Posted 30 May 2014 - 04:22 PM
After looking at the wiki page I think it's like this:

--# you create a new window
--# with the actual term as parent terminal, it starts at 5,5 and ends at 15,8
local window1 = window.create(term,5,5,10,3)

--# write in the window
window1.write("Some Text")
--# As you can see, it's like the term API. The only difference is that you don't use term.*, you use window_name.*

--# you can also redirect to the window you've created
--# then you don't have to use window_name.* because then the term.* functions redirect to you window object
term.redirect(window1)
term.write("Some other text written using redirection")
Hope you understand it a bit better now ^^

not working :/
IsaacTBeast #9
Posted 30 May 2014 - 04:27 PM
wow thanks Freack100
Edited on 30 May 2014 - 02:28 PM