Hello everyone.
I'm wondering if there is a script that makes the name of a location appear on the screen briefly whenever you enter there, perhaps in the corner so it isn't intrusive. Does such a thing exist?
Posted 25 March 2017 - 01:25 PM
Hello everyone.
I'm wondering if there is a script that makes the name of a location appear on the screen briefly whenever you enter there, perhaps in the corner so it isn't intrusive. Does such a thing exist?
Posted 25 March 2017 - 02:09 PM
Hello everyone.
I'm wondering if there is a script that makes the name of a location appear on the screen briefly whenever you enter there, perhaps in the corner so it isn't intrusive. Does such a thing exist?
You mean, like a little text box window?
Sure, that wouldn't be too hard. Although there might be a certain amount of hard-coding involved. I'm guessing you don't want to use the DMap intro text because you have to wait for it to go away before you can do anything (and the same is true regarding messages).
The question is how complex you want this to be. Tango.zh has the most options, but it takes a bit more scripting than others. If you don't care about a back ground behind the text, or custom fonts; then Screen->DrawString is your friend.
Here's an example script.
//D0- String number from ZC. ffc script AreaNameSet{ void run(int AreaNum){ int AreaName[256]; GetMessage(AreaNum,AreaName); int timer=60; while(timer>0){ Screen->DrawString(7,this->X,this->Y,FONT_Z1,1,0x0F,TF_NORMAL,AreaName,128); timer--; Waitframe(); } } }
This script reads a built-in ZC string and displays it at the coordinates of the ffc for 60 seconds.
It draws it on layer 7 (above everything) in the Zelda 1 font, using the last color of the first CSet.
The string will display every time you enter a particular screen, so only place it at the edge of whatever map it should show up on.
If there's a more complex solution that you're seeking, that's available.
Edited by ywkls, 25 March 2017 - 09:33 PM.
Posted 25 March 2017 - 02:38 PM
I can experiment with this for now. Thanks!
Posted 25 March 2017 - 06:58 PM
Posted 25 March 2017 - 09:33 PM
Hm, does changing while(timer>60) adjust the amount of time it appears? I might use this too, if you guys don't mind.
And I think whether or not strings freeze the screen is a quest rule, but I don't remember if it affects d-map into strings.
The timer number can be anything you want. You can even do this...
//D0- String number from ZC. //D1- Amount of time (in frames) to display string. ffc script AreaNameSet{ void run(int AreaNum, int timer){ int AreaName[256]; GetMessage(AreaNum,AreaName); while(timer>0){ Screen->DrawString(7,this->X,this->Y,FONT_Z1,1,0x0F,TF_NORMAL,AreaName,128); timer--; Waitframe(); } } }
I edited the code above too, because there was an error in it.
Edited by ywkls, 29 March 2017 - 09:39 AM.
Posted 28 March 2017 - 11:18 AM
Edited by cavthena, 28 March 2017 - 11:30 AM.
Posted 29 March 2017 - 09:43 AM
FYI you have int timer; declared twice.
For something like this it may be an idea to have time be in seconds instead of frames. Floating text in games typically appear for a few seconds to let the player find and read said text.
This is just a critique on your code. I'd replace the while loop with a for loop. They do the same thing but the for loop is easier to read code wise.
I fixed the duplicate instance of int timer.
I could do seconds instead of frames, to make things easier.
//D0- String number from ZC. //D1- Amount of time (in seconds) to display string. ffc script AreaNameSet{ void run(int AreaNum, int timer){ int AreaName[256]; GetMessage(AreaNum,AreaName); int frames = timer*60; while(frames>0){ Screen->DrawString(7,this->X,this->Y,FONT_Z1,1,0x0F,TF_NORMAL,AreaName,128); frames--; Waitframe(); } } }
The only reason I didn't use a for loop was because I don't normally insert waitframes into them. There's no reason why I can't, I'm just not in the habit of doing it.
Posted 31 March 2017 - 01:03 PM
The timer number can be anything you want. You can even do this...
//D0- String number from ZC. //D1- Amount of time (in frames) to display string. ffc script AreaNameSet{ void run(int AreaNum, int timer){ int AreaName[256]; GetMessage(AreaNum,AreaName); while(timer>0){ Screen->DrawString(7,this->X,this->Y,FONT_Z1,1,0x0F,TF_NORMAL,AreaName,128); timer--; Waitframe(); } } }I edited the code above too, because there was an error in it.
timer = timer * 60;I'm a sick bastard, and prefer:
while (timer--)I would also make the string settings *x, y and so fort into constants, and add a clear my up routine after the loop, thus:
this->Data = 0; this->Script = 0; Quit ();It is prudent to make this a habit at the end of every ttc script.
0 members, 0 guests, 0 anonymous users