Difference between revisions of "Display Text on Screen"

From AGI Wiki
Jump to navigationJump to search
(Created page with "== Basics == Displaying text in AGI basically happens with commands print and display their variants. Print produces a message box and display a textlin...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Basics ==
+
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]<br />
 +
&nbsp;
 +
<div align="center"><span style="font-size: 22pt">Display Text on Screen</span><br />
 +
''By unknown''</div>
 +
 
 +
&nbsp;
 +
 
 +
== <br />Basics ==
  
 
Displaying text in AGI basically happens with commands [[Print|print]] and [[Display|display]] their variants. Print produces a message box and display a textline. The major difference between these two command-types are that while the print-command functions better within and while playing the game with animated objects, the display is better for uses like status-bar, intros, outros and credits for example where there is no interference from animated objects.
 
Displaying text in AGI basically happens with commands [[Print|print]] and [[Display|display]] their variants. Print produces a message box and display a textline. The major difference between these two command-types are that while the print-command functions better within and while playing the game with animated objects, the display is better for uses like status-bar, intros, outros and credits for example where there is no interference from animated objects.
Line 8: Line 15:
  
 
&nbsp;
 
&nbsp;
 
 
== Examples ==
 
== Examples ==
  
Line 42: Line 48:
  
 
&nbsp;
 
&nbsp;
 
 
=== Print.v ===
 
=== Print.v ===
  
Line 59: Line 64:
  
 
&nbsp;
 
&nbsp;
 
 
=== Print.at ===
 
=== Print.at ===
  
Line 73: Line 77:
  
 
&nbsp;
 
&nbsp;
 
 
=== Print.at.v ===
 
=== Print.at.v ===
  
Line 79: Line 82:
  
 
&nbsp;
 
&nbsp;
 
 
==== WinAGI ====
 
==== WinAGI ====
  
Line 107: Line 109:
 
==== AGI Studio ====
 
==== AGI Studio ====
  
AGI Studio's helpfile claims that command should be like this: <code>print.at.v(vA,vX,vY,vW);</code> but it only accepts <code>print.at.v(mA,vX,vY,vW);</code>. It is better to avoid using this command under AGI Studio altogether and compile it with WinAGI and with correct syntax.
+
AGI Studio's help file claims that command should be like this: <code>print.at.v(vA,vX,vY,vW);</code> but it only accepts <code>print.at.v(mA,vX,vY,vW);</code>. It is better to avoid using this command under AGI Studio altogether and compile it with WinAGI and with correct syntax.
  
 
<div class="CodeBlockHeader">Code:</div>
 
<div class="CodeBlockHeader">Code:</div>
Line 128: Line 130:
  
 
&nbsp;
 
&nbsp;
 
 
=== Flag 15 & variable 21 ===
 
=== Flag 15 & variable 21 ===
  
Line 142: Line 143:
  
 
== Advanced ==
 
== Advanced ==
 +
 +
&nbsp;
 +
 +
[[Tutorials and Guides|Tutorials and Guides Table of Contents]]
 +
 +
&nbsp;
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
 +
[[Category:References]]

Latest revision as of 16:29, 26 December 2013

Tutorials and Guides Table of Contents
 

Display Text on Screen
By unknown

 


Basics

Displaying text in AGI basically happens with commands print and display their variants. Print produces a message box and display a textline. The major difference between these two command-types are that while the print-command functions better within and while playing the game with animated objects, the display is better for uses like status-bar, intros, outros and credits for example where there is no interference from animated objects.

The reason why print works better with animated.objects is that usually it covers everything behind it when the messagebox appears and when it disappears almost everything behind is still like they were when the messagebox appeared. The display on the other hand simply displays line of text that can be easily wiped by animated object or message box. Worth remembering is that messageboxes are also used by system commands like quit.

Both print and display-variants can be affected by other commands, not forgetting certain flag and variable when it comes to print.

 

Examples

Print

A typical messagebox, displayed in the middle of the screen.

Code:
print("Hello world");

Same but using ability to use #message .

Code:
print(m1);

return();
#message 1 "Hello world"

This time in the #message-part has been put a string. Note that string s1 has been defined before using print-command and #message can be also elsewhere within the logic than beneath return-command.

Code:
set.string(s1,"Hello world");
print(m1);
 
return();
#message 1 "%s1"

 

Print.v

Print.v provides a way for one print.v to display various messages. Once again it is important to define all modifiers before printing.

Code:
v40 = 2; /* Oh hi just sounds better than Hello */
set.string(s1,"Hello world");
print.v(v40);
 
return();
#message 1 "%s1"
#message 2 "Oh hi world"

 

Print.at

Should a need for displaying messagebox elsewhere than middle arise, print.at is the solution.

Code:
print.at(m2,1,20,10);
 
return();
#message 2 "Oh hi world"

 

Print.at.v

And the variant print.at.v is bit tricky because it's syntax varies which software one uses. AGI Studio uses wrong arguments. However, examples for both WinAGI and AGI Studio are presented. It is unknown how QT AGI Studio handles this command though it is based on AGI Studio.

 

WinAGI

With this command WinAGI is the IDE. The correct syntax being print.at.v(vA,byte ROW,byte COLUMN,byte MAXWIDTH);

Code:
#message 2 "Hallo world"
#message 1 "%s1"
 
if(f5){
  set.string(s1,"Hello world");
  
  v40 = 1;
  v41 = 1;
  v42 = 20;
  v43 = 10;
  
  print.at.v(v40,1,20,10);
}

return();

 

AGI Studio

AGI Studio's help file claims that command should be like this: print.at.v(vA,vX,vY,vW); but it only accepts print.at.v(mA,vX,vY,vW);. It is better to avoid using this command under AGI Studio altogether and compile it with WinAGI and with correct syntax.

Code:
#message 2 "Hello world"
 
  if(f5){
  
    v41 = 1;
    v42 = 20;
    v43 = 10;
   
    print.at.v(m2,v41,v42,v43);
  
  }
  return();

However, it will only print empty, yet right size messagebox. Weird, huh.

 

Flag 15 & variable 21

As default, messagebox halts progress of logic until user presses key. Yet that kind of behavior can be altered with means like flag 15 and variable 21. Variable 21 defines the time in half-seconds how long the messagebox will remain until it's closed. Flag 15 causes messageboxes to remain on screen until close.window-command is issued or variable 21 value is met. The intriguing part when flag 15 is issued with messagebox is that messagebox won't no longer halt the logic nor cover possible action, such as display-command, happening behind it.

 

Display

Display.v

Set.text.attribute

Advanced

 

Tutorials and Guides Table of Contents