Jump to content




TheOriginalBIT's Programs, APIs, and Utilities

turtle api utility

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

#301 jesusthekiller

  • Banned
  • 562 posts
  • LocationWrocław, Poland

Posted 25 July 2013 - 04:24 AM

Cool :)

#302 Mitchfizz05

  • Members
  • 125 posts
  • LocationAdelaide, Australia

Posted 25 July 2013 - 05:12 PM

Is it really necessary to have that many words in your typing program?
How did you manage?
There are words I've never even heard of in there!

#303 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 25 July 2013 - 08:49 PM

View Postmitchfizz05, on 25 July 2013 - 05:12 PM, said:

Is it really necessary to have that many words in your typing program?
Reduces the chance of duplicates...

View Postmitchfizz05, on 25 July 2013 - 05:12 PM, said:

How did you manage?
There are words I've never even heard of in there!
Online scrabble dictionary... xD So they're all valid scrabble words...

#304 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 30 July 2013 - 08:20 PM

Updated ccConfig to version 2.0!

See change-log link in OP for more details!

#305 mrpoopy345

  • Members
  • 148 posts
  • LocationMy Computer

Posted 23 August 2013 - 03:55 PM

Awesome programs! The door lock is my fav.

#306 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 August 2013 - 04:35 PM

View Postmrpoopy345, on 23 August 2013 - 03:55 PM, said:

Awesome programs! The door lock is my fav.
Thanks :)

#307 Lux

  • Members
  • 19 posts
  • LocationArgentina

Posted 30 August 2013 - 06:22 AM

Thanks for the programs! They are very useful!

#308 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 30 August 2013 - 06:33 AM

View PostLux, on 30 August 2013 - 06:22 AM, said:

Thanks for the programs! They are very useful!
Your welcome. Thanks for the feedback.

#309 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 02:13 PM

I was testing the peripherals of OpenPeripherals for an idea I had earlier, and I decided to use your ccConfig.

I ran into 2 issues.
1) This is the main issue. I try to set the value of a Boolean of a Boolean I had set earlier, and it gives me the error "No key exists for the key 'stored'" (Also, I think you mean "No value for this key"??) I have checked the file generated by ccConfig, and the key and value both exist.

2) getNumber() seems to have an issue. It gives me an error, says it's expecting a boolean, not <whatever number=""> of type number. (I am using -1 here) I have been able to get around this with using getString(), so it's not a big issue.

I left comments in the code where the problems occurred, http://pastebin.com/GHUU7QPA.

Any help would be appricated. Thanks!

Edit: I am using the PIM from OpenPeripherals and the Player Detector from MiscPeripherals in this setup, if that helps.

#310 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 02:41 PM

View PostCascadingDragon, on 04 September 2013 - 02:13 PM, said:

