Jump to content


MysticT's Content

There have been 177 items by MysticT (Search limited from 10-February 22)


By content type

See this member's


Sort by                Order  

#131330 Hurt/Heal Forum Staff & Members

Posted by MysticT on 04 July 2013 - 04:32 PM in Forum Games

Edit: damn ninjas :ph34r: Sorry Cranium, I was too slow to save you.

Lets balance things a little.

Heal Cranium MysticT
Hurt nitrogenfingers

AfterLifeLochie: 8
Cloudy: 10
dan200: 11
MysticT: 6 (+1)
nitrogenfingers: 9 (-2)
theoriginalbit: 6



#130975 Path to lua programs in server

Posted by MysticT on 03 July 2013 - 09:41 AM in Ask a Pro

As Pinkishu said, the lua folder (where the rom is) is now inside the zip (in older versions you needed to unzip, that's why you had a folder). But you can still add files to the rom (or override existing ones). Just make a folder in mods, called ComputerCraft, inside that another one called lua, and then one called rom. The path would be something like .minecraft/mods/ComputerCraft/lua/rom (not sure what the path is for tekkit, but it should be something like that).



#130887 Annoying double number

Posted by MysticT on 02 July 2013 - 07:56 PM in Ask a Pro

View Posttheoriginalbit, on 02 July 2013 - 07:24 PM, said:

View PostKingdaro, on 02 July 2013 - 06:55 PM, said:

Try using a format string.
print(string.format('%d', someNumber))
I'd suggest using %i not %d ... %d is very likely that in this context it will keep the .0 as 'd' is Double, so use 'i' for Integer...
Nope, "%d" is for integers too. "%f", "%e" and "%g" are for float/double.
This printf reference lists all the formats you can use. string.format uses printf (in the C version), so this should be the same for CC lua.



#130630 textutils.tabulate & Table in Tables

Posted by MysticT on 01 July 2013 - 01:53 PM in Ask a Pro

If you are using numerical indices, you can use unpack. unpack returns all the values stored in the table (only for numerical indices), so you can then pass them to the tabulate function. Like this:
textutils.tabulate(unpack(tTables))



#130575 Hurt/Heal Forum Staff & Members

Posted by MysticT on 01 July 2013 - 07:53 AM in Forum Games

Heal Lyqyd (hang in there lyqyd, I'll heal you)
Hurt theoriginalbit (how dare you hurting me! :P)

AfterLifeLochie: 7
Cloudy: 7
Cranium: 11
Cruor: 9
dan200: 11
Lyqyd: 5 (+1)
MysticT: 9
nitrogenfingers: 11
theoriginalbit: 10 (-2)



#130490 [Official] CCLite - Lightweight CC Emulator

Posted by MysticT on 30 June 2013 - 06:41 PM in General

View PostKingOfNoobs, on 30 June 2013 - 06:05 PM, said:

View PostMysticT, on 30 June 2013 - 05:55 PM, said:

View PostKingOfNoobs, on 30 June 2013 - 03:11 PM, said:

I just played around with it a little bit and when I tried to edit a file it gave me this error:
[string "edit"]:53:attemp to call field `insert`(a nile value)
The code of the file was(i just made a little program to test this emulator):
table = {"hi", "dude", "hello"}
for i,v in ipairs(table) do
  write(v)
  if i < #table then write(", ") end
end
I hope you can find and fix the bug!
I don't think it's a bug in the emulator. You redefined the "table" table in that program, so any program after that can't use table functions (like table.insert). Just give your table another name, and make it local.
Damn I forgot that! But why should I give it another name or make it local? I just made this to test the emulator.
Well... to avoid that error maybe? :P
I'm just giving you a fix for the problem. If you are not going to use that code, then don't use the fix. But check your code before saying there's a bug (either in CC or some emulator).



#130484 [Official] CCLite - Lightweight CC Emulator

Posted by MysticT on 30 June 2013 - 05:55 PM in General

View PostKingOfNoobs, on 30 June 2013 - 03:11 PM, said:

I just played around with it a little bit and when I tried to edit a file it gave me this error:
[string "edit"]:53:attemp to call field `insert`(a nile value)
The code of the file was(i just made a little program to test this emulator):
table = {"hi", "dude", "hello"}
for i,v in ipairs(table) do
  write(v)
  if i < #table then write(", ") end
end
I hope you can find and fix the bug!
I don't think it's a bug in the emulator. You redefined the "table" table in that program, so any program after that can't use table functions (like table.insert). Just give your table another name, and make it local.



#130069 What was your first post here?

Posted by MysticT on 28 June 2013 - 09:34 PM in General

Looks like mine was this: http://www.computerc...ch__1#entry1328
Helping since the begining :P
I remember I was still learning lua at that time (I started using it just because of ComputerCraft). I was writing the first version of my os, and now, more than a year later, my os is still in development :P (but I know a lot more lua than then, all thanks to CC :))



#129765 BIOS Recommendations?

Posted by MysticT on 27 June 2013 - 11:21 AM in Ask a Pro

View PostPharap, on 27 June 2013 - 03:22 AM, said:

Do be sure to notify me if the __metatable trick works, I would think there's some reason it isn't used, but you never know, it might just be that nobody has tried it before and it turns out to be a much better solution.
It's worked so far. You can't get the string metatable, but it doesn't error like the other method did (wich can be good in some cases, bad in some others). I haven't found any way to bypass this, but that doesn't mean there isn't. Will keep testing that.
The only "problem" I found is that you can't set the metatable for strings (also, it will error if you try). But, who does that anyway? :P



#129436 BIOS Recommendations?

Posted by MysticT on 26 June 2013 - 12:00 PM in Ask a Pro

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If there's no rom file in the lua directory in computercraft, computercraft complains. Also if bios.lua errors, it doesn't give you a line number, it only complains that you have 'installed craftOS wrong'.
Ahhh, now I remember. Yeah, that was anoying :P I think I used another file that loaded the bios or something like that to test.

View PostPharap, on 26 June 2013 - 08:18 AM, said:

If it's that crucial they should really make it Java-side, or at least leave a bit more of a note. Makes me wonder why the usual __metatable trick won't work.
True, not sure why it's not done java-side. But still, I think it should be done, and the bios is the best place to do it (the only safe place to do it actually).
The __metatable way should work. Maybe they should do that java-side. Doing it on the bios would mean that you just need to do it once, since it's modified on every computer. I think I'll do that.



#129281 BIOS Recommendations?

Posted by MysticT on 25 June 2013 - 08:41 PM in Ask a Pro

View PostPharap, on 25 June 2013 - 06:59 PM, said:

I've used CCemu as well, but it has the same problems regardless because the requirement of a rom file and the whole not telling you what line the error is on is an issue with ComputerCraft itself.
I'm not sure what you mean. I never had any problem getting the line number for an error. And what do you mean by "the requirement of a rom file"?

View PostPharap, on 25 June 2013 - 06:59 PM, said:

That bios there has an issue btw. It replaces the native getmetatable.
I may consider it however, depending on what alternatives are available.
Well, originally it didn't change or add any function. But I had to add that one, it's a protection that must be done on the bios. The only change with the native getmetatable is that it doesn't allow to get the string metatable. The string metatable is one for the whole Lua VM, so it's shared across computers. You don't want another computer changing your string functions, do you? :P



#129234 About Linux

Posted by MysticT on 25 June 2013 - 03:54 PM in General

View Posttonkku107, on 25 June 2013 - 12:45 PM, said:

Installed! I don't see any window manager problems
Because there isn't. There used to be performance issues with unity, but it was fixed/improved in one of the latest versions.
What everyone is saying is that they don't like the interface. That is not a problem, but an opinion. Also, if you don't like unity, you can always install another wm. So, that's not a reason to say some distro is bad or not.

View PostShadowedZenith, on 25 June 2013 - 08:24 AM, said:

Also, wasn't Ubuntu adding in like advertisements and stuff into Unity? I could have sworn that they were sending unencrypted searches to Amazon or something like that when you searched your own computer/desktop.
I think you mean the shopping lens. It's not advertisement (it just allows you to make purchases from amazon directly from the dash), but yes, noone was happy when they added it :P. But you can turn it off, so I don't think that's a problem.

Anyway, what I'm trying to say is that not everyone likes the same distro, that's why there is so many of them. So, I think it's pretty stupid to say that some distro is bad, or that someone shouldn't try it out. Let him try it out, then if he doesn't like it he can try another one.



#128891 Mouse and keyboard input simultaneously

Posted by MysticT on 24 June 2013 - 02:03 PM in Ask a Pro

The parallel.waitForAny call should return when one of the functions ends. So, you just have to make the mouse input function end and it will end the other one too. Example:
local input

local function getInput()
  print("Type something:")
  input = read()
end

local function getMouseInput()
  while true do
    local evt, btn, x, y = os.pullEvent("mouse_click")
    break -- stop the loop when we get a mouse click
  end
end

parallel.waitForAny(getInput, getMouseInput)

term.clear()
term.setCursorPos(1, 1)
if input then
  print("Your input: ", input)
else
  print("You clicked the screen!")
end

If this is not what you need, please explain what you are trying to do, so we can help.



#128842 Hurt/Heal Forum Staff & Members

Posted by MysticT on 24 June 2013 - 11:42 AM in Forum Games

Hurt PixelToast
Heal Cranium

Advert: 5
AfterLifeLochie: 9
Casper7526: 10
ChunLing: 8
Cloudy: 9
Cranium: 8 (+1)
Cruor: 9
Dan200: 11
FuzzyPurp: 7
Lyqyd: 8
MysticT: 11
nitrogenfingers: 10
PixelToast: 2 (-2)
remiX: 11
theoriginalbit: 10



#128835 tonumber() not working

Posted by MysticT on 24 June 2013 - 11:20 AM in Ask a Pro

Are you using
x = tonumber(x)
or just
tonumber(x)

The tonumber function will return the value converted to a number (or nil if it can't be converted). So, you have to store that return value somewhere.



#128803 BIOS Recommendations?

Posted by MysticT on 24 June 2013 - 09:33 AM in Ask a Pro

Well, I wrote a bios that supports multi-boot. I use it to test my own OS. Here's the github repo.
Also, I recommend using an emulator (CCEmu or CCDesk) to test. It makes the development faster, since you don't have to go into minecraft, then into the computer, you just have all the computers there in one screen. And it saves some resources too ;)



#128634 Mouse and keyboard input simultaneously

Posted by MysticT on 23 June 2013 - 05:47 PM in Ask a Pro

Why would you write a coroutine manager when you have the parallel api? ;)
local input

local function getInput()
  print("Type something:")
  input = read()
end

local function getMouseInput()
  while true do
    local evt, btn, x, y = os.pullEvent("mouse_click")
    -- Handle the mouse click here
  end
end

parallel.waitForAny(getInput, getMouseInput)



#127091 Get background colour

Posted by MysticT on 17 June 2013 - 05:52 PM in Ask a Pro

You can't. There's no function to get the colors in the screen. However, you could keep track of the colors before writing them to the screen, so you can get it back later. The implementation would depend on your needs, so if you want some help with that, tell us what you're trying to do and we'll do our best to help.



#126821 string.find

Posted by MysticT on 16 June 2013 - 06:12 PM in Ask a Pro

Another option to escaping magic characters would be to perform a plain search:
string.find(line, 'shell.run("herpherp-1.0/herpherp")', 1, true)
Also note that you can use ' for strings, so you don't need to escape the " too.



#126425 raw key events laying over?

Posted by MysticT on 15 June 2013 - 01:55 PM in Ask a Pro

Well, the problem is that there's a "char" event after the "key" event for printable keys. So, you are pulling the "key" event, but the corresponding "char" event is left in the queue, and the shell pulls it and writes it to the console. It shouldn't afect programs, since you will probably pull the char event too. So there's no need to fix this "problem".



#125068 CCDesk PR7.1.1 - CC Networked Emulation Environment

Posted by MysticT on 09 June 2013 - 04:24 PM in APIs and Utilities

View Postbunny365, on 09 June 2013 - 02:35 PM, said:

Either my internet is breaking my downloads again, or the launcher.jar file on the website is missing the Main-Class information in the META-INF.
C:\Users\silly_000\Downloads>java -jar launcher.jar
no main manifest attribute, in launcher.jar
Yeah, I noticed that too. You can start it using:
java -cp ./ccdesk.jar net.deskcc.web.DesktopAppletProxy



#124432 CCDesk PR7.1.1 - CC Networked Emulation Environment

Posted by MysticT on 07 June 2013 - 02:42 PM in APIs and Utilities

View Postcheetah, on 07 June 2013 - 01:07 PM, said:

When I start it, it hangs on "Setting up environment".

OS: Ubuntu 12.04
Java: oracle-java-8
Desktop Environment: Unity
I would recommend using another java version. Java 8 is still in development, so it still has some bugs (last time I tried, sorting didn't work, and some other stuff). I'm not sure if that's the problem you are having, but it's worth trying. Use OpenJDK 7, it works for me (on ubuntu 13.04, should work the same on 12.04).



#122339 Shell.run() problem

Posted by MysticT on 31 May 2013 - 01:30 PM in Ask a Pro

The code is inside an api, right? You can't use the shell api in apis, it's not defined in that environment. You can use os.run instead.



#113932 Necromancy

Posted by MysticT on 30 April 2013 - 02:55 PM in Forum Games

This time I'm sure it's right.
7 days, 13 hours and 16 minutes (wow, a week already)
181 hours (rounded down)



#113826 [help] local variables in environments

Posted by MysticT on 24 April 2013 - 07:45 AM in Ask a Pro

No, local variables are not saved in the environment. The only way to access local variables is to be in the same scope (function, loop, etc.) or using the debug library (wich is not available in CC).