Discworld Gui

Started by , Sun 26/10/2003 10:48:21

Previous topic - Next topic

Damaged

Hi, I'm new, and I need some help with my game.

I'm trying to do a Discworld type GUI for my engine, so that the item description hover over the cursor when you mouse over a hotspot or object.

I'd also like to do a Broken Sword interface, so that the Cursor Mode changes automatically depending on the hotspot or object it is over.

I'd normally be able to figure it out, but I am not farmiliar with all of AGS functions.

If you could help me figure this one out, please do! :)


Cheers.

Ghost

Hm, okay, since my pc is two miles away and I don't know the commands by heart, this is going to be a bit theoretical...
here goes.

To make the item name hover over the mouse cursor you could either use a gui with a changing label, and always (repeatetly execute) move it so that x becomes mouse.x and y becomes mouse.y-some small number.

You could also do that with RawText (RawPrint??? Check the help file),
but I never used that before so I can't tell you which way is better.

As with the broken sword style interface- you could assign properties to each object/hotspot and then write some code so that the cursoer goes into another cursor mode when it is over item x. Like USE for a lever but LOOK AT for a picture. Personally I don't think that this is a good idea, though, because a lot of fun in adventures is figuring out what to do with an item, and limiting the player to only one or very few actions, well, might spoil the things a bit.

Hope this helps!

Damaged

Thanks for the help, but where and how would I go about implimenting this?

MasterBetty

******************** 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
   }

If this doesn't work or you haave any questions mail Spyros at lordovol@hotmail.com

Damaged

I fugured it out!!!!


Heres what I did, anyone else can use this if they want.:
######################################################


function mouse_over_item() {

 string buffer;
 string madetext;
 int cur_mode;
 // Initialize the label to display nothing
 StrCopy (madetext,"");


 // Find out what's under the cursor, and add it to the status line
 GetLocationName(mouse.x,mouse.y,buffer);
 StrCat(madetext,buffer);
 }

function move_gui() {
   int x_offset = (mouse.x - 50); //makes the text in the right position
   int y_offset = (mouse.y - 20); //makes the text in the right position
     SetGUIPosition(3,x_offset,y_offset);
}



function repeatedly_execute() {
 // put anything you want to happen every game cycle here
 
   mouse_over_item();
   move_gui();
}


SMF spam blocked by CleanTalk