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

Pound Sign in CC

Started by Astrophylite, 11 August 2015 - 03:20 PM
Astrophylite #1
Posted 11 August 2015 - 05:20 PM
Hi,

I have always wondered. Why can you not print "£" in ComputerCraft? I know you can, but when you press backspace, it turns into a question mark.

Another question, how can I grab the tKeys table from the Keys API?

Thanks in advance,
_Zircon_

EDIT: Just thought of another question. How do you stop shutting down and rebooting ?
Edited on 11 August 2015 - 03:23 PM
HPWebcamAble #2
Posted 11 August 2015 - 05:26 PM
Not sure about the pound sign.
When I try to copy and paste it into a CC computer (Well, CCEmuRedux), it errors with

window:94: Arguments must be the same length
Probably cause it messes with 'term.blit', CC might see it as more than 1 character or something


As for the Keys API, you can find it in the CC Jar file.
(You can obviously see it in-game, but you can't copy that)
Astrophylite #3
Posted 11 August 2015 - 05:28 PM
Thanks for your quick response!
I guess I will just keep messing around trying to get it to work, and then I will post a solution if I find one!
HPWebcamAble #4
Posted 11 August 2015 - 05:47 PM
Just noticed your edit:
EDIT: Just thought of another question. How do you stop shutting down and rebooting ?

You'd override 'os.shutdown()' and 'os.reboot()', like so:

local oldShutdown = os.shutdown
local oldReboot = os.reboot

os.shutdown = function()
  --# The new shutdown procedure
end

os.reboot = function()
  --# The new reboot procedure
end

EDIT: This stops other programs from shutting down / rebooting the computer. Ctrl+r / Ctrl+s can't be prevented
Almost forgot about this!
Edited on 11 August 2015 - 03:56 PM
Astrophylite #5
Posted 11 August 2015 - 05:49 PM
-snip-
Thanks!
KingofGamesYami #6
Posted 11 August 2015 - 05:52 PM
Control+S and Control+R cannot be stopped, just so you know. You can stop programs from shutting down the computer, but not players.
Astrophylite #7
Posted 11 August 2015 - 05:55 PM
Control+S and Control+R cannot be stopped, just so you know. You can stop programs from shutting down the computer, but not players.
They can be overridden as HPWebcamAble said.
HPWebcamAble #8
Posted 11 August 2015 - 05:58 PM
Control+S and Control+R cannot be stopped, just so you know. You can stop programs from shutting down the computer, but not players.
They can be overridden as HPWebcamAble said.

Well, the functions can.
But the key combinations cannot be, they are hardcoded through Java.
Astrophylite #9
Posted 11 August 2015 - 05:58 PM
Hmm. Just remembered that CTRL+S / CTRL+R don't use os.reboot() or os.shutdown() ;(
Now I see what you guys meant :D/>
Bomb Bloke #10
Posted 11 August 2015 - 11:59 PM
CC might see it as more than 1 character or something

That's pretty much it, any characters above 126 are generally rendered as question marks, assuming that code doesn't bomb out and turn them into two-byte unicode symbols.

I find that by way of simply bypassing the window API I can indeed paste symbol 163, £, in (can't type it as not all keyboards have it), but you still end up with a two-byte value. What's interesting is that it renders in the first place!

Manually defining higher characters with string.char() avoids the unicode thing, but still doesn't allow you to render outside of the 32 - 126 character range (probably because Dan's font-cropping system would make many symbols outside of it illegible). There's a number of threads around discussing it - eg, eg, eg - though thus far I haven't noticed Dan acknowledging it, let alone any interest in fixing it. I suspect the current plan of updating LuaJ will sort it out.