maxarturo Posted July 27, 2019 Share Posted July 27, 2019 (edited) Question is very simple, but in order to answer this myself i'll need at least two PCs, with the second been a low end PC. Question : Which is faster in a low end pc or medim pc ?, "PlayerREF" or "Game.GetPlayer()" in a medium size Script meant to be used continuously in game. With multiple "If - ElseIf" > multiple "Menu Messages - Options" > multiple "Fanctions" > multiple "Visual - Shaders FX" to execute simultaneously. Many thanks in advance ! Edited July 27, 2019 by maxarturo Link to comment Share on other sites More sharing options...
foamyesque Posted July 27, 2019 Share Posted July 27, 2019 Function calls are *murder*, because a great many of them are linked to the games frame rate and will never execute faster than the game generates a frame. Pull it once and put it in a variable, or store it in a property directly in the CK. It isn't too bad if it's a one-and-done execution, but you say this is meant to 'be used continuously', and that'll make optimization important. Link to comment Share on other sites More sharing options...
maxarturo Posted July 27, 2019 Author Share Posted July 27, 2019 (edited) Function calls are *murder*, because a great many of them are linked to the games frame rate and will never execute faster than the game generates a frame. Pull it once and put it in a variable, or store it in a property directly in the CK. It isn't too bad if it's a one-and-done execution, but you say this is meant to 'be used continuously', and that'll make optimization important.Thanks foamyesque for replying. By continuously i meant that is an Exchange Dragon Souls > Gain Perk > Advance Skill > Gain Health or Stamina or Magicka > all that for a cost depending on your combination you'll make and what you'll choose at the end, and you can use this Activator - Pedestal as many times as you want. But... I was thinking about optimizaing the script and so i did. Now instead of having just one Activator - Pedestal - Script (huge script) doing all of that, i seperated it to three Scripts, and reduce all Menu Options from 8 to 3 without sub-options.Now i have three small scripts - three pedestals and everything is less complicated and more elegant and user friendly. But my initial question and worries remains.When the exchange occurs and the FXs + on screen messages will play, they all have a specific order on how they play and they are attach to the actual exchange Function.Will there be a lag on a Low End PC ? (messing up or overlapping the order of how things should happen), and which is best to use to avoid this "PlayerREF" or "Game.GetPlayer()" ?. * I'm thinking also of those with slower PCs... Edited July 27, 2019 by maxarturo Link to comment Share on other sites More sharing options...
PeterMartyr Posted July 28, 2019 Share Posted July 28, 2019 The answer is usually a microsecond, and totally unimportant. Example Game.GetPlayer Vs PlayerRefYou would have to call it over a hundred time in 1 second for the difference to be significant, in tens of a second, so just write your code. Have fun too. Link to comment Share on other sites More sharing options...
PeterMartyr Posted July 28, 2019 Share Posted July 28, 2019 Whether it is an interpreter or a compiler nothing gonna execute simultaneously. Ever. Edit: How good are you creating multiple threads? So things appear to happening at the same time? Try doing a part-time course in coding, you seems to asking questions that imply you need to take the next step, I encourage you to do so. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted July 28, 2019 Share Posted July 28, 2019 (edited) By using Game.GetPlayer() your script will be paused until the return value has been send back to the caller.Now it is possible to run another script or the same script attached to another reference. From my experience it is always a good idea to call Game.GetPlayer() once and after that use the return value like this:sample (1) actor player = Game.GetPlayer() IF player.IsSprinting() || player.IsRunning() ENDIFsample (2) EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not activated by the player ENDIF ;----------------------------- IF (akActionRef as Actor).IsSneaking() ; player is sneaking during activation ENDIF ENDEVENTLook also here, if you didn't checked already: https://www.creationkit.com/index.php?title=Differences_from_Previous_Scripting You will also find the term "latent function" https://www.creationkit.com/index.php?title=Category:Latent_Functionsand "non-delayed native functions" https://www.creationkit.com/index.php?title=Category:Non-delayed_Native_Function do not have to sync with the game's framerate in order to execute Edited July 28, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
foamyesque Posted July 28, 2019 Share Posted July 28, 2019 The answer is usually a microsecond, and totally unimportant. Example Game.GetPlayer Vs PlayerRefYou would have to call it over a hundred time in 1 second for the difference to be significant, in tens of a second, so just write your code. Have fun too. You'd think so, but you're wrong. Game.GetPlayer() is linked to the frame rate. It will not return any faster than the game can render a frame, which is much much much slower than accessing a property (which is not frame-linked, and therefore effectively instantaneous by comparison). This is also, by the by, why manipulating arrays are so much faster than FormLists. Link to comment Share on other sites More sharing options...
maxarturo Posted July 28, 2019 Author Share Posted July 28, 2019 (edited) Whether it is an interpreter or a compiler nothing gonna execute simultaneously. Ever. Edit: How good are you creating multiple threads? So things appear to happening at the same time? Try doing a part-time course in coding, you seems to asking questions that imply you need to take the next step, I encourage you to do so.Three scripts cooperating + communicating with each other and firing its FX and Exchange functions simultaneously.Is that clear enough ?. Edited July 28, 2019 by maxarturo Link to comment Share on other sites More sharing options...
maxarturo Posted July 28, 2019 Author Share Posted July 28, 2019 By using Game.GetPlayer() your script will be paused until the return value has been send back to the caller.Now it is possible to run another script or the same script attached to another reference. From my experience it is always a good idea to call Game.GetPlayer() once and after that use the return value like this:sample (1) actor player = Game.GetPlayer() IF player.IsSprinting() || player.IsRunning() ENDIFsample (2) EVENT OnActivate(ObjectReference akActionRef) IF (akActionRef == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - not activated by the player ENDIF ;----------------------------- IF (akActionRef as Actor).IsSneaking() ; player is sneaking during activation ENDIF ENDEVENTLook also here, if you didn't checked already: https://www.creationkit.com/index.php?title=Differences_from_Previous_Scripting You will also find the term "latent function" https://www.creationkit.com/index.php?title=Category:Latent_Functionsand "non-delayed native functions" https://www.creationkit.com/index.php?title=Category:Non-delayed_Native_Function do not have to sync with the game's framerate in order to executeOnce more, you've been most helpful !Many Thanks !!!. Link to comment Share on other sites More sharing options...
PeterMartyr Posted July 28, 2019 Share Posted July 28, 2019 This is also, by the by, why manipulating arrays are so much faster than FormLists. How would the game handle FormList in your opinion? I think is a safe bet that it places them into Arrays. So by going directly to an Array you are cutting out the middle man. Or is some other way of doing it? Please enlighten me. How does the game deal with Formlist? Mate, seriously, no offense intended, but even a web-page is just a glorified array of data manipulation. Link to comment Share on other sites More sharing options...
Recommended Posts