Trying to show icon over hotspot

Started by Candle, Sun 12/12/2004 03:53:54

Previous topic - Next topic

Candle

Getting this error .
---------------------------
Compile Error
---------------------------
There was an error compiling your script. The problem was in 'Global script':
Error (line 19): Parse error: unexpected 'GetLocationName'

Code
Code: ags

******************** HOW TO MAKE CURSORS CHANGE OVER HOTSPOTS/OBJECTSA/CHARACTERS *******************************
Using the GetLocationType function you don't have to write a code for every hotspot in the game and you get
the cursor change also above objects and characters ( tou can modify it to change only on hotspots or objects,
change it to TALK when above characters etc)
Let's say your cursors are:
0 WALK
1 LOOK
2 USE
3 TALK
4 TAKE // NOT USED
5 CHANGED WALK
6 CHANGED LOOK
7 CHANGED USE
8 CHANGED TALK
9 WAIT
Just put the following code in the GLOBAL SCRIPT'S REPEATEDLY EXECUTE function
GetLocationName(mouse.x,mouse.y,name); // Get the name of what's under the cursor
if (StrComp(name,"")==0) SetDefaultCursor(); // if blank ( or hotspot with no name
//'used for CHAR STANDS ON HOTSPOT') do nothing
else {
if (GetCursorMode()==0) { //if cursor is WALK
if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(5); // change cursor to CHANGED WALK
else SetDefaultCursor(); } // change back to WALK
if (GetCursorMode()==1) { // if cursor is LOOK
if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(6); // change cursor to CHANGED LOOK
else SetDefaultCursor(); } // change back to LOOK
if (GetCursorMode()==2) { // if cursor is USE
if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(7); // change to CHANGED USE
else SetDefaultCursor(); } // change back to USE
if (GetCursorMode()==3) { // if cursor is TALK
if (GetLocationType(mouse.x,mouse.y)>0) SetMouseCursor(8); // Change to CHANGED TALK
else SetDefaultCursor(); } // change back to TALK
}

What would do that ?


RickJ

I would say that the following lines need to be "comment out"  using the "//" chars because they are not reconizeabe to the compiler.  You probably also need to define the variable "name" as follows;

string name;

Quote
//******************** HOW TO MAKE CURSORS CHANGE OVER HOTSPOTS/OBJECTSA/CHARACTERS *******************************
// Using the GetLocationType function you don't have to write a code for every hotspot in the game and you get
// the cursor change also above objects and characters ( tou can modify it to change only on hotspots or objects,
// change it to TALK when above characters etc)
// Let's say your cursors are:
// 0 WALK
// 1 LOOK
// 2 USE
// 3 TALK
// 4 TAKE // NOT USED
// 5 CHANGED WALK
// 6 CHANGED LOOK
// 7 CHANGED USE
// 8 CHANGED TALK
// 9 WAIT
// Just put the following code in the GLOBAL SCRIPT'S REPEATEDLY EXECUTE function

Hope this works for you.  Cheers.

Candle

Oh I didn't have all of that in the script .. I just pout it all here so someone could see what I was using . I will try the  string name; .
So I just add string name; to the top of the script ?

Radiant


SMF spam blocked by CleanTalk