Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Calculation

Posted by: bmbot Oct 15 2017, 04:08 AM

I am trying to build a calculator for a board game. At the start of the game, an input is sought for the number of players (say 2) and the amount of game currency given to each player (say 1000). Once this input is stored, another screen appears as follows:

Player 1: 1000 Add: Less:

Player 2: 1000 Add: Less:

Bank : 0

In the above, "Player 1" and "Player 2" are labels. "Add" and "Less" are buttons with the space in front of them have input fields. So if Player 1 makes a purchase of 200, in front of the "Less" button against Player 1, 200 is entered and the "Less" button is pressed. On that action, the Bank increases by 200 and Player 1 balance reduces from 1000 to 800. Similar actions lead to similar result. The game ends when the Bank becomes 0 after at least [number of players] * 3 clicks of add or less.

I want to build this as a HTML code that I can embed on a third party application.

Posted by: Christian J Oct 15 2017, 04:24 AM

This can't be done with HTML alone, you need a scripting language. Javascript is simple, and works well if the game is only meant to be seen in the user's own browser, and doesn't need to be saved. In other cases you need a server side language (e.g. PHP), and if you want different people to play with each other online (in separate browsers) you probably also need a database. Finally, if you'd want the server to update the users' games in real time, you might need Ajax and/or Push technology.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)