-
Posts
3 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by gpp9999
-
Generally if you have a condition that long, you'll want to split it up on multiple lines to make it easier to read: if (csbmagellanquest04locations.isrunning() && \ SavedText[0] != CorrectReplacementText && \ SavedText[1] != CorrectReplacementText && \ SavedText[2] != CorrectReplacementText && \ SavedText[3] != CorrectReplacementText && \ SavedText[4] ...... ) In this example, you could also do it using a loop: bool matchFound = false While (i < SavedText.Length && !matchFound) if (SavedText[i] == CorrectReplacementText) matchFound = true endif index += 1 EndWhile if (csbmagellanquest04locations.isrunning() && !matchFound) .... But as mentioned above, using Find is the best way to do this particular example. You could even do it in one line: If (csbmagellanquest04locations.isrunning() && SavedText.Find(CorrectReplacementText) < 0)
-
Hi, I'm looking at an old mod that allows playing instruments by playing a sound when you press a key on the keyboard. It has pieces of code that looks like this: I'm new to papyrus scripting, but my understanding of RegisterForSingleUpdate is that it will cause the OnUpdate event to be called after the specified time. However this script has no OnUpdate event. I was also getting errors in the log coming from the RegisterForSingleUpdate calls ("Object reference has no 3D" and "no native object bound to the script object, or object is of incorrect type"). I tried commenting out all of the calls and the mod still works fine as far as I can tell. So I'm wondering if there's any reason to have those in there. Trying to understand why the original mod author might have done it this way.