error563: Variable 'initialize_control-panel' is already defined"??[SOLVED]

Started by Papyrus, Mon 09/06/2014 21:07:09

Previous topic - Next topic

Papyrus

Hi everyone! im newbie, i don`t have idea about scrpting, im triying to make my first game (i thought it would be easier :X). I was creating another char when suddenly appear this message and i can't understand why becouse, i think, i didn't touch this code.

"error 563: Variable 'initialize_control-panel' is already defined"

i did three things before this error: "Interact character", "Look at character" and rewrite one display message for one inventory item. I read all the GlobalScript but i didn't find out a 2initialize_control_panel" before. So i read all three steps i did before and all seems be ok.

here is the line 563 and all since { to }.

Code: ags

function initialize_control_panel(){
  // Centre the control panel
  gPanel.Centre(); 
  // Centre the Restart dialog as well
  gRestartYN.Centre();
  if (!IsSpeechVoxAvailable()) { 
    // If there is no speech-vox file, and therefore no speech,
    // disable all the controls related with speech.
    lblVoice.Visible = false;  
    btnVoice.Visible = false;  
    sldVoice.Visible = false;
  }
  else {
    // If there *is*, then set it to voice and text. It's best to use
    // both whenever possible, for the player's sake.
    Speech.VoiceMode = eSpeechVoiceAndText;
    // And reflect this in the control panel.
    btnVoice.Text = "Voice and Text"; 
  }
  if (!System.SupportsGammaControl) {
    // If we can't change the gamma settings, disable the relevant options.
    sldGamma.Visible = false; 
    lblGamma.Visible = false;
  } 
  
  //And now, set all the defaults
  System.Volume = 100;
  sldAudio.Value = System.Volume;
  SetGameSpeed(40);
  sldSpeed.Value = 40;
  if (IsSpeechVoxAvailable()) {
     Speech.VoiceMode = eSpeechVoiceAndText;
     btnVoice.Text = "Voice and Text";
     sldVoice.Value = 255;
     SetSpeechVolume(255);
  }
  if (System.SupportsGammaControl) {
    System.Gamma = 100;
    sldGamma.Value = 100;
  }
}




I can't find out what is happening. Further, my english is so bad...(laugh)
¿what could be wrong?
Thanks everyone will respond to me.

Papyrus

i have found it!...im so so stupid :-[. I don't know how but i copy all the GlobalScript twice, well this is my theory.
I will try to solve it, and i'll post.

thanks to me
i'm welcome
:-D

Papyrus

ok, i noticed that line 1 of global Script was the same that the line 561(approx) and i deleted all since 561 to the last i remember i had scripted (character interact). And now works fine ^^

Surely all this info is completly unusefull, but i`m so happy :)

Khris

Yeah, every function and variable name has to be unique. You will get this message as soon as you try to use a name twice. Pasting the entire global script into itself will have this effect ;-D

SMF spam blocked by CleanTalk