Errors, Errors, and more Errors?
Hi, I am making a top down RPG and I am having these errors. It is a script for dialogue:
Here is a script version:
using UnityEngine;
using System.Collections;
public class Dialogue : MonoBehaviour {
public bool Talk;
public bool TextOpt;
public bool LargeOpt;
public int MaxOpt;
public int SelectedOpt;
public int Box;
public int TalkingTarget;
public string Text;
public bool Restart;
void Awake; {
if (Restart) { //If restarting
Box = 0; //put the box to 0
}
DialogBox.Visible = True; //Shows the box (YOU WILL PROBABLY HAVE TO CHANGE)
if (Talk = False Or Dialog <> CurrentDialog) { //If not continuing a dialog
Talk = True; //Then start one
Box = 0; //from the beginning
CurrentDialog = Dialog; //and record what dialog is being started
} ElseIf (Restart = False) { //Otherwise (if continuing)
Box += 1 //Progress a box
}
if (TextOpt = False) { //If it's not a choice,
OptionBox.Visible = False; //Don't show the options.
}
}
//. . . Code to put the correct text into the “text” variable . . .
//I don’t know how you want to do this, maybe from text resource file or a select case?
//You mentioned audio. That would probably have to be controlled in this chunk too then, as well as anything that may change on a box-by-box basis.
DialogBox.Text = Text; //Display the text!
if (Talk = False) { //If no longer talking,
txtDialog.Visible = False; //close the box
}
if (TextOpt = False) { //If there isn't a choice,
txtOption.Visible = False; //Don't show the options
}
screenshot-2016-07-13-220403.png
(167.4 kB)
Comment
Best Answer
Answer by Anas173 · Jul 14, 2016 at 05:12 PM
You have a serious brackers and semicolon issues.. i fixed them now fix your if statements..
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine;
public class Dialogue : MonoBehaviour {
public bool Talk;
public bool TextOpt;
public bool LargeOpt;
public int MaxOpt;
public int SelectedOpt;
public int Box;
public int TalkingTarget;
public string Text;
public bool Restart;
void Awake()
{
if (Restart)
{ //If restarting
Box = 0; //put the box to 0
}
DialogBox.Visible = True; //Shows the box (YOU WILL PROBABLY HAVE TO CHANGE)
if (Talk == False)
{ //If not continuing a dialog
Talk = True; //Then start one
Box = 0; //from the beginning
CurrentDialog = Dialog; //and record what dialog is being started
}
If (!Restart)
Box += 1; //Progress a box
if (TextOpt == False)
{ //If it's not a choice,
OptionBox.Visible = False; //Don't show the options.
}
DialogBox.Text = Text; //Display the text!
if (!Talk)
{ //If no longer talking,
txtDialog.Visible = False; //close the box
}
if (!TextOpt)
{ //If there isn't a choice,
txtOption.Visible = False; //Don't show the options
}
}
}
Answer by ClearRoseOfWar · Jul 14, 2016 at 05:24 AM
you have a semicolon after awake....
void Awake; {