-
Notifications
You must be signed in to change notification settings - Fork 2
Interacting with the mouse
There are 2 ways of interacting with the mouse.
- IsControlJustPressed for when you click once.
- IsControlPressed for when you keep the mouse pressed.
Used with IsControlJustPressed
will have 2 functions, select items in menu, and select panels
Parameters | TYPE | Optional | Description |
---|---|---|---|
mouseX | Float |
☒ | The mouse X |
mouseY | Float |
☒ | The mouse Y |
Returns | String |
---|
To retrieve the mouse coordinates it's suggested not only to draw on frame the cursor, but to subtract from the mouse coord the offset before sending.
if the menu is drawn with an offset of 20, 20... subtract 20 from both x and y before calling the scaleform function.
the result will always be a "," (comma) separated string.
- C#
if (Game.IsControlJustPressed(0, Control.Attack))
{
PointF mouse = new PointF(0,0);
mouse = new PointF(GetDisabledControlNormal(0, 239) * Screen.ScaledWidth - Offset.X, GetDisabledControlNormal(0, 240) * Screen.Height - Offset.Y);
BeginScaleformMovieMethod(NativeUIScaleform._nativeui.Handle, "SET_INPUT_MOUSE_EVENT_SINGLE");
ScaleformMovieMethodAddParamFloat(mouse.X);
ScaleformMovieMethodAddParamFloat(mouse.Y);
var ret = EndScaleformMovieMethodReturnValue();
while (!IsScaleformMovieMethodReturnValueReady(ret)) await BaseScript.Delay(0);
var res = GetScaleformMovieMethodReturnValueString(ret);
}
- Lua
if(IsControlJustPressed(0, 24) then
local mouse = {x=0, y=0};
local aspectRatio = GetScreenAspectRatio(false)
local scaledWidth = 720 * aspectRatio
mouse = {x=GetDisabledControlNormal(0, 239) * scaledWidth - offset.x, y=GetDisabledControlNormal(0, 240) * 720 - offset.y)
BeginScaleformMovieMethod(scaleformUI, "SET_INPUT_MOUSE_EVENT_SINGLE")
ScaleformMovieMethodAddParamFloat(mouse.X)
ScaleformMovieMethodAddParamFloat(mouse.Y)
var ret = EndScaleformMovieMethodReturnValue()
while (not IsScaleformMovieMethodReturnValueReady(ret)) do
Wait(0)
end
local res = GetScaleformMovieMethodReturnValueString(ret)
end
The result string can be filtered based on item or panel..
- if it's an item it can be "it,0,0,12"
- if it's a panel it can be "pan,0,0,0.5,0.5"
explanation:
return parameters | TYPE | Optional | Description |
---|---|---|---|
typeFilter | string |
☒ | "it" for item, "pan" for panel |
position | Int |
☒ | item or panel position in their lists |
type | Int |
☒ | item/panel type ( example 0 for normal Item or ColorPanel) |
value |
Int /Float
|
☒ | item or panel value.. can be int for ColorPanel or float for Percentage / Grid panels |
extra_value | Float |
☑ | extra value only for GridPanel |
This is the same for the SINGLE one the only difference is that it applies ONLY for SliderItems, ProgressItems, PercentagePanels, GridPanels. The Example code is the same as above The Returned value is the same as above.
by manups4e