Hi guys
I have a complex problem in a formula.
I formulate to minimum to be clear.
I wish I could remove the first variable found in the second process.
These possible?
// variable initialisation
A = 3
B = 5
T = 1
X = 4
// Now found the most big valur
ItemQ = new Array(A,B,T,X);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++)
{ if (ItemQ[n] > ItemQ[ItemL])
ItemL = n;
}
// EXAMPLE HERE ITS FOUND (😎 MOST HIGTH VALUR
// Now a need to do again, but exclud B _.without()
without = ItemL; // maybe store B in witout ??? or ...
ItemQ = new Array.without()(A,B,T,X);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++)
{ if (ItemQ[n] > ItemQ[ItemL])
ItemL = n;
}
Tank you
Here is the full version, but this solution does not please me.
I have a complex problem in a formula.
I formulate to minimum to be clear.
I wish I could remove the first variable found in the second process.
These possible?
// variable initialisation
A = 3
B = 5
T = 1
X = 4
// Now found the most big valur
ItemQ = new Array(A,B,T,X);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++)
{ if (ItemQ[n] > ItemQ[ItemL])
ItemL = n;
}
// EXAMPLE HERE ITS FOUND (😎 MOST HIGTH VALUR
// Now a need to do again, but exclud B _.without()
without = ItemL; // maybe store B in witout ??? or ...
ItemQ = new Array.without()(A,B,T,X);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++)
{ if (ItemQ[n] > ItemQ[ItemL])
ItemL = n;
}
Tank you
Here is the full version, but this solution does not please me.
Code:
// variable initialisation
D4 = $gameVariables.value(18), D6 = $gameVariables.value(19), D8 = $gameVariables.value(20), D12 = $gameVariables.value(21), D20 = $gameVariables.value(22),
D30 = $gameVariables.value(23), D50 = $gameVariables.value(24), D100 = $gameVariables.value(25);
// take quantity of the 8 item , ref by variable
ItemQ = new Array(D4,D6,D8,D12,D20,D30,D50,D100);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++)
{ if (ItemQ[n] > ItemQ[ItemL])
ItemL = n;
}
console.log (ItemL, ItemQ[ItemL]);
$gameVariables.setValue(32, ItemL);
// On recommence mais sans la derniere valeur
switch (ItemL)
{case 0: D4 = 0; break;case 1: D6 = 0; break;case 2: D8 = 0; break;case 3: D12 = 0; break;case 4: D20 = 0; break;case 5: D30 = 0; break;case 6: D50 = 0; break;case 7: D100 = 0; break;}
ItemQ = new Array(D4,D6,D8,D12,D20,D30,D50,D100);
ItemL = 0;
for(n = 0; n < ItemQ.length; n++) { if (ItemQ[n] > ItemQ[ItemL])ItemL = n;}
console.log (ItemL, ItemQ[ItemL]);
$gameVariables.setValue(33, ItemL);