Trying to get the Display function to show elsewhere

Started by Aljoho, Fri 28/03/2008 21:26:48

Previous topic - Next topic

Aljoho

   Im just making my first game and i have an annoying problem.

   Is there a way i can automatically set the display function to display my strings of text at a specific location, such as on my GUI without having to use at x at y for each one, altering the global script to incorporate this. i could do it the long way but im lazy and if anyone knows a simple way to do this it would be much appreciated ;)
A Tribute to my success -  A wonky ASCII Trophy
                              .__.
                              (|  |)
                               (  )
                              _)(_

TwinMoon

#1
You can add a label to your gui. Go to the GUI in the editor, it's one of the icons above your GUI.

If you mean you want character speech to be displayed at a fixed point, there's two things you could do:

1. SetSpeechStyle(SpeechStyle)  :  If you set it to eSpeechSierra the text will be displayed at the top of the screen. The speechview of your character will be drawn next to it, so you might need to draw close-ups of your character's face to use as a speechview.

2. Stop being lazy ;)  Programming is hard work.

Let me know if this helps.

Aljoho

   nope still cant crack it :o

   I was hoping  to alter the display function, or create my own similar function useing display so whenever i use my function , it will display the text at a certain height and width within the bounds of the level (so if I have a level bigger then my resoloution it wont go off the screen). I've tried copying some of the script from the overhot module, using similar bounds as those I set for that but it just shows nothing.
   as for lazyness, you cant blame a guy for trying :P
A Tribute to my success -  A wonky ASCII Trophy
                              .__.
                              (|  |)
                               (  )
                              _)(_

TwinMoon

Ok, I think I understand.

Try this:

anywhere in the global script (globalscript.asc) put:
Code: ags
function MyDisplay(String Text) {
  DisplayAt(x, y, 320, Text);
}


in the global header (globalscript.ash) put:
Code: ags
import function MyDisplay(String Text);


Then, if you need to use Display you can use MyDisplay and it will be placed at the x and y you entered.

Instead of MyDisplay you can use any other name which makes sense to you.
Fill in the x and y where you want the text to be displayed.


I think the text is automatically fitted so it never is displayed outside of the screen.
If that's not the case, make sure that in DisplayAt the y-coordinate and the width added together don't exceed the resolution.

What I mean is: if your resolution is 320x200 and your y-coordinate is 30, use DisplayAt(x,30,290,Text);
The second and third number together should never be greater than the maximum x-coordinate (which is 320 in this case).


Hope I made this clear, it's a little bit messy. And I hope that this works for you. You'll still have to script a lot, but a little less.

Aljoho

A Tribute to my success -  A wonky ASCII Trophy
                              .__.
                              (|  |)
                               (  )
                              _)(_

SMF spam blocked by CleanTalk