Jump to content




Jesusthekiller's Programs || Guess the number minigame | Random string generator | cPrint | WCON

lua api utility

  • You cannot reply to this topic
33 replies to this topic

Poll: About my code :)

What API/program do you like?

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote Guests cannot vote

#1 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 19 April 2013 - 08:24 AM

Jesusthekiller's World

Welcome to the madness!






This thread is not being updated! For accurate info go to my website (link at the top).


APIs section:

cPrint - Adds color codes!

Spoiler


WCON - Control computers over the internet!

Spoiler


Programs section:


Debugging (Inactive for now):

Spoiler




Code snippets:


Spoiler




Tutorials:


Upcomming:

  • Pacman - Package manager for Computer Craft. Website
  • linuxOS - Goal: Bring linux experience to CC!


#2 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 19 April 2013 - 09:22 AM

cPrint api is really useful. Nice work :)

#3 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 19 April 2013 - 09:23 PM

I'm glad you like it :)

#4 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 19 April 2013 - 09:27 PM

Nice. :) Seems everyone is going to the 'all-in-one' posts now :)

here is what I said about cPrint in its thread
Spoiler


#5 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 05:07 AM

cPrint update!
  • Added cwrite
  • Added update
  • cprint now adds "\n" to the end of the line
  • Improved cCode
  • Improved toCode
  • Auto updater


You can disable auto updates check by changing 2nd cPrint line from
local auto = true
to
local auto = false


Massive thanks to theoriginalbit for help with cCode and toCode :D

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 April 2013 - 05:20 AM

View Postjesusthekiller, on 20 April 2013 - 05:07 AM, said:

Massive thanks to theoriginalbit for help with cCode and toCode :D
No problems :)
Oh I forgot to mention that if you wanted the cCode to default to white if the input was invalid just make it this
function cCode(h)
  return 2 ^ (tonumber(h, 16) or 0)
end
that way if tonumber returns nil it will default to 0 ... 2 ^ 0 = 1 and 1 is colours.white...

#7 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 20 April 2013 - 05:22 AM

View Posttheoriginalbit, on 20 April 2013 - 05:20 AM, said:

-snip-
Oh I forgot to mention that if you wanted the cCode to default to white if the input was invalid just make it this
function cCode(h)
  return 2 ^ (tonumber(h, 16) or 0)
end
that way if tonumber returns nil it will default to 0 ... 2 ^ 0 = 1 and 1 is colours.white...

It was my fail fuse left from testing. This will be included in next update tho :)

#8 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 21 April 2013 - 03:50 AM

cPrint update!
  • Support for non-advanced computers
  • Bugfixes


#9 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 April 2013 - 03:54 AM

View Postjesusthekiller, on 21 April 2013 - 03:50 AM, said:

Support for non-advanced computers
Where exactly? I was expecting to see
if term.isColor and term.isColor() then
 -- change text and bg colour here
end


#10 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 21 April 2013 - 08:05 AM

View Posttheoriginalbit, on 21 April 2013 - 03:54 AM, said:

-snip-
Where exactly? I was expecting to see
if term.isColor and term.isColor() then
-- change text and bg colour here
end

If color code ~= black then
  write as white
else
  write as black
end

;)

#11 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 21 April 2013 - 11:45 PM

I have to warn you that your wcon interface is vulnerable to sql injection. Another guy told you the same in the previous thread and you simply answered that it wasn't true. :P But it is... I can PM you the details if you like.

#12 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 21 April 2013 - 11:53 PM

Duh, I'm too lazy to recode it...

Ok, I will.




*epic rage* DAMN YOU NOT WORKING NETBEANS!

#13 Orwell

    Self-Destructive

  • Members
  • 1,091 posts

Posted 22 April 2013 - 12:14 AM

View Postjesusthekiller, on 21 April 2013 - 11:53 PM, said:

Duh, I'm too lazy to recode it...

Ok, I will.




*epic rage* DAMN YOU NOT WORKING NETBEANS!

Yeah, you should indeed. :P Passwords are rather useless if one can control any computer without them.

#14 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 22 April 2013 - 12:24 AM

Yeah. My MySQLi just broke.
I need MySQLi with MySQLnd driver.
I hate this world.


I love world again :D
Got MySQLnd!

#15 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 01:46 AM

View Posttheoriginalbit, on 21 April 2013 - 03:54 AM, said:

View Postjesusthekiller, on 21 April 2013 - 03:50 AM, said:

Support for non-advanced computers
Where exactly? I was expecting to see
if term.isColor and term.isColor() then
-- change text and bg colour here
end
Yeah, that's not necessarily needed for non-advanced computers, since they do have isColor() and it just returns false.
You only need to check for the existence of isColor if you're running the program on an older version of CC which didn't yet have advanced computers.

So strictly speaking, it'll not be compatible with older versions of CC, but the claimed "Support for non-advanced computers" is fullfilled. ^_^

#16 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 22 April 2013 - 01:50 AM

Repaired SQL-Injection hole in WCON.


Whoever made "Ahoj" at their reg1 in WCON - You've made my day ;)

#17 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 April 2013 - 01:50 AM

View PostEspen, on 22 April 2013 - 01:46 AM, said:

Yeah, that's not necessarily needed for non-advanced computers, since they do have isColor() and it just returns false.
You only need to check for the existence of isColor if you're running the program on an older version of CC which didn't yet have advanced computers.
Yeh its habit for me to type it that way, and its not like it would do any harm checking that anyway. Just printing the text without the colour formatters on a pre1.4 computer.

EDIT: Ahh found why I was so confused... the pastebin is still 1.1 not 1.2 ... update your pastebin :P

Edited by theoriginalbit, 22 April 2013 - 01:53 AM.


#18 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 22 April 2013 - 01:56 AM

View Posttheoriginalbit, on 22 April 2013 - 01:50 AM, said:

-snip-
EDIT: Ahh found why I was so confused... the pastebin is still 1.1 not 1.2 ... update your pastebin :P

Oh, I've updated it, but I have not saved it :P

#19 Espen

    Curious Explorer

  • Members
  • 708 posts

Posted 22 April 2013 - 01:56 AM

View Posttheoriginalbit, on 22 April 2013 - 01:50 AM, said:

Yeh its habit for me to type it that way, and its not like it would do any harm checking that anyway. Just printing the text without the colour formatters on a pre1.4 computer.
I feel you, I do the same. Better safe than sorry when it comes to requirement-checks.
One can overdo it, I suppose. But trying to make your programs backwards-compatible from the get-go is a good habit.
I'm just speaking for myself though, so no offense to anyone who doesn't follow that. ( ->Heh, apparently better safe than sorry is deeply ingrained in my brain.^^)

#20 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 April 2013 - 02:01 AM

View Postjesusthekiller, on 22 April 2013 - 01:56 AM, said:

Oh, I've updated it, but I have not saved it :P
So you changed it, but didn't press save... or does pastebin have some "save but don't publish" button I don't know about?

View PostEspen, on 22 April 2013 - 01:56 AM, said:

I feel you, I do the same. Better safe than sorry when it comes to requirement-checks.
One can overdo it, I suppose. But trying to make your programs backwards-compatible from the get-go is a good habit.
Yeh definitely... see if it was me making the function safe for all computers I would be doing this
Spoiler

Edited by theoriginalbit, 22 April 2013 - 02:02 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users