Page 1 of 1

Increasing a player's credits

Posted: Mon Mar 27, 2017 11:06 am
by byronarn
I'm sure there is a method for increasing a player's credits (at the end of a successful mission, for example), but I can't find the function that does it on the wiki. Maybe I am just overlooking it. Can anyone help?

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 11:20 am
by spara
player.credits = 100000000;

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 12:18 pm
by hoqllnq
byronarn wrote: Mon Mar 27, 2017 11:06 am
... but I can't find the function that does it on the wiki....
Here is an overview of all available properties and methods for the player class.

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 12:49 pm
by Diziet Sma
spara wrote: Mon Mar 27, 2017 11:20 am
player.credits = 100000000;
Shouldn't that be:

Code: Select all

player.credits = player.credits + 100000000;
?

:mrgreen:

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 2:13 pm
by spara
:lol: :lol:
Diziet Sma wrote: Mon Mar 27, 2017 12:49 pm
spara wrote: Mon Mar 27, 2017 11:20 am
player.credits = 100000000;
Shouldn't that be:

Code: Select all

player.credits = player.credits + 100000000;
?

:mrgreen:
:lol: True. The question was to increase, not set. I'll do better next time :).

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 6:45 pm
by byronarn
hoqllnq wrote: Mon Mar 27, 2017 12:18 pm
byronarn wrote: Mon Mar 27, 2017 11:06 am
... but I can't find the function that does it on the wiki....
Here is an overview of all available properties and methods for the player class.
I was looking on that page but I guess I overlooked it. Guess I thought there would be a player.increaseCredits(1000) or something like that. But player.credits=player.credits+1000 makes sense, too.

Thanks for the replies everyone! I apreciate your help. :D

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 6:49 pm
by byronarn
Does the += operator work in Oolite javascript? For example,

Code: Select all

player.credits+=1000;
I know it works in a lot of languages. Regular javascript even has, i do believe. So what about Oolite Javascript?

Re: Increasing a player's credits

Posted: Mon Mar 27, 2017 7:00 pm
by another_commander
byronarn wrote: Mon Mar 27, 2017 6:49 pm
Does the += operator work in Oolite javascript?
Yes. Things like player.credits++ or ++player.credits work as well.

Re: Increasing a player's credits

Posted: Mon Sep 17, 2018 9:38 am
by Prester John
*hem* ... or install this little 'cheat.oxp'.....
*hides in shame*