My game is ALREADY running into problems.

Started by DBoyWheeler, Thu 01/01/2015 16:57:05

Previous topic - Next topic

DBoyWheeler

Man, I've gotten all my characters and rooms and stuff ready (plan to get more music and sound FX once the programming is done).

But everything that hadn't gone wrong before is now going wrong.  Every time I try to test run stuff, I see errors popping up.  Some of them I fixed easily, but others I'm not sure how to fix.

As for specifics on what those problems, I'm not sure how to state them.  Um, if it is all right, should I post the file in progress so others can see it and try to find out what might be going wrong?

Cassiebsg

Well... if you really expect any help, then posting the "faulty" code and error msg would be a pretty good idea... (nod) I Doubt any of us in here are clairvoyants... (laugh)
There are those who believe that life here began out there...

DBoyWheeler

Yeah, I shoulda done that in the first place.  :tongue:

Hold up... *gets up the game program...*

Code: ags

// main global script file

bool LydiaGameStart;

//Global variable needed for the "Death Messages", especially if a player decided to leave the Restore Game GUI
//and wanted to Restart or Quit instead.
bool IsLydiaAlive;


// called when the game starts, before the first room is loaded
function game_start() 
{
  IsLydiaAlive = true;
}

// put anything you want to happen every game cycle in here
function repeatedly_execute() 
{
}

// put here anything you want to happen every game cycle, even when the game is blocked
function repeatedly_execute_always() 
{
}

// called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode) 
{
  if (IsGamePaused()) keycode = 0; // game paused, so don't react to keypresses
  
  if (keycode == eKeyCtrlQ) QuitGame(1); // Ctrl-Q
  if (keycode == eKeyF9) RestartGame(); // F9
  if (keycode == eKeyF12) SaveScreenShot("scrnshot.pcx");  // F12
  if (keycode == eKeyCtrlS) Debug(0,0); // Ctrl-S, give all inventory
  if (keycode == eKeyCtrlV) Debug(1,0); // Ctrl-V, version
  if (keycode == eKeyCtrlA) Debug(2,0); // Ctrl-A, show walkable areas
  if (keycode == eKeyCtrlX) Debug(3,0); // Ctrl-X, teleport to room
}

function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
  {
  }
  else if (button == eMouseLeft) 
  {
    ProcessClick(mouse.x,mouse.y, mouse.Mode);
  }
  else // right-click, so cycle cursor
  {   
    mouse.SelectNextMode();
  }
}


function btnInvUp_OnClick(GUIControl *control, MouseButton button)
{
  invLydiaInv.ScrollUp();
}

function btnInvDown_OnClick(GUIControl *control, MouseButton button)
{
 invLydiaInv.ScrollDown();
}

function btnInvSelect_OnClick(GUIControl *control, MouseButton button)
{
  mouse.Mode = eModeInteract;
}

function bSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.Mode = eModeInteract;
  gSaveGame.Visible = true;
}

function bRestoreGame_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.Mode = eModeInteract;
  gRestoreGame.Visible = true;
}


function bRestartGame_OnClick(GUIControl *control, MouseButton button)
{
  gRestartGUI.Visible=true;
  gIconbar.Visible=false;
  mouse.Mode = eModeInteract;
}

function bQuitGame_OnClick(GUIControl *control, MouseButton button)
{
  gQuitGUI.Visible=true;
  gIconbar.Visible=false;
  mouse.Mode = eModeInteract;
}


function bAboutGame_OnClick(GUIControl *control, MouseButton button)
{
  Display("Lydia and the Mystery of Nellreno Manor[[by Danny 'D-Boy' Wheeler");
  //More credits and info will be added later on.
}

function bResumeGame_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = false;
  mouse.UseDefaultGraphic();
}

function sSoundVolume_OnChange(GUIControl *control)
{
  System.Volume = sSoundVolume.Value;
}


function sSpeedSlider_OnChange(GUIControl *control)
{
  SetGameSpeed(sSpeedSlider.Value);
}

function bInventory_OnClick(GUIControl *control, MouseButton button)
{
  gInventory.Visible = true;
  gIconbar.Visible = false;
  mouse.Mode = eModeInteract;
}

function bSystem_OnClick(GUIControl *control, MouseButton button)
{
  gPanel.Visible = true;
  gIconbar.Visible = false;
  mouse.Mode = eModeInteract;
}

function txtNewSaveGame_OnActivate(GUIControl *control)
{
  bSaveGame_OnClick(control, eMouseLeft);
}

