Jump to content




Help me please.


  • You cannot reply to this topic
1 reply to this topic

#1 KaMiKaZeTo

  • Members
  • 8 posts

Posted 07 July 2012 - 08:07 PM

Can someone help me how can I make brackets change their position and when i press Enter they do any command.
Something like this
Posted Image
and when i press down arrow to change its position
Posted Image

#2 KevinW1998

  • Members
  • 93 posts
  • LocationAustria(German)

Posted 07 July 2012 - 08:52 PM

use os.pullEvent()
selectmode = 1
done = false
function DrawPos(x,y,str)
term.setCursorPos(x,y)
term.write(str)
end
term.clear()
DrawPos(2,1,"1")
DrawPos(2,2,"2")
DrawPos(2,3,"3")
DrawPos(1,selectmode,"[")
DrawPos(1+2,selectmode,"]")
while done == false do
evt,k = os.pullEvent()
if evt=="key" then
  DrawPos(1,selectmode," ")
  DrawPos(1+2,selectmode," ")
  if k == 200 and selectmode>1 then
   selectmode=selectmode-1
  elseif k== 208 and selectmode < 2 + 1 then
   selectmode = selectmode+1
  elseif k == 28 or k ==57 then
   done=true;
  end
end
DrawPos(1,selectmode,"[")
DrawPos(1+2,selectmode,"]")
end

With selectmode you can get the selection!





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users