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
[help/question] write and blinking screen at the same time...
Started by Goof, Oct 23 2012 04:48 PM
api computer game
7 replies to this topic
#1
Posted 23 October 2012 - 04:48 PM
#2
Posted 23 October 2012 - 04:58 PM
well you would have to recreate your read function to do achieve something like that
#3
Posted 23 October 2012 - 04:59 PM
but. is there any tutorial on that, just so i have a bit of knowledge on how to do that?
#4
Posted 23 October 2012 - 05:18 PM
Can't you just use term.setCursorPos(x,y) for each part?
#5
Posted 23 October 2012 - 05: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 ?
#6
Posted 23 October 2012 - 05:47 PM
create a function that does the cursor blink in the right position, then call it with parallel API
#7
Posted 23 October 2012 - 05:48 PM
not really i will try to create something like that "live"
its probably not an elegant way but it atleast works
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
#8
Posted 23 October 2012 - 07:23 PM
wait, why? thats verry confusing having two things blink at once
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











