naaitsab Posted April 20, 2014 Share Posted April 20, 2014 Hi there, This is my very first script so please keep that in mind :confused:I want to activate an item which then pops up a messagebox with some text and values. The activate and popup section goes without a problem but I don't seem to get the proper value's from the globals (both Short).At the moment I have the current code running on the item. The global vars ingame show 13.0 and 2.0 so they have a value. The only problem is that the value displayed in the messagebox is 0.000000 Scriptname LedgerMessage extends ObjectReference GlobalVariable Property Myvalue1 Auto GlobalVariable Property Myvalue2 Auto Float Value1 Float Value2 Event OnActivate(ObjectReference akActionRef) Value1 = Myvalue1.GetValue() Value2 = Myvalue2.GetValue() Debug.MessageBox("value 1 = " + "\n" + Value1 + "\n" + "value 2 = " + "\n" + Value2) endEvent I changed the names for value for more easy of use, in reality they are named different of course. The code compiles without any problems. I just get 2 times 0.00000 instead of 13 and 2. Searched all morning for a solution but couldn't find one. Will be a real noob solution but I can't figure out why it doesn't work. Thanks :laugh: Link to comment Share on other sites More sharing options...
fore Posted April 20, 2014 Share Posted April 20, 2014 My usual mistake: forget to fill the properties where the script is called. :smile: Link to comment Share on other sites More sharing options...
naaitsab Posted April 20, 2014 Author Share Posted April 20, 2014 My usual mistake: forget to fill the properties where the script is called. :smile:Bit weird that you need to assign the value again in the properties window but it did the trick. Thanks man :smile: Link to comment Share on other sites More sharing options...
fore Posted April 20, 2014 Share Posted April 20, 2014 My usual mistake: forget to fill the properties where the script is called. :smile:Bit weird that you need to assign the value again in the properties window but it did the trick. Thanks man :smile: It's not weird, it's logical. In the script it's just a name. In the properties windows it's the actual connection between the name (which can be arbitrary), and the actual CK object. Link to comment Share on other sites More sharing options...
naaitsab Posted April 20, 2014 Author Share Posted April 20, 2014 My usual mistake: forget to fill the properties where the script is called. :smile:Bit weird that you need to assign the value again in the properties window but it did the trick. Thanks man :smile: It's not weird, it's logical. In the script it's just a name. In the properties windows it's the actual connection between the name (which can be arbitrary), and the actual CK object. Coming from C# it's still a bit weird to me why you should have to set the variable twice (declare in code and link to that declaration in CK) :wink: Link to comment Share on other sites More sharing options...
IsharaMeradin Posted April 20, 2014 Share Posted April 20, 2014 I understand it was as you are used to in the pre-Skyrim titles. With the introduction of Papyrus and the need to have properties defined on the hosting record one is able to reuse the same script over and over with different defined values for each of the properties. No longer does one need to create separate and distinct scripts for each thing to take place. Link to comment Share on other sites More sharing options...
fore Posted April 20, 2014 Share Posted April 20, 2014 My usual mistake: forget to fill the properties where the script is called. :smile:Bit weird that you need to assign the value again in the properties window but it did the trick. Thanks man :smile: It's not weird, it's logical. In the script it's just a name. In the properties windows it's the actual connection between the name (which can be arbitrary), and the actual CK object.Coming from C# it's still a bit weird to me why you should have to set the variable twice (declare in code and link to that declaration in CK) :wink: That's the misunderstanding. You don't declare in code. In code it's just the name of ANY object of that one type. So, like IsharaMeradin says, you can use the script at different places, and pass it different objects every time. It's just that usually we take the CK object name so we can use the Auto-Fill option. But you could as well declare it in code as "Brumpf", and it will still work. Link to comment Share on other sites More sharing options...
Recommended Posts