EveryOS, on 31 March 2018 - 04:05 PM, said:
- ComputerCraft | Programmable Computers for Minecraft
- → danielsv03's Content
danielsv03's Content
There have been 53 items by danielsv03 (Search limited from 29-March 23)
#276544 Insert help
Posted by danielsv03 on 31 March 2018 - 04:51 PM in Ask a Pro
#276542 Insert help
Posted by danielsv03 on 31 March 2018 - 03:50 PM in Ask a Pro
icons = { ["painter_prog"] = {path = "root/system/Apps/painter/paint.icon"; config = "root/system/Apps/painter/Config.conf"; prog = "root/system/Apps/painter/painter.exf"}; ["lua_shell_prog"] = {path = "root/system/Apps/Lau_Shell/lua_shell.icon"; config = "root/system/Apps/Lau_Shell/Config.conf"; prog = "root/system/Apps/Lau_Shell/Lua_Shell.exf"}; ["Settings_prog"] = {path = "root/system/Apps/settings/settings.icon"; config = "root/system/Apps/settings/Config.conf"; prog = "root/system/Apps/settings/settings.exf"}; }
Right now for each line i'm adding them manually but i want it to be bale to add them automaticly via a program for example for a like an appstore program where for each app it will add the programs to that table automaticly
Thanks!
#268500 Buttons?
Posted by danielsv03 on 24 July 2017 - 08:21 AM in Ask a Pro
Krul__Tepes, on 23 July 2017 - 05:24 PM, said:
well Danels makes sense but the 4th line
a good way to do this is too tell it first: if x is more or equal to example 34 and x is less or equal too 50 this will keep it in between 34 and 50 as x
picture: ----->34 between 50<-----
and lastly the Y it tells if the y is ex on line 3 then continue if all those is correct.
Note: you can do the same with Y as with x
I tried to do my best explaining just ask if you have any questions
#268472 Buttons?
Posted by danielsv03 on 23 July 2017 - 12:15 PM in Ask a Pro
and from there you want an mouse click detection and mouse click position
ex:
function click() --this function is for checking where and if clicked event, button, x, y = os.pullEvent("mouse_click") --this will call the event with the variables button, x, y if button == 1 then --if user click left click (2 is for right click and 3 is for middle click) if x>=34 and x<= 45 and y == 3 then --check if x is more or equal to 34 and less or equal too 45 and Y is equal to 3 thats gonna be the area where the button is shell.run("program to run here") --runs the program end end end
#267714 [2019] [1.12.2] [Survival] LurCraft : We're back, and better than ever!
Posted by danielsv03 on 20 June 2017 - 12:29 PM in Servers
#267699 parallel.watForAny problem
Posted by danielsv03 on 19 June 2017 - 05:23 PM in Ask a Pro
#267696 parallel.watForAny problem
Posted by danielsv03 on 19 June 2017 - 02:18 PM in Ask a Pro
then it prints like it should be doing but the the prompt of course is gone so do an know why?
code
local w,h = term.getSize() uis = true ui = "Startup" his = false hi = "none" comm = none drive = false drivepos = "none" function setup() term.setBackgroundColor(colors.lightGray) print("cleaning") term.setCursorPos(1, 1) term.clear() gui() end function gui() paintutils.drawFilledBox(1, 1, 90, 2, colors.orange) term.setCursorPos(math.floor(w-string.len("Console OS 2.1"))/2, 2) term.setTextColor(colors.white) print("Console OS 2.1") end function display() buf = window.create(term.current(),1,3,51,17) buf.setBackgroundColor(colors.lightGray) oldterm = term.redirect(buf) term.clear() --print("ye") while true do sleep(0.5) --oldterm = term.redirect(buf) --print("Ye") if uis == true then uis = false print("User: "..ui) --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER --print("Boi") term.redirect(oldterm) elseif his == true then his = false print(hi) --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER --print("bois") term.redirect(oldterm) else --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER --print("bo") term.redirect(oldterm) end end end function prompt() --sleep(0.5) buff = window.create(term.current(),1,17,51,1) buff.setBackgroundColor(colors.gray) while true do oldtermm = term.redirect(buff) term.setCursorPos(1, 1) term.clear() write(">> ") --term.redirect(oldterm) local com = read() ui = com uis = true --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO DISPLAY OR HANDLER oldterm = term.redirect(buf) end end function handler() while true do sleep(0.5) left = peripheral.isPresent("left") right = peripheral.isPresent("right") bottom = peripheral.isPresent("bottom") top = peripheral.isPresent("top") front = peripheral.isPresent("front") back = peripheral.isPresent("back") if left == true then his = true drivepos = "left" drive = true hi = ("Detected drive "..drivepos) oldterm = term.redirect(buf) elseif right == true then his = true drivepos = "right" drive = true hi = ("Detected drive "..drivepos) oldterm = term.redirect(buf) else drive = false end --HERE DO SOMETHING TO GO BACK TO PROMPT OR DISPLAY end end setup() parallel.waitForAny(display, prompt, handler) --display() --prompt()
#267695 parallel.watForAny problem
Posted by danielsv03 on 19 June 2017 - 02:04 PM in Ask a Pro
#267691 parallel.watForAny problem
Posted by danielsv03 on 19 June 2017 - 09:04 AM in Ask a Pro
Bomb Bloke, on 19 June 2017 - 02:05 AM, said:
ohh so i will just have to redirect them at the correct time
#267679 parallel.watForAny problem
Posted by danielsv03 on 18 June 2017 - 08:02 PM in Ask a Pro
#267677 parallel.watForAny problem
Posted by danielsv03 on 18 June 2017 - 07:54 PM in Ask a Pro
i want them to pause the function where it says
--DO SOMETHING HERE TO GO BACK TO BLA BLA BLAthen continue the function when it gets back to it
here is the code
and a brief explanation to what it should do
so the display function will always look if an variable like his changes if so then print the suggested variable and the prompt will take in user commands and send it to the display so the display show it and the last thing is the handler with checks if it founds a peripheral attached to it if so send that to the display
code
local w,h = term.getSize() uis = true ui = "Startup" his = false hi = "none" comm = none drive = false drivepos = "none" function setup() term.setBackgroundColor(colors.lightGray) print("cleaning") term.setCursorPos(1, 1) term.clear() gui() end function gui() paintutils.drawFilledBox(1, 1, 90, 2, colors.orange) term.setCursorPos(math.floor(w-string.len("Console OS 2.1"))/2, 2) term.setTextColor(colors.white) print("Console OS 2.1") end function display() buf = window.create(term.current(),1,3,51,17) buf.setBackgroundColor(colors.lightGray) oldterm = term.redirect(buf) term.clear() while true do sleep(0.5) print("Ye") if uis == true then uis = false print("User: "..ui) --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER elseif his == true then his = false print(hi) --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER else --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO PROMPT OR HANDLER end end end function prompt() --sleep(0.5) buff = window.create(term.current(),1,17,51,1) buff.setBackgroundColor(colors.gray) oldterm = term.redirect(buff) while true do term.setCursorPos(1, 1) term.clear() write(">> ") local com = read() ui = com --coroutine.yield() --HERE DO SOMETHING TO GO BACK TO DISPLAY OR HANDLER end end function handler() while true do sleep(0.5) left = peripheral.isPresent("left") right = peripheral.isPresent("right") bottom = peripheral.isPresent("bottom") top = peripheral.isPresent("top") front = peripheral.isPresent("front") back = peripheral.isPresent("back") if left == true then his = true drivepos = "left" drive = true elseif right == true then his = true drivepos = "right" drive = true hi = ("Detected drive "..drivepos) else drive = false end --HERE DO SOMETHING TO GO BACK TO PROMPT OR DISPLAY end end setup() parallel.waitForAny(display, prompt, handler) --display() --prompt()
Any help is useful
#267673 Error handling no function
Posted by danielsv03 on 18 June 2017 - 01:33 PM in Ask a Pro
Exerro, on 18 June 2017 - 12:49 PM, said:
literally_any_code --# is the same as (function() literally_any_code end)()with the slight exception of stack-related stuff being a little different, but inside CC, that's almost never a problem.
If your code isn't working when put in a function, something else is going wrong, and you should address that issue. We can't help with an ambiguous error message and no source code, however. (i.e. give the source code and you'll get help!)
My best shot without source is that there's a chance you called your main function something that essentially overrides another function, so instead of calling that other function, it's calling itself, resulting in a stack overflow.
Bomb Bloke, on 18 June 2017 - 09:48 AM, said:
here
#267665 Error handling no function
Posted by danielsv03 on 18 June 2017 - 08:57 AM in Ask a Pro
#267651 Error handling no function
Posted by danielsv03 on 17 June 2017 - 04:10 PM in Ask a Pro
#267649 Error handling no function
Posted by danielsv03 on 17 June 2017 - 03:52 PM in Ask a Pro
Lupus590, on 17 June 2017 - 01:51 PM, said:
print("hello world")
What KingofGamesYami is suggesting is something like this:
local function main() print("hello world") end local ok, err = pcall(main) if not ok then --# handle error print("error: "..err) --# print out the error end
Thats wha i have been doing but the problem is that the pat of the script is the GUI handling part and it gets an error if it is in a function so i moved it ou of the function and still want the error handling btw the method you guys told that was the one i was using also btw the error wasn't because of the error handling its that the GUI handling part was just timing out or something
#267645 MLG teachers and students table bonanza!
Posted by danielsv03 on 17 June 2017 - 12:02 PM in Ask a Pro
#267642 Error handling no function
Posted by danielsv03 on 17 June 2017 - 11:37 AM in Ask a Pro
#267638 MLG teachers and students table bonanza!
Posted by danielsv03 on 17 June 2017 - 09:29 AM in Ask a Pro
local persons = { ["Alex"] = {rank = "Teacher"; PremissionLevel = 3}; ["Paul"] = {rank = "Student"; PremissionLevel = 0}; }
Could be a good table for this
what you could do is that you have an function that checks if student have rank == teacher if so add that person to another table called teachers in a separate file
That could look something like this
teachers = {} student = {} function check() for k,v in pairs(persons) do if v.rank == "Teacher" then table.insert(teachers, k) elseif v.rank == "Student" then table.insert(student, k) end end end
that should separate all the student and teachers into separate tables
then you could just check if that person belongs to that table and add premissions to that table like if the person belongs to teacher table then it has more permissions like permissionslevel 3
#267622 DanzOs
Posted by danielsv03 on 16 June 2017 - 03:18 PM in Operating Systems
hbomb79, on 19 April 2017 - 03:16 AM, said:
Yes
Restioson, on 19 April 2017 - 10:38 AM, said:
Working on it
houseofkraft, on 19 April 2017 - 12:46 PM, said:
local pass = read("*"). Finally, you should really consider securing the password with SHA2.
Also, don't copy the CraftOS Shell! Please, different UI's (even without a GUI) makes operating systems unique. You are just copying the CraftOS shell and modifying it.
Good luck with your OS!
The local pass = read(" * ")
i already knew it and it is included when you login not when you set up a password
btw thanks for the tips.
#267576 [1.7.10] CubeSpace Creative [CC 1.75] [24/7]
Posted by danielsv03 on 14 June 2017 - 06:40 AM in Servers
#267575 Why can't click on shutdown [SOLVED!]
Posted by danielsv03 on 14 June 2017 - 05:53 AM in Ask a Pro
#267568 Why can't click on shutdown [SOLVED!]
Posted by danielsv03 on 13 June 2017 - 05:27 PM in Ask a Pro
KingofGamesYami, on 13 June 2017 - 04:22 PM, said:
It's not a problem with your script though. This is a computercraft bug which you have no control over.
#267566 Why can't click on shutdown [SOLVED!]
Posted by danielsv03 on 13 June 2017 - 04:24 PM in Ask a Pro
KingofGamesYami, on 13 June 2017 - 04:22 PM, said:
It's not a problem with your script though. This is a computercraft bug which you have no control over.
ohh well that weird. Because i tried another script that works just the same and it works fine
#267562 Why can't click on shutdown [SOLVED!]
Posted by danielsv03 on 13 June 2017 - 03:10 PM in Ask a Pro
KingofGamesYami, on 13 June 2017 - 03:02 PM, said:
danielsv03, on 13 June 2017 - 03:10 PM, said:
#267559 Why can't click on shutdown [SOLVED!]
Posted by danielsv03 on 13 June 2017 - 02:51 PM in Ask a Pro
KingofGamesYami, on 12 June 2017 - 09:19 PM, said:
Wow well shutdown dosen't work for me
Ohh well nvm i know why now its because i have to click outside shutdown.. idk why
Do any one know why i have to click outside the text?
- ComputerCraft | Programmable Computers for Minecraft
- → danielsv03's Content