disable right clicking?

Started by Nixxon, Wed 11/06/2003 05:13:39

Previous topic - Next topic

Nixxon

hail :D
In my menu screen i've disabled all cursor modes (walk.look.use.talk) appart from the pointer. For some reason however, If i right click cycle through my cursors in this menu screen, it changes from the pointer.. to wait... then to walk.
Is there a way i could just disable right clicking all together? or perhaps fix my script so that it stays as the pointer and ONLY the pointer?
Here's the script anyhow -

 // script for room: Player enters screen (before fadein)
 GUIOff(2);
DisableCursorMode(MODE_WALK);
DisableCursorMode(MODE_USE);
DisableCursorMode(MODE_TALK);
DisableCursorMode(MODE_LOOK);
SetCursorMode(6);


Thanks :D

EDIT - Disableinterface works, but then i can't click on my "play game" hotspot  :-\

Gilbert

In your global script, in the function on_mouse_click(), you may find something like (may vary depends on what custum GUI or scrpts you may have used):

...
 else if (button==LEFT) {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else {   // right-click, so cycle cursor
   SetNextCursorMode();
 }

...

In which the part in GREEN is related to right-clicking in the game. Yo can change it to something like:

 else if (condition){ //when right-clicking disabled, do nothing
 }

 else {  // right-click, so cycle cursor
   SetNextCursorMode();
 }


Where condition is the condition you'd like to check when right click should be disabled, (can be when you're in a certain room, or a GUI is active, etc., it's up to you).

Nixxon

Thanks, i getcha :D
However, how should the condition be scripted? i want this condition to take effect when the player is in room 7. would it be somthing like -

}
 else if (ROOM7){ //when right-clicking disabled, do nothing

or player.ROOM=7 etc.

I'm not familiar with basic script commands... thanks :D

Nixxon

#3
Oooop! I don't know what I've done but i can't seem to cursor cycle at all now :(


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)
if (IsGUIOn(6) && button==LEFT) GUIOff(6);
if (IsGUIOn(7) && button==LEFT) GUIOff(7);

}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}

Scorpiorus

Actually DisableCursorMode() has to prevent any cursor changes (even by means of SetNextCursorMode() function). I pasted your original script and seems like SetNextCursorMode()  cycles (on mouse right click) to the Wait mode as it is still enabled. In theory it must not happen as the Wait mode is not checked to be Standart cursor mode.
So what you need is to place one more line to the before fadein function:

// script for room: Player enters screen (before fadein)
GUIOff(2);
DisableCursorMode(MODE_WALK);
DisableCursorMode(MODE_USE);
DisableCursorMode(MODE_TALK);
DisableCursorMode(MODE_LOOK);
DisableCursorMode(7); // Disable Wait mode
SetCursorMode(6);


and don't forget enable modes:

// script for room: Player leaves screen
EnableCursorMode (MODE_WALK);
EnableCursorMode (MODE_USE);
EnableCursorMode (MODE_TALK);
EnableCursorMode (MODE_LOOK);
EnableCursorMode (7); // enable Wait mode[/b]
SetCursorMode(MODE_WALK);

QuoteOooop! I don't know what I've done but i can't seem to cursor cycle at all now
maybe you already did the similar thing and disabled the Wait mode. :P

P.S. But if you want to be sure that the player is not allowed even to attempt to cycle modes while he is in the particular room then add the next condition in on_mouse_click():

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)
if (IsGUIOn(6) && button==LEFT) GUIOff(6);
if (IsGUIOn(7) && button==LEFT) GUIOff(7);

}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
if (character[GetPlayerCharacter()].room != 7) SetNextCursorMode();
}

-Cheers

Proskrito

what i made in my template is to make a global script int and 2 functions:
int allowrightclick;
DisableRightClick(){
allowrightclick=0;
}
EnableRightClick(){
allowrightclick=1;
}
So in the on_mouse_click function i have in the right mouse code:
....
if (button == RIGHT && allowrightclick==1){
blahblah;
}
and if you export these two functions with the script header, you´ll have the ability of disabling right clicks.

Nixxon

Cheers, I'd prefer to use somthing as simple as disabling the wait cursor... since it's only really one room i want to disable the other cursors... I 'THINK' it works now... can't really tell since none of my rooms will let me cycle right click now... very distressing. ill paste both my room scripts and my global mouse function thingie :P
thanks a lot.

the menu screen -

 // script for room: Player enters screen (before fadein)
GUIOff(2);
DisableCursorMode(MODE_WALK);
DisableCursorMode(MODE_USE);
DisableCursorMode(MODE_TALK);
DisableCursorMode(MODE_LOOK);
DisableCursorMode(7); // Disable Wait mode
SetCursorMode(6);


first playable room (cycle not working) -

 // script for room: Player enters screen (before fadein)
  EnableCursorMode(MODE_WALK);
EnableCursorMode(MODE_USE);
EnableCursorMode(MODE_LOOK);
EnableCursorMode(MODE_TALK);
EnableCursorMode(7);
GUIOn(2);
   SetObjectView(2,11);
   AnimateObject(2,0,2,1);
    SetObjectView(4,12);
AnimateObject(4,0,2,1);
SetObjectTransparency(2,20);
SetObjectView(5,14);
AnimateObject(5,0,4,1);
SetObjectTransparency(5,90);
SetObjectView(6,15);
AnimateObject(6,0,4,1);
SetObjectView(7,16);
AnimateObject(7,0,7,1);
SetObjectTransparency(8,40);
SetObjectView(9,19);
AnimateObject(9,0,5,1);

Mouse Function Script -


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)
if (IsGUIOn(6) && button==LEFT) GUIOff(6);
if (IsGUIOn(7) && button==LEFT) GUIOff(7);

}
else if (button==LEFT) {
ProcessClick(mouse.x, mouse.y, GetCursorMode() );
}
else { // right-click, so cycle cursor
SetNextCursorMode();
}




Sorry about all the code :( as i said im happy to use disable wait... but my main concearn now is to be able to cycle cursors again.
Thanks, means a lot :D

Scorpiorus

#7
Once you have enabled them the cycling should work again.  ::)

Hmm... maybe you unchecked Standart cursor mode flags on the cursor panel?... :P

btw, what is the GUI 2 ?

Nixxon

#8
nope all standard cursor mode boxes are checked  :-\

GUI2 is my lucas style main GUI

EDIT - I think it stopped working apon pasting some of gilberts code into my global... i prob left somthing out.
i still can't see any flaws however   :-\

I could always start a new game and copy the default template mouse function code into mine... really don't know. BTW the cursors are definately working... since i can select them on my GUI2... just can't right click cycle.

EDIT - YAY WORKED... here's the code i copied from a new game and pasted into my global.

 }
 else if (button==LEFT) {
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 else {   // right-click, so cycle cursor
   SetNextCursorMode();
 }

looks the same to me, but meh.. worked, maybe i was missing a bracet etc.?

Anyway s'all working, thanks a lot :D
very much appreciated :) :) :)

Scorpiorus

I'm glad it works now. :)

Funny thing... in fact the block of code completely identical.

The reason I was asking about GUI is because if it's checked Clickable and you click on that GUI (even on a transparent part) then SetNextCursorMode() is not get called at all.

Or maybe, as you pointed out, it's braces... But they seems allright to me. Well on_mouse_click() wasn't close actually but I think that is copy/paste issue. Othewise you would get nested function error. :P

-Cheers

SMF spam blocked by CleanTalk