(Keeps Hive Alive)
Go Back   The Hive Workshop - A Warcraft III Modding Site > Warcraft III Hosted Projects > Reinventing the Craft > Miscellaneous

Miscellaneous A forum for a variety of functions where users may also request other features.

Reply
 
LinkBack Thread Tools Display Modes
Old 07-09-2007, 09:22 PM   #1 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

MouseAPI

MouseAPI allows getting and setting mouse coordinates. These aren't relative to the game, but just the screen coordinates.
native GetMouseX takes nothing returns integer
native GetMouseY takes nothing returns integer
native GetMouseXRelative takes nothing returns integer
native GetMouseYRelative takes nothing returns integer
native SetMouseX takes integer x returns nothing
native SetMouseY takes integer y returns nothing
native SetMousePos takes integer x, integer y returns nothing
//
//===================================================
// Mouse API constants
//===================================================
constant integer EVENT_LMOUSEUP = 0
constant integer EVENT_LMOUSEDOWN = 1
constant integer EVENT_RMOUSEUP = 2
constant integer EVENT_RMOUSEDOWN = 3
constant integer EVENT_MMOUSEUP = 4
constant integer EVENT_MMOUSEDOWN = 5
constant integer EVENT_MOUSEWHEEL = 6
// New Functions
native TriggerRegisterMouseEvent takes trigger whichTrigger, integer eventtype returns nothing
native GetTriggerWheelDelta takes nothing returns integer

Download: N/A Part of official Release
Native Set Type: Single Player or WarSoc
Release: 0.02alpha, updated in 0.10

GetMouseX Gets the X component of the mouse position.
GetMouseY Gets the Y component of the mouse position.
GetMouseXRelative Gets the X component of the mouse position relative to the window.
GetMouseYRelative Gets the Y component of the mouse position relative to the window.
SetMouseX Sets the X component of the mouse position.
SetMouseY Sets the Y component of the mouse position.
SetMousePos Sets the X and Y component of the mouse position, faster if you need to move both at once.

Example usage:
 local integer mx = GetMouseX()
 local integer my = GetMouseY()
 local integer vx = GetWindowWidth()/2 //GetWindowWidth is part of WindowAPI
 local integer vy = GetWindowHeight()/2 //GetWindowHeight is part of WindowAPI

    set vx = vx-mx
    set vy = vy-my
        //now you can use vx and vy as offset variables to move things. Like a unit.
    call SetMouseX(GetWindowWidth()/2) //GetWindowWidth is part of WindowAPI
    call SetMouseY(GetWindowHeight()/2) //GetWindowHeight is part of WindowAPI
YouTube Movie

Last edited by MindWorX; 03-10-2008 at 06:29 PM.. Reason: New Update
MindWorX is offline   Reply With Quote
Old 07-26-2007, 11:08 PM   #2 (permalink)

iRawr
 
Join Date: Dec 2005
Posts: 8,349

PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)PurplePoot is a splendid one to behold (807)

Paired Mapping Contest #4 Winner: Fallen Angel - Lucifer's Keep Respected User: This user has been given the respected user award. Map Development Mini-Contest #1 Winner: Stand of the Elements 

(bump) Does GetMouseX/YRelative relate to the game, then?
PurplePoot is offline   Reply With Quote
Old 07-27-2007, 09:17 AM   #3 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Quote:
Originally Posted by PurplePoot View Post
(bump) Does GetMouseX/YRelative relate to the game, then?
It's relative to the window x and y, incase someone, like me, sometimes test or play in windowed mode.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 11-24-2007, 06:57 PM   #4 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

Bump, new update.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 01-15-2008, 04:22 AM   #5 (permalink)
 
wd40bomber7's Avatar

Starcraft2 Fan
 
Join Date: Aug 2006
Posts: 960

wd40bomber7 is on a distinguished road (70)wd40bomber7 is on a distinguished road (70)


