Leveraging The Text Resources Further: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
No edit summary
Andrew Branscom (talk | contribs)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:SCI Pages]]
[[Category:SCI Pages]]
[[Category:Temp SCI Pages]]
[[Category:Temp SCI Pages]]
[[Category:SCI Pages to be Edited]]
<div align="center"><span style="font-size: 22pt">Leveraging The Text Resources Further</span><br />''By [[Jeremiah Nellis]]''</div>
<br />
==<br /> Introduction ==
You can move all your #title & #button text descriptions used in Print() statements:
You can move all your #title & #button text descriptions used in Print() statements:


In controls.sc, in the Print() procedure change the '(case #button' section:
In [[controls.sc]], in the Print() procedure change the '(case #button' section:
<div class="CodeBlockHeader">Code:</div>
<div class="CodeBlockHeader">Code:</div>
<syntaxhighlight lang="sci" class="cs">
<syntaxhighlight lang="sci" class="cs">
Line 59: Line 66:
   Print(0 22 #button 888 1)
   Print(0 22 #button 888 1)
</syntaxhighlight>
</syntaxhighlight>
[[Category:Template Game Fixes]]
 
==<br /> References ==
 
<references />
 
==<br /> Related Links ==
 
* &nbsp;
&nbsp;
[[Category:Text Resources]]
[[Category:SCI Text Resources]]
[[Category:SCI Template Game Fixes]]
[[Category:Syntax]]
[[Category:Syntax]]
[[Category:SCI Syntax]]

Latest revision as of 16:06, 29 April 2025


Leveraging The Text Resources Further
By Jeremiah Nellis



Introduction

You can move all your #title & #button text descriptions used in Print() statements:

In controls.sc, in the Print() procedure change the '(case #button' section:

Code:
			(case #button
		    	= hButtons[buttonCnt] (DButton:new())
		    	
				(if(>= Abs(params[+ paramCnt 1]) 0 and <= Abs(params[+ paramCnt 1]) 999)	
					(send hButtons[buttonCnt]:
						text(Format("%s" params[+ paramCnt 1] params[+ paramCnt 2]))
						value(params[+ paramCnt 3])
						setSize()
			    	)	
					= paramCnt + paramCnt 3
				)(else
					(send hButtons[buttonCnt]:
						text(params[++paramCnt])
						value(params[++paramCnt])
						setSize()
			    	)
				)		    	
		    	= btnsWidth (+ btnsWidth (+ (send hButtons[buttonCnt]:nsRight) 4))
		    	++buttonCnt
			)

And the '(case #title' section:

Code:
			(case #title
				++paramCnt

				(if(>= Abs(params[paramCnt]) 0 and <= Abs(params[paramCnt]) 999)
					Format("%s" params[paramCnt] params[+ paramCnt 1])
					++paramCnt
				)(else
					(send hDialog:text(params[paramCnt]))
			       )
			)

Now, you can use either technique - specify a static string or a text resource like this:

Code:
   Print("Hello there" #title 999 1)    //  999 is the text resource holding our title text
   Print("Hello there" #title "Greetings")   // the original way of specifying a title still works too

Same with buttons:

Code:
   Print("Make a selection" #button 888 2)   // 888 is the text resource holding our button text
   Print("Make a selection" #button "OK")    // the original way of specifying text for buttons still works

Of course, if you are this heap-bound, you'd have the actual text of your Print statement to be in a text resource too, so a more realistic example would be something like this:

Code:
  Print(0 15 #title 999 1)
  Print(0 22 #button 888 1)


References



Related Links

  •