Speaker text with static position

  • #10, by Yug_EtsapMonday, 27. January 2014, 01:51 11 years ago
    I'm sorry, it could be my scripting ineptitude showing, but I see nothing about getting the script to work with the dialog feature. I just see him mention you can have both narrator text and regular speaker text by adding an if statement checking for the font.

    Newbie

    12 Posts


  • #11, by afrlmeMonday, 27. January 2014, 03:39 11 years ago
    ahh... it's more a case of removing the if statements; not adding more.
    --[[
    narrator text position script by Spacepaw
    modified by AFRLme
    -- * --
    script type: definition
    -- * --
    define absolute position of speaker text!
    -- * usuage * --
    in the editor set: game > speaker text alignment to "centered"!
    then to display text: select action part > misc > display text > add text to display!
    if you want to be able to walk about & do other things while narrator text is visible then ...
    check the "show as background text" box!
    only downfall to background text is you can't skip it! 
    --]]
    
    -- * local variables * --
    local textState, narratorText
    local yVal = 100 -- add offset value from bottom here (in pixels)
    
    -- * start the text position loop* --
    function OnStartText(text)
      local finalPoint=game:getPoint(VGameScrollPosition)
      finalPoint.x = finalPoint.x + game:getPoint(VGameWindowResolution).x / 2 -- declares game resolution x /shared by 2 to get center!
      finalPoint.y = finalPoint.y + game:getPoint(VGameWindowResolution).y - yVal
      text:setValue(VTextPosition, finalPoint)
     textState = true -- start loop
     narratorText = text -- store text
    end
    
    -- * kills the loop when the text has finished displaying * --
    function OnStopText(text)
     textState = false -- kill loop
    end
    
    -- * loop to keep the displayed text in the same position on screen scroll * --
    function OnMainLoop()
     if textState then
      if not((game:getInt(VGameScrollDirectionHorizontal)==0) and (game:getInt(VGameScrollDirectionVertical))==0) then
       local finalPoint=game:getPoint(VGameScrollPosition)
       finalPoint.x = finalPoint.x + game:getPoint(VGameWindowResolution).x / 2
       finalPoint.y = finalPoint.y + game:getPoint(VGameWindowResolution).y - yVal
       narratorText:setValue(VTextPosition, finalPoint)
      end
     end
    end
    
    registerEventHandler("textStarted","OnStartText")
    registerEventHandler("textStopped","OnStopText")
    registerEventHandler("mainLoop", "OnMainLoop")
    

    I have modified the script a bit - not sure if it works, mind, as I've not tested it.

    Imperator

    7278 Posts

  • #12, by Yug_EtsapMonday, 27. January 2014, 09:28 11 years ago
    No, unfortunately it doesn't work. When the screen scrolls, it removes the last object text you inputted, which messes up the interface, and then it doesn't show the narrator text at all.

    I'm guessing this will take a bit of work. I'll try messing with it, though I can't figure out how this actually works. I assume textStarted, textStopped and mainLoop are the internal events that this gets put in, but I can't find anything on those events in the wiki.

    Newbie

    12 Posts

  • #13, by afrlmeMonday, 27. January 2014, 13:24 11 years ago
    they are listed on the new wiki under player commands.

    http://wiki.visionaire-tracker.net/wiki/Player_Commands
    http://wiki.visionaire-tracker.net/wiki/RegisterEventHandler

    I edited the script off the top of my head, so there's bound to be an issue or 2; or 3! wink

    * edit: edited script again.... see if it works now.

    Imperator

    7278 Posts

  • #14, by Yug_EtsapMonday, 27. January 2014, 13:36 11 years ago
    Thank you very much for all the help. The script still doesn't work as is, but I'll try fiddling with it myself, now that I know where to find more of the internals of the engine and I'll post it here if I get it to work.

    Newbie

    12 Posts

  • #15, by afrlmeMonday, 27. January 2014, 14:21 11 years ago
    you need to refer to the "data structure" page too: http://wiki.visionaire-tracker.net/wiki/Data_Structure

    it would be easier for me to help if I knew exactly what it is you are wanting to do - maybe with a decent explanation, some screenshots or quick diagrams or something...

    Imperator

    7278 Posts

  • #16, by Yug_EtsapMonday, 27. January 2014, 14:48 11 years ago
    After rummaging some more through the forums, I realize that the Dialog feature is too rigid and there are too many things that are hardcoded in it. I'm sorry for wasting your time with it, but I've decided to go with my own custom dialogue choice system. It will require more work in the long run, but it already looks much better.

    As for what I was trying to do - I basically want to have a visual novel-type text system. All of the text in the game has to appear at the bottom of the screen inside a rectangle. The script here is useful for all the text and it looks great when I tweak it a bit, but I also wanted to use the Visionaire's Dialog system. However, when I use that, the text still appears above the characters' heads, instead of the rectangle, like all other text.

    Right now, I'm going for a different approach - I'm manually inputting all of the text and the choices. I'm doing the choices through an interface. The problem I'm having now is making the action part wait for input from the player before continuing. I currently have it just looping through the same part of script until a choice is made:

    http://images.siteface.net/siteface//tmpDirs/1EF9519B27006550851BC23DBDC14AE8/1_Screen.jpg

    However, clicking the buttons does nothing.

    This is, very basically, what I want it to ultimately look like:

    http://img.gawkerassets.com/img/17kk2do3rkwokjpg/xlarge.jpg

    http://i.neoseeker.com/screenshots/R2FtZXMvUEMvQWR2ZW50dXJlL090aGVy/katawa_shoujo_image_mKv7p7Aou32RZTl.jpg

    Newbie

    12 Posts

  • #17, by afrlmeMonday, 27. January 2014, 17:35 11 years ago
    ah I see... I myself do not like the current dialog system as it is somewhat awkward to use & I think, very outdated.

    what is the loop part you've added doing exactly?

    if you are wanting to make a custom dialog interface then you can just create the text/buttons/choices as images & add them as scene objects or interface buttons & then use if queries & conditions or values to determine what should be displayed, where & when. I myself plan on making a custom dialog system for my own game project.

    Imperator

    7278 Posts

  • #18, by Yug_EtsapMonday, 27. January 2014, 18:41 11 years ago
    The way I've made it right now is that basically there's one interface called Dialog. That shows up whenever someone speaks and it's just a rectangle at the bottom of the screen.

    Then when there's a choice coming up, I call another interface - Dialog Choice. It has 4 buttons and when one is clicked, it assigns a value of 1-4(depending on which button was pressed) to a variable called "Choice"(which is empty in the screenshot). After the value is assigned, the button also hides the Dialog Choice interface. But while the choice is still being made, the loop keeps the script from ignoring the choice and continuing forward. Once "Choice" is different than 0(meaning a button was pressed), the loop is broken and a series of IF statements check which choice was selected, leading to whatever outcome that choice leads to. After all of the choices are done, the "Choice" variable is reset to 0, so it's ready for use in another multiple choice intersection.

    It's a pretty simple system and it'll require a bit more busywork than the internal Dialog feature of Visionaire, but it's much more flexible and looks much better, since you can assign a custom "look" to the textbox and the choice buttons.

    Thanks again for all the help. Despite my decision to give up on the Dialog function, I still learned some useful stuff for future use.

    Newbie

    12 Posts

  • #19, by afrlmeMonday, 27. January 2014, 19:10 11 years ago
    hmm... still not understanding the point in the loop. you seem to be complicating matters more than anything to me.

    if you created an interface for dialogs & set the interface size & area as same size as your game default resolution then it would prevent the player from clicking anywhere but on the interface itself.

    also just as a quick note: you can actually create actions which you can call at any time "call by other action" meaning you don't have to add all actions inside of the same left click executed as you have done.

    I would recommend using Lua script to do the whole thing but alas we can't script/trigger displayed text or narration text with Lua. Though if you were wanting to create the anime/graphic novel style typewritten text then you would do it as an animation which you could easily start/play with Lua.

    Just bouncing some ideas around for you & glad to be of help, even if we didn't manage to sort out what you were initially after wink

    Imperator

    7278 Posts

  • #20, by Yug_EtsapMonday, 27. January 2014, 19:39 11 years ago
    I'm using the loop, because if I don't, then the script will just continue running through. The Dialog Choice interface will appear, but the script won't wait for the player to select a choice, so it'll reach the IF statements for the Choice variable and after not completing any of them, the script will just end before the player has had a chance to even click one of the buttons. Clicking anywhere other than the buttons does nothing right now, as it should. Right now it works pretty much flawlessly. But yeah, I should move the majority of the script into its own action.

    It can be done in Lua, sure - but I don't see a real reason to change anything right now, it's a pretty simple script and it works pretty well.

    Newbie

    12 Posts