How fast are these? Will it badly affect my performance to run the example script every .04 seconds? (Or faster?)
__________________
I can help you.......... Maybe......
Give Rep to those that help you!

I'm back! My computers been finished.
wd40bomber7 is offline   Reply With Quote
Old 01-15-2008, 07:40 AM   #6 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

I've made a map where it ran 0.01 for a smooth movement control of a flying glaive. So I'm pretty sure it's fast enough.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 01-15-2008, 11:20 PM   #7 (permalink)
 
wd40bomber7's Avatar

Starcraft2 Fan
 
Join Date: Aug 2006
Posts: 960

wd40bomber7 is on a distinguished road (70)wd40bomber7 is on a distinguished road (70)


Great, thats all I need to know about MouseAPI.
I'm using it in a first person shooter. The only problem is I can't get the screen to rotate correctly. The custom natives work fine, I'm just not sure how to go about rotating the camera.
If you have any time, check the below post to see what I've tried.
Turning camera
__________________
I can help you.......... Maybe......
Give Rep to those that help you!

I'm back! My computers been finished.

Last edited by wd40bomber7; 01-16-2008 at 06:15 AM..
wd40bomber7 is offline   Reply With Quote
Old 01-16-2008, 09:16 AM   #8 (permalink)
 
MindWorX's Avatar

Wulfy loves Nex!
 
Join Date: Aug 2004
Posts: 293

MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)MindWorX has a spectacular aura about (122)

PayPal Donor: This user has donated to The Hive. Hosted Project of the Year 2007: Reinventing the Craft 

I see that you found a solution to the problem you had. :) Be sure to write once you have a demo of the FPS engine you're doing, would be a great demo to show the possibilities of the MouseAPI.
__________________
"Wulfy loves Nex!"
MindWorX is offline   Reply With Quote
Old 03-10-2008, 04:33 PM   #9 (permalink)
 
Bubba Ex's Avatar

Master JASSer to-be
 
Join Date: Aug 2007
Posts: 164

Bubba Ex has little to show at this moment (6)


how do I get the mouse x and y for each individual player? Using GetLocalPlayer()?

EDIT:
Didn't read the 'single player or WarSoc' part, sorry.
__________________
Bubba Ex

Please give rep+ to those who help you!


Bubba Ex is offline   Reply With Quote
Old 03-10-2008, 06:22 PM   #10 (permalink)
 
SFilip's Avatar

Jack of all trades
 
Join Date: Nov 2005
Posts: 291

SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)


Well, it will in theory work in multiplayer (under the condition all players have rtc), but syncing might be hard to accomplish.
SFilip is offline   Reply With Quote
Old 03-25-2008, 01:04 PM   #11 (permalink)
 
Need_O2's Avatar

meow
 
Join Date: Aug 2007
Posts: 2,521

Need_O2 is a jewel in the rough (182)Need_O2 is a jewel in the rough (182)


I think its impossible to play the maps made with it in Bnet
because its impossible to change mause position in default Wc3
so all players will have to have RtC
Wc3 doesnt sync the mause because it would delay AFAIK
Need_O2 is online now   Reply With Quote
Old 11-08-2008, 11:14 PM   #12 (permalink)
 
Dynasti's Avatar

vJass O.o?
 
Join Date: Oct 2007
Posts: 622

Dynasti will become famous soon enough (117)Dynasti will become famous soon enough (117)Dynasti will become famous soon enough (117)


It should be returns real not integer :)
__________________
Click Me -><- Click Me
Need a spell or system?
Dynasti is offline   Reply With Quote
Old 11-09-2008, 03:03 PM   #13 (permalink)
 
SFilip's Avatar

Jack of all trades
 
Join Date: Nov 2005
Posts: 291

SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)SFilip has little to show at this moment (34)


Which one? And why?
SFilip is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

All times are GMT. The time now is 09:34 AM.






Your link here 
Sexy Dress | Credit Counseling | Credit Score | Mobile Phones | Free eBooks Download
Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Copyright©Ralle