License from €75 Log in
DE EN FR ES IT CZ

Accessing character object via lua dynmically

This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials

  1. · 12 years ago
    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. Working on a game?

    The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license.

    See licenses Try it for free
  3. · 12 years ago
    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?
  4. · 12 years ago
    i will post the rest of the funcion after i come home from work smile
  5. · 12 years ago
    Sorry I never work with characters, but it looks good.
  6. · 12 years ago
    @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.

This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.

New thread

Really delete this post?