[solved] oMyobject.Move(..); in a function

Started by jpcr, Sat 27/02/2010 22:38:56

Previous topic - Next topic

jpcr

hi,

i would like to run a script doing :

oMyobject.Move(320, 480, 1,  eBlock, eAnywhere);

when it is inside the room script , no problem.
but i would like to be able to apply this same move for all my objects so i tought i could use a function.

i dont know how to pass the object referene to the function.heres my code :

in globalscript.ash :
import function getrid (Object);

in globalscript.asc :
function getrid(Object myObject )
{
 
 myObject.Move(320, 480, 1,  eBlock, eAnywhere);

}



in the room :

getrid(oChaussette);

i get an error : Failed to save room room1.crm; details below
room1.asc(11): Error (line 11): Type mismatch: cannot convert 'Object*' to 'Object'


any help would be appreciated!!

thanks
jp




monkey0506

#1
In your function it should be a pointer, such as:

Code: ags
function getrid(Object *myObject)


It should have caught that you weren't making that a pointer to begin with..but that seems to be the reason why.

Read the manual entry on pointers..it should help clarify for you the differences.

jpcr

mm yes but i still have the same ompilation error.

function getrid(Object *myObject )
{
 
  myObject.Move(320, 480, 1,  eBlock, eAnywhere);

}

monkey0506

Sorry, the import should also be such as:

Code: ags
import function getrid(Object*);

jpcr

fantastic , it works great.

thanks so much  :D

jp

SMF spam blocked by CleanTalk