Anonymous user
AGS Editor & User Interface: Difference between revisions
Jump to navigation
Jump to search
→Disabling right-clicks in your game
Line 86: | Line 86: | ||
There are many ways to disable right clicks in your game. If you only need it done in '''one''' room, then use the following script in the relevant room's scripts: | There are many ways to disable right clicks in your game. If you only need it done in '''one''' room, then use the following script in the relevant room's scripts: | ||
// AGS 2.62 and earlier | |||
function on_mouse_click(int button) { | function on_mouse_click(int button) { | ||
if (button==RIGHT) ClaimEvent(); | if (button==RIGHT) ClaimEvent(); | ||
} | |||
// AGS 2.7 and later | |||
function on_mouse_click(MouseButton button) { | |||
if (button == eMouseRight) ClaimEvent(); | |||
} | } | ||
This will prevent the global script's on_mouse_click function (or any other on_mouse_click function for that matter) from reacting to right-clicks. Since there is nothing else in this function, nothing will occur when the right mouse button is clicked within that room. | This will prevent the global script's on_mouse_click function (or any other on_mouse_click function for that matter) from reacting to right-clicks. Since there is nothing else in this function, nothing will occur when the right mouse button is clicked within that room. | ||
To disable right mouse clicks throughout the entire game (for your own interface, for example), find the on_mouse_click function in the game's global script, and find the section that detects if the right mouse button was clicked (it's the '''else''' part in case you couldn't find it), and erase everything (usually just '''mouse.SelectNextMode();''' in AGS 2.7, or '''SetNextCursorMode();''' in older versions) between the braces. That section should look like below: | To disable right mouse clicks throughout the entire game (for your own interface, for example), find the on_mouse_click function in the game's global script, and find the section that detects if the right mouse button was clicked (it's the '''else''' part in case you couldn't find it), and erase everything (usually just '''mouse.SelectNextMode();''' in AGS 2.7 and later, or '''SetNextCursorMode();''' in older versions) between the braces. That section should look like below: | ||
// AGS 2.62 and earlier | |||
function on_mouse_click(int button) { | function on_mouse_click(int button) { | ||
... | /* ... */ | ||
else { // right-click, so cycle cursor | |||
} | |||
} | |||
// AGS 2.7 and later | |||
function on_mouse_click(MouseButton button) { | |||
/* ... */ | |||
else { // right-click, so cycle cursor | else { // right-click, so cycle cursor | ||
} | |||
} | } | ||