function lstSavedGamesList_OnSelectionChanged(GUIControl *control)
{
  txtNewSaveName.Text = lstSaveGamesList.Items[lstSavedGamesList.SelectedIndex];
}

function bNewSaveGame_OnClick(GUIControl *control, MouseButton button)
{
  int gameSlotToSaveInto = lstSavedGamesList.ItemCount + 1;
  int i = 0;
  while (i < lstSaveGamesList.ItemCount)
  {
    if (lstSavedGamesList.Items[i] == txtNewSaveName.Text)
    {
      gameSlotToSaveInto = lstSavedGamesList.SaveGameSlots[i];
    }
    i++;
  }
  SaveGameSlot(gameSlotToSaveInto, txtNewSaveName.Text);
  gSaveGame.Visible = false;
  gIconbar.Visible = true;
}

function bDeleteSaveGame_OnClick(GUIControl *control, MouseButton button)
{
   if (lstSavedGamesList.SelectedIndex >= 0)
  {
    DeleteSaveSlot(lstSavedGamesList.SaveGameSlots[lstSavedGamesList.SelectedIndex]);
    lstSavedGamesList.FillSaveGameList();
  }
}

function bCancelSave_OnClick(GUIControl *control, MouseButton button)
{
  gSaveGame.Visible = false;
  gIconbar.Visible = true;
  if (!gPanel.Visible) mouse.UseDefaultGraphic(); 
}



function bRestoreSavedGame_OnClick(GUIControl *control, MouseButton button)
{
  if (lstRestoreGamesList.SelectedIndex >= 0)
  {
    RestoreGameSlot(lstRestoreGamesList.SaveGameSlots[lstRestoreGamesList.SelectedIndex]);
  }
  gRestoreGame.Visible = false;
  if IsLydiaAlive = false;
  {IsLydiaAlive = true;
  gDeathMessageGu.Visible = false;
  gIconbar.Visible = true;}
}

function bCancelRestore_OnClick(GUIControl *control, MouseButton button)
{
  gRestoreGame.Visible = false;
  if IsLydiaAlive = false {gDeathMessageGu.Visible = true;}
  else if (cLydia.Room == 1) {gTitleScreenGUI.Visible = true;}
  else {
    gIconbar.Visible = true;
    if (!gPanel.Visible) mouse.UseDefaultGraphic();}
}

function bYesRestart_OnClick(GUIControl *control, MouseButton button)
{
  RestartGame();
}

function bNoRestart_OnClick(GUIControl *control, MouseButton button)
{
  gRestartGUI.Visible = false;
  gIconbar.Visible = true;
  if (!gPanel.Visible) mouse.UseDefaultGraphic();
}

function bYesQuit_OnClick(GUIControl *control, MouseButton button)
{
  QuitGame();
}


function bNoQuit_OnClick(GUIControl *control, MouseButton button)
{
  gQuitGUI.Visible = false;
  gIconbar.Visible = true;
  if (!gPanel.Visible) mouse.UseDefaultGraphic();
}

function bDeathRestore_OnClick(GUIControl *control, MouseButton button)
{
  gRestartGUI.Visible=true;
  gDeathMessageGu.Visible=false;
  mouse.Mode = eModeInteract;
}


function bDeathRestart_OnClick(GUIControl *control, MouseButton button)
{
  RestartGame();
}


function bDeathQuit_OnClick(GUIControl *control, MouseButton button)
{
  QuitGame();
}

function bTitleNewGame_OnClick(GUIControl *control, MouseButton button)
{
LydiaGameStart = true;
cLydia.ChangeRoom(301);
}

function bTitleLoadGame_OnClick(GUIControl *control, MouseButton button)
{
  gTitleScreenGUI.Visible = false;
  gRestoreGame.Visible = true;
}


function bTitleQuit_OnClick(GUIControl *control, MouseButton button)
{
  QuitGame();
}
function iPocketknife_Look()
{
  Display("Lydia is carrying her pocketknife. [She recently had it sharpened and cleaned, and ready for duty.");
}

function iRope_Look()
{
  Display("Lydia is carrying some rope. [It looks well woven, and ready for good use.");
}

function iFlashlight_Look()
{
  Display("Lydia is carrying a flashlight. [The battery had recently been replaced, so it's ready to light dark areas really well.");
}

function iHotSauce_Look()
{
  Display("Lydia has a bottle of hot sauce. [The label alone shows what its contents might be like.");
}


function iHatchet_Look()
{
  Display("Lydia is holding a hatchet. [Despite being in a stump for a long time, it looks to be in good shape.");
}

function iMansionKey_Look()
{
  Display("Lydia is holding a golden key. [It seems to be the size to fit in a front door of a fancy house.");
}