-snip-
Which version are you using, the one from pastebin or github? It just occurred to me that i fixed a few bugs the other day that were reported to me on GitHub, but forgot to update the pastebin (I'll do that now). And yes value was meant, thanks for pointing that out.


EDIT:
getNumber was fixed in the patch the other day, it was a problem in my validation of arguments.
— Your check in addPlayer would not work, make it if fs.exists(name..".cfg") then, as a .cfg is added to the end of the file.
— Just out of curiosity why do you use both new and init? It's not a problem, just curious.
— The reason that setBoolean doesn't work is because you haven't loaded the configuration file. After you create the object with new/init you need to call sFile:load() which loads the configuration file into the memory.
— You will have the same problem in your pullItems function, you don't load it.
— Why do you reset the config file in your pullItems function? You realise that reset turns all the values into the defaults correct?

Edited by theoriginalbit, 04 September 2013 - 02:55 PM.


#311 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 03:05 PM

That resolved both my issues. Although, I believe the 1st issue I had was a user issue, because the main program (I made a debug copy once I seen issues) has con:load(), and my debug version didn't.
Thanks!!

#312 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 03:10 PM

View PostCascadingDragon, on 04 September 2013 - 03:05 PM, said:

-snip-
Yeh I'm sorry, I always forget about the whole updating my pastebin's when I push out bug fixes on GitHub.

#313 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 03:21 PM

It actually appears to me, that your save() function isn't working.
In my test program, I generate the config with all the defaults. Afterwards, in a different function, I set the value of 1 boolean and up to 40 numbers.
If I run the program without a config file generated, it runs smoothly, but the values are never updated, even after a save. If I run the program again, with the config file generated, it actually tells me that the key doesn't exist. Looking at the config file, the numbers are all default, and the boolean isn't in the file.
I added a reset() to the end of my program, along with a save(), and the boolean was not in the file after the reset.
Any ideas?

#314 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 03:25 PM

Wait what? All my debug programs work perfectly fine in regards to saving and adding new values and such, is it possible that you can send me the main code you're using here so I can test with that? you may have found like some boundary case I didn't think of or something...

#315 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 03:36 PM

Here.

Yeah, the code contains code for OpenPeripheral's PIM and MiscPeripheral's Player Detector however. If you don't have them , the code obviously won't work. If you need me to, I'll create one that simulates the program without them.

#316 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 03:48 PM

View PostCascadingDragon, on 04 September 2013 - 03:36 PM, said:

Yeah, the code contains code for OpenPeripheral's PIM and MiscPeripheral's Player Detector however. If you don't have them , the code obviously won't work. If you need me to, I'll create one that simulates the program without them.
It's ok, I could have easily changed it myself...

However I've discovered your problem:

To tackle the first problem of the values never updating — this is because in the pullItems function you reset the configuration file back to the default values at the end of the function, what was your intention by calling the sFile:reset()?

Now to tackle the second problem, the boolean not being in the file — in your pullItems function you do not load the config file, as such the contents of the config file are only the numbers, meaning that when you save the file it only the new values go in because you haven't loaded the old ones.

Thank you so much as you have illuminated some problems on my end that I need to fix so people cannot make these mistakes again, for example being able to change the file without first using load.

#317 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 04:06 PM

Just resetting everything to default, but that function only gets called at the end, when the crux of the issue was in the middle of the function. However, since I was not loading it, the issue is moot.

(I just seen your edit of your original post to me, where you pointed out the issues in the first place. Also, I use init() instead of new() to signify the difference between when I am creating a file and when I am loading a file object. Just like if I was programming something in Python, new() would be my empty object, and init() would be loading a existing file [Which doesn't completely make sense since a newly created object also calls __init__() in Python but.... go with it])

I would recommend detecting and auto loading with init() or create a function that auto loads.

Slight tangent: I find it strange (as a self taught programmer) that I should call new()/init() with the path of an existing file, and also call load() on it. Maybe it's common convention, but I generally don't look at other people's Python/Java code. I really am only using your code cause... Minecraft is my lazy time. Haha :)

Edit: How does grammar work? Le sigh. My formatting and grammar suck >.>

#318 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 04:15 PM

View PostCascadingDragon, on 04 September 2013 - 04:06 PM, said:

Just resetting everything to default, but that function only gets called at the end, when the crux of the issue was in the middle of the function.
See but the problem here is that a file does not save until you call the save function, think of all the get/set's as writing to a buffer, and the save as the flushing the buffer to the file.

View PostCascadingDragon, on 04 September 2013 - 04:06 PM, said:

Also, I use init() instead of new() to signify the difference between when I am creating a file and when I am loading a file object. Just like if I was programming something in Python, new() would be my empty object, and init() would be loading a existing file [Which doesn't completely make sense since a newly created object also calls __init__() in Python but.... go with it])
Yes well Python is really the only Language I know of that uses init in that way, I was basing the name init on how in Objective-C it is the same as using new. And if you actually look in the code it is the same implementation.

View PostCascadingDragon, on 04 September 2013 - 04:06 PM, said:

I would recommend detecting and auto loading with init() or create a function that auto loads.
I'm going to make it so people cannot change values without first using the load function.

View PostCascadingDragon, on 04 September 2013 - 04:06 PM, said:

Slight tangent: I find it strange (as a self taught programmer) that I should call new()/init() with the path of an existing file, and also call load on it. Maybe it's common convention, but I generally don't look at other peoples Python/Java code. I really am only using your code cause... Minecraft is my lazy time. Haha :)
Basically I based this off another API I've used in the past and that is how they did it and I quite like the design pattern they have used.

#319 CascadingDragon

  • Members
  • 7 posts

Posted 04 September 2013 - 04:22 PM

View Posttheoriginalbit, on 04 September 2013 - 04:15 PM, said:

See but the problem here is that a file does not save until you call the save function, think of all the get/set's as writing to a buffer, and the save as the flushing the buffer to the file.
For the end file, yes, I kinda overlooked that. The main issue inside the function was fixed with a load().

View Posttheoriginalbit, on 04 September 2013 - 04:15 PM, said:

Yes well Python is really the only Language I know of that uses init in that way, I was basing the name init on how in Objective-C it is the same as using new. And if you actually look in the code it is the same implementation.
I knew it was the same from your documentation, I use them currently to signify to myself when I am creating a config file and when I am loading one.

View Posttheoriginalbit, on 04 September 2013 - 04:15 PM, said:

I'm going to make it so people cannot change values without first using the load function.
That would be good as well.

View Posttheoriginalbit, on 04 September 2013 - 04:15 PM, said:

Basically I based this off another API I've used in the past and that is how they did it and I quite like the design pattern they have used.
Whatever works for you. You did a great job. I'm just having so many issues because of being self-taught, I believe. That and I hate editing in Minecraft, and overlook things constantly.

Well thank you for the help.
Cheers!

#320 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 04 September 2013 - 04:31 PM

View PostCascadingDragon, on 04 September 2013 - 04:22 PM, said:

I knew it was the same from your documentation, I use them currently to signify to myself when I am creating a config file and when I am loading one.
Fair enough, as I said it wasn't a problem in your code, I was just curious with that one. And wow thanks for actually reading my documentation! So many people don't, and so many people don't appreciate or understand the time I put into those to make them useful.

View PostCascadingDragon, on 04 September 2013 - 04:22 PM, said:

Whatever works for you. You did a great job. I'm just having so many issues because of being self-taught, I believe. That and I hate editing in Minecraft, and overlook things constantly.
I am considering changing it now slightly in a version 3.0, we shall see what I end up with. Also if you wish to continue programming in Minecraft, look up LuaIDE on these forums, it's made by GravityScore and it really does make in-game editing nice, however if you have access to the Minecraft world data, definitely external editing with Sublime Text 2 and GravityScore's ComputerCraft plugin (also on the forums, search "sublime" in the utilities section) for it is very nice.

View PostCascadingDragon, on 04 September 2013 - 04:22 PM, said:

Well thank you for the help.
No problems, thanks for pointing out some problems with some stuff I was doing.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users