Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: johanvepa on Tue 27/09/2016 20:47:19

Title: SOLVED - What is wrong with this sentence? (cannot convert Character* to int)
Post by: johanvepa on Tue 27/09/2016 20:47:19
I am doing a check to see if things are overlapping. I have two character, one stationary called ctrashbin, and one moving, called cAffald1. Every game cycle, I wish to see if they overlap, then something happens.

Code (ags) Select
  if (AreThingsOverlapping(cTrashbin, cAffald1))

When trying to compile, I am told there is an error at the line: Cannot convert 'Character*' to 'int'.

Me no unnerstand?
Title: Re: What is wrong with this sentence? (cannot convert Character* to int)
Post by: Crimson Wizard on Tue 27/09/2016 21:06:55
Description of this function in the manual (http://www.adventuregamestudio.co.uk/wiki/Room_functions#AreThingsOverlapping):

Quote
AreThingsOverlapping(int thing1, int thing2)

THING1 and THING2 can either be a CHARID, or can be an object number PLUS 1000

Example:
if (AreThingsOverlapping(1002, EGO)) {
   // code here
}
Title: Re: What is wrong with this sentence? (cannot convert Character* to int)
Post by: johanvepa on Tue 27/09/2016 21:16:18
I read that.
In the example it shows us that it is suitable to write EGO.
What, then, is the CHARID of "cTrashbin" if not "cTrashbin"?

Title: Re: What is wrong with this sentence? (cannot convert Character* to int)
Post by: Crimson Wizard on Tue 27/09/2016 21:22:25
Quote from: Nanuaraq on Tue 27/09/2016 21:16:18
I read that.
In the example it shows us that it is suitable to write EGO.
What, then, is the CHARID of "cTrashbin" if not "cTrashbin"?
AGS automatically creates a numeric constant for every character you have, and gives them names like your character's object name, except without "c" and in capital letters. These are CHARIDs.

EGO - is a numeric constant equal to ID of cEgo character.

There should be automatically created constants like TRASHBIN, but alternatively you could use cTrashbin.ID.
Title: Re: What is wrong with this sentence? (cannot convert Character* to int)
Post by: johanvepa on Tue 27/09/2016 21:32:17
So I should write cTrashbin.ID? Because that is an integer, a numeric constant created by AGS. Allright, got that. It's damn hard to remember all these things, but it' still fun.
However, a nother problem just popped up. I try to determine if two characters are overlapping and I would expect that condition to be true when the graphics are actually touching each other, visually. These characters are just big circles, so its plain to see that they're 'overlapping' the moment the outer borders of their respective square 'boxes' touch, even though these parts of the characters are transparent. Do parts of characters that are transparent also set off 'AreThingsOverlapping'?



EDIT: I just read the manual. Of course they do. Sorry. And thank you for your help, wizard