inherit
169267
0
Dec 1, 2024 13:31:59 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 21, 2013 16:59:52 GMT -8
I want to click on my "New amount" button and produce one number per turn.The way this is supposed to work is you click new amount and it generates a number.(It works) Then you have to click on take which refers to poison and that will also run on it's own random generator to live or die.You live you get the new amount,if you die it takes from your monetary money.The turn refers to new amount and then take.
<center> <div class="container affiliate">
<div class="title-bar" ><center><h2>Poison</h2></center></div> <div class="title-bar" > <button onclick="na()">New amount</button> <b>$<span id="number"></span></b> <button onclick="take">Take</button><b>$<span id="health"></span></b> <script language="javascript"> function na() { $('#number').text(Math.floor(Math.random() * pb.plugin.get('poison_bar_game').settings.money_amount) + 100); } </script> </div> </div> </center>
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 21, 2013 19:15:31 GMT -8
You haven't explained yourself very well when you ask what you need to do. I'm thinking you need to create a user key or super user key to save each members money. Instead of using a preset money amount defined in your settings. And do something like this. <center> <div class="container affiliate">
<div class="title-bar" ><center><h2>Poison</h2></center></div> <div class="title-bar" > <button onclick="na()">New amount</button> <b>$<span id="number"></span></b> <button onclick="take()">Take</button><b>$<span id="health"></span></b> <script language="javascript"> function na() { $('#number').text(Math.floor(Math.random() * pb.plugin.get('poison_bar_game').settings.money_amount) + 100);} function take() { if (Math.floor(Math.random() * parseInt($('#number').text())) < 60) {alert('dead');//set key for less money } else {alert('lived')//set key for more money }; }
</script>
</div> </div> </center>
|
|
inherit
169267
0
Dec 1, 2024 13:31:59 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 21, 2013 21:06:52 GMT -8
What I mean is after getting the new amount I want to disable the button until the user presses take.That would be a full turn. Is that posible?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 22, 2013 9:03:37 GMT -8
<center> <div class="container affiliate">
<div class="title-bar" ><center><h2>Poison</h2></center></div> <div class="title-bar" > <button id="amountbutton" onclick="na()">New amount</button> <b>$<span id="number"></span></b> <button onclick="take();showamount();">Take</button><b>$<span id="health"></span></b> <script language="javascript"> function na() { $('#number').text(Math.floor(Math.random() * 20) + 100);$('#amountbutton').css('visibility','hidden');} function take() { if (Math.floor(Math.random() * parseInt($('#number').text())) < 60) {alert('dead');} else {alert('lived')};} function showamount() { $('#amountbutton').css('visibility','visible');}
</script>
</div> </div> </center>
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 22, 2013 9:12:25 GMT -8
If you wanted the button to still be there, you could do: <center> <div class="container affiliate">
<div class="title-bar" ><center><h2>Poison</h2></center></div> <div class="title-bar" > <button id="amountbutton" onclick="na()">New amount</button> <b>$<span id="number"></span></b> <button onclick="take();showamount();">Take</button><b>$<span id="health"></span></b> <script language="javascript"> function na() { $('#number').text(Math.floor(Math.random() * 20) + 100);$('#amountbutton').attr('onclick', '');} function take() { if (Math.floor(Math.random() * parseInt($('#number').text())) < 60) {alert('dead');} else {alert('lived')};} function showamount() { $('#amountbutton').attr('onclick', 'na()');}
</script>
</div> </div> </center>
|
|
inherit
169267
0
Dec 1, 2024 13:31:59 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 22, 2013 10:38:10 GMT -8
That worked fine thank you P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓Just one more question how would I setup a key to add and subtract from the monetary system for each user?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 22, 2013 22:23:33 GMT -8
If you install the monetary system + yootil, all you have to do is use: pixeldepth.monetary.add(100); pixeldepth.monetary.subtract(100); Taken from the webpage: API For Developers
The Monetary System has a very basic API for other developers to hook into the money system.
For the moment the following methods are implemented.
Note: These are all methods.
pixeldepth.monetary.get - Gets money (see source for params). pixeldepth.monetary.subtract - Removes money (see source for params). pixeldepth.monetary.add - Adds money (see source for params). pixeldepth.monetary.clear - Clears the money amount (see source for params). pixeldepth.monetary.bank.clear_transactions - Clears all the transactions. pixeldepth.monetary.bank.clear_balance - This will clear the bank balance (doesn't touch the wallet). pixeldepth.monetary.bank.get_transactions - Gets the last X transactions. pixeldepth.monetary.disable_earning - Can disable money from being earned for the current page. pixeldepth.monetary.enable_earning - Can enable money to be earned for the current page. pixeldepth.monetary.clear_all - Clears everything for the user (data object is reset). pixeldepth.monetary.clear_last_interest - Clears the last interest timestamp.
|
|
inherit
169267
0
Dec 1, 2024 13:31:59 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 23, 2013 6:07:23 GMT -8
Thank you
|
|
inherit
169267
0
Dec 1, 2024 13:31:59 GMT -8
Mike
Praise God Almighty!
1,534
July 2011
riccetts
|
Post by Mike on Dec 23, 2013 17:03:03 GMT -8
Thanks
|
|