Need help with "Self Variable" script!

● ARCHIVED · READ-ONLY
Started by davidgoh 4 posts View original ↗
  1. Hi all!

    I'm currently using PK8's Self Data suite for RMVX Ace, but I can't seem to get the self_variables data working all that well. I feel like I'm missing something very obvious!

    I have an event with the following script:

    self_variable(@orig_a, 1)

    self_variable(@orig_b, 2)

    self_variable(@orig_c, 3)

    self_variable(@orig_d, 4)

    self_variable(@orig_e, 5)

    self_variable(@orig_f, 6)

    print self_variable([@orig_a])

    print self_variable([@orig_b])

    print self_variable([@orig_c])

    print self_variable([@orig_d])

    print self_variable([@orig_e])

    print self_variable([@orig_f])

     

    Executing the script should print out "123456" in the console. Unfortunately, all i get is "666666." Whatever I do, the last variable function seems to override all the previous ones! Anyone have any ideas?

     


    EDIT: A friend who does a bit of python pointed out the problem after looking at the script. It turns out that for setting variables under the self_variable, I can't use conventional names like "@variable"... rather, just simple integers would do (e.g. [1] or [2]. It's because of the "@name" variable that game ignores it and applies the assigning function to a default variable instead.

     

    Silly me! Sorry about this. Consider this solved!
  2. I've moved this thread to script support. Please be sure to post your threads in the correct forum next time. Thank you.
  3. davidgoh said:
    rather, just simple integers would do (e.g. [1] or [2]. It's because of the "@name" variable that game ignores it and applies the assigning function to a default variable instead.
    You still got it wrong.
    You should not use integers and especially not array of integers for the variable's ID because that way you can mix it with the internal IDs and apply the variables to the wrong events.


    The best way is to use simple string names - that's what those functions are intended for.


    self_variable('Data_Storage_A', 1)


    will work perfectly.
  4. I see! Thank you for this :D I'll definitely work this in.

    Andar said:
    You still got it wrong.

    You should not use integers and especially not array of integers for the variable's ID because that way you can mix it with the internal IDs and apply the variables to the wrong events.
    The best way is to use simple string names - that's what those functions are intended for.

    self_variable('Data_Storage_A', 1)

    will work perfectly.