thx to scorp for helping last time.
Anyway, when i press the right mouse button, it changes to walk cursor and starts a timer. When the timer expires it is suppose to change back to look cursor. But it doesn't unless i press the left mouse button once again. y?
Oh, it's a shooter game, ammo engine thing.
btw any suggestions on my scripting would be nice.
int chooser;
int mouse_clicks = 0;
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsTimerExpired(9)==1){ //when the reload timer is up
mouse_clicks = 0;
EnableCursorMode(MODE_LOOK);
SetCursorMode(MODE_LOOK);
SetObjectGraphic(3,10);
}
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() );
mouse_clicks = mouse_clicks + 1; // increasing mouse click counter
if (mouse_clicks < 9) {
PlaySound(1);
}
if (mouse_clicks == 0) {
SetObjectGraphic(3,10);
SetCursorMode(MODE_LOOK);
}
if (mouse_clicks == 1) { //changes graphics with number of
SetObjectGraphic(3,11);//clicks. Changes the ammo thing.
}
if (mouse_clicks == 2) {
SetObjectGraphic(3,12);
}
if (mouse_clicks == 3) {
SetObjectGraphic(3,13);
}
if (mouse_clicks == 4) {
SetObjectGraphic(3,14);
}
if (mouse_clicks == 5) {
SetObjectGraphic(3,15);
}
if (mouse_clicks == 6) {
SetObjectGraphic(3,16);
}
if (mouse_clicks == 7) {
SetObjectGraphic(3,17);
}
if (mouse_clicks == 8) {
SetObjectGraphic(3,18);
SetTimer(9, 50);
SetCursorMode(MODE_WALK);
DisableCursorMode(MODE_LOOK);
mouse_clicks = 10;
}
}
else { // right-click, so cycle cursor
SetTimer(9, 50);
SetCursorMode(MODE_WALK); //when right clicked re-loads
DisableCursorMode(MODE_LOOK); //sets the time it
mouse_clicks = 10; //to reload
}
}
Anyway, when i press the right mouse button, it changes to walk cursor and starts a timer. When the timer expires it is suppose to change back to look cursor. But it doesn't unless i press the left mouse button once again. y?
Oh, it's a shooter game, ammo engine thing.
btw any suggestions on my scripting would be nice.
int chooser;
int mouse_clicks = 0;
function on_mouse_click(int button) {
// called when a mouse button is clicked. button is either LEFT or RIGHT
if (IsTimerExpired(9)==1){ //when the reload timer is up
mouse_clicks = 0;
EnableCursorMode(MODE_LOOK);
SetCursorMode(MODE_LOOK);
SetObjectGraphic(3,10);
}
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() );
mouse_clicks = mouse_clicks + 1; // increasing mouse click counter
if (mouse_clicks < 9) {
PlaySound(1);
}
if (mouse_clicks == 0) {
SetObjectGraphic(3,10);
SetCursorMode(MODE_LOOK);
}
if (mouse_clicks == 1) { //changes graphics with number of
SetObjectGraphic(3,11);//clicks. Changes the ammo thing.
}
if (mouse_clicks == 2) {
SetObjectGraphic(3,12);
}
if (mouse_clicks == 3) {
SetObjectGraphic(3,13);
}
if (mouse_clicks == 4) {
SetObjectGraphic(3,14);
}
if (mouse_clicks == 5) {
SetObjectGraphic(3,15);
}
if (mouse_clicks == 6) {
SetObjectGraphic(3,16);
}
if (mouse_clicks == 7) {
SetObjectGraphic(3,17);
}
if (mouse_clicks == 8) {
SetObjectGraphic(3,18);
SetTimer(9, 50);
SetCursorMode(MODE_WALK);
DisableCursorMode(MODE_LOOK);
mouse_clicks = 10;
}
}
else { // right-click, so cycle cursor
SetTimer(9, 50);
SetCursorMode(MODE_WALK); //when right clicked re-loads
DisableCursorMode(MODE_LOOK); //sets the time it
mouse_clicks = 10; //to reload
}
}