Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Savegame files (instead of in the registry)?

j9907
Registered User
Quote
2018-10-18 17:05:47

Is there a cleaner way for storing variables across sessions aside from using the registry? Ideally it'd be a text file. I see ccbWrite/readto/fromFile is something which might be of use, but how would I make it read the file and check if a variable equals something and, if it does, then unlock specific levels / do certain things?


niko
Moderator
Quote
2018-10-19 07:46:02

You need to parse the file. Whatever file format you are going to use, write it in and parse it to read it out.


j9907
Registered User
Quote
2018-10-20 09:04:21

Hmm... Yeah, this is confusing already :) hah. Damn I need to learn JavaScript since I'm as confused as someone trying to use a bow and arrow and hit a moving target with a blindfold covering my eyes...


I tried this:

ccbWriteFileContent (savegame.lvl, level1) ;

and it said savegame.lvl and level1 were not defined. I'm guessing this is saying the things I entered weren't defined (it doesn't know what they are). It's a bit confusing... hmm


tim12345
Guest
Quote
2018-10-20 09:17:29

put quotation marks around savegame.lvl and level1 and see what happens. without them you are assuming they are declared variables.

p.s. you probably dont exactly need to learn javascript to do this.


j9907
Registered User
Quote
2018-10-20 09:24:58

Great! That worked.

hmm, now that I think of it, I don't know how I'd make it read the file, check if it equals a specific value (level1, level2, etc..) and, if so, do certain things. I very well may be best off using the registry since my idea of having actual files is a bit convoluted and far-reaching for me right now. hah


tim12345
Guest
Quote
2018-10-20 09:49:45

basically something like this...

var checklevel = ccbReadFileContent("savegame.lvl");

if(checklevel == "level1"){
ccbSwitchToScene("level1");
}


i think it pretty much speaks for itself.


j9907
Registered User
Quote
2018-10-20 10:19:07

It works! Thanks!


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact