Error in a part i havent touched: Undefined token 'InventoryScreen'

Started by dissembly, Tue 23/06/2009 08:04:35

Previous topic - Next topic

dissembly

Hey all,

I understand that the "Undefined token" error is fixed by adding, for example,

"int InventoryScreen"

...somewhere earlier than the line causing the error.

I don't want to do this without advice, because i haven't actually done anything to the game yet except create a room, some sprites, and a main character. I havent touched the script, and certainly havent done anything with the inventory screen.

When i delete the line causing the problem; line 27:

if keycode==(9) InventoryScreen(); //Tab, show inventory

...by putting as "//" in front of it, the game will compile and run, but there will be no cursor, and no menu options running across the top of the screen (as there have been with other games i've experimented in making in the past using AGS).

So i am not sure if adding the "int" line will fix the problem, or if it'll just create more problems, because it seems like the menu and the cursors, which seemed to come as the default with my earlier AGS experiments, are missing from this game, and the "Undefined token" error is more of a symptom than a problem...

Does anyone know what the problem might be?

Akatosh

Well, AFAIK, that error is caused by referring to something (variable, GUI, etc) the game doesn't "know" about, so... did you maybe select the "Empty Game" template instead of the "Default" one (or whatever it's called these days)? If so, that's naturally not going to work - there's no InventoryScreen to show (and no statusline to display, no cursor graphics etc.), you'll have to create one first.

dissembly

AH! I think you're right, i probably did click the "empty game" slot. I was afraid of that. Now i have to learn things i was hoping not to have to concentrate on untill later...

Akatosh

Don't worry, it's not that frightfully complicated, and if you have further questions... well, there's always the forums. Good luck!

GuyAwesome

The 'Empty Game' template is the most likely cause of the no GUIs problem - as Akatosh said, it comes with no GUIs created by default, so no Statusline or Iconbar to display at the top of the screen. If there're no GUIs in the editor, this is your problem.

However, that doesn't really explain what caused the 'undefined token' problem to begin with, as 'Empty Game' also comes with the bare minimum global script, which doesn't include the InventoryScreen() line. InventoryScreen() was a built-in function to display the hard-coded Inventory GUI - which no longer exists, meaning the function is obsolete and so 'undefined'. If you're using an earlier than 3.x version (not sure when InventoryScreen() was obsoleted), the function would be defined, but you'd have other errors... Could you have used some OTHER template you got from somewhere?

Still, if you've only done a few things in your game, it should be easy enough to import them into a new 'Default Game', that'll take less work to reach a playable state. Or just delete the offending line...

EDIT:
Actually, I might've just added to the confusion with this :- Sorry. If you've managed to resolve it to you satisfaction, please ignore this post, and go about your business... (Although the last sentence may still be good advice.)

EDIT2:
OK, the 'Empty Game' template in earlier versions (than 3.1.2, at least - only checked with 3.0.2) DO include InventoryScreen in on_key_press - perefectly understandable, as it wasn't obsolete then ;). So if you started your game in an earlier version and then updated, somehow used the template from an earlier version (e.g., copied them into the Templates folder of a beta version), or used a template made in one, that'd explain where it came from. Just realised this when I tried Baron's STUDIO MEDIOCRE TEMPLATE, and got the same error...


dissembly

I think that may be what happened. I downloaded and instaled the newest version around the same time as i started working on this game, and i may have opened the "Empty Game" up slightly beforehand...

SMF spam blocked by CleanTalk