767 posts
Posted 23 October 2012 - 05:48 PM
Hey everyone…
i have a bit of troubles during my operating system…
#############
[Password] <– here i want to type in password or other thingies…
#############
– BUT is this possible?
###############
# ANTIVIRUSOS() # <– i want this to blink, at the same time, pressing keys into "the box above"
###############
that was the look of my system…
but is it possible, to make a blinking box (or any other things, like that) in the same time, also when you are typing something onto the "[password]" ????
Thanks
—————————————————————————————————————————————————–
- Mikk809h
236 posts
Location
Germany
Posted 23 October 2012 - 05:58 PM
well you would have to recreate your read function to do achieve something like that
767 posts
Posted 23 October 2012 - 05:59 PM
but. is there any tutorial on that, just so i have a bit of knowledge on how to do that?
2088 posts
Location
South Africa
Posted 23 October 2012 - 06:18 PM
Can't you just use term.setCursorPos(x,y) for each part?
767 posts
Posted 23 October 2012 - 06:36 PM
ehhm how… ? then i have to make a blinking cursor, and then while i press a key it would print the key and trigger a LOT of other functions ??? or just a for loop / while loop ?
194 posts
Location
Spain
Posted 23 October 2012 - 06:47 PM
create a function that does the cursor blink in the right position, then call it with parallel API
236 posts
Location
Germany
Posted 23 October 2012 - 06:48 PM
not really i will try to create something like that "live"
blink = false
function draw(pa)
blink = not blink
term.clear()
term.setCursorPos(1,5)
write("Password: ")
for x=1, pa:len() do
write("*")
end
if blink then
write("#")
end
end
function read2()
local pass = ""
while true do
os.startTimer(0.5)
local ev,key = os.pullEvent()
if ev == "char" then
pass = pass .. key
draw(pass)
end
if ev == "timer" then
draw(pass)
end
if ev == "key" then
if key == 28 then
return pass
end
if key == 14 then
pass = pass:sub(0,pass:len()-1)
draw(pass)
end
end
end
end
print(read2())
its probably not an elegant way but it atleast works
2217 posts
Location
3232235883
Posted 23 October 2012 - 08:23 PM
wait, why? thats verry confusing having two things blink at once