Duke4.net Forums: Multiple Lines of Text? - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Multiple Lines of Text?

User is offline   afurman 

#1

Silly question I'm sure, but problem has me flummoxed.

So I want to have multiple lines of text displayed simultaneously, but am unsure of how to do so. Right now I have defined all my quotes and have no problem getting one quote to appear at the top of the screen, but in searching for a way to display a second line of text directly beneath that one I have not managed to find any answers. Is there any way to do this.

Thanks in advance
0

User is offline   Chip 

#2

I have a system that displays upto 3 quotes at one time. If a 4th appears, then it'll push the top quote off the screen so there's never any more than 3.

Although the following works for me, there's most certainly a better and more efficient way:




// QUOTE VARS
gamevar NEWQUOTE -1 0 // This holds a quote number to be played through gametext.
gamevar QUOTEPAL 0 0 // This colours the quotes through gametext based on who owns the quote. I.E: if an enemy caused a critical hit then it'll be colourd red. If the player or a firend caused it, then blue.
gamevar QUOTEPAL1 0 0
gamevar QUOTEPAL2 0 0
gamevar QUOTEPAL3 0 0
gamevar QUOTEPAL4 0 0
gamevar SLOTTIME1 0 0 // This is the duration time of quotes on screen. However, the quotes can only be removed through slot 1.
gamevar SLOTTIME2 0 0
gamevar SLOTTIME3 0 0
gamevar SLOTTIME4 0 0
gamevar QUOTESLOT1 -1 0 // These slots indicate whether a quote is currently occupying a line on screen. If so then the quote will take place on the following slot.
gamevar QUOTESLOT2 -1 0
gamevar QUOTESLOT3 -1 0
gamevar QUOTESLOT4 -1 0
gamevar QUOTE1Y 0 0 // These y possitions are used for a nice roll off effect instead of the quote just jumping to the next slot.
gamevar QUOTE2Y 0 0
gamevar QUOTE3Y 0 0
gamevar QUOTE4Y 0 0
gamevar ORIEN 26 0 // Orientation for the slot 1 (as it'll have to take on transparrentcey when time is up)
gamevar QSHADE 0 0 // Simple really - this holds the shade of the quotes.
gamevar QSHADE2 0 0 // This keeps track of how much shade has been applied. When enough has been done, it'll lighten the quotes then repeat.






onevent EVENT_DISPLAYREST
ifvarg QUOTESLOT1 -1 // There's meant to be a quote on screen.
{
 gametext 2822 320 QUOTE1Y QUOTESLOT1 QSHADE QUOTEPAL1 ORIEN 0 0 1920 1080
}

ifvarg QUOTESLOT2 -1
{
 gametext 2822 320 QUOTE2Y QUOTESLOT2 QSHADE QUOTEPAL2 26 0 0 1920 1080
 ifvare QUOTESLOT1 -1 // The slot above this one is now empty.
 {
  setvarvar QUOTESLOT1 QUOTESLOT2
  setvarvar QUOTEPAL1 QUOTEPAL2
  setvarvar SLOTTIME1 SLOTTIME2
  setvarvar QUOTE1Y QUOTE2Y
  setvar QUOTESLOT2 -1
  setvar SLOTTIME2 0
 }
}

ifvarg QUOTESLOT3 -1
{
 gametext 2822 320 QUOTE3Y QUOTESLOT3 QSHADE QUOTEPAL3 26 0 0 1920 1080
 ifvare QUOTESLOT2 -1 // The slot above this one is now empty.
 {
  setvarvar QUOTESLOT2 QUOTESLOT3
  setvarvar QUOTEPAL2 QUOTEPAL3
  setvarvar SLOTTIME2 SLOTTIME3
  setvarvar QUOTE2Y QUOTE3Y
  setvar QUOTESLOT3 -1
  setvar SLOTTIME3 0
 }
}

ifvarg QUOTESLOT4 -1
{
 gametext 2822 320 QUOTE4Y QUOTESLOT4 QSHADE QUOTEPAL4 26 0 0 1920 1080
 ifvare QUOTESLOT3 -1 // The slot above this one is now empty.
 {
  setvarvar QUOTESLOT3 QUOTESLOT4
  setvarvar QUOTEPAL3 QUOTEPAL4
  setvarvar SLOTTIME3 SLOTTIME4
  setvarvar QUOTE3Y QUOTE4Y
  setvar QUOTESLOT4 -1
  setvar SLOTTIME4 0
 }
}

