I need help on txt so far I have a small piece of code found in the answer section.
It works fine, but I do not know the correct location to show a specific line of text in the GUI.
How to display GUI 1 line 2 line or element 0, element 1, etc. …
Any idea?
code :
#pragma strict
import System;
import System.IO;
import System.Collections.Generic;
import System.Linq;
var fileLines : List.<String>;
function Start () {
ReadFile();
}
function ReadFile()
{
var sr = File.OpenText("Test.txt");
fileLines = sr.ReadToEnd().Split("\n"[0]).ToList();
sr.Close();
}
function OnGUI ()
{
GUI.Label(Rect(10,150,150,150),"?");
}
Hi,
I don´t know if I understand your last Sentence right but you can get the elements of the Array by this code (please have a look at line 19):
#pragma strict
import System;
import System.IO;
import System.Collections.Generic;
import System.Linq;
var fileLines : List.<String>;
function Start () {
ReadFile();
}
function ReadFile()
{
var sr = File.OpenText("Test.txt");
fileLines = sr.ReadToEnd().Split("\n"[0]).ToList();
sr.Close();
}
function OnGUI ()
{
GUI.Label(Rect(10,150,150,150),fileLines[0]);
}
that simple:sweat_smile: hehe:p
My aim is to create characters dialogue simply by calling the respective line of text in a text file for each situation.
I pity after export to exe, txt file is not visible. Well I would like the user can modify to translate into your language.
Do not know if it’s a good way.
In other words is STR style.
For example:
Mission 1.
P1: Hey, how’s it going?
P2: You’ll be walking. What have you been doing?
P1: Nothing special.
Mission 2.
P1: Your mission is to escape as far as possible.
P2: I’ll try my best possible.
P1: Do not trust anybody. A lot of fake people.
I add some staff to have access to the line number .
var linetextNumber : int = 0;
modify.
GUI.Label(Rect(10,150,150,150),fileLines[linetextNumber]);
It is possible to read the name without relying on P1?
I mean show the name but not the P1.
The P1 serves only as a reference.
It is possible to read the name without relying on P1?
like:
P1> My text.
Read “my text” and not “P1>”.?
I know how to make the text stand pending the executable. So you can modify the text to other languages freely.
But I still need help how to manipulate paragraph, without counting the P1?? manipulating spaces.
i´m not pro in c#
how to apply?? sorry for asking.
this is cool:
var arrLine : String[ ] = File.ReadAllLines(fileName);
arrLine[line_to_edit - 1] = newText;
File.WriteAllLines(fileName, arrLine);