morogoth35 Posted June 24, 2017 Share Posted June 24, 2017 (edited) So I really need FISS for a mod I'm making but everytime I try and make a script in FISS it always fails to compile. This is happening even if I copy the full example script from the mod page. Anyone that got FISS working? This is the full example script that does not compile. Script MyScript extends <whatever> ;Variables bool bMyBool int iMyInt string sMyString ;import the FISSFactory to create the FISS Interface import FISSFactory ;Save Function Function MySaveFunction ; get a reference to the FISS Interface FISSInterface fiss = FISSFactory.getFISS() ; check if FISS is installed If !fiss debug.MessageBox(“FISS not installed. Saving disabled”) return endif ; save variables fiss.beginSave(“MyFile.xml”) fiss.saveBool(“MyBool”, bMyBool) fiss.saveInt(“MyInt”, iMyInt) fiss.saveString(“MyString”, sMyString) string saveResult = fiss.endSave() ; check the result if saveResult != “” debug.Trace(saveResult) endif EndFunction ; Load Function Function MyLoadFunction ; get a reference to the FISS Interface FISSInterface fiss = FISSFactory.getFISS() ; check if FISS is installed If !fiss debug.MessageBox(“FISS not installed. Loading disabled”) return endif ; load variables fiss.beginLoad(“MyFile.xml”) bMyBool = fiss.loadBool(“MyBool”) iMyInt = fiss.loadInt(“MyInt”) sMyString = fiss.loadString (“MyString”) string loadResult = fiss.endLoad() ; check the result if loadResult != “” debug.Trace(loadResult) endif EndFunction Here's the errors in the compiler: https://gyazo.com/5166c865e01221016220f75016b20bdc Edited June 24, 2017 by morogoth35 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 24, 2017 Share Posted June 24, 2017 You are using "smart quotes". (i.e. they are curved) You need to use the straight quotes that are native to the keyboard. The compiler doesn't understand the curved quotation marks. Link to comment Share on other sites More sharing options...
morogoth35 Posted June 24, 2017 Author Share Posted June 24, 2017 Wait what? I have never changed them. Is this not the right ones: "" ? Thats my default qoutation marks. If they are not what I need how can I change it? Maybe you know? Link to comment Share on other sites More sharing options...
morogoth35 Posted June 24, 2017 Author Share Posted June 24, 2017 You're right! Thank you! But now I have another compiler error.... Here is the new error: https://gyazo.com/9b16404625907307b9be40304a9c4929 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 24, 2017 Share Posted June 24, 2017 Double check your syntax and/or repost your updated code. The error indicates that a ( is expected but not there. Link to comment Share on other sites More sharing options...
morogoth35 Posted June 24, 2017 Author Share Posted June 24, 2017 (edited) Okay: I am making a death counter mod so the script I'm making needs to on death increase an integer then I need to save it with FISS so here is the updated script: Scriptname DeathCounter extends ReferenceAlias int property DeathCount Event OnDeath(Actor akKiller) DeathCount = DeathCount + 1 saveSettings() EndEvent Function saveSettings() FISSInterface fiss = FISSFactory.getFISS() if fiss fiss.beginSave("DeathCount\\DeathCount.xml", "DeathCount") fiss.saveInt("DeathCount", DeathCount) string saveResult = fiss.endSave() if saveResult == "" debug.MessageBox("Settings Saved") else debug.MessageBox("Error " + saveResult) endif else debug.MessageBox("FISS is not installed. File operations are disabled. Please download FISS from") endif EndFunction endProperty But it fails to compile. Here is the errors in the compiler: https://gyazo.com/4994d40be5d92382a7e799bbde25e2fb And the last error line is in Swedish it translates to this: The objectreference has not been assigned to an object. Edited June 24, 2017 by morogoth35 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 24, 2017 Share Posted June 24, 2017 Add 'Auto' at the end of your property declaration. From int property Deathcountto int property Deathcount auto Link to comment Share on other sites More sharing options...
mrpwn Posted June 25, 2017 Share Posted June 25, 2017 (edited) You have an incomplete definition for an Int property. As IsharaMeradin pointed out, you will probably just want to declare it as an Auto property unless you want to implement some specific behavior when either assigning a value to the property or getting its value. You'll need to remove the EndProperty keyword from the last line or it will cause a compilation error once you have added the Auto keyword. The first error (mismatched input 'Event' expecting FUNCTION) was caused by the fact that you were incorrectly defining a "full" property (i.e. without the Auto keyword). Only specific functions (Set and/or Get functions with the appropriate return values, but at the very least one of the functions is required) may be defined inside of a property definition, but your script contained definitions for an event and a function, which is neither a Set nor a Get function, inside of the property definition. Edited June 25, 2017 by mrpwn Link to comment Share on other sites More sharing options...
morogoth35 Posted June 25, 2017 Author Share Posted June 25, 2017 (edited) Okay I actually made the script compile and after much testing I know that when my character dies it updates the file FISS made but it updates it to nothing other than one. So something with my integer is wrong it seems since the value does not increase past one. I even tried do add an event OnInit and make that event update the int but it still is 1 in the file. Here is the script now: Scriptname DeathCounterScriptTest extends ReferenceAlias import FISSFactory Int DeathCounter Event OnDeath(Actor akKiller) DeathCounter = DeathCounter + 1 BeginLoadPreset() BeginSavePreset() EndEvent Function BeginSavePreset() FISSInterface fiss = FISSFactory.getFISS() If (!fiss) Debug.MessageBox("FISS not installed. Saving disabled.") return EndIf fiss.beginSave("DeathCounter", "DeathCounter") fiss.saveInt("DeathCounter", DeathCounter) string saveResult = fiss.endSave() ; check the result if saveResult != "" debug.Trace(saveResult) endif EndFunction Function BeginLoadPreset() FISSInterface fiss = FISSFactory.getFISS() If (!fiss) Debug.MessageBox("FISS not installed. Loading disabled.") return EndIf fiss.beginLoad("DeathCounter.xml") DeathCounter = fiss.loadInt("DeathCounter") string loadResult = fiss.endLoad() ; check the result if loadResult != "" debug.Trace(loadResult) endif EndFunction Edited June 25, 2017 by morogoth35 Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 25, 2017 Share Posted June 25, 2017 More info than in the quick question and answer thread... I was right, you are updating the variable, loading the stored variable then saving the variable. On the first instance there is no file to load and thus no value to place into the variable and thus it saves the one. On future instances there is a file to load and it will always overwrite the variable's value with 1. Change the position of BeginLoadPreset in the OnDeath event. Make sure it comes prior to updating the DeathCounter variable. Question of my own: Why are you doing this complicated FISS route when you could simply store the value in a global variable and increment it as needed? Link to comment Share on other sites More sharing options...
Recommended Posts