Announcement

Collapse
No announcement yet.

Hard Time With Variables....

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

  • Hard Time With Variables....

    Hi,

    It's past 3 in the morn and i'm still non the wiser for looking at post after post so...

    My menu firstly....
    Looks at a txt file, finds a string (the genre of game!!) and then I want to use a loop to store proceeding lines upto the gap (where the loop terminates), stroring the game name (each line!) in its own variable....

    I would dodge in and out of a simple array in Java...

    I'm just using a variable 'i' as a counter and finding it impossible to concat a string 'game' with the counter 'i' to form a variable. I can form a value easily.. but how does one change a value to a variable....

    I hope this doesn't turn out as me being really thick..


    My actions as they stand so far..


    %GenreName% = "Trigga Hippy"
    %GenreSel% = "Trig"
    %LineNumber% = TextFile.FindLine ("%SrcDir%\Menu\Games.txt","%GenreName%", 0)
    %i% = Evaluate (%LineNumber%+2)


    WHILE (%i% < %LineCount% AND %spaceCount% < 2)

    %curGame% = Evaluate (("%"+Game+%i%+"%"))

    %i% = Evaluate ((%i%+1))
    %tmpLineVal% = TextFile.GetLine ("%SrcDir%\Menu\Games.txt", %i%)

    IF (%tmpLineVal% = " " OR %tmpLineVal% = "" OR %tmpLineVal% = " ")
    %i% = Evaluate (%LineCount%)

    END IF
    ELSE

    ????????
    something like
    %(%curGame%)% = %tmpLineStr%

    or

    %("game"+%i%)% = %tmpLineStr%

    This doesnt work...
    help!!!!!!!


    END WHILE




    Page.Jump ("Genre")


    --------------

    %Game1% = Evaluate (("%"+%GenreSel%+"1"+"%"))

    Above is this working sort of backwards I think..
    but then, does it work with %i% instead of '1'???



    Hope you understand what i'm barking on about, if anyone can help then thank you loads.

    Cheers

    Pete

    PS.. What ever happened to my new year celebrations?

  • #2
    Re: Hard Time With Variables....

    As explained in another thread:

    Store the variable name in a hidden Text Object and then retrieve it; that will recursively evaluate a variable name like %game%i%%.

    Or, even better: use a delimited string list, or a Global List, instead.
    --[[ Indigo Rose Software Developer ]]

    Comment


    • #3
      Re: Hard Time With Variables....

      Thanks loads sir, I'll give that a go, I'm sorry for apparent laziness on my behalf, I'll search longer next time!

      Pete

      Comment


      • #4
        Re: Hard Time With Variables....

        No accusation of laziness intended at all. [img]/ubbthreads/images/icons/smile.gif[/img] Although I did explain this in another thread a good while ago, I was actually referring to this other thread that you also started. I answered there first, and I didn't feel like explaining it twice when I ended up in this thread afterwards.
        --[[ Indigo Rose Software Developer ]]

        Comment

        Working...
        X