Jump to content

GAME_ENDED event not firing?


BeatTheHouse

Recommended Posts

Some of my old scripts are not working anymore.. I wrote a simple test script and the GAME_ENDED event is not firing.

var config = {

}

function main () {

log.info('Starting Script up');

engine.on('GAME_STARTING', function () {
log.info('game is starting');
});

engine.on('GAME_ENDED', function () {
log.info('game has ended');
});

}

 

All I get is:

 

Starting Script up

game is starting

game is starting

game is starting

game is starting

game is starting

 

Has this been broken since the upgrade? 

 

If I do console.log(game)  I do see the events registered.

Any info would be great!

 

Thanks

 

 

 

 

 

 

 

Link to comment
Share on other sites

Ok so it appears that they've switched the script over to the hash dice style, you'll no longer use game ended function. I just stuck one of my hash dice scripts in and it seems to be working just as it should. Look at the built in martingale script as an example. The config stuff is pretty much the same but to start playing we use the following functions:

function main() {
  game.onBet = function () {
    game.bet(currentBet, config.payout.value).then(function (payout) {

This will place your bet and wait for the payout of the game to be returned into variable payout.

After this you'll use an if function to check if you won (payout > 1) and put everything you'd normally do after a win in there. Then you'll finish it with an else (you lost).

  if (payout > 1) {
        Do whatever you would normally do after a win here.
      } else {
        Do whatever you would normally do after a loss here.
      }

 

Link to comment
Share on other sites

Interesting enough though the GAME_STARTING event is working just not the GAME_ENDED.  I will have to upgrade the script to use the hash dice style but id rather have the developers fixed the problem with GAME_ENDED event. It does register correctly I can see if I look at the game object after I run that line of code. Support has been notified so lets see what they can do before I begin to port over the scripts to the new style...

Link to comment
Share on other sites

  • 4 months later...

its not actually a problem they are allowing you to pass a delegate that runs when the game ends that is what the new code does so you don't need to know when it is ended.

think of it like you wanting to know what time someone is off work so you can do something, but instead they say give me whatever it is you have to do now.  And when i am done i will do it for you.

My question is can we get the actual values of the crash, because this delegate only pass you what you got paid out.  And they deprecated the history api.

Link to comment
Share on other sites

so i looked into this a little more and i am going to do some expirementation but the binding is still there.

key: "bindEvent",
                            value: function () {
                                var e = this;
                                this.socket.on("connect", this.onConnect.bind(this)),
                                this.socket.on("reconnecting", (function () {
                                        return e.status = Gn.CONNECTION
                                    })),
                                this.socket.on("pj", Object(vt.c)(this.onJackpotChange.bind(this), Bt.Jackpot)),
                                this.socket.on("pr", Object(vt.c)(this.onPrepare.bind(this), Bt.Prepare)),
                                this.socket.on("b", Object(vt.c)(this.onBet.bind(this), Bt.Bet)),
                                this.socket.on("bg", Object(vt.c)(this.onBegin.bind(this), Bt.Begin)),
                                this.socket.on("e", Object(vt.c)(this.onEscape.bind(this), Bt.Escape)),
                                this.socket.on("ed", Object(vt.c)(this.onEnd.bind(this), Bt.End)),
                                this.socket.on("st", Object(vt.c)(this.onSettle.bind(this), Bt.Settle)),
                                this.socket.on("pg", Object(vt.c)(this.onProgress.bind(this), Bt.Progress)),
                                this.script.enableAutoStep(!1),
                                this.on("game_prepare", this.script.step);
                                var t = this.hotkeyList.find((function (e) {
                                            return "space" == e.key
                                        }));
                                t && (t.handler = function () {
                                    return e.requesting || (e.canBet ? e.handleBetCrash().catch(B.ab) : e.canEscape && e.handleEscape().catch(B.ab)),
                                    !1
                                }),
                                this.on("game_end", (function () {
                                        e.betInfo || e.script.onGameEnd(e.history.slice(-20).reverse())
                                    }))

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 months later...
  • 3 weeks later...

So I've got a pretty simple project set up. The main loop is handled by an SDL_Event, and when the player presses Q or dies, it calls exit(0). It's at this point that I call my screen system's goto menu() function. Students who are interested in games should also visit https://bestonlinewritingservice.com/ website for guidance about their educational career.

Link to comment
Share on other sites

so i looked into this briefly and i don't know if i am just too high to see where in the api that value is being passed in or what, but i am only seeing the SPAN for the high and low that they style and make look like its handled.  So my recommendation depending on how complex you want to make the high and low is to either persist something to a global variable so that you can hopefully acess it from the scripts running on the dom.  Because the normal gaming script runs as a web worker and uses a messaging promise type system.  I am not familiar enough with that to try and hack around it at the moment.  From everything i am reading it sounds like you need to use a transferable object and transfer the ownership around here is the answer given to similar questions javascript - Using transferable objects from a Web Worker - Stack Overflow
"

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...