HTML5 Blackjack w/REST API Sample
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
HTML5 Blackjack w/REST API Sample
The new do as JavaScript command adds a whole WORLD of opportunity. I've put together a demonstration of an LC stack making external Javascript calls.
The stack is Blackjack. The decks and cards are determined from a REST API call to deckofcardsapi.com. The API calls are Javascript functions. The Livecode stack calls this functions to shuffle the deck and deal out cards.
The game play is pretty good although there is a bug with Aces (I'm working on it). I'm also going to add some other calls out to the HTML page to further demonstrate the JavaScript capabilities. The important item of note is that a Livecode HTML5 stack is making a call to a Javascript function that is calling a REST API on a remote server. COOL!
http://bobhall.net/blackjack/index.html
God, I hope I don't break my server
Let me know what you think,
Bob
The stack is Blackjack. The decks and cards are determined from a REST API call to deckofcardsapi.com. The API calls are Javascript functions. The Livecode stack calls this functions to shuffle the deck and deal out cards.
The game play is pretty good although there is a bug with Aces (I'm working on it). I'm also going to add some other calls out to the HTML page to further demonstrate the JavaScript capabilities. The important item of note is that a Livecode HTML5 stack is making a call to a Javascript function that is calling a REST API on a remote server. COOL!
http://bobhall.net/blackjack/index.html
God, I hope I don't break my server
Let me know what you think,
Bob
Re: HTML5 Blackjack w/REST API Sample
This is a fantastic demo of what can be done with LiveCode HTML5, Bob! Thank you for sharing it with us.
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com
Re: HTML5 Blackjack w/REST API Sample
Excellent example..thanks.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search
Re: HTML5 Blackjack w/REST API Sample
Thanks peter-b and AndyP!
I've updated the demonstration to fix the Ace's bug.
To Peter (or whomever at Livecode Central), THANK YOU for adding this ability to get to Javascript. For me, I was missing the goes-inta and goes-outa capability of HTML5 and now that is SOLVED!.
I'm sure you've already got this but it would be really nice to send a SIMPLE message into the Livecode container (no data) from Javascript.
My hope is that no data makes it an easier thing to do. I've seen examples of Javascript being able to call functions of other languages running in a container in the Browser so I'm hoping this might be doable and, who knows, maybe, Trivial
Sending a message back to Livecode not only do we get asynchronous GET/POST but also some other cool things (WebSockets...).
Thanks again!
Bob
I've updated the demonstration to fix the Ace's bug.
To Peter (or whomever at Livecode Central), THANK YOU for adding this ability to get to Javascript. For me, I was missing the goes-inta and goes-outa capability of HTML5 and now that is SOLVED!.
I'm sure you've already got this but it would be really nice to send a SIMPLE message into the Livecode container (no data) from Javascript.
Code: Select all
livecodeObject.sendMessage("someDataIsReady");
Sending a message back to Livecode not only do we get asynchronous GET/POST but also some other cool things (WebSockets...).
Thanks again!
Bob
Re: HTML5 Blackjack w/REST API Sample
Adding the ability to send messages back into LiveCode is something we're currently hoping to get working in December or January. It will be a bit more involved than the "do as JavaScript" feature. I made some comments about it here: https://www.mail-archive.com/use-liveco ... 80603.html
LiveCode Open Source Team — @PeterTBBrett — peter.brett@livecode.com
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: HTML5 Blackjack w/REST API Sample
Hi Bob.
This is a really great example for a "direct connection" from/to a HTML5 standalone, also solved in an elegant way!
'Newcomers' to HTML5 standalone building perhaps would appreciate a few lines of explanation about 'the essentials' of the connection, independent of details of the game.
Would you mind to add such a post here?
This is a really great example for a "direct connection" from/to a HTML5 standalone, also solved in an elegant way!
'Newcomers' to HTML5 standalone building perhaps would appreciate a few lines of explanation about 'the essentials' of the connection, independent of details of the game.
Would you mind to add such a post here?
shiftLock happens
Re: HTML5 Blackjack w/REST API Sample
Great suggestion [-hh]. I will work on it today and get it posted.
Bob
Bob
Re: HTML5 Blackjack w/REST API Sample
Hi Bob,
I'm an absolute novice in these server affairs,
I hope to get an answer for you;
Is the UserInterface (UI) which is displayed in the browser a LC-HTML5-standalone or is it a LC-stack which is "mirrored" into the webpage ?
I'm looking for a solution to let the LC-stack run on the server and it's UI is mirrored in a standard web browser.
Do you know any product who allows something like this ?
Best regards
Ulrich
I'm an absolute novice in these server affairs,
I hope to get an answer for you;
Is the UserInterface (UI) which is displayed in the browser a LC-HTML5-standalone or is it a LC-stack which is "mirrored" into the webpage ?
I'm looking for a solution to let the LC-stack run on the server and it's UI is mirrored in a standard web browser.
Do you know any product who allows something like this ?
Best regards
Ulrich
bhall2001 wrote:Great suggestion [-hh]. I will work on it today and get it posted.
Bob