Make item clickable again despite having an Interact Inventory Item event

Started by Ramorama, Thu 01/06/2023 22:22:36

Previous topic - Next topic

Ramorama

I've noticed after I added an Interact Inventory Item Event

Code: ags
function iVoiceRecorder_Interact()
{

}

my item became unclickable by clicking first on the verb "Use" and then on this item.
How to make this item clickable again with the verb "use", despite having an event for Interact Inventory Item?

I'm using the Thumbleweed template.

Khris

By "became unclickable", do you mean the game no longer reacts to the click immediately?

By default, clicking with the "Use" verb on an item makes the action line change to "Use item_name with" and you're now supposed to click a second item/hotspot.

Also, with the Tumbleweed template you're supposed to put the same function in all item events, then check for the verb inside the function. Best check the example code in the template. It's in the Global Script, starting at line 180.

Ramorama

Quote from: Khris on Fri 02/06/2023 01:41:34By default, clicking with the "Use" verb on an item makes the action line change to "Use item_name with" and you're now supposed to click a second item/hotspot.

Yeah, I mean it should be supposed to do this, but instead the action line "use item_name with" doesn't show up anymore and I can't click a second item/hotspot.

I'll check out this line in the template later.

Khris

So you added a single, empty function and now the action label simply disappears? No idea what's going on there, it should always show the verb at least.

Or do you have code in there?

Ramorama

I checked line 180 for the blue cup. This function is used for all events.


Quote from: Khris on Fri 02/06/2023 08:10:49So you added a single, empty function and now the action label simply disappears? No idea what's going on there, it should always show the verb at least.

Or do you have code in there?

Here's the event function for Interact Inventory Item

Code: ags
function iVoiceRecorder_Interact()
{
 if (!recorded_own_voice)
 {
  if (!voice_recorder_has_cassette)
  {  
   player.Say("It needs a cassette to play.");
              
   if (!voice_recorder_has_batteries)
   {
    player.Say("And it needs batteries.");
   }
  }
  else
  {
   if (!voice_recorder_has_batteries)
   {
    player.Say("It's out of batteries.");
   }
   else
   {
    if (!entered_camp_first_time)
    {
     player.Say("PLAY!");
    }
    else
    {
     player.Say("I will record my own voice!");
     recorded_own_voice = true;
     iVoiceRecorder.Name = "voice device";
    }
   }
  }
 }   
}

My idea is that after I recorded my own voice, the entire if-condition will be ignored by setting recorded_own_voice to true. After that, I want to use the verb "use" on this inventory item (voice recorder) to interact with other hotspots/objects/items, but nothing happens.

Ramorama

Found an solution for my problem. Thanks to @CaptainD for pointing it out.
Although I've read the documentation of the Thumbleweed template I hadn't found anything about "using-inventory-item" until now.

https://adventuregamestudio.github.io/ags-manual/Tumbleweed.html#using-inventory-items

SMF spam blocked by CleanTalk