Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- 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!
- --]]
- -- * this gets & declares the x, y position of the speaker text * --
- function OnStartText(text)
- if text:getLink(VTextOwner):isEmpty() then
- 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 - 100 -- declares game resolution y (bottom) change - 100 offset to whatever you want!
- text:setValue(VTextPosition, finalPoint)
- isNarratorText=true
- narratorText=text
- print('xPos=' .. finalPoint.x .. ' yPos=' .. finalPoint.y .. ' onStart!') -- prints the x,y position values to the log!
- end
- end
- -- * kills the loop when the text has finished displaying - I think? * --
- function OnStopText(text)
- if text:getLink(VTextOwner):isEmpty() then
- isNarratorText=false
- end
- end
- -- * loop to keep the displayed text in the same position on screen scroll * --
- function OnMainLoop()
- if isNarratorText 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 - 100
- narratorText:setValue(VTextPosition, finalPoint)
- print('xPos=' .. finalPoint.x .. ' yPos=' .. finalPoint.y .. ' onMain!') -- prints the x,y position values to the log!
- end
- end
- end
- registerEventHandler("textStarted","OnStartText")
- registerEventHandler("textStopped","OnStopText")
- registerEventHandler("mainLoop", "OnMainLoop")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement