📧 Message Board Archive

mouse support?
okay, here goes...

I'm trying to have a section of my d-mod(note: just a small section, one screen, not the whole game) use mouse support, but I'm running into problems.  I've set everything up similarly to "START.c", but it's not working properly.  I've checked my scripts for bugs and can't find any.  I can get Dink to turn into a pointer, and I can get the pointer to respond to mouse movements, but it won't respond to mouse clicks.  Further, its very frustrating to test this because, for some reason, once Dink becomes a pointer, the Escape button no longer works so I'm forced to shut down the computer with every failed attempt at making this run properly.  Has anyone used in game mouse support before?  Is this actually possible?  Are there any scripts available I could look at?  Can anyone help me?  
Re: mouse support?
: okay, here goes...



: I'm trying to have a section of my d-mod(note: just a small section, one screen, not the whole game) use mouse support, but I'm running into problems. I've set everything up similarly to "START.c", but it's not working properly. I've checked my scripts for bugs and can't find any. I can get Dink to turn into a pointer, and I can get the pointer to respond to mouse movements, but it won't respond to mouse clicks. Further, its very frustrating to test this because, for some reason, once Dink becomes a pointer, the Escape button no longer works so I'm forced to shut down the computer with every failed attempt at making this run properly. Has anyone used in game mouse support before? Is this actually possible? Are there any scripts available I could look at? Can anyone help me?



Yeah, do as mimifish says.  But a couple other notes...



1) Using the mouse turns off all other keyboard/joystick/mouse input off except directions and the attack button (Ctrl, Left Mouse Button, and Joystick Button 0).  So no other keys are detected while mouse mode is on.  You can't even use the right mouse button for anything.



2) As such, press Alt-F4 to exit any time you have it in mouse mode.



3) You need to use set_keep_mouse, as the excerpt from the Dink C Help Files says:
set_keep_mouse( int O_or_1);



Let's say you wanted cursor like mouse control in your addon, set this right after loading the game, and the mouse support will stay.



Note that sprite one must have brain 13 for it to activate. (1 is yes)
I think you need to use it in start-1.c, right before the kill_this_task() statement.
Re: Okay, but...
I don't want Dink to a mouse pointer all the time, as in Redink's Basement.  I want Dink to run around for awhile as Dink, then at some point, use mouse support for a special task.  I've got everything to work correctly now, except that Dink won't change into the pointer.  He acts like a pointer (I can move him with the mouse and click on buttons), but he looks like a frozen Dink.  This is the script I'm using...
void talk( void )

{

sp_seq(1, 0);

sp_brain(1, 13);

sp_pseq(1, 10);

sp_pframe(1, 8);

sp_que(1, 20000);

sp_noclip(1, 1);

//followed by some lines to create buttons

}




BTW thanks for the Alt-F4 tip, Redink1, that's saving me from many a headache!



Re: Okay, but...
: I don't want Dink to a mouse pointer all the time, as in Redink's Basement. I want Dink to run around for awhile as Dink, then at some point, use mouse support for a special task. I've got everything to work correctly now, except that Dink won't change into the pointer. He acts like a pointer (I can move him with the mouse and click on buttons), but he looks like a frozen Dink. This is the script I'm using...



Right, but you still need set keep mouse in START.C . You just give Dink brain 1 most of the time and Brain 13 for the special tast. As for lookling like a pointer, you have to do that yourself. Here's How I did it:



sp_base_walk(1, 0);

sp_base_idle(1, 0);

sp_seq(1, 0);

sp_pseq(1, 10);

sp_pframe(1, 8);

sp_noclip(1, 1);



And to turn him back:



sp_base_walk(1, 70);

sp_base_idle(1, 10);

sp_brain(1, 1);

sp_noclip(1, 0);



sp_noclip means the pointer can be over the status bar. I use it because the menu I have fills the whole screen. If yours doesn't, take that part out.
Re: maybe...
I don't know if it will work, but what redink1 and DinkC help said was that you need to put set_keep_mouse(1); right after you loading the game to enable the use of mouse in your game. maybe you need to use set_mode(2), too, to use set_keep_mouse(1).



In your script, maybe you should put freeze(1) first. It's possible since you did not freeze Dink, that once you move Dink with mouse or keyboard, Dink would try to walk and load the base_walk sequence.





void talk( void )

: {

: sp_seq(1, 0);

: sp_brain(1, 13);

: sp_pseq(1, 10);

: sp_pframe(1, 8);

: sp_que(1, 20000);

: sp_noclip(1, 1);

: //followed by some lines to create buttons

: }




: BTW thanks for the Alt-F4 tip, Redink1, that's saving me from many a headache!



Re: mouse support?
I knew there are at least 2 dmods which used mouse control in the game. Both were written by redink1. A mini game in FIAT and another experimental dmod called "Explorations: redink1's Basement". The source codes are available for both dmods.