Displaying a global variable in a message. What am I missing

Post » Mon Jun 18, 2012 5:18 pm

Alright so I managed to get a message that works correctly and will display 6 variables to the screen. Now I think I am missing one detail with working with global variables.

This will cause an error "type mismatch while assigning to a int (cast missing or types unrelated)"
ATHShungerValueLocal = ATHShungerValue.GetValue()ATHShungerRateLocal = ATHShungerRate.GetValue()ATHSsleepValueLocal = ATHSsleepValue.GetValue()ATHSsleepRateLocal = ATHSsleepRate.GetValue()ATHSthirstValueLocal = ATHSthirstValuel.GetValue()ATHSthirstRateLocal = ATHSthirstRate.GetValue()UpdateMessage.Show( ATHSthirstValueLocal, ATHSthirstRateLocal, ATHShungerRateLocal, ATHShungerValueLocal, ATHSsleepValueLocal, ATHSsleepRateLocal )

While this seems to work perfectly fine...
ATHShungerValueLocal = 10ATHShungerRateLocal = 20ATHSsleepValueLocal = 30ATHSsleepRateLocal = 40ATHSthirstValueLocal = 50ATHSthirstRateLocal = 60UpdateMessage.Show( ATHSthirstValueLocal, ATHSthirstRateLocal, ATHShungerRateLocal, ATHShungerValueLocal, ATHSsleepValueLocal, ATHSsleepRateLocal )

What step am I missing with global variables?....
User avatar
Ross Thomas
 
Posts: 3371
Joined: Sat Jul 21, 2007 12:06 am

Post » Mon Jun 18, 2012 6:04 am

Have you tried casting the results of the functions with "as", e.g.:

ATHShungerValueLocal = ATHShungerValue.GetValue() as int
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Mon Jun 18, 2012 7:31 pm

Have you tried casting the results of the functions with "as", e.g.:
 ATHShungerValueLocal = ATHShungerValue.GetValue() as int 

You are my hero, it seems to be working and I am once again making progress :)
User avatar
Lew.p
 
Posts: 3430
Joined: Thu Jun 07, 2007 5:31 pm


Return to V - Skyrim