Editing Useful Scripts
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
= GECK = | = GECK = | ||
==Timed Doors== | ==Timed Doors== | ||
Line 323: | Line 304: | ||
</pre> | </pre> | ||
== | == Iterating through multiple lists == | ||
This is a good technique for making simulated 2 dimension arrays in tes script | |||
There are a few technically unnecessary variables but this loop is setup to be used as part of a series. | |||
To use in series, just copy everything from ";Main Loop" to the last "EndIf". The only thing you need to change is the value of "MainList". | |||
Sorry for any errors, I'm writing this from memory | |||
<pre> | <pre> | ||
scn Test2Dim | |||
; Counter vars | |||
long Count1 | |||
long Count2 | |||
; Max Count vars | |||
long MaxCount1 | |||
long MaxCount2 | |||
; Label vars | |||
short Label1 | |||
short Label2 | |||
; Lists | |||
ref MainList | |||
ref CurrentList | |||
ref CurrentRef | |||
Begin onActivate | |||
; setup counters | |||
Set Label1 To 0 | |||
Set Label2 To 1 | |||
;Main Loop | |||
Set MainList To TopLevelListHere | |||
Set Label1 To Label1 + 2 ; 2 Because its the number af labels | |||
Set Label2 To Label2 + 2 | |||
Set Count1 To 0 | |||
Set MaxCount1 To ListGetCount MainList | |||
Label Label1 | |||
Set Count2 To 0 | |||
Set CurrentList To ListGetNthForm MainList Count1 | |||
Set MaxCount2 To ListGetCount CurrentList | |||
Label Label2 | |||
Set CurrentRef To ListGetNthForm CurrentList Count2 | |||
; Use CurrentRef here | |||
If Count2 < MaxCount2 | |||
Set Count2 To Count2 + 1 | |||
GoTo Label2 | |||
EndIf | |||
If Count1 < MaxCount1 | |||
Set Count1 To Count1 + 1 | |||
GoTo Label1 | |||
EndIf | |||
End | |||
</pre> | </pre> | ||
Line 477: | Line 438: | ||
endif | endif | ||
endif | endif | ||
End | End | ||
</pre> | </pre> |