Announcement

Collapse
No announcement yet.

Please help! Display! Random page on start up!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Please help! Display! Random page on start up!

    Please can someone help me.

    I've created a nice application, that's like a random steam games picker.

    There's 10 pages inside the application, and when it launches i need it to simply randomly pick a page each time it's launched. (Each page contains the game's CD Cover a small game play movie, Specs and the game launch button)

    I've search the forum for the following terms "Dynamic Page jump" Random page jump"
    There's 10 pages in the results, most mention using Math.Random, but this isn't a numbers problem so i don't think Math.Random would work since it's a Page.Jump

    I know this is going to be SO simple for someone to do. But i don't know where to begin.

    Would anyone mind helping me out please? it would be great as the program is completely finished just need this 2-3 line script to finish it off.

    Much Appreciated!

  • #2
    Math.Random is what you want, create a table indexed 1 to 10 and have the value of the table be the page name then when its time for a page jump do a Math.Random ie:
    Code:
    Pages = {}
    Page[1] = "Page 1"
    Page[2] = "Page 2"
    
    RandomPage = Math.Random(1,2)
    
    Page.Jump(Table.Concat(Pages,"",RandomPage,RandomPage))

    Comment


    • #3
      Add simply two lines at the end of the On Startup script:

      Code:
      local tPages = Application.GetPages();
      Page.Jump(tPages[Math.Random(1, #tPages)]);
      Ulrich

      Comment


      • #4
        Thanks for both quick replies guys,

        I come across this below

        Code:
        [B]%RndValue%[/B] = [B]Variable.SetRandomValue[/B] (Number, 1, 10)
        Page.Jump ("Page [B]%RndValue%[/B]")
        Which the poster also explains if the pages was titled BL1 - BL7
        you could swap out "Page above and replace it with "BL

        But that's great if all you're pages are Words(number) like BL1
        But how could this be done? if say the pages was named like

        warfare, blackops, blackops2, worldatwar, need4speed etc..

        there's no actual numbers if it was just "names" as the page titles?

        Also, in the search forum, i keep coming across Variable.SetRandomValue action
        which is mentioned in quite a few examples, I've scoured the AMS help file.

        I cannot see any actions for Variable.set or SetRandomValue,

        is this just an UN-documented action?

        Comment


        • #5
          I think your looking at examples from Setup Factory, just look at the forum you are in when searching as the actions from the various products aren't compatible.

          tPages, who knew?

          Comment


          • #6
            Originally posted by Shrek View Post
            I think your looking at examples from Setup Factory, just look at the forum you are in when searching as the actions from the various products aren't compatible.

            tPages, who knew?
            I thought that, but it included detailed examples and also included Pages/Page.Jump examples.
            So it cannot be Setup Factory, here's the link to the exact post Shrek if you're still interested.

            http://www.indigorose.com/forums/thr...4710#post34710

            Comment


            • #7
              That is from AMS v4 so it well out of date.

              Comment


              • #8
                Originally posted by Shrek View Post
                That is from AMS v4 so it well out of date.
                oops! sure is! well at least now there's 3 methods posted for the public that works
                For anyone else who wants to do the same type of thing (Random page jumps)

                At least now there's an up-to date version,

                Thank you very much both of you guys! for providing the great examples.
                Hope this now helps anyone else too who's searching how to do this.

                Comment

                Working...
                X