AGS saying term is wrong?

Started by Willdon, Tue 20/04/2010 21:14:22

Previous topic - Next topic

Willdon

Hey...Here is my script:

// room script file

function room_AfterFadeIn()
{
  cSammy.Say("Ugh! What a weird dream!");
}
function hHotspot1_Look()
{

}

function hTV_Look()
{
  //cSammy.Walk (88, 161, eBlock, eWalkableAreas);
  //cSammy.Say("Looks like an old T.V. Must be from like 2030 or so...");
  Display("Looks like an old TV here");
}

function hHotspot2_Look()
{
  cSammy.Walk (256, 169, eBlock, eWalkableAreas);
  cSammy.Say("the infamous Duke Nukem Forever was finally released after 43 years!");
}
function oObject0_Look()
{
  cSammy.Say("there is a cup sitting on the floor...");
}

function oObject0_Interact()
{
  cSammy.Walk(210, 158, eBlock, eWalkableAreas);
  cSammy.AddInventory(icup);
  icup.Visible = true;
}

and here is the resulting error

Failed to save room room1.crm; details below
room1.asc(33): Error (line 33): '.Visible' is not a public member of 'InventoryItem'. Are you sure you spelt it correctly (remember, capital letters are important)?

Matti

You can't turn on/off the visibility of an inventory item. An inventory item is always visible, as long as it's part of the inventory ;)

I guess in your example you want a cup to disappear after it's taken, right? But then you must have an object representing the cup and make that one disappear.

Oh, but one thing seems strange. You wrote "icup.Visible = true;" after adding it to the inventory. I guess you mean false.

Khris

For readability, it's best to rename a newly created hotspot/object/etc. before creating the events and thus the functions; e.g. instead of "oObject0_Look" it'd then read "oCup_Look" in the script. You can still do that manually though, just remember that you have to rename the function both in the script and the events pane.

In case of by that line what you wanted to do was make the cup appear inside the inventory window: this is done automatically as soon as it is added to the inventory of the character assigned to the inventory window.

Note that room objects and inventory items are two completely seperate things as far as the engine is concerned; the idea that both represent the same object in the game world is in the designer's mind only.

Willdon

*Facepalm*

LOL. Thanks guys. It blew right by me. I'm a newbie in case you could not tell. :P

SMF spam blocked by CleanTalk