function iGateKey_Look()
{
  Display("Lydia is holding a silver key. [It looks large enough to open some sturdy gates to a mansion or villa.");
}


function iCryptKey_Look()
{
  Display("Lydia is holding a creepy-looking metal key with a skull on it. [Perhaps it opens a crypt or tomb of sorts.");
}


function iRecipeCard_Look()
{
  Display("Lydia has a card containing a marble cake recipe.");
}


function iCupcake_Look()
{
  Display("Lydia has some cupcakes she made using the Marble Cake recipe.");
}

function iTreatedCupcake_Look()
{
  Display("Lydia has some Marble Cupcakes that are laced with the Knockout Drops. [Could be useful against a dangerous enemy.");
}


function iWhiskey_Look()
{
  Display("Lydia is holding a flask of whiskey. [Someone must like this particular drink.");
}


function iFormula_Look()
{
  Display("Lydia is holding a card with a formula for [a strong dissolving agent. [This might be useful.");
}


function iMakeup_Look()
{
  Display("Lydia is holding a makeup compact. [There's still some makeup powder in it.");
}


function iPlumbClean_Look()
{
  Display("Lydia is carrying a tub of pluming cleaner.");
}


function iMarbles_Look()
{
  Display("Lydia is carrying a bag of marbles.");
}


function iChemSet_Look()
{
  Display("Lydia is VERY carefully carrying a chemistry set. [Despite the chemicals not being used for a long time, [the chemicals still look like they can be used.");
}


function iEmptyVial_Look()
{
  Display("Lydia is holding an empty vial. [But it's still intact, so perhaps it can be used.");
}


function iReadyVial_Look()
{
  Display("Lydia has an empty vial that has the dissolving agent formula near it. [It's ready to be used for the concoction.");
}


function iDissolveAgent_Look()
{
  Display("Lydia is holding a vial of dissolving agent. [Now to use it on something that needs to be removed quickly.");
}


function iKnockoutDrops_Look()
{
  Display("Lydia is holding some knockout drops. [Seems someone has trouble going to sleep at night.");
}

function dialog_request(int param) {
}
function btnInvOk_OnClick(GUIControl *control, MouseButton button)
{
	// They pressed the OK button, close the GUI
	gInventory.Visible = false;
	mouse.UseDefaultGraphic();
}
}


Yeah, I wanted to take care of all the global stuff before getting into the "nitty gritty" of each situation.  I took care of some of the Inventory and System Panel (I think)... but what could be causing error messages to pop up?

Crimson Wizard

DBoyWheeler, please, tell, what exactly are these error messages!

If that are script errors, AGS usually tells which script file and line they occur at, which greatly helps to narrow search down.

DBoyWheeler

Well, the previous error was with the save game name, but I took care of that.

Code: ags

function lstSavedGamesList_OnSelectionChanged(GUIControl *control)
{
  txtNewSaveGame.Text = lstSaveGamesList.Items[lstSavedGamesList.SelectedIndex];
}


Now the hassle is Error (Line 145): undefined symbol 'lstSaveGamesList'.  And I could've sworn I gave the listbox the name "lstSaveGamesList".

Slasher

#5
Try moving that part further down the script....

undefined symbol
This happens like when you try to run a variable (say bool) in a line before declaring it.

DBoyWheeler

#6
Or maybe it's because I didn't notice the typos earlier... :tongue:

[Update] Now it's just a matter of getting the names of the views to fit the 14 character limit.

Slasher


DBoyWheeler

#8
Yeah, thanks, Slasher.

Anyway, I managed to get through the dang errors... now I can start testing and really start building the program bit by bit...

[Update] Didn't take long for trouble to show up again.

The display text hadn't given me trouble before, but now this is showing up.

The error I'm getting is "Nested functions not supported (you may have forgotten a closing brace)."

The code referred to is this:
Code: ags

function oPocketknife_Look()
{
  LydDisplay("It's Lydia's Pocketknife.  She always places it on her table at the end of the day.");
  LydDisplay("She has a feeling she might need it.");
 }


LydDisplay being the new void I prepared for special display texts in the game--I thank Khris for showing me and others how to do a special Text Display--just need to find a way to set it so to make it vary in size properly, and not have a time limit, but rather wait for click of the mouse.

Again, in the past tests it didn't give me this hassle, but now it's causing me a hassle.

[Update part 2] Yeah, figures it had to had been a missing brace in the function above it.  Like slasher said, I'm such an a**head.  *facepalm*

SMF spam blocked by CleanTalk