Object string display function

Started by Slasher, Sun 13/12/2015 08:53:12

Previous topic - Next topic

Slasher

Hi

how can I change this to display what ever object the mouse clicks on within one function:

Code: ags

function  object_click()
{
  
 c009.Phylactere(String.Format("That %s does not seem to harbor anything about the plans by Skull.",object[19].Name)); // any object not just object 19?
}


I could do them individually and just change the object number but looking for a more simpler way ;)

cheers



Snarky

You'll need something like:

Code: ags

function  object_click()
{
  Object* clickedObject = Object.GetAtScreenXY(mouse.x, mouse.y);
  if(object != null)
    c009.Phylactere(String.Format("That %s does not seem to harbor anything about the plans by Skull.",clickedObject.Name));
  else // shouldn't happen!
  {
    // ...
  }
}

Slasher

Cheers Snarky,

i should have known had to reference object first :-[

SMF spam blocked by CleanTalk