Jump to content

[LE] FISS Can't get any of the scripts to work


Recommended Posts

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 by morogoth35
Link to comment
Share on other sites

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 by morogoth35
Link to comment
Share on other sites

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 by mrpwn
Link to comment
Share on other sites

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 by morogoth35
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...