http://en.doc.boardgamearena.com/api.php?action=feedcontributions&user=GoDodyGo&feedformat=atomBoard Game Arena - User contributions [en]2024-03-29T08:15:00ZUser contributionsMediaWiki 1.39.0http://en.doc.boardgamearena.com/index.php?title=Gamehelpliverpoolrummy&diff=18573Gamehelpliverpoolrummy2023-10-28T23:44:50Z<p>GoDodyGo: Added description of LIVERPOOL behavior.</p>
<hr />
<div>A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. Shorter game tables can also be created. During each hand, players attempt to meet a target contract of Sets and Runs. Once they have the necessary cards in hand, they can 'go down' and put these cards face-up on the table into 'melds'. They can then play their remaining hand cards on other melds, towards the final goal of 'going out' by discarding their final hand card. When a player goes out, other players are penalized points for the cards remaining in their hand.<br />
<br />
'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks or more.<br />
<br />
Players start with 10 or more cards in their hand, depending on the hand target. All cards are dealt face down. After all player hands have been dealt the remaining cards are placed face down in a pile known as the 'draw deck'. The top card of the draw deck placed face up next to the draw deck, forming the 'discard pile'.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
'''Objective:''' Complete a specific set of target melds (also known as a contract in other references). Melds come in 2 forms: Sets and Runs. A Set is three or more cards of the same value (5-5-5), of any suit. A Run is four or more cards of the same suit and consecutive value (10-J-Q-K).<br />
<br />
In the full game, the sequence of target contracts is (# of cards dealt):<br />
1. 2 Sets (10)<br />
2. 1 Set and 1 Run (11)<br />
3. 2 Runs (11)<br />
4. 3 Sets (12)<br />
5. 2 Sets and 1 Run (12)<br />
6. 2 Runs and 1 Set (12)<br />
7. 3 Runs (12)<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the draw deck or the discard pile<br />
B) Going Down (aka melding), if possible<br />
C) Playing cards onto other melds (only after Going Down)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard even when going out. This is placed face-up onto the discard pile. The hand immediately ends and points are scored. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. So, the Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive number) after all hands have been played wins the game.<br />
<br />
Jokers: 20 points against the player<br />
Aces: 15 points against the player<br />
10,J,Q,K: 10 points against the player<br />
2-9: 5 points against the player<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract prior to being able to play the remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own. '''So, if the contract is 2 sets you can only put down 2 sets!'''<br />
<br />
'''Buying:''' Any player may attempt to 'buy' a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a card from the deck as penalty. Buyer priority is dictated by seat order, with the highest priority going to the player who has not had a turn the longest.<br />
<br />
'''Jokers:''' Jokers are wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a Run or a Set containing a Joker, the other players may place the card that properly completes the Run in place of the Joker and remove it from the Run into their hand. The taken Joker may then be used elsewhere (to the best advantage of the player) in the same turn. Players can use up to 1 joker in the act of Going Down, placing the card to be substituted in a special area on the BGA table and also selecting the joker on the board.<br />
<br />
'''Liverpool:''' [Game options are BONUS or PENALTY] BONUS: When a playable card is discarded instead of being played onto a board meld, any player who has previously gone down may declare LIVERPOOL (click the button) before the next turns starts. The discarded card will come into their hand. They can then play one card onto a meld and discard one other card from their hand. Play then resumes back to the interrupted player. [PENALTY] Same as [BONUS] except the discarder takes their card back and draws an additional card as a penalty. The player declaring PENALTY gets no other benefit.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelpliverpoolrummy&diff=7255Gamehelpliverpoolrummy2021-02-07T09:08:17Z<p>GoDodyGo: </p>
<hr />
<div>A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. There are 4 hands in a shorter version. During each hand, players attempt to meet a target contract of Sets and Runs. Once they have the necessary cards in hand, they can 'go down' and put these cards face-up on the table in 'melds'. They can then play their remaining hand cards on other melds, towards the final goal of 'going out' by discarding their final hand card. When a player goes out, other players are penalized points for the cards remaining in their hand.<br />
<br />
'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks or more.<br />
<br />
Players start with 10 or more cards in their hand, depending on the hand target. All cards are dealt face down. After all player hands have been dealt the remaining cards are placed face down in a pile known as the 'draw deck'. The top card of the draw deck placed face up next to the draw deck, forming the 'discard pile'.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
'''Objective:''' Complete a specific set of target melds (also known as a contract in other references). Melds come in 2 forms: Sets and Runs. A Set is three or more cards of the same value (5-5-5), of any suit. A Run is four or more cards of the same suit and consecutive value (10-J-Q-K).<br />
<br />
In the full game, the sequence of target contracts is (# of cards dealt):<br />
1. 2 Sets (10)<br />
2. 1 Set and 1 Run (11)<br />
3. 2 Runs (11)<br />
4. 3 Sets (12)<br />
5. 2 Sets and 1 Run (12)<br />
6. 2 Runs and 1 Set (12)<br />
7. 3 Runs (12)<br />
<br />
In the short game, the sequence of target contracts is:<br />
1. 2 Sets<br />
2. 2 Runs<br />
3. 2 Sets and 1 Run<br />
4. 3 Runs<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the draw deck or the discard pile<br />
B) Going Down (aka melding), if possible<br />
C) Playing cards onto other melds (only after Going Down)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard even when going out. This is placed face-up onto the discard pile. The hand immediately ends and points are scored. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. So, the Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive number) after all seven hands wins the game.<br />
<br />
Jokers: 20 points against the player<br />
Aces: 15 points against the player<br />
10,J,Q,K: 10 points against the player<br />
2-9: 5 points against the player<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract prior to being able to play the remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own. '''So, if the contract is 2 sets you can only put down 2 sets!'''<br />
<br />
'''Buying:''' Any player may attempt to 'buy' a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a card from the deck as penalty. Buyer priority is dictated by seat order, with the highest priority going to the player who has not had a turn the longest.<br />
<br />
'''Jokers:''' Jokers are wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a Run or a Set containing a Joker, the other players may place the card that properly completes the Run in place of the Joker and remove it from the Run into their hand. The taken Joker may then be used elsewhere (to the best advantage of the player) in the same turn. Players can use up to 1 joker in the act of Going Down, placing the card to be substituted in a special area on the BGA table and also selecting the joker on the board.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Stock&diff=6819Stock2021-01-09T20:52:50Z<p>GoDodyGo: Added example code fragment of updateDisplay()</p>
<hr />
<div>{{Studio_Framework_Navigation}}<br />
<br />
== Overview ==<br />
<br />
<br />
'''Stock''' is a javascript component that you can use in your game interface to display a set of elements of the same size that need to be arranged in single or multiple lines.<br />
<br />
Stock is very flexible and is the most used component in BGA games.<br />
<br />
Examples of stock use cases:<br />
<br />
* Display a set of cards, typically hands (examples: ''Hearts'', ''Seasons'', ''The Boss'', ''Race for the Galaxy'').<br />
* Display items in player panels (examples: ''Takenoko'', ''Amyitis'', ...)<br />
* ... Many other situations. For example, black dice and cubes on cards in ''Troyes'' are displayed with stock components.<br />
<br />
Using stock:<br />
<br />
* Your items are arranged nicely and sorted by type.<br />
* When adding or removing items to a set, all items slide smoothly to their new position in the set.<br />
* Selecting and unselecting items are built-in functions.<br />
* You don't have to worry about inserting/removing HTML code; the entire life cycle of the stock is managed by the component.<br />
<br />
== Using stock: a simple example ==<br />
<br />
Let's have a look on how the stock is used in the game ''Hearts'' to display a hand of standard cards.<br />
<br />
First, don't forget to add "ebg/stock" as a dependency in your js file:<br />
<br />
<pre><br />
define([<br />
"dojo","dojo/_base/declare",<br />
"ebg/core/gamegui",<br />
"ebg/counter",<br />
"ebg/stock" /// <==== HERE<br />
],<br />
</pre><br />
<br />
The stock is initialized in the Javascript "setup" method like this:<br />
<br />
<pre><br />
// Player hand<br />
this.playerHand = new ebg.stock();<br />
this.playerHand.create( this, $('myhand'), this.cardwidth, this.cardheight );<br />
</pre><br />
<br />
Explanations:<br />
* We create a new stock object for the player hand.<br />
* As parameters of the "create" method, we provide the width/height of an item (a card), and the div container "myhand" - which is a simple empty "div" element defined in our HTML template (.tpl).<br />
<br />
Then, we must tell the stock what items it is going to display during its life: the 52 cards of a standard card game. Of course, we did not create 52 different images, but a "CSS sprite" image named "cards.jpg" with the cards arranged in 4 rows and 13 columns.<br />
<br />
Here's how we tell stock what items to display:<br />
<br />
<pre><br />
// Specify that there are 13 images per row in the CSS sprite image<br />
this.playerHand.image_items_per_row = 13;<br />
<br />
// Create card types:<br />
for( var color=1;color<=4;color++ )<br />
{<br />
for( var value=2;value<=14;value++ )<br />
{<br />
// Build card type id<br />
var card_type_id = this.getCardUniqueId( color, value );<br />
this.playerHand.addItemType( card_type_id, card_type_id, g_gamethemeurl+'img/cards.jpg', card_type_id );<br />
}<br />
}<br />
</pre><br />
<br />
Explanation:<br />
<br />
* First, we tell the stock component that our CSS sprite contains 13 items per row. This way, it can find the correct image for each card type id.<br />
* Then for the 4x13 cards, we call the "addItemType" method that creates the type. The arguments are the type id, the weight of the card (for sorting purpose), the URL of our CSS sprite, and the position of our card image in the CSS sprite.<br />
<br />
Note: In this specific example we need to generate a unique ID for each type of card based on its color and value. This is the only purpose of "getCardUniqueId".<br />
<br />
From now on, if we need to add a card - for example, the 5 of Hearts - to a player's hand, we can do this:<br />
<br />
<pre><br />
this.playerHand.addToStock( this.getCardUniqueId( 2 /* 2=hearts */, 5 ) );<br />
</pre><br />
<br />
In reality, cards have some IDs, which are useful to manipulate them. This is the reason we are using "addToStockWithId" instead:<br />
<br />
<pre><br />
this.playerHand.addToStockWithId( this.getCardUniqueId( 2 /* 2=hearts */, 5 ), my_card_id );<br />
</pre><br />
<br />
If afterwards we want to remove this card from the stock:<br />
<br />
<pre><br />
this.playerHand.removeFromStockById( my_card_id );<br />
</pre><br />
<br />
== Complete stock component reference ==<br />
<br />
=== Creation ===<br />
<br />
'''create( page, container_div, item_width, item_height ):'''<br />
<br />
With create, you create a new stock component.<br />
<br />
Parameters:<br />
* page: the container page. Usually: "this".<br />
* container_div: the container "div" element (a void div element in your template, with an id).<br />
* width and height (in pixels) for the stock component.<br />
<br />
(See ''Hearts'' example above).<br />
<br />
'''addItemType( type, weight, image, image_position ):'''<br />
<br />
Define a new type of item and add it to the stock.<br />
<br />
This is mandatory to define a new item type before adding it to the stock. Example: if you want to have a stock contain cubes of 3 different colors, you must add 3 item types (one for each color).<br />
<br />
Parameters:<br />
* type: ID of the type to add. You can choose any positive integer. All item types must have distinct IDs.<br />
* weight: weight of items of this type. Weight value is used to sort items of the stock during the display. Note that you can specify the same weight for all items; in this case, they are not sorted and their order might change randomly at any time.<br />
* image: URL of item image. Most of the time, you will use a CSS sprite for stock items, so you have to specify CSS sprite image here.<br />
<br />
Be careful: you must specify the image url as this:<br />
<br />
<pre><br />
g_gamethemeurl+'img/yourimage.png'<br />
</pre><br />
<br />
* image_position: if "image" specify the URL of a CSS sprite, you must specify the position of the item image in this CSS sprite. For example, if you have a CSS sprite with 3 cubes with a size of 20x20 pixels each (so your CSS image has for example a size of 20x60 or 60x20), you specify "0" for the first cube image, 1 for the second, 2 for the third.<br />
<br />
''Important'': if there is more than one line of items in your CSS sprite, you must specify how many items per line you have in your CSS sprite like this:<br />
<br />
<pre><br />
// Specify that there are 10 image items per row in images used in "myStockObject" control.<br />
this.myStockObject.image_items_per_row = 10;<br />
</pre><br />
<br />
<br />
<br />
=== Add/Remove items ===<br />
<br />
<br />
<br />
<br />
'''addToStock( type, from )'''<br />
<br />
Add an item to the stock, with the specified type, but without a unique ID.<br />
<br />
To make your life easier, in most cases we suggest you use '''addToStockWithId''' in order to give an ID to the item added. '''addToStock''' is suitable when you are using a stock to control items that are generic game materials that don't need to be tracked individually (example: a bunch of money tokens).<br />
<br />
Parameters:<br />
* type: ID of the item type to use (as specified in "addItemType")<br />
* from: OPTIONAL: if you specify an HTML item here, the item will appear on this item and will be slid to its position on the stock item.<br />
<br />
Example:<br />
<pre><br />
// Add a money token to the "player money" stock.<br />
// The money token will appear on "player_id" player panel and will move to its position.<br />
this.playerMoney.addToStock( MONEY_TOKEN, 'overall_player_board_'+player_id );<br />
</pre><br />
<br />
Important: for a given stock control, you must use either '''addToStock''' or '''addToStockWithId''', but NEVER BOTH OF THEM.<br />
<br />
'''addToStockWithId( type, id, from )'''<br />
<br />
This is the same method as '''addToStock''', except that it also associates an ID with the newly created item.<br />
<br />
This is especially useful:<br />
<br />
* When you need to know which item(s) have been selected by the user (see '''getSelectedItems''').<br />
* When you need to remove a specific item from the stock with '''removeFromStockById'''.<br />
<br />
'''removeFromStock( type, to, noupdate )'''<br />
<br />
Remove an item of the specific type from the stock.<br />
<br />
'to' is an optional parameter. If "to" contains the ID of an HTML element, the item removed from the Stock slides to this HTML element before it disappears.<br />
<br />
'noupdate' is an optional parameter. If set to "true" it will prevent the Stock display from changing. This is useful when multiple (but not all) items are removed at the same time, to avoid ghost items appearing briefly. Be sure to call '''updateDisplay''' after all items are removed.<br />
<br />
'''removeFromStockById( id, to, noupdate )'''<br />
<br />
Remove an item with a specific ID from the stock.<br />
<br />
'to' is an optional parameter. If "to" contains the ID of an HTML element, the item removed from the stock slides to this HTML element before it disappears.<br />
<br />
'noupdate' is an optional parameter. If set to "true" it will prevent the Stock display from changing. This is useful when multiple (but not all) items are removed at the same time, to avoid ghost items appearing briefly. Be sure to call '''updateDisplay''' after all items are removed.<br />
<br />
'''removeAll()'''<br />
<br />
Remove all items from the stock.<br />
<br />
'''removeAllTo( to )'''<br />
<br />
Remove all items from the stock. If "to" contains the ID of an HTML element, the item removed from the stock slides to this HTML element before it disappears.<br />
<br />
Example code if you change the underlying stock item, or otherwise want to make the stock item refresh:<br />
<pre><br />
this.myStockControl.updateDisplay();<br />
</pre><br />
<br />
=== Getters ===<br />
<br />
'''getPresentTypeList()'''<br />
<br />
Return an array with all the types of items present in the stock right now.<br />
<br />
Example:<br />
<pre><br />
this.myStockControl.removeAll();<br />
this.myStockControl.addToStock( 65 );<br />
this.myStockControl.addToStock( 34 );<br />
this.myStockControl.addToStock( 89 );<br />
this.myStockControl.addToStock( 65 );<br />
<br />
// The following returns: { 34:1, 65:1, 89:1 }<br />
var item_types = this.myStockControl.getPresentTypeList();<br />
</pre><br />
<br />
'''count():'''<br />
<br />
Return the total number of items in the stock right now.<br />
<br />
'''getAllItems()'''<br />
<br />
Get all items (same format as getSelectedItems and getUnselectedItems).<br />
<br />
'''getItemDivId(id)'''<br />
<br />
Get the div id using the stock item id (to manipulate element properties directly).<br />
<br />
'''getItemById(id)'''<br />
<br />
Get the Stock item with the id in parameter<br />
ex : return the object { type:1, id: 1001 }<br />
<br />
<br />
=== Selection ===<br />
<br />
'''setSelectionMode( mode )'''<br />
<br />
For each stock control, you can specify a selection mode:<br />
* 0: no item can be selected by the player.<br />
* 1: a maximum of one item can be selected by the player at a time.<br />
* 2 (default): multiple items can be selected by the player at the same time.<br />
<br />
'''setSelectionAppearance( type )'''<br />
<br />
For each stock control, you can specify a selection highlighting type:<br />
* 'border': there will be a red border around selected items (this is the default). The attribute 'apparenceBorderWidth' can be used to manage the width of the border (in pixels).<br />
* 'disappear': the selected item will fade out and disappear. This is useful when the selection has the effect of destroying the item.<br />
* 'class': there will be an extra '''stockitem_selected''' css class added to the element when it is selected (and removed when unselected). You can override this class in the css file for your game.<br />
<br />
By default this class definition is:<br />
<pre><br />
.stockitem_selected {<br />
border: 2px solid red ! important;<br />
}<br />
</pre><br />
<br />
If you want to override it (for example, to change the border color) add this in your <game>.css file:<br />
<pre><br />
.stockitem_selected {<br />
border: 2px solid orange ! important;<br />
}<br />
</pre><br />
<br />
'''isSelected( id )'''<br />
<br />
Return a boolean indicating whether the specified item id has been selected.<br />
<br />
'''selectItem( id )'''<br />
<br />
Select the specified item.<br />
<br />
'''unselectItem( id )'''<br />
<br />
Unselect the specified item.<br />
<br />
'''unselectAll()'''<br />
<br />
Unselect all items of the stock.<br />
<br />
'''onChangeSelection'''<br />
<br />
This callback method is called when the player selects/unselects an item of the stock.<br />
<br />
You can connect this to one of your methods like this:<br />
<br />
<pre><br />
dojo.connect( this.myStockControl, 'onChangeSelection', this, 'onMyMethodToCall' );<br />
<br />
(...)<br />
<br />
onMyMethodToCall: function( control_name, item_id )<br />
{<br />
// This method is called when myStockControl selected items changed<br />
var items = this.myStockControl.getSelectedItems();<br />
<br />
// (do something)<br />
},<br />
</pre><br />
<br />
Nota bene: <br />
- The "control_name" argument is the ID (the "DOM" id) of the "div" container of your stock control. Using "control_name", you can use the same callback method for different Stock control and see which one trigger the method.<br />
- The "item_id" argument is the stock ID (index) of the stock item that has just been selected/unselected.<br />
<br />
'''getSelectedItems()'''<br />
<br />
Return the list of selected items, as an array with the following format:<br />
<pre><br />
[<br />
{ type:1, id: 1001 },<br />
{ type:1, id: 1002 },<br />
{ type:3, id: 1003 }<br />
...<br />
]<br />
</pre><br />
<br />
'''getUnselectedItems()'''<br />
<br />
Same as the previous one, but return unselected item instead of seleted ones.<br />
<br />
<br />
=== Layout ===<br />
<br />
<br />
'''resetItemsPosition()'''<br />
<br />
If you moved an item from the stock control manually (ex: after a drag'n'drop) and want to reset their positions to their original ones, you can call this method.<br />
<br />
'''item_margin'''<br />
<br />
By default, there is a margin of 5px between the items of a stock. You can change the member variable "item_margin" to change this.<br />
<br />
Example:<br />
<pre><br />
this.myStockControl.item_margin=5;<br />
</pre><br />
<br />
'''changeItemsWeight( newWeights )'''<br />
<br />
With this method you can change dynamically the weight of the item types in a stock control.<br />
<br />
Items are immediately re-sorted with the new weight.<br />
<br />
Example: with a stock control that contains classic cards, you can order them by value or by color. Using changeItemsWeight you can switch from one sort method to another when a player request this.<br />
<br />
newWeights is an associative array: item type id => new weight.<br />
<br />
Example:<br />
<pre><br />
// Item type 1 gets a new weight of 10, 2 a new weight of 20, 3 a new weight of 30.<br />
this.myStockControl.changeItemsWeight( { 1: 10, 2: 20, 3: 30 } );<br />
</pre><br />
<br />
'''centerItems'''<br />
<br />
Center the stock items in the middle of the stock container.<br />
e.g. this.myStock.centerItems = true; <br />
<br />
'''setOverlap( horizontal_percent, vertical_percent )'''<br />
<br />
Make items of the stock control "overlap" each other, to save space.<br />
<br />
By default, horizontal_overlap and vertical_overlap are 0.<br />
<br />
When horizontal_overlap=20, it means that a stock item will overlap to only show 20% of the width of all the previous items. horizontal_overlap can't be greater than 100.<br />
<br />
vertical_overlap works differently: one items on two are shifted up.<br />
<br />
See the games "Jaipur" or "Koryŏ" to see examples of use of this function.<br />
<br />
<br />
'''autowidth'''<br />
<br />
Stock does not play well if you attempt to inline-block it with other blocks, to fix that you have to set this flag which will calculate width properly<br />
mystock.autowidth = true;<br />
<br />
=== Customize apperance ===<br />
<br />
'''extraClasses'''<br />
<br />
Can be set to a list of class names (separated by space) on stock object, so when div is created these are added, i.e.<br />
<br />
this.playerHand.extraClasses='mycard';<br />
<br />
Note that is is same list for all items.<br />
<br />
'''onItemCreate'''<br />
<br />
Using onItemCreate, you can trigger a method each time a new item is added to the Stock, in order to customize it.<br />
<br />
Complete example:<br />
<pre><br />
// During "setup" phase, we associate our method "setupNewCard" with the creation of a new stock item:<br />
this.myStockItem.onItemCreate = dojo.hitch( this, 'setupNewCard' ); <br />
<br />
<br />
// And here is our "setupNewCard":<br />
setupNewCard: function( card_div, card_type_id, card_id )<br />
{<br />
// Add a special tooltip on the card:<br />
this.addTooltip( card_div.id, _("Some nice tooltip for this item"), '' );<br />
<br />
// Note that "card_type_id" contains the type of the item, so you can do special actions depending on the item type<br />
<br />
// Add some custom HTML content INSIDE the Stock item:<br />
dojo.place( this.format_block( 'jstpl_my_card_content', {<br />
....<br />
} ), card_div.id );<br />
}<br />
<br />
</pre><br />
<br />
'''onItemDelete'''<br />
<br />
Function handler called when div is removed<br />
<br />
this.myStock.onItemDelete = (card_div, card_type_id, card_id) => { console.log("card deleted from myStock: "+card_id); };<br />
<br />
<br />
== Tips when adding/removing items to/from Stock components ==<br />
<br />
Most cases will be one of the following situations:<br />
<br />
'''Situation A''':<br />
<br />
When you add a card to a stock item, and this card is '''not''' coming from another stock:<br />
<br />
* Use '''addToStockWithId''' with a "from" argument set to the element of your interface where the card should come from (i.e. div id). For example if you want to "reveal" card from player hand and it is not an interface element you can set from to be 'player_board_'+activePlayerId (where activePlayerId is player who played that card).<br />
<br />
'''Situation B''':<br />
<br />
When you add a card to a stock item, and this card is coming from another stock:<br />
<br />
* On the destination Stock, use '''addToStockWithId''' with a "from" argument which is the HTML id of the corresponding item in the source Stock. For example, if the source stock id is "myHand", then the HTML id of card 48 is "myHand_item_48".<br />
* Then, remove the source item with '''removeFromStockById'''.<br />
<br />
(Note that it's important to do things in this order, because the source item must still exist when you use it as the origin of the slide.)<br />
<br />
'''Situation C''':<br />
<br />
When you move a card from a stock item to something that is not a stock item:<br />
<br />
* Insert the card as a classic HTML template (dojo.place / this.format_block).<br />
* Place it on the Stock item with '''this.placeOnObject''', using the Stock item HTML id (see above).<br />
* Slide it to its new position with '''this.slideToObject'''.<br />
* Remove the card from the Stock item with '''removeFromStockById'''.<br />
<br />
Using the methods above, your cards should slide to, from, and between your Stock controls smoothly.<br />
<br />
<br />
You can customize this (showing the default value):<br />
<pre><br />
<br />
this.mystock.jstpl_stock_item= "<div id=\"${id}\" class=\"stockitem\" style=\"top:${top}px;left:${left}px;width:${width}px;height:${height}px;z-index:${position};background-image:url('${image}');\"></div>";<br />
</pre><br />
To produce a different type of stock item</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelpliverpoolrummy&diff=6167Gamehelpliverpoolrummy2020-11-17T07:43:36Z<p>GoDodyGo: Created page with "A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. There are 4 hands in a shorter version. During each hand, players attempt..."</p>
<hr />
<div>A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. There are 4 hands in a shorter version. During each hand, players attempt to meet a target contract of Sets and Runs. Once they have the necessary cards in hand, they can 'go down' and put these cards face-up on the table in 'melds'. They can then play their remaining hand cards on other melds, towards the final goal of 'going out' by discarding their final hand card. When a player goes out, other players are penalized points for the cards remaining in their hand.<br />
<br />
'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks or more.<br />
<br />
In the standard 7 hand version, in each of the first 4 hands each player starts with 10 cards. In each of the last 3 hands, each player starts with 12 cards. All cards are dealt face down. After all player hands have been dealt the remaining cards are placed face down in a pile known as the 'draw deck'. The top card of the draw deck placed face up next to the draw deck, forming the 'discard pile'.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
'''Objective:''' Complete a specific set of target melds (also known as a contract in other references). Melds come in 2 forms: Sets and Runs. A Set is three or more cards of the same value (5-5-5), of any suit. A Run is four or more cards of the same suit and consecutive value (10-J-Q-K).<br />
<br />
In the full game, the sequence of target contracts is:<br />
1. 2 Sets<br />
2. 1 Set and 1 Run<br />
3. 2 Runs<br />
4. 3 Sets<br />
5. 2 Sets and 1 Run<br />
6. 2 Runs and 1 Set<br />
7. 3 Runs<br />
<br />
In the short game, the sequence of target contracts is:<br />
1. 2 Sets<br />
2. 2 Runs<br />
3. 2 Sets and 1 Run<br />
4. 3 Runs<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the draw deck or the discard pile<br />
B) Going Down (aka melding), if possible<br />
C) Playing cards onto other melds (only after Going Down)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard even when going out. This is placed face-up onto the discard pile. The hand immediately ends and points are scored. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. So, the Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive number) after all seven hands wins the game.<br />
<br />
Jokers: 20 points against the player<br />
Aces: 15 points against the player<br />
10,J,Q,K: 10 points against the player<br />
2-9: 5 points against the player<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract prior to being able to play the remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own. '''So, if the contract is 2 sets you can only put down 2 sets!'''<br />
<br />
'''Buying:''' Any player may attempt to 'buy' a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a card from the deck as penalty. Buyer priority is dictated by seat order, with the highest priority going to the player who has not had a turn the longest.<br />
<br />
'''Jokers:''' Jokers are wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a Run or a Set containing a Joker, the other players may place the card that properly completes the Run in place of the Joker and remove it from the Run into their hand. The taken Joker may then be used elsewhere (to the best advantage of the player) in the same turn. Players can use up to 1 joker in the act of Going Down, placing the card to be substituted in a special area on the BGA table and also selecting the joker on the board.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelptutorialrumone&diff=6118Gamehelptutorialrumone2020-11-11T07:06:53Z<p>GoDodyGo: </p>
<hr />
<div>A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. During each hand, players attempt to meet a target contract of Sets and Runs. Once they have the necessary cards in hand, they can 'go down' and put these cards face-up on the table in 'melds'. They can then play their remaining hand cards on other melds, towards the final goal of 'going out' by discarding their final hand card. When a player goes out, other players are penalized points by the cards remaining in their hand.<br />
<br />
'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks.<br />
<br />
In each of the first 4 hands, the dealer deals 10 cards to each player. In each of the last 3 hands, the dealer deals 12 cards to each player. Cards are dealt from left to right, beginning with the player to the dealer’s immediate left. All cards are dealt face down. Once all player’s hands have been dealt, the remaining cards are placed face down in a pile known as the “draw deck”. The top card of the draw deck placed face up next to the draw deck, forming the “discard pile”.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
'''Objective:''' Complete a specific set of melds (also known as a contract in other references). Melds come in the form of Sets and Runs (sequences). A Set is three or more cards of the same value (5-5-5), of any suit. A Run is four or more cards of the same suit and consecutive value (10-J-Q-K).<br />
<br />
In the full game, the sequence of target contracts is:<br />
1. 2 Sets<br />
2. 1 Set and 1 Run<br />
3. 2 Runs<br />
4. 3 Sets<br />
5. 2 Sets and 1 Run<br />
6. 2 Runs and 1 Set<br />
7. 3 Runs<br />
<br />
In the short game, the sequence of target contracts is:<br />
1. 2 Sets<br />
2. 2 Runs<br />
3. 2 Sets and 1 Run<br />
4. 3 Runs<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the draw deck or the discard pile<br />
B) Melding, or going down (if possible)<br />
C) Playing cards onto other melds (if possible)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard, placed face-up onto the discard pile. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. So, the Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive number) after all seven hands wins the game.<br />
<br />
Jokers: 20 points against the player<br />
Aces: 15 points against the player<br />
10,J,Q,K: 10 points against the player<br />
2-9: 5 points against the player<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract, prior to being able to play the individual remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own.<br />
<br />
'''Buying:''' Any player may attempt to “buy” a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a card from the deck as penalty.<br />
<br />
'''Jokers:''' Jokers are wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a sequence containing a Joker, the other players may place the card that properly completes the sequence in place of the Joker and remove it from the sequence. The taken Joker must then be used elsewhere (to the best advantage of the player) in the same turn.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelptutorialrumone&diff=6043Gamehelptutorialrumone2020-11-03T01:00:02Z<p>GoDodyGo: </p>
<hr />
<div>A game of Liverpool Rummy is played in 7 hands where players take turns drawing and discarding cards. During each hand, players attempt to meet a target contract of Sets and Runs. Once they have the necessary cards in hand, they can 'go down' and put these cards face-up on the table in 'melds'. They can then play their remaining hand cards on other melds, towards the final goal of 'going out' by discarding their final hand card. When a player goes out, other players are penalized points by the cards remaining in their hand.<br />
<br />
'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks.<br />
<br />
In each of the first 4 hands, the dealer deals 10 cards to each player. In each of the last 3 hands, the dealer deals 12 cards to each player. Cards are dealt from left to right, beginning with the player to the dealer’s immediate left. All cards are dealt face down. Once all player’s hands have been dealt, the remaining cards are placed face down in a pile known as the “draw deck”. The top card of the draw deck placed face up next to the draw deck, forming the “discard pile”.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
'''Objective:''' Complete a specific set of melds (also known as a contract in other references). Melds come in the form of Sets and Runs (sequences). A Set is three or more cards of the same value (5-5-5), of any suit. A Run is four or more cards of the same suit and consecutive value (10-J-Q-K).<br />
<br />
The sequence of target contracts is:<br />
1. 2 Sets<br />
2. 1 Set and 1 Run<br />
3. 2 Runs<br />
4. 3 Sets<br />
5. 2 Sets and 1 Run<br />
6. 2 Runs and 1 Set<br />
7. 3 Sets<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the draw deck or the discard pile<br />
B) Melding, or going down (if possible)<br />
C) Playing cards onto other melds (if possible)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard, placed face-up onto the discard pile. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. So, the Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive number) after all seven hands wins the game.<br />
<br />
Jokers: 20 points against the player<br />
Aces: 15 points against the player<br />
10,J,Q,K: 10 points against the player<br />
2-9: 5 points against the player<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract, prior to being able to play the individual remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own.<br />
<br />
'''Buying:''' Any player may attempt to “buy” a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a stock pile card as penalty.<br />
<br />
'''Jokers:''' Jokers are always wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a sequence containing a Joker, the other players may place the card that properly completes the sequence in place of the Joker and remove it from the sequence. The taken Joker must then be used elsewhere (to the best advantage of the player) in the same turn.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelptutorialrumone&diff=6042Gamehelptutorialrumone2020-11-03T00:46:30Z<p>GoDodyGo: </p>
<hr />
<div>'''Format:''' Games are played with 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are best played with 2 decks. Games with 5 to 8 players are best played with 3 decks.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
A game of Liverpool Rummy is played in 7 hands. In each of the first 4 hands, the dealer deals 10 cards to each player. In each of the last 3 hands, the dealer deals 12 cards to each player. Cards are dealt from left to right, beginning with the player to the dealer’s immediate left. All cards are dealt face down. Once all player’s hands have been dealt, the remaining cards are placed face down in a pile known as the “stock pile”. The top card of the stock pile is drawn and placed face up next to the stock pile, forming the “discard pile”.<br />
<br />
'''Objective:''' Complete a specific set of melds, known as a contract. Melds come in the form of sets and sequences (runs). A set is three cards of the same value (5-5-5). A sequence, or run, is four cards of the same suit and consecutive value (10-J-Q-K). The sequence of contracts is:<br />
1. 2 Sets<br />
2. 1 Set and 1 Run<br />
3. 2 Runs<br />
4. 3 Sets<br />
5. 2 Sets and 1 Run<br />
6. 2 Runs and 1 Set<br />
7. 3 Sets<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the stock pile or the discard pile<br />
B) Melding, or going down (if possible)<br />
C) Playing cards onto other melds (if possible)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard, placed face-up into the “discard pile”. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. The Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive) after all seven hands wins the game.<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract, prior to being able to play the individual remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own.<br />
<br />
'''Buying:''' Any player may attempt to “buy” a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a stock pile card as penalty.<br />
<br />
'''Jokers:''' Jokers are always wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a sequence containing a Joker, the other players may place the card that properly completes the sequence in place of the Joker and remove it from the sequence. The taken Joker must then be used elsewhere (to the best advantage of the player) in the same turn.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Gamehelptutorialrumone&diff=6024Gamehelptutorialrumone2020-10-30T23:13:19Z<p>GoDodyGo: Game rules for Cozy Oaks Rummy</p>
<hr />
<div>'''Format:''' Games are played with either 2 or more standard 52-card decks, depending on the number of players. 2 Jokers are added to each 52-card deck. Games with 3 to 4 players are played with 2 decks. Games with 5 to 8 players are played with 3 decks.<br />
<br />
'''Card rank:''' Cards are ranked in descending order from high to low, (Hi) K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2 (Lo). An Ace (A) can be played high (above a King) or low (below a 2) at the player’s discretion.<br />
<br />
A game of Liverpool Rummy is played in 7 hands. In each of the first 4 hands, the dealer deals 10 cards to each player. In each of the last 3 hands, the dealer deals 12 cards to each player. Cards are dealt from left to right, beginning with the player to the dealer’s immediate left. All cards are dealt face down. Once all player’s hands have been dealt, the remaining cards are placed face down in a pile known as the “stock pile”. The top card of the stock pile is drawn and placed face up next to the stock pile, forming the “discard pile”.<br />
<br />
'''Objective:''' Complete a specific set of melds, known as a contract. Melds come in the form of sets and sequences (runs). A set is three cards of the same value (5-5-5). A sequence, or run, is four cards of the same suit and consecutive value (10-J-Q-K). The sequence of contracts is:<br />
1. 2 Sets<br />
2. 1 Set and 1 Run<br />
3. 2 Runs<br />
4. 3 Sets<br />
5. 2 Sets and 1 Run<br />
6. 2 Runs and 1 Set<br />
7. 3 Sets<br />
<br />
'''Player turn:''' Each player’s turn consists of 4 steps:<br />
A) Draw a card from the stock pile or the discard pile<br />
B) Melding, or going down (if possible)<br />
C) Playing cards onto other melds (if possible)<br />
D) Discarding 1 card<br />
<br />
Every turn must end with a discard, placed face-up into the “discard pile”. The first player to successfully complete the contract and lay off their entire hand wins the hand. At the conclusion of a hand, all remaining cards in other player’s hands are scored based on their point value. On BoardGameArena, points count negatively. The Liverpool Rummy player with the least negative cumulative score (i.e. the most-positive) after all seven hands wins the game.<br />
<br />
'''Aces:''' An ace may be used to complete high (A-K-Q-J) and low (4-3-2-A) sequences. They may not be used to “turn the corner” (Q-K-A-2).<br />
<br />
'''Playing on melds:''' Players must first complete the hand’s contract, prior to being able to play the individual remaining cards from their hand. Following the completion of a contract, the player can play cards only onto the existing melds on the table. The player may not create any new melds of their own.<br />
<br />
'''Buying:''' Any player may attempt to “buy” a discarded card out of turn, if the player whose turn it is does not want it. Any player that purchases a card out of turn must also take a stock pile card as penalty.<br />
<br />
'''Jokers:''' Jokers are always wild and can substitute for any card in the deck. If multiple players have already completed the contract for a hand and one player has played onto a sequence containing a Joker, the other players may place the card that properly completes the sequence in place of the Joker and remove it from the sequence. The taken Joker must then be used elsewhere (to the best advantage of the player) in the same turn.</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=Troubleshooting&diff=5909Troubleshooting2020-10-19T00:45:38Z<p>GoDodyGo: /* Other errors with "Application loading..." */</p>
<hr />
<div>{{Studio_Framework_Navigation}}<br />
<br />
Describing common errors which is hard to understand and debug <br />
<br />
== Game does not start at all ==<br />
<br />
=== Undefined offset: 0 in table/table.game.php on line 830 ===<br />
<br />
Check if you're calling self::getActivePlayerName () during setupNewGame()<br />
<br />
Check if you're NOT calling self::activeNextPlayer() at the end of your game setup. You must always have at least one active player.<br />
<br />
=== Unexpected error: Wrong formatted data from BGA gameserver 1 (method: createGame): ... ===<br />
<br />
This is generic message usually followed by exact position in your source code, and usually its syntax error in one of yours php script<br />
<br />
=== Unexpected error: Propagating error from GS 1 (method: createGame): Fatal error during yourgame setup: Not logged ===<br />
<br />
Calling self::getCurrentPlayerId () or using $g_user from 'args' state function, see also below<br />
<br />
=== Unexpected error: Propagating error from GS 1 (method: createGame): Fatal error during yourgame setup: Unknow player statistic: ===<br />
<br />
Calling self::incStat() with second parameter which is an empty string<br />
<br />
=== Unexpected error: Propagating error from GS 1 (method: createGame): Fatal error during yourgame setup: Error while processing SQL request: INSERT INTO stats ... ===<br />
<br />
Fatal error during yourgame setup: Error while processing SQL request: INSERT INTO stats (stats_type, stats_player_id, stats_value) VALUES ('10','2300663','0'),('10','2300662','0')<br />
Duplicate entry '10-2300663' for key 'stats_table_id'<br />
<br />
Why? In the stats.inc.php you declared two keys with the same integer "id"<br />
<br />
=== Fatal error during creation of database ebd_quoridor_389 Not logged ===<br />
<br />
Check that you didn't use $g_user or getCurrentPlayerId() in setupNewGame() function or in an 'args' function of your state.<br />
<br />
As these functions are not consequences of a user action, there is no current player defined.<br />
<br />
As a general rule, you should use getActivePlayerId() and not getCurrentPlayerId(). See the [http://www.slideshare.net/boardgamearena/bga-studio-focus-on-bga-game-state-machine presentation on the game state machine] for more information.<br />
<br />
=== Warning: Invalid argument supplied for foreach() in table.game.php ===<br />
<br />
Warning: Invalid argument supplied for foreach() in /var/tournoi/release/tournoi-151226-1240-gs/www/game/module/table/table.game.php on line 129 <br />
Fatal error: Cannot unset string offsets in /var/tournoi/release/tournoi-151226-1240-gs/www/game/module/table/table.game.php on line 143<br />
<br />
That appears when your arg* function that suppose to return array of state arguments returns a scalar (a non-array) value<br />
<br />
=== The server reported an error ===<br />
<br />
During table creation: "The server reported an error" error shown and nothing else.<br />
<br />
If you cannot even create a table - there is syntax error in gameinfos.php, check it, reload it from management panel.<br />
If still no luck copy clean version from template https://github.com/elaskavaia/bga-sharedcode/blob/master/gameinfos.inc.php<br />
<br />
== Game starts but I can't make a move ==<br />
<br />
=== When I do a move, I got "Move recorded, waiting for update ..." forever ===<br />
<br />
"Move recorded" means that your ajaxcall request has been sent to the server and returned normally.<br />
<br />
"Waiting for update" means that your client interface is waiting for some notifications from the server that correspond to the move we just did.<br />
<br />
If this message stays forever, it is probably that your PHP code does not send any notification when the move happens, which is abnormal. To fix this: add a notifyAllPlayers or a notifyPlayer call in your PHP code.<br />
<br />
=== When I do a move, I get "Sending move to server..." then nothing and game resets to state before the move ===<br />
<br />
Its possible that server code get into infinite loops or thinks too much, in which case it will timeout and will be aborted without any extra logs (and db transaction you saw in the log won't be committed). You will usually see "Unable to connect to server" message on console in this case. You have to put more logging into server<br />
to trace where it hangs.<br />
<br />
=== Some player action is triggered randomly when I click somewhere on the game area ===<br />
<br />
You probably used "dojo.connect" on a null object. In this case, dojo.connect associate the event (ex: "onclick") to the whole game area.<br />
<br />
Most of the time it happens in this situation, when my_object element does not exists:<br />
<pre><br />
dojo.connect( $("my_object"), "onclick", this, function() {<br />
...<br />
}<br />
</pre><br />
<br />
To determine if this is the case, place "alert( $("my_object") )" before the dojo.connect to check if the object exists or not.<br />
<br />
=== "This is not your turn" error when I click on a possible move ===<br />
<br />
You need to change to the active player by clicking the red arrow next to their name in the player panel (right side of the page).<br />
<br />
[[File:Change_active_player.jpg]]<br />
<br />
== Predefined server errors ==<br />
<br />
=== Unexpected error: Unexpected final game state (XX) ===<br />
<br />
The action function does not transition to any state, i.e.<br />
function selectField($field) {<br />
self::checkAction ( 'selectField' );<br />
if ($field!=0) $this->gamestate->nextState ( 'next' );<br />
}<br />
Here if $field is 0 there is no transition<br />
<br />
=== This game action is impossible right now ===<br />
<br />
Check the game log. Usually your state does not define the action you trying to perform in 'possibeactions' array.<br />
<br />
=== Unexpected error: This transition (playerTurn) is impossible at this state (42) ===<br />
<br />
This is pretty self explanatory. Function nextState() takes transition name not a state name, so you probably did not<br />
define this transition that the given state<br />
<br />
== Game interface hangs during reload or on start ==<br />
<br />
Showing "Application Loading..."<br />
<br />
=== Javascript error: During pageload undefined no_stack_avail Script: ===<br />
<br />
This error usually has no useful data, but it means you called somes API that require a callback and did not define callback function, i.e<br />
in dojo.connect, this.connectClass, dojo.subscribe, etc<br />
<br />
this.connectClass('field', 'onclick', 'onField'); // <-- onField is not defined<br />
<br />
=== Other errors with "Application loading..." ===<br />
<br />
You probably have a syntax error in your Javascript code, and the interface refuses to load.<br />
<br />
To find this error, check if there is an error message in the Javascript console (F12).<br />
<br />
If there is really nothing on the log, it's probably that the system was unable to load your Javascript because of an syntax error that affect the structure of the Javascript file, typically a missing "}" or a missing "," after a method definition.<br />
<br />
If you have "Uncaught ReferenceError: bgagame is not defined" you have major syntax error in your js file, you should see some other clues in the log where the errors is.<br />
<br />
If you have "dojo.publish is not defined" or something similar, this could be caused by another error earlier. For example, a syntax error caused by a malformed generated file (such as using newlines in tiebreaker description). Also you might have left some images in the /img directory with special characters in the name which must be removed. If you edited images for the game box and website, ensure that you have not left any unnecessary files there.<br />
<br />
=== Unexpected Syntax Error: ===<br />
<br />
No further details in the log. When log is filling with some social connect errors.<br />
<br />
Possible Reason: Syntax error in of the php script which is loaded before the start, such as gameoptions.inc.php, gameinfos.inc.php and such.<br />
<br />
=== Game interface spins in a loop throwing error ===<br />
<br />
Errors is something like "Cannot read property 'is_ai' of undefined". Cannot restart the game because cannot access UI to stop.<br />
Likely you get in actplayer state with player id == 0. The only way to fix it is to edit database, globals index == 2 set player id to one of your test dudes<br />
(can copy from row 5 for example).<br />
<br />
=== Unable to find table database (1): ebd_yourgame_112222 ===<br />
<br />
Its either temporarily server error especially on studio it timeouts sometimes, just try reloading again.<br />
Or check if you have syntax errors in your php game file or sql.<br />
<br />
== Type conversion / juggling errors ==<br />
<br />
=== On php side I get a number instead of string I expect ===<br />
<br />
$num = 3;<br />
$meeple = "meeple_" + $num; // <-- suppose to be "meeple_3"!<br />
<br />
When you switch between JS and PHP it easy to type this and not notice the +. Plus sign (+) in php does not mean string concatenation (in javascript does!),<br />
in php + means integer arithmetic. So change + to . (dot)<br />
<br />
=== On php side my string comparison does not work ===<br />
<br />
if ($color == '4baae2' || $color == '000000') { <br />
}<br />
<br />
Apparently you should not be using '==' in php to compare strings! You should use '==='. The (==) operator will typecast the strings <br />
to numbers then do comparison!<br />
Its not very apparent because usually you can get away with it, but not when strings resemble numbers like hex 'colors'.<br />
<br />
=== Integer columns in the database are returned as strings ===<br />
<br />
This is normal PHP behavior. All fields are returned as string type, regardless of their actual type in the database. This also applies to global variables accessed via getGameStateValue(), since they are stored in a database table.<br />
<br />
You can use type-casting to convert them to the correct type after they come out of the database.<br />
<br />
$myValueInt = (int)self::getGameStateValue(GLOBAL_ROUND_NUMBER);<br />
<br />
or<br />
<br />
$sql = "SELECT my_int_column FROM my_table WHERE my_condition";<br />
$myResult = self::getUniqueValueFromDB($sql); <-- this is a string<br />
$myResultAsInt = (int)$myResult;<br />
<br />
https://stackoverflow.com/questions/5323146/mysql-integer-field-is-returned-as-string-in-php<br />
<br />
== Zombie mode ==<br />
<br />
=== Unexpected error: Propagating error from GS 1 (method: zombie): Not logged ===<br />
<br />
You are probably calling getCurrentPlayerId() or getCurrentPlayerName() in your zombieTurn method or any of the methods it uses. Instead, use the $active_player_id provided as parameter to zombieTurn().<br />
<br />
=== Unexpected error: Can't manage zombie player in this game state ===<br />
<br />
Despite what the message suggests, this error has nothing to do with your state machine. It is caused by an exception in the zombie code. It could be an undefined value sent to a database query. Check the unexpected exceptions log. It could also be the same problem as above, so look for getCurrentPlayerId() or getCurrentPlayerName() in your zombieTurn method.<br />
<br />
=== Unexpected error: Wrong formatted data from BGA gameserver 1 (method: zombie): ===<br />
<br />
This is almost certainly an undefined value in PHP code. Look for a warning or error message in the game replay log on the right side of the table UI.<br />
<br />
=== Unexpected error: BGA gameserver 1 do not respond (method: zombie) (timeout: cluster) ===<br />
<br />
You are trying to end the game from a zombie method. This is not allowed. The zombie logic must continue the game as best it can. See [[Main_game_logic:_yourgamename.game.php#Zombie_mode|Zombie mode]] for more info.<br />
<br />
== Other errors ==<br />
<br />
=== Javascript does not know how to sum two numbers ===<br />
<br />
Be careful when you manipulate integers returned by notifications: most of the time, Javascript considers they are Strings and not Integers.<br />
<br />
As a result:<br />
<pre><br />
var i=1;<br />
i += notif.args.increment; // With notif.args.increment='1'<br />
alert( i ); // i=11 instead of 2 !! Javascript concatenate 2 strings !<br />
</pre><br />
<br />
To solve this, you should use the "toint" function:<br />
<pre><br />
var i=1;<br />
i += toint( notif.args.increment ); // With notif.args.increment='1'<br />
alert( i ); // i=2 :)<br />
</pre><br />
<br />
=== Javascript: do not use substr with negative numbers ===<br />
<br />
To get the last characters of a string, use "slice" instead of "substr" which has a bug on IE:<br />
<pre><br />
var three_last_characters = string.substr( -3 ); // Wrong<br />
var three_last_characters = string.slice( -3 ); // Correct<br />
</pre><br />
<br />
=== Game "spontaneously" transition to a new state without user input ===<br />
<br />
Make sure on php side you have no code after $this->gamestate->nextState(...) code.<br />
Because if you do accidentally have code that goes to another state it will cause another state transition without user interaction.<br />
<br />
function selectField($field) {<br />
self::checkAction ( 'selectField' );<br />
if ($field!=0) $this->gamestate->nextState ( 'next' );<br />
$this->gamestate->nextState ( 'last' ); // <-- here is missing else, so it will cause double state transition<br />
}</div>GoDodyGohttp://en.doc.boardgamearena.com/index.php?title=First_steps_with_BGA_Studio&diff=5290First steps with BGA Studio2020-08-16T22:07:50Z<p>GoDodyGo: /* Let's code! */</p>
<hr />
<div>{{Studio_Framework_Navigation}}<br />
<br />
== Connect to the BGA Studio website ==<br />
<br />
Go to BGA Studio website:<br />
http://en.studio.boardgamearena.com<br />
<br />
Choose one of your 10 accounts (ex: myusername0), and login into the website - as you would do for Board Game Arena.<br />
<br />
If you don't have account see [[How to join BGA developer team?]]<br />
<br />
<br />
== Create a new game project ==<br />
<br />
You can do most of the projects-related operations from "Control Panel / Manage games". In particular, you can create a new project automatically from there.<br />
<br />
Your first "game" should be one of the tutorials, so your project name should be something like "tutorialbob".<br />
<br />
At this stage it is too early to create a real game but if you really don't want to start until you have a game in mind, check [[Create a game in BGA Studio: Complete Walkthrough]]<br />
section "Select a First Game"<br />
<br />
For reference top bar studio links<br />
* AVAILABLE LICENSES - list of all available licenses (not public domain) - http://en.studio.boardgamearena.com/#!licensing<br />
* STUDIO PROJECTS - list of all registered studio projects - http://en.studio.boardgamearena.com/#!projects <br />
* CONTROL PANEL - manage projects - http://en.studio.boardgamearena.com/#!controlpanel<br />
<br />
== Connect to your SFTP folder == <br />
<br />
From the initial email from the Studio you get:<br />
* the name of the SFTP server to connect to<br />
* your SFTP login and password<br />
<br />
Using this information:<br />
# Connect to the SFTP server using your SFTP login and password, through your favourite SFTP client software (such as [http://winscp.net/ WinSCP], see [[Tools_and_tips_of_BGA_Studio#File_Sync_on_Windows|File Sync]])<br />
# Check that your remote home folder contains one folder for each of the three example games (reversi, hearts, gomoku). If you have already created a new game project, one additional folder should be in your "home" folder.<br />
# Note: You have to setup AUTOMATED sync between your folder and remote folder, manually ftp'ing files would be no-starter. For WinSCP you can do this from the file menu (Commands->Keep remote directories up to Date...)<br />
<br />
== Let's code! ==<br />
<br />
Now, you can try to launch a new game on BGA Studio from the "Play now" menu entry, as you would do on Board Game Arena website.<br />
<br />
# Find your game in the 'PLAY NOW' section and create a table<br />
# Use the 'I want between X and X' players to tick down the maximum players number to the minimum<br />
# Click 'Express start': your game launches with the maximum number of players specified. It shows an empty canvas: in the game zone you just have a sentence 'This is your game interface. You can edit this HTML in your ".tpl" file.'.<br />
# Switch to your SFTP home folder, go into your game folder. Edit the game_game.tpl file, and change this sentence to 'Hey, this is my first game!', then save.<br />
# Go back to your browser and refresh, check that the game zone has updated.<br />
# Click the red arrow next to a test account's name in the player panel to view the game from that player's account <br/>[[File:Change_active_player.jpg]]<br />
# From the Player page or Table page click on the link "You are playing <name of game> (realtime)" (or click on the 'Gear' icon on the top right) and choose 'Express STOP'. The game ends automatically and you are brought back to the table screen for this ended game.<br />
# Switch to your game folder, go into the img folder and overwrite your game_box.png file with another image.<br />
# Go back to your browser, '''empty your browser cache''', then refresh the page, and check that the game box image has been updated.<br />
<br />
Then you can modify the provided skeleton and begin to develop your game :)<br />
<br />
== Commit your changes ==<br />
<br />
Committing uploads your changes on BGA's [http://en.wikipedia.org/wiki/Revision_control revision control] system. This is an extra assurance not to lose your code, and to have the possibility to get a previous version of your code if you need to backtrack. It also helps us to follow your progress (we get an email when you commit). So you should commit from time to time, when you hit some landmark in your development.<br />
<br />
You can automatically commit your sources in the repository from "Control Panel / Manage Games / Your game / Commit my modifications now". Then:<br />
<br />
# Enter your commit comment (such as 'My first commit') then hit the 'Submit' button;<br />
# Check the log for errors, it should end with the following lines:<br />
<br />
Transmitting file data .<br />
Committed revision #revision number#.<br />
HAL says: done.<br />
<br />
NOTE: committing the code is currently not working until admin commits it manually the first time. Even if it does you cannot automatically deal with this version control system except for committing. Therefore its recommended to use another means of storing the code in version control system, such as local git repo or github, see [[Tools_and_tips_of_BGA_Studio#Version_Control|Version Control]]<br />
<br />
== That's all! ==<br />
<br />
Now you know about the basics of updating your game on BGA Studio and testing your changes.<br />
<br />
Now you can select one of the tutorials to play with and start coding.<br />
<br />
For links to tutorials and ALL studio documentation see [[Studio]].</div>GoDodyGo