Script error with beta 17 (SOLVED)

Started by Cardician, Mon 14/02/2005 03:24:49

Previous topic - Next topic

Cardician

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

Code: ags
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.Ã,  Ã, :-\

Ashen

1.
Try replacing it with:
Code: ags

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!
I know what you're thinking ... Don't think that.

Scorpiorus

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.

Pumaman

Well spotted, I'd better fix the manual.

Cardician

 ;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.  :-\

RickJ

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

SMF spam blocked by CleanTalk