Hi, I need some major help optimizing this trigger somehow. Right now, it can has about 70,000 different combinations of how it can run, and although I have made it so it will exit as early as it can, is still lags a wee bit
As for background, heres the essential facts about the trigger:
*It is an item-combining trigger
*the combining is based off of materials in items
*Temp_Materials_B is what the new item's materials are
thank you, and if you have any questions, please ask away, ill try to clarify the best i can
2evil
As for background, heres the essential facts about the trigger:
*It is an item-combining trigger
*the combining is based off of materials in items
*The materials for the items are stored in two integer arrays (7 digits in each)
*possible items are ranked and the 10 best (determined by leftover mats) are able to be chosen by the player
*at this point in the trigger, the combined materials have already been found (Temp_Materials_A)*possible items are ranked and the 10 best (determined by leftover mats) are able to be chosen by the player
*Temp_Materials_B is what the new item's materials are
Code:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
[i]-------- Sword Verification --------[/i]
Temp_Materials_A[1] Equal to 1
Then - Actions
[i]-------- Looping through all swords --------[/i]
For each (Integer B) from 15 to 71, do (Actions)
Loop - Actions
[i]-------- Looping through materials --------[/i]
For each (Integer Temp_value_2) from 2 to 14, do (Actions)
Loop - Actions
[i]-------- Since the materials are stored in 2 different variables, it changes which variable it calls upon depending on the loop number (1-7 in variable [b]Item_Codes[/b], 8-14 in [b]Item_Codes_Elements[/b]) --------[/i]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_value_2 Less than or equal to 7
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_value_2 Less than or equal to 6
Then - Actions
Set Temp_Materials_B[Temp_value_2] = (0 + (((Item_Codes[(Integer B)] mod (Integer((Power(10.00, (8.00 - (Real(Temp_value_2)))))))) - (Item_Codes[(Integer B)] mod (Integer((Power(10.00, (7.00 - (Real(Temp_value_2))))))))) / (Integer((Power(10.00, (7.00 - (Real(Temp_value_2)))))))))
Else - Actions
Set Temp_Materials_B[Temp_value_2] = (0 + (Item_Codes[(Integer B)] mod (Integer((Power(10.00, (8.00 - (Real(Temp_value_2)))))))))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_value_2 Less than or equal to 13
Then - Actions
Set Temp_Materials_B[Temp_value_2] = (0 + (((Item_Codes_Elements[(Integer B)] mod (Integer((Power(10.00, (15.00 - (Real(Temp_value_2)))))))) - (Item_Codes_Elements[(Integer B)] mod (Integer((Power(10.00, (14.00 - (Real(Temp_value_2))))))))) / (Integer((Power(10.00, (14.00 - (Real(Temp_value_2)))
Else - Actions
Set Temp_Materials_B[Temp_value_2] = (0 + (Item_Codes_Elements[(Integer B)] mod (Integer((Power(10.00, (15.00 - (Real(Temp_value_2)))))))))
[i]-------- Starting the similarity process, initiates once [b]Temp_Value_2[/b]=14 --------[/i]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_Materials_A[Temp_value_2] Greater than or equal to Temp_Materials_B[Temp_value_2]
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Temp_value_2 Equal to 14
Then - Actions
[i]-------- Creating an index for the item, based upon the amount of materials left over --------[/i]
For each (Integer A) from 2 to 14, do (Actions)
Loop - Actions
Set Temp_value = (Temp_value + (Temp_Materials_A[(Integer A)] - Temp_Materials_B[(Integer A)]))
[i]-------- Looping through other intexes, determining if the item is one of the 10 best that the player is able to create, based upon leftover materials --------[/i]
For each (Integer A) from 1 to 10, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Combiner_Items_Remainder[(Integer A)] Greater than or equal to Temp_value
Then - Actions
For each (Integer Temp_value_3) from 1 to 9, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(10 - Temp_value_3) Greater than or equal to (Integer A)
(10 - Temp_value_3) Less than or equal to 9
Then - Actions
Set Combiner_Items[(11 - Temp_value_3)] = Combiner_Items[(10 - Temp_value_3)]
Set Combiner_Items_Remainder[(11 - Temp_value_3)] = Combiner_Items_Remainder[(10 - Temp_value_3)]
Else - Actions
Set Combiner_Items[(Integer A)] = Item_Type[(Integer B)]
Set Combiner_Items_Remainder[(Integer A)] = Temp_value
Game - Display to (All players) the text: (Organizing! Temp_value (New item index): + (String(Temp_value)))
Custom script: exitwhen true
Else - Actions
Else - Actions
Else - Actions
Set Temp_value_2 = 30
Else - Actions
thank you, and if you have any questions, please ask away, ill try to clarify the best i can
2evil