TheOriginalBIT's Programs, APIs, and Utilities
#301
Posted 25 July 2013 - 04:24 AM
#302
Posted 25 July 2013 - 05:12 PM
How did you manage?
There are words I've never even heard of in there!
#303
Posted 25 July 2013 - 08:49 PM
mitchfizz05, on 25 July 2013 - 05:12 PM, said:
mitchfizz05, on 25 July 2013 - 05:12 PM, said:
There are words I've never even heard of in there!
#304
Posted 30 July 2013 - 08:20 PM
See change-log link in OP for more details!
#305
Posted 23 August 2013 - 03:55 PM
#307
Posted 30 August 2013 - 06:22 AM
#309
Posted 04 September 2013 - 02:13 PM
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
Posted 04 September 2013 - 02:41 PM
CascadingDragon, on 04 September 2013 - 02:13 PM, said:
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
Posted 04 September 2013 - 03:05 PM
Thanks!!
#313
Posted 04 September 2013 - 03:21 PM
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
Posted 04 September 2013 - 03:25 PM
#316
Posted 04 September 2013 - 03:48 PM
CascadingDragon, on 04 September 2013 - 03:36 PM, said:
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
Posted 04 September 2013 - 04:06 PM
(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
Posted 04 September 2013 - 04:15 PM
CascadingDragon, on 04 September 2013 - 04:06 PM, said:
CascadingDragon, on 04 September 2013 - 04:06 PM, said:
CascadingDragon, on 04 September 2013 - 04:06 PM, said:
CascadingDragon, on 04 September 2013 - 04:06 PM, said:
#319
Posted 04 September 2013 - 04:22 PM
theoriginalbit, on 04 September 2013 - 04:15 PM, said:
theoriginalbit, on 04 September 2013 - 04:15 PM, said:
theoriginalbit, on 04 September 2013 - 04:15 PM, said:
theoriginalbit, on 04 September 2013 - 04:15 PM, said:
Well thank you for the help.
Cheers!
#320
Posted 04 September 2013 - 04:31 PM
CascadingDragon, on 04 September 2013 - 04:22 PM, said:
CascadingDragon, on 04 September 2013 - 04:22 PM, said:
CascadingDragon, on 04 September 2013 - 04:22 PM, said:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











