Good for all. Since completing the first phase of my program, how they have not given me new instructions and my mom is ending the sheets where I will base my stats (when is the result better understood), I decided to make a record of consultations, if the doctor want to save the patient consultation, include observations, etc…
Anyway, what happens to me is I have this code (fragment) in the script calculator.js
if(resultH >= 1){
consult="El paciente tiene "+resultH+" horas de vida o "+yyyyInt+" años.";
GUI.Label(Rect(Screen.width/2-column4Pos, Screen.height/2-230,Screen.width/2-100,100), consult);
GUI.Label(Rect(Screen.width/2-column4Pos, Screen.height/2-120,Screen.width/2-100,100), key);
}
That if validates and verifies certain data, in this case, it overwrites a string variable, which will be displayed in the Label beneath: P Good thing it perfect, in fact seen in the inspector that changes, is printed with a print () to verify that this has been written, but over the script reg.js, which is creating the record in the log file … SO fails when there is: (
This is the code reg.js (clarified I tried removing the # pragma strict just in case and there was no difference
#pragma strict
var statusAddReg: boolean = false;
/* Variable que guarda el ID de cada paciente */
private var ID: int;
/* GetComponent */
public var otherGameObject: GameObject;
private var anotherScript: Calculator;
function Awake(){
anotherScript = otherGameObject.gameObject.GetComponent("Calculator") as Calculator;
}
/* Script */
function Update () {
Invoke("addReg", 0.1);
}
function addReg () {
ID = PlayerPrefs.GetInt("ID");
if(statusAddReg){
print(anotherScript.consult);
ID+=1;
PlayerPrefs.SetString(anotherScript.namePacient+"_"+ID, ""+anotherScript.namePacient+" | Resultado de la consulta: "+anotherScript.consult+"");
PlayerPrefs.SetInt("ID", ID);
statusAddReg=false;
}
}
He explained that the variable statusAddReg [/ u] is activated from the calculator.js [/ b], I noticed and it does, but it gives me that data is lost in the middle … I explain … if I put a print (anotherScript.consult) print what I have to print, that is (for example):
**__ __**The patient has 122,640 hours of life or 14 years.**__ __**
Now, if I put that print () inside the if (in the script reg.js):
**__ __**if(statusAddReg){ // Code }**__ __**
The print does not return nothing … how to consult if the variable does not have anything inside (does not return NULL simply returns nothing xD).
Is there any solution for this? Thanks to all