Xaranth Posted November 10, 2012 Share Posted November 10, 2012 All right, I've learned not to take ANYTHING for granted with this atrocious mockery of a programming language. Basically, I want to know if comparisons work like every other language on earth. Assuming rDummy is disabled: if rDummy.getDisabled DoStuff endIf and: if (rDummy.getDisabled == 1) DoStuff endIf are the exact same thing, right? Link to comment Share on other sites More sharing options...
blove Posted November 10, 2012 Share Posted November 10, 2012 That is correct. Link to comment Share on other sites More sharing options...
Xaranth Posted November 10, 2012 Author Share Posted November 10, 2012 Thank you. Link to comment Share on other sites More sharing options...
CaptMitch Posted November 10, 2012 Share Posted November 10, 2012 0 = null/false 1 = 1/true Link to comment Share on other sites More sharing options...
Xaranth Posted November 10, 2012 Author Share Posted November 10, 2012 0 = null/false 1 = 1/true Yes, but the lack of a real Boolean type had me mistrusting it. Also a number of other things that I would expect in any language simply aren't here in FNVScript. And the script in question wasn't working either way. >.> Got it sorted though. -X Link to comment Share on other sites More sharing options...
luthienanarion Posted November 10, 2012 Share Posted November 10, 2012 You can use any variable type as a boolean value for conditions, with any non-zero value considered 'true.' Link to comment Share on other sites More sharing options...
CaptMitch Posted November 10, 2012 Share Posted November 10, 2012 0 = null/false 1 = 1/true Yes, but the lack of a real Boolean type had me mistrusting it. Also a number of other things that I would expect in any language simply aren't here in FNVScript. And the script in question wasn't working either way. >.> Got it sorted though. -X can i see the script. Link to comment Share on other sites More sharing options...
Xaranth Posted November 10, 2012 Author Share Posted November 10, 2012 (edited) can i see the script. No need. The issue was that I forgot that I needed reset my time float in the GameMode bock. Dumb*** mistake. ...Actually, I could tighten it up some more by eliminating the time variable completely. It's not used for anything but a comparison anyway... But for your edification, here's the final, WORKING script. scn DARC02scptGHLtDayNt ref rLtParent ;Diabled == Day, Enabled == Night begin onLoad Set rLtParent to GetLinkedRef if ((GetCurrentTime > 5) && (GetCurrentTime <= 19)) if rLtParent.GetDisabled == 0 rLtParent.Disable endif else if rLtParent.GetDisabled rLtParent.Enable endif endif end begin GameMode if ((GetCurrentTime > 5) && (GetCurrentTime <= 19)) if rLtParent.GetDisabled == 0 rLtParent.Disable endif else if rLtParent.GetDisabled rLtParent.Enable endif endif end Edited November 10, 2012 by Xaranth Link to comment Share on other sites More sharing options...
CaptMitch Posted November 10, 2012 Share Posted November 10, 2012 (edited) The begin OnLoad i think is redundant seeing as you have the Begin Gamemode does the same thing but in each frame. begin GameMode Set rLtParent to GetLinkedRef if (GetCurrentTime > 5 && GetCurrentTime <= 19) if rLtParent.GetDisabled == 0 rLtParent.Disable endif else if rLtParent.GetDisabled rLtParent.Enable endif endif end This should be more then enough. Edited November 10, 2012 by Capt Mitch Link to comment Share on other sites More sharing options...
Xaranth Posted November 10, 2012 Author Share Posted November 10, 2012 The begin OnLoad i think is redundant seeing as you have the Begin Gamemode does the same thing but in each frame. This should be more then enough. Actually, it is. But given that I'm resource mad to the point of being truly irritating, I'll tweak it this way: scn DARC02scptGHLtDayNt ref rLtParent ;Diabled == Day, Enabled == Night begin onLoad Set rLtParent to GetLinkedRef end begin GameMode if ((GetCurrentTime > 5) && (GetCurrentTime <= 19)) if rLtParent.GetDisabled == 0 rLtParent.Disable endif else if rLtParent.GetDisabled rLtParent.Enable endif endif end Saves a memory IOp every frame. Link to comment Share on other sites More sharing options...
Recommended Posts