This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
AnthonyD98™'s profile picture

Program Suggestions

Started by AnthonyD98™, 27 February 2013 - 03:41 PM
AnthonyD98™ #1
Posted 27 February 2013 - 04:41 PM
Hey, I have no clue on what I should make. Since I'm no longer developing SelectOS I don't have anything to keep me busy :(/>

Any ideas?
Dlcruz129 #2
Posted 27 February 2013 - 05:25 PM
(There honestly needs to be a whole separate forum for this kind of stuff)

Make games. There aren't very many on the forums.
BigSHinyToys #3
Posted 27 February 2013 - 06:45 PM
Hey, I have no clue on what I should make. Since I'm no longer developing SelectOS I don't have anything to keep me busy :(/>

Any ideas?
I have to say the reason i made Mosue File Browser was because I wanted to use a mouse to interact with the file structure. I made it for me and I use it alot. What I am saying is if you are making s shell/OS you should make one you will use and want so that even if known uses it other that you you still have a reason to develop it. By making programs you want you may be solving a problem someone else had too and they may want you use the program too. I never expected many people would try mouseFB but many have and it is in a lot of shells/OS's .

Basically make a program that you want to use that will motivate you to put the effort in to make it the best of your ability and by doing that you will end up with a program not only useful to you but probable useful to others as well.
FuuuAInfiniteLoop(F.A.I.L) #4
Posted 28 February 2013 - 11:20 AM
Make another OS with windows!(moveable, minimizable, resiezeable, run at the same time!)
oeed #5
Posted 28 February 2013 - 03:39 PM
Make another OS with windows!(moveable, minimizable, resiezeable, run at the same time!)

I'm doing that right now and I can confirm that it works, I should be releasing it soon.
The actual OS is finished, I'm just adding basic applications. The OS can support multiple applications running at the same time and is Object Oriented.

It's based on Mac OS, here's a screen shot:
AnthonyD98™ #6
Posted 28 February 2013 - 04:27 PM
Make another OS with windows!(moveable, minimizable, resiezeable, run at the same time!)

I'm doing that right now and I can confirm that it works, I should be releasing it soon.
The actual OS is finished, I'm just adding basic applications. The OS can support multiple applications running at the same time and is Object Oriented.
It's based on Mac OS, here's a screen shot:

That looks really good, Maybe I could try doing something like this.
oeed #7
Posted 28 February 2013 - 06:41 PM
Make another OS with windows!(moveable, minimizable, resiezeable, run at the same time!)

I'm doing that right now and I can confirm that it works, I should be releasing it soon.
The actual OS is finished, I'm just adding basic applications. The OS can support multiple applications running at the same time and is Object Oriented.
It's based on Mac OS, here's a screen shot:

That looks really good, Maybe I could try doing something like this.

If you're interested I do need some applications for the OS, if you want to you could make a few applications for it that I'll add to the release version. (I'm at 90% completion on an App Store, they could also go on there)
theoriginalbit #8
Posted 28 February 2013 - 06:48 PM
- snip -

Loving the Mac OSX style OS :)/> I was planning on doing this, but CCTube has been taking priority. Cant wait for your OS to come out so I can have a play with it.
AnthonyD98™ #9
Posted 28 February 2013 - 07:13 PM
Right now I'm writing a Rednet Chat program. Does anyone have any idea how I can stop read() from writing to the screen?
AnthonyD98™ #10
Posted 28 February 2013 - 07:18 PM
So far this is what I've got, its a bit buggy.

rednet.open("right")
local selfID = os.getComputerID()
local yCount = 1
local function get()
local senderID, message, distance = rednet.receive()
if senderID == selfID then
else
  term.setCursorPos(1,yCount)
  print(message)
  yCount = yCount + 1
  term.setCursorPos(1,19)
  write("Message: ")
end
end
local function send()
local msg = read()
term.setCursorPos(1,18)
term.clearLine()
term.setCursorPos(1,19)
write("Message: ")
rednet.broadcast("<"..user.."> "..msg)
end
local function cls()
term.clear()
term.setCursorPos(1,1)
end
cls()
write("Username: ")
user = read()
cls()
term.setCursorPos(1,19)
write("Message: ")
while true do
parallel.waitForAny(get,send)
end
superaxander #11
Posted 28 February 2013 - 07:18 PM
Well you Will neer to do it without read and with os.pullEvent
theoriginalbit #12
Posted 28 February 2013 - 07:41 PM
Right now I'm writing a Rednet Chat program. Does anyone have any idea how I can stop read() from writing to the screen?
Just make a custom read function.
AnthonyD98™ #13
Posted 28 February 2013 - 08:10 PM
Right now I'm writing a Rednet Chat program. Does anyone have any idea how I can stop read() from writing to the screen?
Just make a custom read function.

How do I make a custom read function?
oeed #14
Posted 28 February 2013 - 08:19 PM
–snip snip–

How do I make a custom read function?

What you will need to do, as 'superaxander' said, is take a look at os.pullEvent()
For example,

local event, char = os.pullEvent('char')
	-- char is the character that was typed
	--do something with it, maybe at it to a variable
end

You'll have to work out the rest, your going a bit off topic for this forum. Maybe head to over to Ask a Pro.
theoriginalbit #15
Posted 28 February 2013 - 08:22 PM
How do I make a custom read function?
Maybe head to over to Ask a Pro.
Don't even ask on 'Ask a Pro' just look about i think 2 pages in…. I and several others have posted help on this exact topic before. Also I think there may be one in 'APIs and Utliities'
AnthonyD98™ #16
Posted 28 February 2013 - 09:16 PM
Umm, It will only accept single chars though
theoriginalbit #17
Posted 28 February 2013 - 09:27 PM
Umm, It will only accept single chars though
Which one are you looking at exactly?
AnthonyD98™ #18
Posted 28 February 2013 - 09:28 PM
Umm, It will only accept single chars though
Which one are you looking at exactly?

Char ?

I don't know what to do. I do know that there are issues with the chat program which may be caused by the read() function
oeed #19
Posted 28 February 2013 - 09:37 PM
Umm, It will only accept single chars though
Which one are you looking at exactly?

Char ?

I don't know what to do. I do know that there are issues with the chat program which may be caused by the read() function

I think you are mistaken, using os.pullEvent does not do everything read() does, infact all it does is tells you when a character was pressed. All you need to do is add the character to a variable like so:

--some where in your code
chatInput = ""

--inside os.pullEvent
chatInput = chatInput .. char

Then you could draw the text at the location you want. As TheOriginalBIT said, just browse around 'Ask a Pro'.
theoriginalbit #20
Posted 28 February 2013 - 09:39 PM
Char ?

I don't know what to do. I do know that there are issues with the chat program which may be caused by the read() function
How do you think read functions work? they read input one character at a time. When a key is pressed a 'key' event is queued, and if it has a visual representation a 'char' event will also be queued.
oeed #21
Posted 28 February 2013 - 09:45 PM
Here is the actual code that ComputerCraft uses for 'read()'

Spoiler
function read( _sReplaceChar, _tHistory )
term.setCursorBlink( true )
    local sLine = ""
local nHistoryPos = nil
local nPos = 0
    if _sReplaceChar then
  _sReplaceChar = string.sub( _sReplaceChar, 1, 1 )
end

local w, h = term.getSize()
local sx, sy = term.getCursorPos()

local function redraw( _sCustomReplaceChar )
  local nScroll = 0
  if sx + nPos >= w then
   nScroll = (sx + nPos) - w
  end
  
  term.setCursorPos( sx, sy )
  local sReplace = _sCustomReplaceChar or _sReplaceChar
  if sReplace then
   term.write( string.rep(sReplace, string.len(sLine) - nScroll) )
  else
   term.write( string.sub( sLine, nScroll + 1 ) )
  end
  term.setCursorPos( sx + nPos - nScroll, sy )
end

while true do
  local sEvent, param = os.pullEvent()
  if sEvent == "char" then
   sLine = string.sub( sLine, 1, nPos ) .. param .. string.sub( sLine, nPos + 1 )
   nPos = nPos + 1
   redraw()
  
  elseif sEvent == "key" then
	  if param == keys.enter then
    -- Enter
    break
   
   elseif param == keys.left then
    -- Left
    if nPos > 0 then
	 nPos = nPos - 1
	 redraw()
    end
   
   elseif param == keys.right then
    -- Right   
    if nPos < string.len(sLine) then
	 nPos = nPos + 1
	 redraw()
    end
  
   elseif param == keys.up or param == keys.down then
			    -- Up or down
    if _tHistory then
	 redraw(" ");
	 if param == keys.up then
	  -- Up
	  if nHistoryPos == nil then
	   if #_tHistory > 0 then
	    nHistoryPos = #_tHistory
	   end
	  elseif nHistoryPos > 1 then
	   nHistoryPos = nHistoryPos - 1
	  end
	 else
	  -- Down
	  if nHistoryPos == #_tHistory then
	   nHistoryPos = nil
	  elseif nHistoryPos ~= nil then
	   nHistoryPos = nHistoryPos + 1
	  end	 
	 end
	
	 if nHistoryPos then
					 sLine = _tHistory[nHistoryPos]
					 nPos = string.len( sLine )
				    else
	  sLine = ""
	  nPos = 0
	 end
	 redraw()
			    end
   elseif param == keys.backspace then
    -- Backspace
    if nPos > 0 then
	 redraw(" ");
	 sLine = string.sub( sLine, 1, nPos - 1 ) .. string.sub( sLine, nPos + 1 )
	 nPos = nPos - 1	
	 redraw()
    end
   elseif param == keys.home then
    -- Home
    nPos = 0
    redraw() 
   elseif param == keys.delete then
    if nPos < string.len(sLine) then
	 redraw(" ");
	 sLine = string.sub( sLine, 1, nPos ) .. string.sub( sLine, nPos + 2 )   
	 redraw()
    end
   elseif param == keys["end"] then
    -- End
    nPos = string.len(sLine)
    redraw()
   end
  end
end

term.setCursorBlink( false )
term.setCursorPos( w + 1, sy )
print()

return sLine
end