Displaying Character Name along with Dialog

  • #10, by afrlmeMonday, 10. July 2017, 13:18 7 years ago
    I'm pretty sure you can't add line breaks into the text.

    Anyway, it won't do anything as you need to manually call the text function. It's not automatic.

    -- let's create the function which sets the position of displayed text
    function setTextPosHook(text)
     -- if text owner is a character then...
     if text:getLink(VTextOwner):getId().tableId == eCharacters then
      text:setValue(VTextPosition, {x=630, y=625})
      txt(game.CurrentCharacter)
      return true
     end
    end
    
    -- let's create the event listener for handling position of displayed text
    registerHookFunction("setTextPosition", "setTextPosHook")
    
    
    -- adding character name to dialog
    function txt(obj)
      return obj.Owner:getName() .. ": " .. obj.CurrentText
    end
    
    registerHookFunction("textText", "txt")
    

    Imperator

    7278 Posts


  • #11, by mikael32225Monday, 10. July 2017, 13:40 7 years ago
    This seems to cause more trouble than I expected. Thank you everyone for chiming in.

    Since text seems to be troublesome, would it be easier to just display a character portrait? Or would that cause other problems?

    Newbie

    42 Posts

  • #12, by afrlmeMonday, 10. July 2017, 13:57 7 years ago
    This seems to cause more trouble than I expected. Thank you everyone for chiming in.

    Since text seems to be troublesome, would it be easier to just display a character portrait? Or would that cause other problems?
    Character portrait would certainly be much simpler than trying to manipulate active text, but like they already mentioned before, you could simply insert the characters name manually yourself into the displayed text action part.

    Imperator

    7278 Posts

  • #13, by mikael32225Monday, 10. July 2017, 14:50 7 years ago
    Not sure about adding the name in with the actual line. Seems fiddly since I have a lot of dialog. I will have to play around and see what I like. 

    Are there any good resources for learning basic scripting for Visionaire?

    The stuff I've found so far has mostly been confusing to me. I would just like to understand the basics of how scripts work with Visionaire. For instance, how to play a sound, display a picture, show a piece of text, etc.

    Newbie

    42 Posts

  • #14, by afrlmeMonday, 10. July 2017, 16:43 7 years ago
    Not sure about adding the name in with the actual line. Seems fiddly since I have a lot of dialog. I will have to play around and see what I like. 

    Are there any good resources for learning basic scripting for Visionaire?

    The stuff I've found so far has mostly been confusing to me. I would just like to understand the basics of how scripts work with Visionaire. For instance, how to play a sound, display a picture, show a piece of text, etc.
    Those aren't the basics. More like advanced stuff.

    Sound with Lua script is handled through the openAL sound engine & requires creating Lua tables to store the paths to the sound files you want to play. To actually play the sounds you need to use various functions that Simon created for VS, all of which have various parameters you can manipulate.

    Displaying of text &/or images with Lua script was only recently added to Visionaire Studio. Simon created some draw functions for displaying & manipulating text & images.

    Have you bothered checking out the wiki? There are loads of pages dedicated to scripting. The only 2 you really need for starting is the "scripting" page & the "data structure" page which lists all the available VisObj fields that you can access/manipulate.

    Finally, Simon has been working on a new online documentation thing dedicated to the Lua side of the engine, which you can find here - he's still working on it.

    Imperator

    7278 Posts

  • #15, by mikael32225Monday, 10. July 2017, 20:02 7 years ago
    Thank you for such a thorough answer. I have looked at the wiki, but for the most part I find it difficult to decipher. It's hard to wrap my head around it since I'm not much of a coder, so I was looking for a way to make babysteps forward.
    For some reason I imagined it being easier to display and play sounds, as opposed to making something more grandiose like a puzzle. Kind of like when I used to play around with HTML – start with getting an image on the site, before coding the online store.

    Sorry if it came off as I was just looking for easy answers. I really just want to learn.

    Newbie

    42 Posts

  • #16, by afrlmeMonday, 10. July 2017, 20:36 7 years ago
    No worries. Check out the online Lua docs that Simon has been working on. He has posted links to other websites/blogs with useful information in regards to learning the basics of Lua script. I highly recommend checking out the phailed.me blog as it's written in a way that pretty much everyone can understand.

    Quick note: scripting in visionaire is a combination of 3 different things.
    • Lua script - this is a language used by various different applications, game engines & websites. It's fairly easy language to learn & there are lots of different websites & blogs out there with syntax examples & tutorials.
    • VisObj (visionaire objects) - these are essentially tables that contain various data for your game & the game engine. You can query or modify most of these during runtime inside of any custom scripts you create. All of the VisObj can be found on the data structure page of the wiki.
    • GLSL (openGL shader language) - I think this is basically C (Simon?). It's a lot more complicated than Lua script, but for those that know any of the C languages such as C++ or C#, they should probably be able to learn how to write custom shaders with it to provide various different lighting & screen warp effects & so on to apply to their games.

    Also, you should check out the "script index" page on the wiki. I have provided various script examples of my own & other peoples. Most come with resource files & tutorials. Reverse engineering is always a great way for learning things. wink

    Imperator

    7278 Posts

  • #17, by mikael32225Tuesday, 11. July 2017, 09:19 7 years ago
    This is great. Thanks again!

    Newbie

    42 Posts