ifvarg NEWQUOTE -1 // We have a new addition to the quote list.
{
 ifvare QUOTESLOT1 -1 { setvarvar QUOTESLOT1 NEWQUOTE setvarvar QUOTEPAL1 QUOTEPAL } // The first slot is empty so lets take it!
 else
 ifvarn QUOTESLOT1 13
 {
  ifvare QUOTESLOT2 -1 { setvarvar QUOTESLOT2 NEWQUOTE setvarvar QUOTEPAL2 QUOTEPAL setvar QUOTE2Y 8 }
  else
  ifvarn QUOTESLOT2 13
  {
   ifvare QUOTESLOT3 -1 { setvarvar QUOTESLOT3 NEWQUOTE setvarvar QUOTEPAL3 QUOTEPAL setvar QUOTE3Y 16 }
   else
   ifvarn QUOTESLOT3 13 { setvarvar QUOTESLOT4 NEWQUOTE setvarvar QUOTEPAL4 QUOTEPAL setvar QUOTE4Y 28 setvar QUOTESLOT1 -1 setvar SLOTTIME1 0 }
  }
 }
 setvar NEWQUOTE -1
}
endevent



The following should be placed in the Player actor code (so the timings are fixed). Look for the line "actor APLAYER MAXPLAYERHEALTH PSTAND 0 0" and then find the line direclty under that, which should read: "ifaction 0 action PSTAND"
modify that so it reads:
ifaction 0
{
 setplayer[THISACTOR].fta -1 setplayer[THISACTOR].ftq -1 // Prevents the "auto aiming" quote from being displayed at map start up.
 action PSTAND
}


Now place the following under that:

// Moving quotes to the new quote system.
getplayer[THISACTOR].ftq TEMP ifvarg TEMP -1 { setvarvar NEWQUOTE TEMP setvar QUOTEPAL 0 setplayer[THISACTOR].ftq -1 }
getplayer[THISACTOR].fta TEMP ifvarg TEMP -1 setplayer[THISACTOR].fta -1

// The counter.
ifvarg QUOTESLOT1 -1 // There's at least 1 quote on screen.
{
 ifvare QSHADE 0 setvar QSHADE2 0 else ifvare QSHADE 9 setvar QSHADE2 1
 ifvare QSHADE2 1 subvar QSHADE 1 else addvar QSHADE 1

 ifvarg QUOTE1Y 0 subvar QUOTE1Y 1
 else
 ifvarn QUOTESLOT1 13
 {
  ifvare SLOTTIME1 124 { setvar SLOTTIME1 0 setvar QUOTESLOT1 -1 setvar ORIEN 26 }
  else
  ifvare SLOTTIME1 122 setvar ORIEN 59
  else
  ifvare SLOTTIME1 120 setvar ORIEN 27
  ifvarl SLOTTIME1 124 addvar SLOTTIME1 1
 }
}

ifvarg QUOTESLOT2 -1 { ifvarg QUOTE2Y 8 subvar QUOTE2Y 1 ifvarl SLOTTIME2 120 addvar SLOTTIME2 1 }
ifvarg QUOTESLOT3 -1 { ifvarg QUOTE3Y 16 subvar QUOTE3Y 1 ifvarl SLOTTIME3 120 addvar SLOTTIME3 1 }
ifvarg QUOTESLOT4 -1 { ifvarl SLOTTIME4 120 addvar SLOTTIME3 4 }


I hope I haven't missed anything.
Quotes can be displayed normally with the quote command or by directly setting "NEWQUOTE" to the quote number to be played. Also at the same time, setting QUOTEPAL to a palette number will change the pal of the text. Also no more quotes will be displayed once "press space to restart level" appears.

This post has been edited by Chip: 30 August 2010 - 12:48 PM

0

User is offline   afurman 

#3

Assuming I were to use that code (which i really appreciate you posting btw), would i be able to get it to display two pieces of text by simply coding (forexample)

onevent EVENT_DISPLAYREST
{ quote 1
quote 2
}
0

User is offline   Chip 

#4

Unfortunately not. The quotes are only moved to the new system once the APLAYER code is read. So the second quote will need to be set a tic later.

However, I may adjust my system to allow something like that to work. It shouldn't be too hard since quotes for this system can be set diectly with this: setvar NEWQUOTE <quote number> (I actually would advise doing this way instead of using the old quote command but both ways work)
So I could just add a another temp var that can be used to hold the second quote for when EVENT_DISPLAYREST is looked at but these vars would have to be set directly so you couldn't just use original quote command.

This post has been edited by Chip: 30 August 2010 - 01:08 PM

0

User is offline   afurman 

#5

anyone with any other ideas?
0

User is offline   TerminX 

  • el fundador

  #6

Shit, maybe I should just add support for \n to quotes. :wacko:
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#7

View Postafurman, on Aug 31 2010, 12:39 PM, said:

anyone with any other ideas?

http://wiki.eduke32.com/wiki/Userquote
0

User is offline   Chip 

#8

I was about to say that wont work for me since it doesn't support colour but apparently the standard quote command actually does! :wacko:
That's surely something that the orginal Duke3d could not do?

This post has been edited by Chip: 31 August 2010 - 08:08 AM

0

#9

FFS! Is it a spammers national holiday or something?
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#10

Yatta should be on to it now, ugh
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options