- Joined
- Mar 28, 2016
- Messages
- 1,641
- Reaction score
- 1,474
- First Language
- French
- Primarily Uses
- RMMV
hi am trying make a easy way to auto increase a variable .
in this example, so
when i showPicture , the var PID and defxy[1] need to increase after show.
Is work good for ++, but not the +=
function ActionKey(WhatToDo) {
var PID = 83; // default PID for actionkey huds
var defxy = [1200,500]; // default x y pos for actionkey
var PH = 125; // picture fixed heigth from Action-Key.png
if (WhatToDo==='show') {
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
}
}
The way clearer.
Why does this return me 5, 6 and not 5, 5 ?
var A = 5;
var B = 5;
console.log((A++)+ ' ' + (B+=1)); // return 5 6
That fµ©£ me, all the easy way, with which I would like make my code.
Is there a way? or is a buggy javascript ?
in this example, so
when i showPicture , the var PID and defxy[1] need to increase after show.
Is work good for ++, but not the +=
function ActionKey(WhatToDo) {
var PID = 83; // default PID for actionkey huds
var defxy = [1200,500]; // default x y pos for actionkey
var PH = 125; // picture fixed heigth from Action-Key.png
if (WhatToDo==='show') {
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
$gameScreen.showPicture(PID++, 'Action-Key', 0, defxy[0], defxy[1]+=PH, 100, 100, 255, 0);
}
}
The way clearer.
Why does this return me 5, 6 and not 5, 5 ?
var A = 5;
var B = 5;
console.log((A++)+ ' ' + (B+=1)); // return 5 6
That fµ©£ me, all the easy way, with which I would like make my code.
Is there a way? or is a buggy javascript ?
Last edited by a moderator: