Hi! I'm testing a GUI like LucasArt but I have a problem. When I use any action, the cursor doesn't return to Walk Mode.
ex. My char used the action "Look At" on the window. And then said "WOW! Nice day!!" and my action still remains "Look At". :-\
How can I return to Walk Mode inmediatly after use any action?!
Can I make a general option of this function??
<?
// main global script file
String Accion;
// called when the game starts, before the first room is loaded
function gModo(GUIControl *control, MouseButton button) {
if(control == bCerrar){
mouse.Mode = eModeCerrar;
Accion = "Cerrar";
}
else if(control == bAbrir){
mouse.Mode = eModeAbrir;
Accion = "Abrir";
}
else if(control == bDar){
mouse.Mode = eModeUsar;
Accion = "Dar";
}
//else if(control == bCoger){mouse.Mode = eModeAgarrar;
// Accion = "Coger";}
//else if(control == bMirar){mouse.Mode = eModeMirar;
// Accion = "Mirar";}
//else if(control == bHablar){mouse.Mode = eModeHablar;
// Accion = "Hablar";}
else if(control == bUsar){
mouse.Mode = eModeUsar;
Accion = "Usar";
}
/*else if(control == bEmpujar){mouse.Mode = eModeEmpujar;
Accion = "Empujar";}
else if(control == bTirar){mouse.Mode = eModeTirar;
Accion = "Tirar";}*/
}
function ActualizarBarra(){
String Objetivo, InvActivo, Conector;
Objetivo = "";
InvActivo = "";
Conector = "";
if(player.ActiveInventory!=null){
InvActivo = player.ActiveInventory.Name;
if(Accion == "Usar") Conector = " con ";
else Conector = " a ";
}
if(InventoryItem.GetAtScreenXY(mouse.x, mouse.y) != null){
InventoryItem* item = InventoryItem.GetAtScreenXY(mouse.x, mouse.y);
if(item != player.ActiveInventory) Objetivo = item.Name;
}
if(GetLocationType(mouse.x, mouse.y)!=eLocationNothing)
Objetivo = Game.GetLocationName(mouse.x,mouse.y);
sBarra.Text = String.Format("%s %s%s%s",Accion,InvActivo,Conector,Objetivo);
}
function game_start()
{
mouse.Mode = eModeIra;
Accion = "Ir a";
}
// put anything you want to happen every game cycle in here
function repeatedly_execute()
{
ActualizarBarra();
}
// called when a key is pressed. keycode holds the key's ASCII code
function on_key_press(eKeyCode keycode)
{
if (IsGamePaused()) keycode = 0; // game paused, so don't react to keypresses
if (keycode == eKeyCtrlQ) QuitGame(1); // Ctrl-Q
if (keycode == eKeyF9) RestartGame(); // F9
if (keycode == eKeyF12) SaveScreenShot("scrnshot.pcx"); // F12
if (keycode == eKeyCtrlS) Debug(0,0); // Ctrl-S, give all inventory
if (keycode == eKeyCtrlV) Debug(1,0); // Ctrl-V, version
if (keycode == eKeyCtrlA) Debug(2,0); // Ctrl-A, show walkable areas
if (keycode == eKeyCtrlX) Debug(3,0); // Ctrl-X, teleport to room
}
#sectionend on_key_press // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart on_mouse_click // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(MouseButton button)
{
if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
{
}
else if (button == eMouseLeft)
{
ProcessClick(mouse.x,mouse.y, mouse.Mode);
}
else if (button == eMouseRight)
{
ProcessClick(mouse.x,mouse.y, eModeMirar);
}
//mouse.Mode = eModeIra; // HERE I HAVE THE PROBLEM!!
Accion = "Ir a";
player.ActiveInventory = null;
}
#sectionend on_mouse_click // DO NOT EDIT OR REMOVE THIS LINE
#sectionstart interface_click // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button)
{
// OBSOLETE, NOT USED IN AGS 2.7 AND LATER VERSIONS
}
#sectionend interface_click // DO NOT EDIT OR REMOVE THIS LINE
function dialog_request(int param) {
}
>?
In this part I have a problem, when I use in the click function, I can't use Hotspot_AnyClick() becaouse the action by default is Ir a (walk to).
>?
function on_mouse_click(MouseButton button)
{
if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
{
}
else if (button == eMouseLeft)
{
ProcessClick(mouse.x,mouse.y, mouse.Mode);
}
else if (button == eMouseRight)
{
ProcessClick(mouse.x,mouse.y, eModeMirar);
}
//mouse.Mode = eModeIra; // HERE I HAVE THE PROBLEM!! If I use this I can't use Hotspot_AnyClick()
Accion = "Ir a";
player.ActiveInventory = null;
}
>?
Thank you very much! :=
Nahuel.
if you want the mouse to return to walk mode then just use
Mouse.Mode = eModeWalkTo;
Why do you have the "//" before mouse.Mode=eModeIra?
Quote from: Float On on Mon 10/08/2009 17:35:56
if you want the mouse to return to walk mode then just use
Mouse.Mode = eModeWalkTo;
Yes but I want to make a general function, not 1 per action.
Thank you. very much!
Quote from: NsMn on Mon 10/08/2009 17:39:31
Why do you have the "//" before mouse.Mode=eModeIra?
Because this is my problem, When I use the mouse.Mode=eModeIra sentence I can't use in the hotspot AnyClick() functions.
Thank you very much!
Nahuel.