I finally discovered something, after loads of odd behaviours in game. Scripts that should work but they do not. I will give 2 different examples when they do not work and how I make them work. This is my observations and my conclusions and solutions. We do not really need to argue about this. Use your own judgement.



Let and Set do not work the same way, even if it may look that way.
- Set this variable to XXXXX
- Let this Variable be XXXXXX
Let xxxArr[3] := 4XXXThat looks good right? Compile it in CSE --> No problems find.
(4th number is 3 ---> 0 to 3 is 4 numbers.)
Run it in game. Nothing happens, look at the console.
ERROR in script 8949204 offset 0x67 (or what ever as we get an error - Cannot use Let)
So in this case we must use the old ways as it works and we must skip the array here and make a separate script.
Ref xxxRef Set xxxRef to 4XXXWorks perfect.
-----------------------------------------------------------
Example 2 is a bit more complicated i guess and it sure took me a long time to really understand this and accept it. Hopefully I remember this now when i write it down as writing this down, will help me think more clear. It helps me make scripts to work so I cam focus in creating, not debugging scripts. So where do we start with this example? Let me start with, we will not use WAC stuff as we use any object in this example, or rather reference as this is happening in a cell, outside the inventories.
Let me first say, this way of making scripts is still a bit new to me, as I did use the old ways a long time and did find a way to optimise it and increase the cell performance, nothing special but it differ a lot from the old way. I did ran into some problems in the process, and now I really understand how to make a work around for this odd behaviour and make everything to just run perfect.
So lets make a list of objects and scripts in this example
- Object 4xxx is reference ff123abc when we add it into a Triggerbox. It is a weapon from WAC in this case. It does not matter as we only use the reference here and will only use ff123abc.
- Script1 runs at the Triggerbox
- Script2 runs at a button
- Script3 is a quest script, that will hold everything together. It runs default 1 time every 10s in my case. Doesn't really matter for this example.
Lets start by taking out this weapon from a container and put it inside the Triggerbox. The Triggerbox will now add this weapon to an reference in its script.
I will use simple examples, not real in game scripting or the scripts will be to long and we loose focus. If you read this, you know scripting and will get it anyway, or we can make real examples later if this makes no sense. I am up for making cool and more real examples really.

Script1
Ref WeaponRef ---- Set WeaponRef to (Whatever is trigging the box and it is ff123abc) PrintC "%i %n", WeaponRef, WeaponRef
So the Triggerbox is now spamming ff123abc WACWeaponREF inside the console with PrintToConsole -> PrintC
We did add an array inside the quest script called WeaponARR and initiated it properly
Script3
array_var WeaponARR ---- Let WeaponARR := ar_construct Array
We will now push a button and a lot of stuff will happen or not happen when we push it. Lets see what will not work for me.
Script2
Ref WeaponRef ----- Onactivate bla bla Set WeaponRef to Script1.WeaponRef Let Script3.WeaponARR[0] := WeaponRef
So the set command will work perfect but the let command will do nothing.... It does not work. No errors, no nothing, the number 0 slot will be empty like the void it self. This can be checked with ar_size
Short DatabaseSize ------- Let DatabaseSize := ar_size WeaponARR
So I solve this by writing the code vice verse in both scripts... We push the button again with the new scripts, Script2 and Script3
Script3
Short State Ref WeaponRef Array_var WeaponARR ------------------------------ If ( State == 7 ) Set WeaponRef to Scrpt1.WeaponRef Let WeaponARR[0] := WeaponRef EndIf EndSo at Script 2 we write:
short Button ------- bla bla button bla If Button is ADD-the-bloody-WEAPON Set Script3.State to 7
The set command will work between the scripts, crossing the values, the let do not. Let + arrays or rather Let xxxxArray works perfect internally inside a single script but crossing that value fails, pushing it to another script.
We cannot set a value to an array, so we cannot compare them with arrays. We can Set and Let ordinary variables.
Set WeaponRef to abcd Let WeaponRef := abcd
We cant
Set WeaponObjID to 4cde Let WeaponObjID := 4cdeWell the set works, the let will fail.
Use Set and let in the right context, when it makes sense to use one or the other. Inside a single script both Let and Set works to 95% for the same stuff. Someone ones wrote, skip set completely, use Let as much as possible.

When we push the button now, it will take up to 10s for the weapon to move. When i put the weapon at the Triggerbox, I also add this to Script1
If the triggerbox is triggered. Set Script3.fQuestDelayTime to 0.1Will it help? No way... Or I do not wait long time enough to figure it out. I do see in the console that the value changes to 0.1 at some point.
I hope these simple examples will be helpful in case you run into similar issues, trying to optimise a cell, removing stupid GameMode code at several Objects that really are unnecessary and only extend the FPS and slow the cell down. Lets try to make Oblivion run at such a high performance as possible and this way to code is helping me to really make a cell run as fast as possible. So I ran into these problems, remade the same mistakes over and over, di peek back at some scripts... hey, what makes this script to work?? Rewrote the new scripts again and voila: The damn sh't is working...
Pekka --> Now remember this stuff, do not forget it, do not repeat failures.
Pekka: Yes sir

So this is also happening in my Library, using Stroti's pelts as beds. ( Yes madame, I will do my very best )
Edited by Pellape, 05 May 2022 - 11:30 AM.