Jackpot game is not returning result text












0















Background Info:



Jackpot Game created and at the end of each round - will show a text of either a win or a lose



What has been done:



created a switch statement to check the element of each slot. Created a conditional check statement to check if all 3 slots are identical - will be a win, else it will be a lost



Issue:



at the end of each spin- There is no update text of either a win or a lost:



CODE:



var BLURB_TBL = [
'JACKPOT!'
];
switch (this.state) {
case 1: // all slots spinning
if (now - this.lastUpdate > RUNTIME) {
this.state = 2;
this.lastUpdate = now;
}
break;
case 2: // slot 1
this.stopped1 = _check_slot( this.offset1, this.result1 );
if ( this.stopped1 ) {
this.speed1 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 3: // slot 1 stopped, slot 2
this.stopped2 = _check_slot( this.offset2, this.result2 );
if ( this.stopped2 ) {
this.speed2 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 4: // slot 2 stopped, slot 3
this.stopped3 = _check_slot( this.offset3, this.result3 );
if ( this.stopped3 ) {
this.speed3 = 0;
this.state++;
}
break;
case 5: // slots stopped
if ( now - this.lastUpdate > 3000 ) {
this.state = 6;
}
break;
case 6: // check results

if ((that.items1[that.result1].id == 'gold-64' && that.items2[that.result2].id == 'gold-64' && that.items3[that.result3].id == 'gold-64') || (that.items1[that.result1].id == 'cash-64' && that.items2[that.result2].id == 'cash-64' && that.items3[that.result3].id == 'cash-64') || (that.items1[that.result1].id == 'energy-64' && that.items2[that.result2].id == 'energy-64' && that.items3[that.result3].id == 'energy-64') || (that.items1[that.result1].id == 'staff-64' && that.items2[that.result2].id == 'staff-64' && that.items3[that.result3].id == 'staff-64') || (that.items1[that.result1].id == 'build-64' && that.items2[that.result2].id == 'build-64' && that.items3[that.result3].id == 'build-64') || (that.items1[that.result1].id == 'goods-64' && that.items2[that.result2].id == 'goods-64' && that.items3[that.result3].id == 'goods-64')){
$('#status').text(BLURB_TBL);
}else {
$('#status').text("GOOD TRY!!");
}




this.state = 7;
break;
case 7: // game ends
break;
default:
}
this.lastupdate = now;









share|improve this question




















  • 4





    not returning... there is no function, therefore nothing can return

    – Jaromanda X
    Dec 31 '18 at 3:59











  • @JaromandaX this is within a function

    – Luke
    Dec 31 '18 at 4:14













  • @Luke if it is within function then you are missing return statement

    – Just code
    Dec 31 '18 at 4:21











  • @Justcode arh....thks!

    – Luke
    Dec 31 '18 at 4:31











  • ok, there's no return statement, so nothing is returned

    – Jaromanda X
    Dec 31 '18 at 5:12
















0















Background Info:



Jackpot Game created and at the end of each round - will show a text of either a win or a lose



What has been done:



created a switch statement to check the element of each slot. Created a conditional check statement to check if all 3 slots are identical - will be a win, else it will be a lost



Issue:



at the end of each spin- There is no update text of either a win or a lost:



CODE:



var BLURB_TBL = [
'JACKPOT!'
];
switch (this.state) {
case 1: // all slots spinning
if (now - this.lastUpdate > RUNTIME) {
this.state = 2;
this.lastUpdate = now;
}
break;
case 2: // slot 1
this.stopped1 = _check_slot( this.offset1, this.result1 );
if ( this.stopped1 ) {
this.speed1 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 3: // slot 1 stopped, slot 2
this.stopped2 = _check_slot( this.offset2, this.result2 );
if ( this.stopped2 ) {
this.speed2 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 4: // slot 2 stopped, slot 3
this.stopped3 = _check_slot( this.offset3, this.result3 );
if ( this.stopped3 ) {
this.speed3 = 0;
this.state++;
}
break;
case 5: // slots stopped
if ( now - this.lastUpdate > 3000 ) {
this.state = 6;
}
break;
case 6: // check results

if ((that.items1[that.result1].id == 'gold-64' && that.items2[that.result2].id == 'gold-64' && that.items3[that.result3].id == 'gold-64') || (that.items1[that.result1].id == 'cash-64' && that.items2[that.result2].id == 'cash-64' && that.items3[that.result3].id == 'cash-64') || (that.items1[that.result1].id == 'energy-64' && that.items2[that.result2].id == 'energy-64' && that.items3[that.result3].id == 'energy-64') || (that.items1[that.result1].id == 'staff-64' && that.items2[that.result2].id == 'staff-64' && that.items3[that.result3].id == 'staff-64') || (that.items1[that.result1].id == 'build-64' && that.items2[that.result2].id == 'build-64' && that.items3[that.result3].id == 'build-64') || (that.items1[that.result1].id == 'goods-64' && that.items2[that.result2].id == 'goods-64' && that.items3[that.result3].id == 'goods-64')){
$('#status').text(BLURB_TBL);
}else {
$('#status').text("GOOD TRY!!");
}




this.state = 7;
break;
case 7: // game ends
break;
default:
}
this.lastupdate = now;









share|improve this question




















  • 4





    not returning... there is no function, therefore nothing can return

    – Jaromanda X
    Dec 31 '18 at 3:59











  • @JaromandaX this is within a function

    – Luke
    Dec 31 '18 at 4:14













  • @Luke if it is within function then you are missing return statement

    – Just code
    Dec 31 '18 at 4:21











  • @Justcode arh....thks!

    – Luke
    Dec 31 '18 at 4:31











  • ok, there's no return statement, so nothing is returned

    – Jaromanda X
    Dec 31 '18 at 5:12














0












0








0








Background Info:



Jackpot Game created and at the end of each round - will show a text of either a win or a lose



What has been done:



created a switch statement to check the element of each slot. Created a conditional check statement to check if all 3 slots are identical - will be a win, else it will be a lost



Issue:



at the end of each spin- There is no update text of either a win or a lost:



CODE:



var BLURB_TBL = [
'JACKPOT!'
];
switch (this.state) {
case 1: // all slots spinning
if (now - this.lastUpdate > RUNTIME) {
this.state = 2;
this.lastUpdate = now;
}
break;
case 2: // slot 1
this.stopped1 = _check_slot( this.offset1, this.result1 );
if ( this.stopped1 ) {
this.speed1 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 3: // slot 1 stopped, slot 2
this.stopped2 = _check_slot( this.offset2, this.result2 );
if ( this.stopped2 ) {
this.speed2 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 4: // slot 2 stopped, slot 3
this.stopped3 = _check_slot( this.offset3, this.result3 );
if ( this.stopped3 ) {
this.speed3 = 0;
this.state++;
}
break;
case 5: // slots stopped
if ( now - this.lastUpdate > 3000 ) {
this.state = 6;
}
break;
case 6: // check results

if ((that.items1[that.result1].id == 'gold-64' && that.items2[that.result2].id == 'gold-64' && that.items3[that.result3].id == 'gold-64') || (that.items1[that.result1].id == 'cash-64' && that.items2[that.result2].id == 'cash-64' && that.items3[that.result3].id == 'cash-64') || (that.items1[that.result1].id == 'energy-64' && that.items2[that.result2].id == 'energy-64' && that.items3[that.result3].id == 'energy-64') || (that.items1[that.result1].id == 'staff-64' && that.items2[that.result2].id == 'staff-64' && that.items3[that.result3].id == 'staff-64') || (that.items1[that.result1].id == 'build-64' && that.items2[that.result2].id == 'build-64' && that.items3[that.result3].id == 'build-64') || (that.items1[that.result1].id == 'goods-64' && that.items2[that.result2].id == 'goods-64' && that.items3[that.result3].id == 'goods-64')){
$('#status').text(BLURB_TBL);
}else {
$('#status').text("GOOD TRY!!");
}




this.state = 7;
break;
case 7: // game ends
break;
default:
}
this.lastupdate = now;









share|improve this question
















Background Info:



Jackpot Game created and at the end of each round - will show a text of either a win or a lose



What has been done:



created a switch statement to check the element of each slot. Created a conditional check statement to check if all 3 slots are identical - will be a win, else it will be a lost



Issue:



at the end of each spin- There is no update text of either a win or a lost:



CODE:



var BLURB_TBL = [
'JACKPOT!'
];
switch (this.state) {
case 1: // all slots spinning
if (now - this.lastUpdate > RUNTIME) {
this.state = 2;
this.lastUpdate = now;
}
break;
case 2: // slot 1
this.stopped1 = _check_slot( this.offset1, this.result1 );
if ( this.stopped1 ) {
this.speed1 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 3: // slot 1 stopped, slot 2
this.stopped2 = _check_slot( this.offset2, this.result2 );
if ( this.stopped2 ) {
this.speed2 = 0;
this.state++;
this.lastUpdate = now;
}
break;
case 4: // slot 2 stopped, slot 3
this.stopped3 = _check_slot( this.offset3, this.result3 );
if ( this.stopped3 ) {
this.speed3 = 0;
this.state++;
}
break;
case 5: // slots stopped
if ( now - this.lastUpdate > 3000 ) {
this.state = 6;
}
break;
case 6: // check results

if ((that.items1[that.result1].id == 'gold-64' && that.items2[that.result2].id == 'gold-64' && that.items3[that.result3].id == 'gold-64') || (that.items1[that.result1].id == 'cash-64' && that.items2[that.result2].id == 'cash-64' && that.items3[that.result3].id == 'cash-64') || (that.items1[that.result1].id == 'energy-64' && that.items2[that.result2].id == 'energy-64' && that.items3[that.result3].id == 'energy-64') || (that.items1[that.result1].id == 'staff-64' && that.items2[that.result2].id == 'staff-64' && that.items3[that.result3].id == 'staff-64') || (that.items1[that.result1].id == 'build-64' && that.items2[that.result2].id == 'build-64' && that.items3[that.result3].id == 'build-64') || (that.items1[that.result1].id == 'goods-64' && that.items2[that.result2].id == 'goods-64' && that.items3[that.result3].id == 'goods-64')){
$('#status').text(BLURB_TBL);
}else {
$('#status').text("GOOD TRY!!");
}




this.state = 7;
break;
case 7: // game ends
break;
default:
}
this.lastupdate = now;






javascript jquery html






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 31 '18 at 4:03









Mark Meyer

38.2k33159




38.2k33159










asked Dec 31 '18 at 3:56









LukeLuke

507215




507215








  • 4





    not returning... there is no function, therefore nothing can return

    – Jaromanda X
    Dec 31 '18 at 3:59











  • @JaromandaX this is within a function

    – Luke
    Dec 31 '18 at 4:14













  • @Luke if it is within function then you are missing return statement

    – Just code
    Dec 31 '18 at 4:21











  • @Justcode arh....thks!

    – Luke
    Dec 31 '18 at 4:31











  • ok, there's no return statement, so nothing is returned

    – Jaromanda X
    Dec 31 '18 at 5:12














  • 4





    not returning... there is no function, therefore nothing can return

    – Jaromanda X
    Dec 31 '18 at 3:59











  • @JaromandaX this is within a function

    – Luke
    Dec 31 '18 at 4:14













  • @Luke if it is within function then you are missing return statement

    – Just code
    Dec 31 '18 at 4:21











  • @Justcode arh....thks!

    – Luke
    Dec 31 '18 at 4:31











  • ok, there's no return statement, so nothing is returned

    – Jaromanda X
    Dec 31 '18 at 5:12








4




4





not returning... there is no function, therefore nothing can return

– Jaromanda X
Dec 31 '18 at 3:59





not returning... there is no function, therefore nothing can return

– Jaromanda X
Dec 31 '18 at 3:59













@JaromandaX this is within a function

– Luke
Dec 31 '18 at 4:14







@JaromandaX this is within a function

– Luke
Dec 31 '18 at 4:14















@Luke if it is within function then you are missing return statement

– Just code
Dec 31 '18 at 4:21





@Luke if it is within function then you are missing return statement

– Just code
Dec 31 '18 at 4:21













@Justcode arh....thks!

– Luke
Dec 31 '18 at 4:31





@Justcode arh....thks!

– Luke
Dec 31 '18 at 4:31













ok, there's no return statement, so nothing is returned

– Jaromanda X
Dec 31 '18 at 5:12





ok, there's no return statement, so nothing is returned

– Jaromanda X
Dec 31 '18 at 5:12












1 Answer
1






active

oldest

votes


















0














You are missing a return function.



For this example:



function a() {
alert('A');
}
//alerts 'A', returns undefined

function b() {
alert('B');
return a;
}
//alerts 'B', returns function a

function c() {
alert('C');
return a();
}
//alerts 'C', alerts 'A', returns undefined

alert("Function 'a' returns " + a());
alert("Function 'b' returns " + b());
alert("Function 'c' returns " + c());





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983444%2fjackpot-game-is-not-returning-result-text%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    You are missing a return function.



    For this example:



    function a() {
    alert('A');
    }
    //alerts 'A', returns undefined

    function b() {
    alert('B');
    return a;
    }
    //alerts 'B', returns function a

    function c() {
    alert('C');
    return a();
    }
    //alerts 'C', alerts 'A', returns undefined

    alert("Function 'a' returns " + a());
    alert("Function 'b' returns " + b());
    alert("Function 'c' returns " + c());





    share|improve this answer




























      0














      You are missing a return function.



      For this example:



      function a() {
      alert('A');
      }
      //alerts 'A', returns undefined

      function b() {
      alert('B');
      return a;
      }
      //alerts 'B', returns function a

      function c() {
      alert('C');
      return a();
      }
      //alerts 'C', alerts 'A', returns undefined

      alert("Function 'a' returns " + a());
      alert("Function 'b' returns " + b());
      alert("Function 'c' returns " + c());





      share|improve this answer


























        0












        0








        0







        You are missing a return function.



        For this example:



        function a() {
        alert('A');
        }
        //alerts 'A', returns undefined

        function b() {
        alert('B');
        return a;
        }
        //alerts 'B', returns function a

        function c() {
        alert('C');
        return a();
        }
        //alerts 'C', alerts 'A', returns undefined

        alert("Function 'a' returns " + a());
        alert("Function 'b' returns " + b());
        alert("Function 'c' returns " + c());





        share|improve this answer













        You are missing a return function.



        For this example:



        function a() {
        alert('A');
        }
        //alerts 'A', returns undefined

        function b() {
        alert('B');
        return a;
        }
        //alerts 'B', returns function a

        function c() {
        alert('C');
        return a();
        }
        //alerts 'C', alerts 'A', returns undefined

        alert("Function 'a' returns " + a());
        alert("Function 'b' returns " + b());
        alert("Function 'c' returns " + c());






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 31 '18 at 4:33









        paintball247paintball247

        182216




        182216






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53983444%2fjackpot-game-is-not-returning-result-text%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas