- Sky
- Blueberry
- Slate
- Blackcurrant
- Watermelon
- Strawberry
- Orange
- Banana
- Apple
- Emerald
- Chocolate
- Charcoal
-
Content Count
451 -
Joined
-
Last visited
-
Days Won
35
Everything posted by Molinko
-
I would recommend using strictly local variables. Your problem is coming from the fact that the variables _rpx and _rpy are expected to be global but are only initialized in the 'printBack' function. This is a problem for the definition of 'readUrl' above that which expects _rpx and _rpy to be able to do its job. I believe a simple fix would be this.... I think this is your issue... Im afraid i haven't had the chance to test. Good luck I was stupid.. Your problem is on line #52. term.setCursor(rpx, rpy) should be term.setCursor(_rpx, _rpy) -- you named the variables w
-
The component lib must be loaded with the require statement. In CC you would call global fn peripheral.wrap. In OC... local component = require 'component' local modem = component.getPrimary 'modem' --...
-
Post you code. All of it. Then I can help you
-
I would recommend not executing strings sent down a network.. If you're just in a SP world then fine, have at it. But, if you're on multiplayer then this is a big security problem. Just saying.. A better solution would be to design commands / responses with parameters that can be sent between the client and server. i.e. -- # On the server -- # Other code implied up hurr... local commands = { openIris = function() if s.irisState() ~= 'offline' then m.send( f1, 20, 'Opening Iris.' ) end end, dial = function( address ) if s.irisState() == 'idle' then m.send( f1, 20, stri
-
I think this is what you mean...? local term = require 'term' local component = require 'component' local gpu = component.getPrimary 'gpu' -- text color palette color? (true or false) (optional) -- Takes ( 'some string to color', number_color, [isPaletteColor] ) local function cWrite( text, fgc, pIndex ) local old_fgc, isPalette = gpu.getForeground() pIndex = ( type( pIndex ) == 'boolean' ) and pIndex or false gpu.setForeground( fgc, pIndex ) write( text ) gpu.setForeground( old_fgc, isPalette ) end -- Usage: cWrite( 'Hello colorfully', 0x2E86C1 )
-
event.listen works like this.... -- your handler local function doOnEvent(event, ...) print( event, ... ) end -- pass handler to event.listen to be called when there is a 'key' event. -- It will recieve the event and any other pertinent parameters like which key was pressed. event.listen( 'key', doOnEvent ) -- Pass event.ignore your previously registered handler to stop it from passing any future event when we're done. event.ignore( 'key', doOnEvent ) My point is that event.listen( 'someEvent', handler ) will be called even after your program has ended. So, if you were experimenting
-
A. Have you called event.listen with a handler that prints in a previous program or the lua prompt?? B. Can I see your code for the program if your problem doesn't extend from A?
-
Trouble networking with ComputerCraft via Relay
Molinko replied to TopOrDrop's question in Programming
I'm fairly sure the relay will interface with cc network cable and reciece wired messeges. I don't think its meant to be a modem for cc. Hook up a cc wired modem to a cc computer and run cc network cable to a relay on an oc network.- 2 replies
-
- cc
- computercraft
-
(and 5 more)
Tagged with:
-
For your first question, you're spot on. Var args are passed like a function to a program. I'm not sure if they're all strings and/or numbers.. You might have to parse em.. Try something like this.. local args, opts = shell.parse(...)
-
kernel:1439 bios:58 no bootable medium found: file not found
Molinko replied to szo1's question in Miscellaneous
Put eeprom in eeprom slot with 'luabios' eeprom. -
The receiving computer must specify a port to open. It can the get messages over that port.
-
Program exits for no reason and wipes screen after it
Molinko replied to nezd's question in Programming
Line 64 "::settingsentrence::" <-no. The next line is term.clear().... -
When prototyping libs its helpful to put this at the top of your script to reload a specific library loaded with require. _G.packages.loaded["myLibFileName"] = nil -note the file name is extension less, And should be used before your call to require your lib.
-
Event.listen runs above your program. Every time you 'touch' the os calls the function passed to event.listen. no need for the while loop. At the end of you program remove the listener so it doesn't continue after your program exits
-
This would be my implementation of my suggestion... Just for shits.. local players = {} for _, name in pairs(acceptableEntities) do players[name] = name end local function isValid(name) return players[name] and true or false end while true do local _,_,x,y,z,entity = event.pull("motion") if math.abs(x)<= tonumber(range) and math.abs(y)<= tonumber(range) and math.abs(z)<= tonumber(range) then --if recieved motion was within range if isValid(entity) then -- entity will always be a string. So will program arguments redstone.setOutput(side,15) os.sleep(st
-
Its a nice program. A suggestion of mine would be to use a lookup list to speed up the indexing of vaild players. i.e local players = { Sangar = true, Gangsir = true } Then... if players[player.name] then ... This will be faster than looping the ordered list. Hope this is helpful
-
Go to the root directory '/' by typing 'cd /' and hitting 'enter' key. run this program 'wget' like so... "wget https://raw.githubusercontent.com/OpenPrograms/Sangar-Programs/master/geo2holo.lua geo2holo.lua" You don't need the quotes when you run wget. The program will be saved as "geo2holo.lua". Run "geo2holo.lua" to start the program.
-
Take a look at this example program Sangar made that does just what you're looking for.
-
function textTools.centerText(_str, x1, x2) term.write( text.padLeft(_str, x1 + math.floor((x2 - x1) / 2) - math.floor(#_str / 2)) ) end I think that'll do what you need bud.
- 1 reply
-
- text
- formatting
-
(and 1 more)
Tagged with:
-
component.inventory_controller.address *remember lua is case sensitive.
-
-
ComputerCraft to OpenComputers -> parallel API
Molinko replied to TheEisbaer's question in Programming
I might consider just porting the parallel api from cc if that's what you want.. Its not that big of a lib and fairly strait forward -
I have an idea to get you started on porting this to OC. There are a few libraries that aren't available globally like their CC counterparts. I.E. the term library isn't global and yadda.... This is a step to get you on your way. -- Component lib for access to the gpu local component = require "component" -- Put term lib into local space.. local term = require "term" -- Other libs we need as well local colors = require "colors" local textutils = require "serialization" -- CC to OC. The 'serialize' method is used the same here i think.... local gpu = component.getPrimary('gpu') local fs =
-
If you have autorun.lua enabled by default in OpenOs, which I believe it is by default, the easiest way is create a new file in / dir named 'autorun.lua' and save this text... <CODE> os.execute("resolution Xwidth Yheight") xwidth and height are strings of the number width and height you want <\CODE>
- 7 replies
-
- resolution
- script
-
(and 1 more)
Tagged with:
-
FYI you can put some upgrades in the adapter block I.E. an inventory_controller To see chest contents and I believe manipulate them.