Interactive card game, JSON and .io websites query

You’re trying too hard.

The whole point of Xojo web is that you not need to run JavaScript this way. If you have a WebPage named GamePage, the way to show it is:


You don’t call the JavaScript for that.

If fact, if you want to go to another url, you use:


Xojo need a simple multi-page and multi-user “demo web app” as an updated “Eddie’s Electronics” (or some silly but complete PoC), with like 3+ pages, included in the “examples”. Desktop centric people need to learn new paradigms they are not used to and Xojo does not provide a good starting and complete learning demo.

1 Like

Thanks Greg, I was just trying different ways of accessing subsidiary pages and .Show is clearly the winner, although it is interesting to know that there is an ExecuteJavaScript method.

Rick, I couldn’t agree more. People aren’t going to try creating Xojo multi-user interactive web pages in these uncharted waters. There are so many issues to tackle. How am I going to know the username of an aspiring player to find out if he’s entitled to play and what he is allowed to do? How do I deal with objects he is supposed to see and others can’t see.

By the way, one of the random web objects I threw on my first “gamePage” was a MoviePlayer, which I probably won’t use, but I wondered if there is a web control I could use so that players in an online game can have an audio link on the page to discuss things? Also some kind of scrolling text link for the hard of hearing?

The way this is usually done is to store user specific things right on the session class. An instance is created for each user and maintained while they are created. If you need longer storage, you put it in a database.

Thanks, Greg, I’ve read what I can find in the documentation about Web Sessions and I can’t yet understand how they relate to what I want to do.

Mainly, I want each player to see, in his browser view of the web gamePage, a rectangular, landscape playing-card display canvas in the same area as everybody else’s, in which the player’s own personal cards are dealt when a Deal button is pressed and into which the player can drag single, face-down cards from the deck. Inside this personal display space, the cards will auto-flip to face up and then behave exactly as they behave in public display spaces - ie they will slide to the left until they reach the left-hand side or another card. When they are dealt or dragged by the player inside the space they may overlap and group with other cards into a set. The player can also drag single cards or groups of cards out of the private area and they won’t be seen by anybody until they emerge from his private space. At any one time there may be a different number of cards inside each player’s private space.

I would also like each player to have a personal set of buttons somewhere on the screen that will sort the cards in his private space in different ways. Each player would have the same set of buttons affecting only that player’s own cards, so the button sets should occupy the same space on the gamePage to keep the page uncluttered.

There will also be a status button of some sort reminding each player whether it is his turn or not, which he can press when his turn is over so that the next player is alerted.

Pretty much everything else on the screen will be visible to everybody. Ideally, only the player designated the game host will be allowed to press the Deal and Reset/Shuffle buttons.

Will carry on reading about Web Sessions and the penny may drop.

Before you get too far in, the web framework does not support drag and drop. For that functionality, you’ll need to use the WebSDK or find a third party solution.

That would be against forum rules :wink:

But as Greg has pointed out XoJo Web doesn’t have the functionality you require anyway here’s a tutorial for creating a card game in vanilla JS which should at least help you get started with the client side.

Well, thank you very much for that link, Steve. I don’t want anybody getting into hot water for seeming to break forum rules. I have had a quick look at the beginning of the video and obviously I need to have a longer and more careful look and think about it.

I won’t comment here and now about your first paragraph, but I may have something to say about it elsewhere, later on.

I have appreciated the helpful, unbiased advice I have always had on this forum from experienced and enthusiastic programmers, ever since I encountered Xojo quite a long time ago, when it was a small, maverick language called REALBasic “for the rest of us”, like Macs, and primarily for Mac users left isolated by the big, moneymaking corporations.

Cheers, Steve