Skip to content

Commit

Permalink
Fix error about array manipulation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sthaagg committed Dec 10, 2020
1 parent 461169f commit 2f8eeff
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 53 deletions.
Binary file modified Scripts/_SMF_API.pex
Binary file not shown.
Binary file modified Scripts/_SMF_EquipUtils.pex
Binary file not shown.
Binary file modified Scripts/_SMF_LocationUtils.pex
Binary file not shown.
Binary file modified Scripts/_SMF_SelfUpdate.pex
Binary file not shown.
Binary file modified Scripts/_SMF_TeamUtils.pex
Binary file not shown.
11 changes: 11 additions & 0 deletions Source/Scripts/_SMF_API.psc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@ KeyWord[] property PopulatedSafeAndAverageHealthyArray Auto hidden;Array filled
KeyWord[] property SupernaturalAndHighHealthyArray Auto hidden;Array filled with corresponding formlist for performance sake
KeyWord[] property PopulatedAndHighHealthyPlaceArray Auto hidden;Array filled with corresponding formlist for performance sake
KeyWord[] property SafeAndUltraHealthyPlaceArray Auto hidden;Array filled with corresponding formlist for performance sake
Int Property iSupernaturalAndultraUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iAbandonnedAndVeryUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iCampAndHighUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iCampAndAverageUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iDwemerAndLowUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iCaveAndLowUnhealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iLowPopulatedAndLowHealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iPopulatedSafeAndAverageHealthyArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iSupernaturalAndHighHealthyArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iPopulatedAndHighHealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
Int Property iSafeAndUltraHealthyPlaceArray Auto Hidden; Store Array max size for performance sake, useful when you need a 'while' avoid to ount each time.
;Required by _SMF_Utils Script
FormList Property _SMF_FurnitureSit Auto

Expand Down
3 changes: 1 addition & 2 deletions Source/Scripts/_SMF_EquipUtils.psc
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,7 @@ Bool Function EquipGear(Form[] akList, Form[] akListL) global
;-------Rest---------------------------------------------------
Int i = ArrayTotalCountForm(akList)
While (i > 0)
i -= 1
Form ListItem = akList[i]
Form ListItem = akList[i - 1]
If (ListItem)
PlayerRef.EquipItemEx(ListItem, 0, false, false)
EndIf
Expand Down
79 changes: 46 additions & 33 deletions Source/Scripts/_SMF_LocationUtils.psc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ Int Function GetPlayerlocationType() global
return 10
ElseIf IsInSafeAndUltraHealthyPlace()
return 11
Else
return 100 ;unknown location
Endif
EndFunction
;location classified by type
Expand Down Expand Up @@ -101,10 +103,11 @@ Bool Function IsInSupernaturalAndultraUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.SupernaturalAndultraUnhealthyPlaceArray)

Int idx = (SMF.iSupernaturalAndultraUnhealthyPlaceArray)
SMFDebugInfo("Liste 1, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.SupernaturalAndultraUnhealthyPlaceArray[idx]
Keyword Test = SMF.SupernaturalAndultraUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -123,10 +126,11 @@ Bool Function IsInAbandonnedAndVeryUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.AbandonnedAndVeryUnhealthyPlaceArray)

Int idx = (SMF.iAbandonnedAndVeryUnhealthyPlaceArray)
SMFDebugInfo("Liste 2, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.AbandonnedAndVeryUnhealthyPlaceArray[idx]
Keyword Test = SMF.AbandonnedAndVeryUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -145,10 +149,11 @@ Bool Function IsInCampAndHighUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.CampAndHighUnhealthyPlaceArray)

Int idx = (SMF.iCampAndHighUnhealthyPlaceArray)
SMFDebugInfo("Liste 3, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.CampAndHighUnhealthyPlaceArray[idx]
Keyword Test = SMF.CampAndHighUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -167,10 +172,11 @@ Bool Function IsInCampAndAverageUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.CampAndAverageUnhealthyPlaceArray)

Int idx = (SMF.iCampAndAverageUnhealthyPlaceArray)
SMFDebugInfo("Liste 4, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.CampAndAverageUnhealthyPlaceArray[idx]
Keyword Test = SMF.CampAndAverageUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -189,10 +195,11 @@ Bool Function IsInDwemerAndLowUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.DwemerAndLowUnhealthyPlaceArray)

Int idx = (SMF.iDwemerAndLowUnhealthyPlaceArray)
SMFDebugInfo("Liste 5, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.DwemerAndLowUnhealthyPlaceArray[idx]
Keyword Test = SMF.DwemerAndLowUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -212,10 +219,11 @@ Bool Function IsInCaveAndLowUnhealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.CaveAndLowUnhealthyPlaceArray)

Int idx = (SMF.iCaveAndLowUnhealthyPlaceArray)
SMFDebugInfo("Liste 6, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.CaveAndLowUnhealthyPlaceArray[idx]
Keyword Test = SMF.CaveAndLowUnhealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -234,10 +242,11 @@ Bool Function IsInLowPopulatedAndLowHealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.LowPopulatedAndLowHealthyPlaceArray)

Int idx = (SMF.iLowPopulatedAndLowHealthyPlaceArray)
SMFDebugInfo("Liste 7, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.LowPopulatedAndLowHealthyPlaceArray[idx]
Keyword Test = SMF.LowPopulatedAndLowHealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -256,10 +265,11 @@ Bool Function IsInPopulatedSafeAndAverageHealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.PopulatedSafeAndAverageHealthyArray)

Int idx = (SMF.iPopulatedSafeAndAverageHealthyArray)
SMFDebugInfo("Liste 8, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.PopulatedSafeAndAverageHealthyArray[idx]
Keyword Test = SMF.PopulatedSafeAndAverageHealthyArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -278,10 +288,11 @@ Bool Function IsInSupernaturalAndHighHealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.SupernaturalAndHighHealthyArray)

Int idx = (SMF.iSupernaturalAndHighHealthyArray)
SMFDebugInfo("Liste 9, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.SupernaturalAndHighHealthyArray[idx]
Keyword Test = SMF.SupernaturalAndHighHealthyArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -300,10 +311,11 @@ Bool Function IsInPopulatedAndHighHealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.PopulatedAndHighHealthyPlaceArray)

Int idx = (SMF.iPopulatedAndHighHealthyPlaceArray)
SMFDebugInfo("Liste 10, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.PopulatedAndHighHealthyPlaceArray[idx]
Keyword Test = SMF.PopulatedAndHighHealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand All @@ -322,10 +334,11 @@ Bool Function IsInSafeAndUltraHealthyPlace() global
If !CurrentPlayerLocation
return false
EndIf
Int idx = ArrayTotalCountKeyword(SMF.SafeAndUltraHealthyPlaceArray)

Int idx = (SMF.iSafeAndUltraHealthyPlaceArray)
SMFDebugInfo("Liste 11, Keyword count:" + idx,2)
While idx > 0
Keyword Test = SMF.SafeAndUltraHealthyPlaceArray[idx]
Keyword Test = SMF.SafeAndUltraHealthyPlaceArray[idx - 1]
SMFDebugInfo("Tested keyword: " + Test,2)
If CurrentPlayerLocation.HasKeyword(Test)
return true
EndIf
Expand Down
Loading

0 comments on commit 2f8eeff

Please sign in to comment.