April 25, 2025, 09:23:03 PM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
For WME related articles and tutorials visit
WME Resource Center
.
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Double Click with an item
« previous
next »
Pages: [
1
]
Print
Author
Topic: Double Click with an item (Read 661 times)
0 Members and 1 Guest are viewing this topic.
MARTIN151
Lurker
Karma: 1
Offline
Posts: 8
Double Click with an item
«
on:
April 07, 2025, 05:29:43 PM »
Hi everyone,
I need help. I'd like to enable skiping walking by double clicking. It already works. But there is a problem. When any item is selected, the actor skips the walking, but he doesn't use the item.
Does anyone know, how to code the doubleclick use for items?
Thanks.
Logged
Mot
Occasional poster
Karma: 3
Offline
Posts: 58
Re: Double Click with an item
«
Reply #1 on:
April 09, 2025, 10:06:24 PM »
I would add an event handler to the file
game.script
to take care of what happens when the user left double clicks. As I don't know what you coded in order to skip (walking) to a location, you may need to modify the next example to include both behaviours.
Code: WME Script
////////////////////////////////////////////////////////////////////////////////
on
"LeftDoubleClick"
{
// what did we double click?
var
ActObj =
Game
.
ActiveObject
;
if
(
ActObj!=
null
)
{
// using an inventory item on another object
if
(
Game
.
SelectedItem
!=
null
&&
Game
.
SelectedItem
!=ActObj
)
{
var
Item
=
Game
.
SelectedItem
;
if
(
ActObj.
CanHandleEvent
(
Item
.
Name
)
)
ActObj.
ApplyEvent
(
Item
.
Name
)
;
else
if
(
Item
.
CanHandleEvent
(
"default-use"
)
)
Item
.
ApplyEvent
(
"default-use"
)
;
else
if
(
ActObj.
CanHandleEvent
(
"default-use"
)
)
ActObj.
ApplyEvent
(
"default-use"
)
;
else
actor.
Talk
(
"I can't use these things together."
)
;
}
// just a simple double click
else
ActObj.
ApplyEvent
(
"LeftDoubleClick"
)
;
}
// else propagate the LeftDoubleClick event to a scene
else
{
Scene
.
ApplyEvent
(
"LeftDoubleClick"
)
;
}
}
////////////////////////////////////////////////////////////////////////////////
«
Last Edit: April 16, 2025, 12:34:50 PM by Mot
»
Logged
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
Double Click with an item