Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Accessing character object via lua dynmically

  • #1, by sebastian 11 years ago Zitieren
    how do i can get character data via a lua function but defining the char inside the function?

    What works (static):

    function get_char()
      local char = getObject("Characters[name_of_character]")
     ...
    end
    

    gets Object of "name_of_character"
    ---------------------------
    What doesn't work:
    function get_char(char)
      local char = getObject("Characters["..char.."]")
     ...
    end
    


    am i doing something wrong here? How can i do this dynamically?
  • #2, by ke4 11 years ago Zitieren
    Hm weird, looks correct...
    I've just pasted it in Visionaire and it works fine for me.

    Do you have anything else in the function?
  • #3, by sebastian 11 years ago Zitieren
    i will post the rest of the funcion after i come home from work smile
  • #4, by Simon_ASA 11 years ago Zitieren
    Sorry I never work with characters, but it looks good.
  • #5, by sebastian 11 years ago Zitieren
    @Simon_ASA: then just use condition for reference:
    function get_a_conditon(conditionname)
      local condition = getObject("Conditions[".. conditionname.."]")
     ...
    end
    


    EDIT: Ok, now it worked. I use the tupel of the object to get the object because they will not change as much as the name does (maybe).

    All i have to do is get the table and id of that object out of the explorer (Dump to log) and use the given numbers to get the desired object.


    I will post my solution in http://www.visionaire-studio.net/forum/thread/dialog-area-dy... when the whole thing is finished and cleaned up. Aim is to set the height and position of the dialog area by knowing the number of available displayed lines to avoid the arrows for scrolling.