lofgren Posted September 1, 2014 Share Posted September 1, 2014 Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could. http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_Script Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 1, 2014 Share Posted September 1, 2014 Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could. http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_ScriptDoesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object. Link to comment Share on other sites More sharing options...
lofgren Posted September 1, 2014 Share Posted September 1, 2014 Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could. http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_ScriptDoesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object. Nope. Read the first line: "Often you will need to get a property of a quest script, and use it in a result script somewhere else." Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 1, 2014 Share Posted September 1, 2014 Alternatively you can reference the property in the script directly by adding the form that the original script is on as a property of that script to your seconds script. Which has probably just confused you more. Here, the wiki does a better job of explaining it than I could. http://www.creationkit.com/Variables_and_Properties#Getting_Properties_of_a_Quest_ScriptDoesn't this only apply to scripts that are on the same thing though? If so, then it won't help me since my scripts aren't on the same object. Nope. Read the first line: "Often you will need to get a property of a quest script, and use it in a result script somewhere else." Mmk... I think I'm just going to create a global variable though, so... Thanks for the information. Link to comment Share on other sites More sharing options...
lofgren Posted September 1, 2014 Share Posted September 1, 2014 Global is probably better for this particular use anyway. Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 1, 2014 Share Posted September 1, 2014 Okay... I'm a bit confused... I created the global variable under Misc/Global with name recordGoldValue, made it into a property in the chest script (GlobalVariable Property recordGoldValue Auto), set a value to it in the chest script (recordGoldValue.SetValue((myGoldValue as Float)) //myGoldValue is another property within the chest script), then try to get the value of it in the button script (value = (recordGoldValue.GetValue() as Int) //value being an integer property in the button script), and try to display it (Debug.MessageBox(value + " is the value of items in your chest")). When I tested to see if it is working, however, it just says "0 is the value of the items in your chest"... did I miss something, or do something wrong? Link to comment Share on other sites More sharing options...
Mattiewagg Posted September 1, 2014 Author Share Posted September 1, 2014 First off, you don't set value as int. SetValue/GetValue - Sets and gets float values SetValueInt/GetValueInt - Sets and gets int values No need to cast. Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too. Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 First off, you don't set value as int. SetValue/GetValue - Sets and gets float valuesSetValueInt/GetValueInt - Sets and gets int values No need to cast. Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too.The Creation Kit site recommends casting instead of using the SetValueInt()/GetValueInt() functions... only reason I was using cast. So you're telling me instead of passing it (myGoldValue as Float) I could just pass it (myGoldValue) since myGoldValue is an Int property? Link to comment Share on other sites More sharing options...
Mattiewagg Posted September 2, 2014 Author Share Posted September 2, 2014 First off, you don't set value as int. SetValue/GetValue - Sets and gets float valuesSetValueInt/GetValueInt - Sets and gets int values No need to cast. Make sure your property is filled, and the script properly compiles. Showing us your script would be nice too.The Creation Kit site recommends casting instead of using the SetValueInt()/GetValueInt() functions... only reason I was using cast. So you're telling me instead of passing it (myGoldValue as Float) I could just pass it (myGoldValue) since myGoldValue is an Int property? Alright... You can do that. It may be true that the int functions are a little slower. If: You are setting a float, or something that doesn't need to be cast as an int (i.e. 1.000000 is the same as 1 when used as a bool, no need to cast that). Use SetValue/GetValue When trying to set or get an integer: You can use the Set/Get Int functions, without having to cast, or you can SetValue/GetValue as Float. Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 The scripts I'm working with atm are: ScriptName ConllectionChestScript extends ObjectReferenceInt Property myGoldValue = 0 AutoInt Property itemValue AutoMiscObject Property Gold001 AutoGlobalVariable Property convertGoldValue AutoEvent OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)If akSourceContainer == Game.GetPlayer()itemValue = akBaseItem.GetGoldValue()itemValue = (itemValue * aiItemCount)myGoldValue += itemValueconvertGoldValue.setValue((myGoldValue as Float))EndIfIf akBaseItem == Gold001resetGoldValue()EndIfEndEventEvent OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer)If akDestContainer == Game.GetPlayer()itemValue = akBaseItem.GetGoldValue()itemValue = (itemValue * aiItemCount)myGoldValue -= itemValueconvertGoldValue.setValue((myGoldValue as Float))EndIfEndEventFunction resetGoldValue()myGoldValue = 0ReturnEndFunction and ScriptName ConvertButton extends ObjectReferenceObjectReference Property CollectionChest AutoInt Property value = 0 AutoMiscObject Property Gold001 AutoEvent OnActivate(ObjectReference akActionRef)Utility.Wait(1.0)value = (convertGoldValue.getValue() as Int)Debug.MessageBox(value + " is the value of items in your chest")EndEvent Link to comment Share on other sites More sharing options...
Recommended Posts