Scripting Error w/Inventory [SOLVED]

Started by Anarcho, Thu 09/12/2004 00:42:54

Previous topic - Next topic

Anarcho

Hi, I just imported my first inventory sprite into my game, pasted it over the key image in the inventory items, and check the box that says "start with inventory item".Ã,  When i open up the inventory in the game, the image is there and looks fine, but when i click on the image and press "ok" in the GUI i get this error message:

(Global Script Line 27)
Error: SetLabelText: specified control is not a label

My Global Script Line 27 is this:
SetLabelText(0,0,useinvtxt);Ã,  }

What am I doing wrong?



Gilbert

Are you sure object 0 of gui 0 is a label?

Anarcho

No, it isn't, but I'm a little lost here.  Here's the whole troublesome bit of code:

if (GetCursorMode()==0) SetLabelText(2,0,"Walk to @OVERHOTSPOT@");
if (GetCursorMode()==1) SetLabelText(2,0,"Look at @OVERHOTSPOT@");
if (GetCursorMode()==2) SetLabelText(2,0,"Interact with @OVERHOTSPOT@"); 
if (GetCursorMode()==3) SetLabelText(2,0,"Talk to @OVERHOTSPOT@");
if (GetCursorMode()==4) {   
   string usinginv;   
   string useinvtxt;   
   StrCopy (useinvtxt, "Use ");   
   GetInvName(character[GetPlayerCharacter()].activeinv,usinginv);   
   StrCat (useinvtxt,usinginv);   
   StrCat (useinvtxt," with ");   
   StrCat (useinvtxt,"@OVERHOTSPOT@");   
   SetLabelText(0,0,useinvtxt);  }


It's something I copied from someone else so I get that nice status line at the bottom of the screen.   My inventory GUI is GUI 1, so I imagine I should change that first 0 in the final line to 1, but what object number do I use?  I don't have a label in the inventory box, so do I create one?

I want the status line to display the name of the inventory item after I click it.   You know, so it says, "Use stick on sofa" and so on.



Gilbert

Quote from: Anarcho on Fri 10/12/2004 00:45:12
No, it isn't, but I'm a little lost here.Ã,  Here's the whole troublesome bit of code:
So that's the reason why it crashed.

From what I read of what you're going to do, that line in question should be:
SetLabelText(2,0,useinvtxt);Ã,  }


Anarcho

Ha!  That did it.  Why was it 2?


Gilbert

Because that status line GUI on the bottom of the screen is #2, from what I read from the codes you pasted.

Anarcho

Aaah.  Duh.  Sorry, I'm inept at times.

Thanks!

-Logan


TerranRich

It's okay, inepititude is very common among AGSers, especially the elders. ;)
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk