Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: shamz on Thu 11/02/2016 14:24:27

Title: "Parameter type does not match prototype" Error when using pointers [SOLVED]
Post by: shamz on Thu 11/02/2016 14:24:27
I wrote a custom function intended to add an Inventory item to the player while also notifying that the item has been added.

Code (ags) Select

function Notify(InventoryItem*item){ //not the best function name but I'll change that later
  AddedInv.Text = item.Name;
  player.AddInventory(item);
  gNotification.Transparency = 100;
  gNotification.Visible = true;
  while (gNotification.Transparency >= 10){
    gNotification.Transparency -= 10;
    Wait(1);
  }
  gNotification.Transparency = 0;
  WaitMouseKey(1000);
  while (gNotification.Transparency <= 90){
    gNotification.Transparency += 10;
    Wait(1);
  }
  gNotification.Visible = false;
}


In the header of GlobalScript I imported the function like this:

Code (ags) Select

import function Notify(InventoryItem);


However, when I run the game I get this error:
Parameter type does not match prototype

Now I am new to using pointers and I don't have a lot of experience writing my own functions. I'm guessing I imported the function wrong or I used pointers incorrectly.
Title: Re: "Parameter type does not match prototype" Error when using pointers
Post by: Khris on Thu 11/02/2016 14:26:40
Use this:
import function Notify(InventoryItem*item);
Title: Re: "Parameter type does not match prototype" Error when using pointers
Post by: shamz on Thu 11/02/2016 14:30:45
That did the trick. Thanks, Khris!