- Home /
Question by
Katofthekat · Apr 17, 2016 at 12:20 PM ·
textstringloadfile
Read dialog text from text file in javascript
Hello, I'm struggling with this for hours now. All I want is to use button names and dialog text from a text file that is separated by a line but whatever I tried to so far has errors or doesn't work at all.
Here is my script. How can I modify it to read the dialog from a text file?
private var TipText = "";
private var Choice1 : boolean = true;
private var randomnumber = 400;
function Start () {
TipText = "VHT-100B entered production just 2 months after VHT-100A featuring redesigned air intake for the fifth engine on the tail. New air intake is more power efficient and weights less whilst providing the same amount of air for the rear engine to operate at it's maximum capacity. This resulted in VHF-100B being slightly faster, while able to carry more weight at the same time when compared to it's older counterpart.";
}
function OnGUI(){
GUI.Label(new Rect(Screen.width/3 - 125, Screen.height - 760, 700, 50), TipText);
}
if (Choice1 == true)
{
if (GUI.Button(Rect(Screen.width/5 - 85, Screen.height - 100, 1000, 30), "<color=#00ff00ff>[90% Sucess]</color>Examine Part"))
{
if ( Random.value < 0.90 )
{
TipText = "Part seems to be intact. ";
}
else
{
TipText = "Part seems to be damaged. ";
}
Choice1 = false;
}
}
Comment
Your answer
Follow this Question
Related Questions
Return name of file only 1 Answer
Loading text into Gui.Box 2 Answers
How to get info from a text file 1 Answer
How do I load a 60mb text file? 0 Answers
Load and save text from web server 2 Answers