Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Cardician on Mon 14/02/2005 03:24:49

Title: Script error with beta 17 (SOLVED)
Post by: Cardician on Mon 14/02/2005 03:24:49
Hello all,

I decided to switch over to the latest beta, since the scripting functionality is changing. I thought it would be better to learn it sooner rather than later. Anyway, I'm getting the following error with this line of code

inventory[player.ActiveInventory].GetName(buffer);

Error: cannot convert 'IventoryItem*' to 'int'

Now I understand what the error is saying, but what really baffles me is I copied this line of code directly out fo the manual. So my question is two fold.

1) What exactly should I put to make this line of code work? I'm trying to use GetName with the new script functionality.Ã,  ???

and

2) Is there a problem with the manual? This is exactly how it tells me to use this line of code under the GetName(inventory) explanation and yet it doesn't work.

Thanks for any and all help. Also I tried searching for this before posting but couldn't seem to find anything. There are so many different terms I could search on it just seemed rather futile.Ã,  Ã, :-\
Title: Re: Script error with beta 17
Post by: Ashen on Mon 14/02/2005 08:53:40
1.
Try replacing it with:

player.ActiveInventory.GetName (buffer);

I think the problem is that inventory[player.ActiveInventory]. returns the item number, whileGetName requires a Script-O-Name (e.g iKey.GetName). That's kind of how it looks from the other InventoryItem functions, anyway.

2.
Yes, it looks that way.

On an unrelated note:
Evil Valentine's day start-up screen! Evil!
Title: Re: Script error with beta 17
Post by: Scorpiorus on Mon 14/02/2005 09:25:34
Yeah, formerly, the ActiveInventory property was an int and then was changed to InventoryItem*, but the example in the manual doesn't reflect the new behaviour.
Title: Re: Script error with beta 17
Post by: Pumaman on Mon 14/02/2005 19:11:42
Well spotted, I'd better fix the manual.
Title: Re: Script error with beta 17
Post by: Cardician on Mon 14/02/2005 20:11:12
 ;D Thank you very much all. I have not yet had a chance to test the suggestion as I'm at work, but I'm pretty postive its exactly what I was looking for.

I should have figured this out myself but it was late when I posted and I was tired and brain dead. It didn't even occur to me in my stupor that as this is a beta release the manual might not be 100% accurateÃ,  ;)Ã, 

Thanks again to all for the help. And hopefully I too provided some help in regards to the manualÃ,  :)Ã,  I love the changes from 2.62 in the scripting functionality. Keep up the phenomenal work!

PS - Sorry for posting in the wrong forum. It seemed like a pretty newbie question to me and I didn't want to upset anyone so I originally put it in the Beginner forum. Hopefully my next post I'll get in the right place.  :-\
Title: Re: Script error with beta 17
Post by: RickJ on Mon 14/02/2005 21:57:14
Quote
PS - Sorry for posting in the wrong forum. It seemed like a pretty newbie question to me and I didn't want to upset anyone so I originally put it in the Beginner forum. Hopefully my next post I'll get in the right place.
IMHO, the moderators probably bumped your question to the tech forum so that it would get the attention it deserved.    I don't think anyone is upset because your question started out in the beginner forum.    Probably it's best to start there when in doubt. 

Anyway welcome to AGS, I look forward to future colaborations with you.

Cheers
Rick