Announcement

Collapse
No announcement yet.

Varibles across Pages

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

  • Varibles across Pages

    Hi,

    Im trying to take date from variables in other pages, i tried but it didnt work.

    Is there anyway to keep the data of variables between Pages, Now im using Text files to store variables data in.

    Regards

  • #2
    You have to make the verbs globelly acceable so anything you save on page one lets say in _SaveMe = ""; will be be accepable in page two, but if you have closed the app and then reopened and skipped page 1 then this wouldn't work as page one would of never wrote that _SaveMe and would give you a nil vale error.

    So you would have to save it like you are to access it later, but if you are always going to page X first to set something it can be assessed on page Y later, but you have to also make sure you save it as a verb and not just put it in a object, as objects wont be acceable with there data on a new page.
    Plugins or Sources MokoX
    BunnyHop 2021 Here

    Comment


    • #3
      Thank So much , I tried it before and didnt work but now it worked.

      So Any variable in any page can be used in other pages ? Like If : MyVar = "1985"; in page 1 , i can get its value in Page 2 in an input like this : Input.SetText("Input1", MyVar) ?

      Regards

      Comment


      • #4
        Yes long as you don't over ride that vrb on the second page or part of a global function what we all can do at times.
        Plugins or Sources MokoX
        BunnyHop 2021 Here

        Comment


        • #5
          In addition to kingzooly's reply on making the variables global, I would suggest to make a global state object in the global section of the project.

          i.e.
          Code:
          ProgramState = {
              MyVariable1 = "Hello World!";
              MyVariable2 = 1337;
              MyVariable3 = true;
          };
          And then anywhere in your program:

          Code:
          Dialog.Message("Testing!", ProgramState.MyVariable1)
          Bas Groothedde
          Imagine Programming :: Blog

          AMS8 Plugins
          IMXLH Compiler

          Comment


          • #6
            Thank you so much IP you gave me a great useful hint, i will try it for sure.

            Comment

            Working...
            X