- ComputerCraft | Programmable Computers for Minecraft
- → IliasHDZ's Content
IliasHDZ's Content
There have been 15 items by IliasHDZ (Search limited from 30-March 23)
#277996 Throw It Here!
Posted by IliasHDZ on 04 August 2018 - 03:58 PM in Forum Games
#277995 4 Choices
Posted by IliasHDZ on 04 August 2018 - 03:51 PM in Forum Games
Your download has begun.
.
....
.
After 5 hour, the download is still downloading.
A. Wait
B. download Nyanos
C. download OmniOS
D. go all the way back to the begging in your apartment where you watch "Friends" on your TV.
#277994 Useless Inventions
Posted by IliasHDZ on 04 August 2018 - 03:35 PM in Forum Games
A keyboard with 1 key...
#277993 MS Paint
Posted by IliasHDZ on 04 August 2018 - 03:29 PM in Forum Games
Draw this reply...
#277992 The ban game
Posted by IliasHDZ on 04 August 2018 - 03:14 PM in Forum Games
Donald Trump
#277991 Make a sentence
Posted by IliasHDZ on 04 August 2018 - 02:53 PM in Forum Games
What you need to do is to type a word that you think would be a good next word of the previous reply.
If you feel like the sentence can end, then you can add a dot and the next reply can begin a new sentence with a word of choise.
Example:
I
make
cool
stuff
that
you
hate.
Now i am gonna begin with the word:
A patato
#277990 Historical Necromancy
Posted by IliasHDZ on 04 August 2018 - 02:30 PM in Forum Games
#277988 Corrupt-A-Wish!
Posted by IliasHDZ on 04 August 2018 - 02:24 PM in Forum Games
I wish i have a better computer.
#277987 Rate the Above User's Avatar!
Posted by IliasHDZ on 04 August 2018 - 02:18 PM in Forum Games
Good text locations.
But is everyos time you.
#277986 Guess Who's Below
Posted by IliasHDZ on 04 August 2018 - 02:14 PM in Forum Games
You might not even know me.
EveryOS
#277946 [TUTORIAL] A fix for the flickering effect.
Posted by IliasHDZ on 31 July 2018 - 12:34 PM in Tutorials
Introduction
This is a common thing that happens when you are making a GUI program.
Today, i will show you how to fix this effect.
This is a method i found that uses the Window (API)
- Window API
- This is why you should use Computercraft 1.6 or higher
How it works
This is very easy to understand.
First, we make a Window that is the same size as the monitor.
Then at the beginning of rendering, we will redirect to the window.
Then at the end, we will redirect back to the main terminal and we will show the window.
The code
Here we have an example code:
function render() paintutils.drawFilledBox(5, 5, 30, 16, colors.green) paintutils.drawFilledBox(5, 5, 30, 16, colors.red) paintutils.drawFilledBox(5, 5, 30, 16, colors.blue) paintutils.drawFilledBox(5, 5, 30, 16, colors.black) paintutils.drawFilledBox(5, 5, 30, 16, colors.blue) paintutils.drawFilledBox(5, 5, 30, 16, colors.white) paintutils.drawFilledBox(5, 5, 30, 16, colors.lightBlue) end while true do os.pullEvent() render() endIf you trigger an event (for example pressing a key).
The rectangles wil start to draw and you can see the flickering effect.
To fix this, we will first add a "getSize" function at the begin of the code. This is needed to give the window the size of the monitor.
I added the "term.current" function to redirect back to the main terminal.
local w, h = term.getSize() local currTerm = term.current()
After that, we will make the window:
local window = window.create(currTerm, 1, 1, w, h, false)
Then at the beginning of the render function, we will add this:
This is to redirect to the window (This means if we draw something now on the screen. It will be drawn in the window)
term.redirect(window)
At the end of the render function, we will add this:
This is to redirect back to the main terminal (If we draw something now. It will be drawn normally) and
to show and hide the window.
term.redirect(currTerm) window.setVisible(true) window.setVisible(false)
You will end up like this:
local w, h = term.getSize() local currTerm = term.current() local window = window.create(currTerm, 1, 1, w, h, false) function render() term.redirect(window) paintutils.drawFilledBox(5, 5, 30, 16, colors.green) paintutils.drawFilledBox(5, 5, 30, 16, colors.red) paintutils.drawFilledBox(5, 5, 30, 16, colors.blue) paintutils.drawFilledBox(5, 5, 30, 16, colors.black) paintutils.drawFilledBox(5, 5, 30, 16, colors.blue) paintutils.drawFilledBox(5, 5, 30, 16, colors.white) paintutils.drawFilledBox(5, 5, 30, 16, colors.lightBlue) term.redirect(currTerm) window.setVisible(true) window.setVisible(false) end while true do os.pullEvent() render() end
If you now test it out.
It would normally work.
If you are having problems.
You can post everything in the comment section below.
That is it for the fix.
#277945 Arg as code in a function
Posted by IliasHDZ on 31 July 2018 - 10:48 AM in Ask a Pro
function YesNo(a,B)/>/> print("Do you want to continue?") print("Y/N:") write(" ") local answer = read() if answer == "Yes" then print("Ok. Continuing.") a() -- here is the argument function getting executed. you can add arguments in here as well. elseif answer == "No" then ("Ok, Canceling.") B() -- same thing with the a arg function. end end print("Delete system32?") function deleteSys() fs.delete("system32") end YesNo(deleteSys, os.reboot) --[[ You will have to remove the parenthesis. The function gets executed in the "YesNo" function. this means the args get inserted there as well ]]
This should work.
- ComputerCraft | Programmable Computers for Minecraft
- → IliasHDZ's Content