6 posts
Posted 14 December 2014 - 09:16 PM
I can't figure out how to make this pastebin
http://pastebin.com/DWg5d7wJ be displayed on my monitor while it's running. I don't want it to use monitor <side> <program>. It needs it to be like this pastebin
http://pastebin.com/fVJe04E4 where it automatically runs on the monitor. I have tried changing the "term" to "mon" but that still didn't help. Right now it only runs on the computer. If anyone could help me with this it would be a hug help.
131 posts
Posted 15 December 2014 - 12:56 AM
Add this as the first line of your code:
local mon = peripheral.find "monitor"
Then add this line after your term.write call:
mon.write(obj.text[cnt])
Edited on 14 December 2014 - 11:57 PM
6 posts
Posted 15 December 2014 - 03:52 AM
Add this as the first line of your code:
local mon = peripheral.find "monitor"
Then add this line after your term.write call:
mon.write(obj.text[cnt])
Ok I put that in
http://pastebin.com/DWg5d7wJ but I'm getting this error startup:1: attempt to call nil
3057 posts
Location
United States of America
Posted 15 December 2014 - 04:12 AM
What version of CC do you have? It sounds like your version doesn't have peripheral.find.
Here's a replacement
function find( sType )
local found = {}
for k, v in pairs( peripheral.getNames() ) do
if peripheral.getType( v ) == sType then
found[ #found + 1 ] = peripheral.wrap( v )
end
end
return unpack( found )
end
6 posts
Posted 15 December 2014 - 04:28 AM
What version of CC do you have? It sounds like your version doesn't have peripheral.find.
Here's a replacement
function find( sType )
local found = {}
for k, v in pairs( peripheral.getNames() ) do
if peripheral.getType( v ) == sType then
found[ #found + 1 ] = peripheral.wrap( v )
end
end
return unpack( found )
end
I'm currently using this on a tekkit classic server 1.2.5 I think the computercraft version is 1.3.2
Where do i put that? Just as the first line of code?
3057 posts
Location
United States of America
Posted 15 December 2014 - 02:25 PM
-snip-
I'm currently using this on a tekkit classic server 1.2.5 I think the computercraft version is 1.3.2
Where do i put that? Just as the first line of code?
Yeah, that explains it.
Put it before the first line, then replace peripheral.find with find.
8543 posts
Posted 15 December 2014 - 03:46 PM
I'm not sure that version has .getNames either. You'll probably need to iterate the table returned by rs.getSides(), which is sufficient, as that version does not include networking cables.
6 posts
Posted 15 December 2014 - 11:04 PM
Yeah, that explains it.
Put it before the first line, then replace peripheral.find with find.
Did that still not working…. My current pastebin
http://pastebin.com/DWg5d7wJ If we can't get this code to work, would you mind coding a new one for me? I'd really appreciate it!
3057 posts
Location
United States of America
Posted 15 December 2014 - 11:53 PM
function find( sType )
local found = {}
for k, v in pairs( rs.getSides() ) do
if peripheral.getType( v ) == sType then
found[ #found + 1 ] = peripheral.wrap( v )
end
end
return unpack( found )
end
local mon = find( "monitor" )
You forgot to
use my function.
6 posts
Posted 16 December 2014 - 02:38 AM
function find( sType )
local found = {}
for k, v in pairs( rs.getSides() ) do
if peripheral.getType( v ) == sType then
found[ #found + 1 ] = peripheral.wrap( v )
end
end
return unpack( found )
end
local mon = find( "monitor" )
You forgot to
use my function.
:/ Ok this is the exact code I'm using. Lines 2-11 are what you told me to put in and it's still not working.
textscrolling = function()
function find( sType )
local found = {}
for k, v in pairs( rs.getSides() ) do
if peripheral.getType( v ) == sType then
found[ #found + 1 ] = peripheral.wrap( v )
end
end
return unpack( found )
end
local mon = find( "monitor" )
local obj ={}
obj.front = {}
obj.text = {}
obj.text.add = function(text)
obj.text[table.maxn(obj.text)+1] = text
obj.front[table.maxn(obj.front)+1] = 1
end
obj.write = function()
for cnt = 1, table.maxn(obj.text) do
local w,h = term.getSize()
if (obj.front[cnt]-1 < -string.len(obj.text[cnt])) then obj.front[cnt] = w end
obj.front[cnt] = obj.front[cnt] - 1
term.setCursorPos(obj.front[cnt],cnt)
term.write(obj.text[cnt])
–if (obj.front[cnt]+1==w) then obj.front[cnt] = 1 else obj.front[cnt] = obj.front[cnt] + 1 end
–term.write(string.sub(string.rep(obj.text[cnt],2),obj.front[cnt],string.len(obj.text[cnt])))
–if (obj.front[cnt]+1==string.len(obj.text[cnt])) then obj.front[cnt] = 1 else obj.front[cnt] = obj.front[cnt] + 1 end
end
end
return obj
end
local var = textscrolling()
var.text.add("Welcome to Slick MC!")
var.text.add("Remember to vote for food, diamonds, and MK3 Collectors!!!")
var.text.add("Our Website - http://slickmc.enjin.com/")
while true do
term.clear()
var.write()
sleep(0.1)
end