Item interaction error in verbcoin template.

Started by Thiscold, Thu 10/06/2010 12:36:04

Previous topic - Next topic

Thiscold

Hello, I've been using verbcoin template on my ags project. I have basic experience of using ags but I'm quite unfamiliar with the template.

My problem is that when I interact with an object on screen (for example an axe in my game) the ags throws me an error.
"Error running function 'repeatedly_execute':
Error: Null pointer referenced"

And ags has already spotlighted a part of template script:
  //===================================================================
// PROCESS VERBCOIN BUTTON CLICKS - INVENTORY
//-------------------------------------------------------------------
// 
// Note: for each action the inventory item that is below the verbcoin should be used
// since the x- and y-coördinates are no longer valid, we use the saved mousex and mousey coördinates
// We can only avoid nullpointer errors by doing this check for each button.

         else{
            if (guixy == gui[verbc_id]) {
          if (control == look_button){
            gui[verbc_id].Visible = false;
                  Wait(1); 
                  item2 = InventoryItem.GetAtScreenXY(mousex, mousey);
                  item2.RunInteraction(eModeLookat); //look at item
               }
               if (control == talk_button){
                  gui[verbc_id].Visible = false;
                  Wait(1); 
                  item2 = InventoryItem.GetAtScreenXY(mousex, mousey);
                  item2.RunInteraction(eModeTalkto); //talk to item
               }
               if (control == interact_button){
                  gui[verbc_id].Visible = false;
                  Wait(1);
                  item2 = InventoryItem.GetAtScreenXY(mousex, mousey);
                  item2.RunInteraction(eModeInteract); //interact with item
       


"item2.RunInteraction(eModeInteract); //interact with item" Was on yellow highlight.
Has anyone else ran into this problem? Help appreciated.

Additional info, there error doesnt always appear, aproximately every other time. Also my project is on 800x600 resolution.

EDIT: To addition I noticed this whole problem is relevant to the fact whether the inventory is open when you interact with the object in game world ( I've changed the basic inventory type that fills the whole screen to an bar that is on the up of the screen.)

I'm open for suggestions how to fix this problem, allowing to interact with the objects in the world while inv window open without receiving this particular error message.

Electroshokker

If I recall correctly (it's been a while), the template is designed by the principle that you don't interact with the environment when your inventory is open.

To fix this you'd have to change the verbcoin module code.

(basically instead of checking whether or not the inventory is visible, check whether or not your mouse is over the inventory)

Thiscold

Ah yes! I think that does the trick.
Thank you for your help, and for a great template.

SMF spam blocked by CleanTalk