Argh, I don't know how many times I've been trying to get my LEC-GUI to work, but there's still some things don't work as they should, even though I copied and pasted the script from the Demo. Eek, I feel really bad at this now...
First of all, the cykling interactions are still there from the Sierra-GUI, and also, the "Give"-verb doesn't work at all.
I thought that it perhaps would be simplest to just post the script for the GUI here, and see if anyone knows what I've been doing wrong:
// main global script file
function game_start() {
game.items_per_line=4;
game.num_inv_displayed=8;
// called when the game starts, before the first room is loaded
}
function repeatedly_execute() {
string buffer;
string madetext;
int cur_mode;
// Initialize the status line to display the score
StrCopy (madetext, "");
// Now, add text depending on the mode
cur_mode = GetCursorMode();
if (cur_mode == MODE_WALK)
StrCat(madetext,"Walk to ");
else if (cur_mode == MODE_LOOK)
StrCat (madetext,"Look at ");
else if (cur_mode == MODE_USE)
StrCat(madetext,"Interact with ");
else if (cur_mode == MODE_TALK)
StrCat(madetext,"Talk to ");
else if (cur_mode == 5)
StrCat(madetext,"Pick up ");
else if (cur_mode == 4) {
StrCat(madetext,"Use ");
GetInvName (player.activeinv, buffer);
StrCat(madetext,buffer);
StrCat(madetext," with ");
}
else if (cur_mode == 8 ) {
if (GetGlobalInt(80) == 1) StrCat(madetext,"Close ");
if (GetGlobalInt(80) == 2) StrCat(madetext,"Give ");
if (GetGlobalInt(80) == 3) StrCat(madetext,"Open ");
if (GetGlobalInt(80) == 4) StrCat(madetext,"Push ");
if (GetGlobalInt(80) == 5) StrCat(madetext,"Pull ");
}
// Find out what's under the cursor, and add it to the status line
GetLocationName(mouse.x,mouse.y,buffer);
StrCat(madetext,buffer);
SetLabelText ( 2, 12, madetext);
}
function on_key_press(int keycode) {
// called when a key is pressed. keycode holds the key's ASCII code
if (IsGamePaused() == 1) keycode=0; // game paused, so don't react to keypresses
if (keycode==17) QuitGame(1); // Ctrl-Q
if (keycode==363) SaveGameDialog(); // F5
if (keycode==365) RestoreGameDialog(); // F7
if (keycode==367) RestartGame(); // F9
if (keycode==434) SaveScreenShot("scrnshot.bmp"); // F12
if (keycode==9) InventoryScreen(); // Tab, show inventory
if (keycode==19) Debug(0,0); // Ctrl-S, give all inventory
if (keycode==22) Debug(1,0); // Ctrl-V, version
if (keycode==1) Debug(2,0); // Ctrl-A, show walkable areas
if (keycode==24) Debug(3,0); // Ctrl-X, teleport to room
}
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1) {
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}
}
function interface_click(int interface, int button) {
// this GUI system uses GlobalInt 80 to store which of the extended
// modes is in use (close, give, push, pull, etc)
if (interface == 2) {
if (button == 0) { // close
SetCursorMode(8);
SetGlobalInt(80,1);
}
if (button == 1) { // give
SetCursorMode(8);
SetGlobalInt(80,2);
}
if (button == 2) { // open
SetCursorMode(8);
SetGlobalInt(80,3);
}
if (button == 7) { // push
SetCursorMode(8);
SetGlobalInt(80,4);
}
if (button == 8 ) { // pull
SetCursorMode(8);
SetGlobalInt(80,5);
}
if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))
game.top_inv_item = game.top_inv_item + 4;
if ((button == 9) & (game.top_inv_item > 0))
game.top_inv_item = game.top_inv_item - 4;
}
I'm sure the solution is very, very simple, but help would be appreciated anyway...
I suspect it's something with the "on_mouse_click", right?
*Rince feels like an amateur*
This is what my old 'on mouse click' looked like before I went over to Proskrito's LEC GUI which rocks. I've known that the one that comes with AGS doesn't really do all that you'll want and that the Give blah doesn't always work like you want it to.
------------------------
function on_mouse_click(int button)
{
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsGamePaused() == 1)
{
// Game is paused, so do nothing (ie. don't allow mouse click)
}
else if (button==LEFT)
{
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
SetCursorMode(MODE_WALK);
}
else if (button==RIGHT)
{
if (GetLocationType(mouse.x, mouse.y)==2)
{
SetGlobalInt(80,9);
ProcessClick(mouse.x, mouse.y, MODE_TALK);
SetGlobalInt(80,0);
}
else
{
FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y );
ProcessClick(mouse.x, mouse.y, MODE_LOOK);
SetCursorMode(MODE_WALK);
}
}
}
------------------
Hey, thanks Scummy - I'll try it out.
Well, I tried it, and that solves the problem with the cykling interactions very nicely, but now I can't use the other verbs on the GUI - It won't react to any click.
Did you ticked the boxes to make the buttons clickable?
Oh yeah, it's not that - It's something to do with the script. I'll try and see if I can find out what's wrong.
hey, in the interface click function you forgot the look at, talk to and pick up.
Also, for the "GIVE" thing, i would use the same cursor mode as "use", and then a global int to check which mode you used, like the open, close... modes.