- Joined
- Mar 28, 2016
- Messages
- 1,623
- Reaction score
- 1,440
- First Language
- French
- Primarily Uses
- RMMV
hi i have question.
Example if i call my function
1:ID 2
perator
StatsControl(322,'-='); // Is do a decrease
if i do this
StatsControl(322,'+='); // Is do a increase
i read Eval can make me do this easy,
I know well the long method, but I would like to find a shortcut to call this function and be, Decrement or increase, without duplicating my code once.
Thank you for your suggestion.
if i try this i get Uncaught ReferenceError: Invalid left-hand side in assignment
op='+=';
eval($dataActors[1].meta.MaxBag + op + 10);
Here my function. Existe a very fast way without duplicate the code for assigned dinamyque operator (+=) or (-=)
function StatsControl(PID,Operator) {
//MaxBag // add point MaxBag (10) // Store MaxBag Adder (/10) pour le reset
if (PID==322) { $dataActors[1].meta.MaxBag+=10, StoreMaxBag+=10; } else
//HP // add point HP (5) // Store HP Adder (/5) pour le reset
if (PID==326) { $gameActors.actor(1).mhp+=5, StoreHP+=5; } else
//MP // add point MP (5) // Store MP Adder (/5) pour le reset
if (PID==330) { $gameActors.actor(1).mmp+=5, StoreMP+=5; } else
//ATT // add point ATT (5) // Store ATT Adder (1) pour le reset
if (PID==334) { $gameActors.actor(1).atk+=1, StoreATT+=1; } else
//Def // add point Def (5) // Store StoreDef Adder (1) pour le reset
if (PID==338) { $gameActors.actor(1).def+=1, StoreDef+=1; } else
//LUK // add point LUK (5) // Store StoreLUK Adder (1) pour le reset
if (PID==342) { $gameActors.actor(1).luk+=1, StoreLUK+=1; } else
//STA // add point STA (5) // Store StoreSTA Adder (1) pour le reset
if (PID==346) { $gameActors.actor(1).agi+=1, StoreSTA+=1; } else
//INT // add point INT (5) // Store StoreINT Adder (1) pour le reset
if (PID==350) { $gameActors.actor(1).mat+=1, StoreINT+=1; }
}
If someone knows a trick, thanks
Example if i call my function
1:ID 2
StatsControl(322,'-='); // Is do a decrease
if i do this
StatsControl(322,'+='); // Is do a increase
i read Eval can make me do this easy,
I know well the long method, but I would like to find a shortcut to call this function and be, Decrement or increase, without duplicating my code once.
Thank you for your suggestion.
if i try this i get Uncaught ReferenceError: Invalid left-hand side in assignment
op='+=';
eval($dataActors[1].meta.MaxBag + op + 10);
Here my function. Existe a very fast way without duplicate the code for assigned dinamyque operator (+=) or (-=)
function StatsControl(PID,Operator) {
//MaxBag // add point MaxBag (10) // Store MaxBag Adder (/10) pour le reset
if (PID==322) { $dataActors[1].meta.MaxBag+=10, StoreMaxBag+=10; } else
//HP // add point HP (5) // Store HP Adder (/5) pour le reset
if (PID==326) { $gameActors.actor(1).mhp+=5, StoreHP+=5; } else
//MP // add point MP (5) // Store MP Adder (/5) pour le reset
if (PID==330) { $gameActors.actor(1).mmp+=5, StoreMP+=5; } else
//ATT // add point ATT (5) // Store ATT Adder (1) pour le reset
if (PID==334) { $gameActors.actor(1).atk+=1, StoreATT+=1; } else
//Def // add point Def (5) // Store StoreDef Adder (1) pour le reset
if (PID==338) { $gameActors.actor(1).def+=1, StoreDef+=1; } else
//LUK // add point LUK (5) // Store StoreLUK Adder (1) pour le reset
if (PID==342) { $gameActors.actor(1).luk+=1, StoreLUK+=1; } else
//STA // add point STA (5) // Store StoreSTA Adder (1) pour le reset
if (PID==346) { $gameActors.actor(1).agi+=1, StoreSTA+=1; } else
//INT // add point INT (5) // Store StoreINT Adder (1) pour le reset
if (PID==350) { $gameActors.actor(1).mat+=1, StoreINT+=1; }
}
If someone knows a trick, thanks
Last edited by a moderator:

