Slight Confusion on Tutorial.

Game development with Board Game Arena Studio
Post Reply
User avatar
Deluxe Flame
Posts: 12
Joined: 31 October 2013, 19:13

Slight Confusion on Tutorial.

Post by Deluxe Flame »

I am following along with the reversi tutorial. I've reached the part where it says

"Now, to test if everything works fine, just call "this.addTokenOnBoard( 2, 2, <your_player_id> )" in your "setup" Javascript method, and reload the page. A token should appear and slide immediately to its position, like this: "

I don't know what I put for <your_player_id>
I understand that to use addTokenOnBoard it pulls x, y, and player.
I don't know what player is.
Is it the actual name of the players?
is it some sort of array listing the players, i.e; player1, player2, etc.

I've tried searching all the files in my home folder for some initialization of players but didn't see anything.
I'm new to BGA dev, and have most experience with C# coding.
haha, to be frank, I don't even know what programming language I'm learning in this tutorial, is it html, java, javascript?
User avatar
Deluxe Flame
Posts: 12
Joined: 31 October 2013, 19:13

Re: Slight Confusion on Tutorial.

Post by Deluxe Flame »

I've gone into the SQL database.
it looks like the value for player_id is 2260488,
I've tried it in the code (2,2, 2260488) but no results =/
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Slight Confusion on Tutorial.

Post by pikiou »

The author of this tutorial confessed it was just meant to be read, so there may be errors preventing it from working.
I fixed about a dozen errors a year ago to make it work, but it may not have been enough.

I would strongly advise you to learn about the basics of HTML, CSS, Javascript (+dojo) and PHP in that order before you go further, otherwise you will spend months of frustrating debugging.
You should find lots of free tutorials on these subjects.
No need to learn SQL if you ask me for some tools interfacing it when you learnt about the rest.
User avatar
sourisdudesert
Administrateur
Posts: 4630
Joined: 23 January 2010, 22:02

Re: Slight Confusion on Tutorial.

Post by sourisdudesert »

Hi,

In fact the "player_id" is the player_id of the player who own the token. As it is one of your player the tutorial cannot knows it :)

Your approach is the good one: find the player_id in the database and use it.

Cheers,
User avatar
Deluxe Flame
Posts: 12
Joined: 31 October 2013, 19:13

Re: Slight Confusion on Tutorial.

Post by Deluxe Flame »

My biggest trouble with this is switching between different windows and codes.
Is there any sufficient program that I can use to program for BGA?
I see that notepad++ can identify and view certain files, but not all of them.
User avatar
Coin-coin le Canapin
Posts: 163
Joined: 31 January 2013, 19:00

Re: Slight Confusion on Tutorial.

Post by Coin-coin le Canapin »

Hi,
I'm trying to follow this tutorial as well and I have an issue on this part :
addTokenOnBoard: function( x, y, player )
{
dojo.place( this.format_block( 'jstpl_token', {
x_y: x+'_'+y,
color: this.gamedatas.players[ player ].color
} ) , 'tokens' );

this.placeOnObject( 'token_'+x+'_'+y, 'overall_player_board_'+player );
this.slideToObject( 'token_'+x+'_'+y, 'square_'+x+'_'+y ).play();
},
I assume we have to put this between the <script> tags on the .tpl file, but javascript throws an error :

Image

Any idea ?
User avatar
Quinarbre
Posts: 140
Joined: 15 December 2013, 23:26

Re: Slight Confusion on Tutorial.

Post by Quinarbre »

This function goes into your .js file (every Javascript function actually).

The .tpl is just here for templates, ie bits of html code that should be generated by your Javascript code but that you don't want to write verbatim into your code (as usual, with the intent of separating logic from look&feel).
User avatar
Coin-coin le Canapin
Posts: 163
Joined: 31 January 2013, 19:00

Re: Slight Confusion on Tutorial.

Post by Coin-coin le Canapin »

Thank you :)
User avatar
Coin-coin le Canapin
Posts: 163
Joined: 31 January 2013, 19:00

Re: Slight Confusion on Tutorial.

Post by Coin-coin le Canapin »

There are some differences between the tutorial code and the actual reversi code ; sometimes "token" is various places instead of "disc". I spend some time trying to figure out what was going on.
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: Slight Confusion on Tutorial.

Post by pikiou »

Feel free to directly fix these errors on the wiki!
I mentioned above that there were errors and that the tutorial was meant to be read, not copy/pasted and ran.

Something else: the error you had in JavaScript above was really obvious so I'm guessing you're new to it. You should spend some time learning the language; you'll have way more fun coding and it'll save you 100+ hours of debugging just for your first project.
BGA Studio projects are run in an remove noob unfriendly proprietary environment so you will have to know what you're doing. It's the worst place to learn about a new language with a try and error approach.
I gave that warning multiple times, was ignored, and no project was finished from the persons I warned. Their projects raised a level of bad practice no one wanted to have to do anything with.
Post Reply

Return to “Developers”