Jump to content

Recommended Posts

Posted (edited)
Hi everybody.


I'm in the process of optimizing - simplifying all my scripts ( for better performance ), and in this particular script i want the " Function " ( Function OneTimeFUNC() ) to run only ONCE.

* There are around 100 objects in the Display room, so that's why i want a more simpler version.


The current script is working fine, but i'm browsing for a better and simplier version of it from a more expirienced scripter ( if there is one, i mean script version ).

I'm on vacations and i'm doing this in my tablet, so i can't test them and experiment for a better altenative.


This is one of my " Display Item Script " :

  Reveal hidden contents



Many thanks in advance and i wish this summer to be the best you ever had !.

Edited by maxarturo
Posted

Calling the function from within a block that will always executes means that the function will always be called. You could move the check for count to equal 1 outside of the function. At least that way, when the block gets to that condition it will skip it since count will no longer equal 1 after the first time. But if you do that, might as well skip the function all together and put the other lines inside the condition check for count to equal 1.

Posted (edited)

Thanks IsharaMeradin for the response.

 

You mean :

 

  Reveal hidden contents

 

 

EDIT :

Now that i thought of it a little bit more, your suggestion is completely logical !.
Stupid of me for not thinking of it to begin with !...
Thanks a lot !.
Edited by maxarturo
Posted (edited)

There are different ways to make things more simple, next is my proposal.

 

aXMDvaultDisplayMISC01

  Reveal hidden contents

 

Edited by ReDragon2013
Posted (edited)

ReDragon your scripting style is so interesting to me that even if i don't end up using them, i study the hell out of them !.

 

* I've completely abandon the use of OnUpdateGameTime() or RegisterForSingleUpdate() and equivalents ( only for the Display scripts ).
Thanks for your post, i'll for sure study this one too !.
Edited by maxarturo
Posted

@ maxarturo A good script and a elegant script are two completely different things, a script doesn't need to be elegant to be good.

 

Swapping a Function (CPU usage) for a Variable (RAM usage) is potato - potata, whether it is good or bad totally depends on the environment it is running in, which is an unknown factor? So NO-ONE can say it is better, cos it might worst too.

 

If your code is working as you intended, it is fine. There are courses to teach you how to code. You will learn about stress & load testing.... and learn how to make the correct choices. Which must be assess on individual basis in an Generic Shittest Possible Environment.

 

Example1 If the System because of Skyrims Mods is under heavy RAM usage the Function is better...

 

Example2 If the System because of Skyrim Mods is under heavy CPU usage the Variable is better.....

 

My question is.... What is the System?

Posted
Thanks PeterMartyr for your response.


To begin with, i should mention that i'm a self teach scripter and i'm too old to go to school again, plus it doesn't interest me to attend code courses, at the end of the day for me it's just a game, and since it doesn't bring home the bacon, that's where it ends !.


Making this occasionally posts in this Forum is the way for me to advance a little bit more my scripting and maybe learn something new from someone more experienced or someone that it's his actual job or studied this particular subject.

Although i'm at a very good level, at least i can script whatever i have in mind with no problems or help.


For me all of this is just a hobby...


Thanks you very much for your input !.

Posted

I had a look into the script "defaultCounter.psc" and maybe next script is more useful. Keep in mind I renamed the script !

 

aXMDvaultDisplayMISC01a

  Reveal hidden contents

 

Posted
Thanks for this one too ReDragon !, i'll study it.


But i'm not going to use the " defaultCounter ", it doesn't serves my purpose, i'll have to make a new " Counter Script " when the times comes, it'll be the last script i'll make and the last addition to the mod ( i still haven't deside what the final reward will be and how will be implemented ).

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...