Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
hi I have a very absurd problem. the variables stopped working, I used the java functions to load and save values in .dat file but when they load the value and in turn they have to do an action (like for example value 1 = make the sphere visible) I don't does! moreover, it loads the value without making the object visible !. the scene weighs like 1.7GB memory but the game is super smooth I don't think that's the problem. can you give me some advice. a thousand thanks |
||||
|
Thomas wrote: hi I have a very absurd problem. the variables stopped working, I used the java functions to load and save values in .dat file but when they load the value and in turn they have to do an action (like for example value 1 = make the sphere visible) I don't does! moreover, it loads the value without making the object visible !. the scene weighs like 1.7GB memory but the game is super smooth I don't think that's the problem. can you give me some advice. a thousand thanks Always make backups so you can go back to last working version.(then you can trace error and you know exactly what problems there can be) instead of 1 or 0 you may need to use true or false when making visible or invisible. (depends of course how your loader works) |
||||
|
I also tried with version 6.5 instead of cc 6.5.1. but nothing the script does not work it does not load the values and if it does the values and as if they were not there. |
||||
|
First make sure your script works 100% [even simple typo can mess up whole game-sometimes doesnt even show error message] then create new project (small project) then test script there. Also make sure your dat file is saved as it should be and script reads that file as it should be readed. Cant help you more with this problem because i have no idea how you load how you save and how you use that data. |
||||
|
I use this to upload var varContent = 0; var readline; var varContent = ccbReadFileContent('value.dat'); readline = varContent.substring(16,varContent.length-1) ccbSetCopperCubeVariable('IntegerValue',readline); and this to save and de all in the same folder var varContent = ccbGetCopperCubeVariable('IntegerValue'); var iniFileContent = 'Integer Value = '; iniFileContent += varContent; iniFileContent += '\n'; ccbWriteFileContent('value.dat', iniFileContent); I also made an empty project to test them by pressing a button to activate the loading and one to save it but nothing! I also downloaded the example on the forum and that works .. I tried to do it the same in every single thing and it doesn't work .. absurd! |
||||
|
Have you a link to the forum example? |
||||
|
no I have no examples. also because if I give an example and it works for you and for me it doesn't change? it's not that there is a script limit that cc can support or even actions I don't know .. I'm thinking about them all .. |
||||
|
you said you download an example from the forum, I wanted to compare because all people can do is guess I had issues reading arrays from file because I ended up with blank spaces I was just reading from file, don't you need to close a file after writing to it? Does it load restarting the exe? |
||||
|
I found it doing a search on the name "save" |
||||
|
now it works .. and I don't know why! and calculate badly too! the value inside the .dat file is 10 and I only see 1 .. absurd! does it just happen to me? |
||||
|
If i use your script to read: var varContent = 0; var readline; var varContent = ccbReadFileContent('value.dat'); readline = varContent.substring(16,varContent.length-1) ccbSetCopperCubeVariable('IntegerValue',readline); print(readline); print(ccbGetCopperCubeVariable('IntegerValue') ); And dat file with input: Integer Value = 1447 Then it prints 1447 and sets CC variable to 1447 (i am using windows publish settings so it may be different with webGL version -as i know there is difference with them sometimes.) |
||||
|
Thomas wrote: now it works .. and I don't know why! and calculate badly too! the value inside the .dat file is 10 and I only see 1 .. absurd! does it just happen to me? this is because you are having -1 from the length of your string. in the line readline = varContent.substring(16,varContent.length-1) so if you use '10' then it will print '1' only if you replace the above line of your code with this line readline = varContent.substring(16,varContent.length)then it will print the correct value for you. it will print '10' for you. I don't know why it is printing `1447` for @sven as it should print `144` if he is subtracting the length by 1. I am on an AMD chipset that can be the reason maybe but I am not sure if this has to do with the chipset. |
||||
|
There is a /n at the end of my line in dat file thats why i can 1447 as he saves it so: var varContent = ccbGetCopperCubeVariable('IntegerValue'); var iniFileContent = 'Integer Value = '; iniFileContent += varContent; iniFileContent += '\n'; ccbWriteFileContent('value.dat', iniFileContent); code: var varContent = 0; |
|