March 29, 2024, 12:27:32 AM
Welcome,
Guest
Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Forum rules
-
please read before posting, it can save you a lot of time.
Home
Help
Search
Calendar
Login
Register
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
query a selected object
« previous
next »
Pages: [
1
]
Print
Author
Topic: query a selected object (Read 3119 times)
0 Members and 1 Guest are viewing this topic.
piere
Supporter
Frequent poster
Karma: 4
Offline
Posts: 301
Sorry for any bad english in my posts. Game on !
query a selected object
«
on:
June 13, 2011, 10:37:29 AM »
Is there a way to query if a certain object is selected? Something like
if (Game.SelectedItem = "book")
{
//do something
}
Thanks
Logged
piere
Supporter
Frequent poster
Karma: 4
Offline
Posts: 301
Sorry for any bad english in my posts. Game on !
Re: query a selected object
«
Reply #1 on:
June 13, 2011, 07:46:47 PM »
I just figured it out, I used IsItemTaken to query it. Thanks anyways guys. !
Logged
Spellbreaker
Supporter
Frequent poster
Karma: 4
Offline
Gender:
Posts: 376
Re: query a selected object
«
Reply #2 on:
June 13, 2011, 09:39:38 PM »
Hey there.
Just as a side note: IsItemTaken does not returns if an item is selected. It returns if an item is in the inventory.
Logged
Apeiron Studios
http://www.apeironstudios.com
piere
Supporter
Frequent poster
Karma: 4
Offline
Posts: 301
Sorry for any bad english in my posts. Game on !
Re: query a selected object
«
Reply #3 on:
June 13, 2011, 10:17:21 PM »
Thanks Spellbreaker. You are right, is there a way I can see if the item is selected, not just in inventory? Thanks
Logged
Mnemonic
WME developer
Administrator
Addicted to WME forum
Karma: 41
Offline
Gender:
Posts: 5683
Re: query a selected object
«
Reply #4 on:
June 15, 2011, 04:27:36 PM »
Game.SelectedItem returns an object, not a name. You need to query the name of the object:
Code: WME Script
var
selItem =
Game
.
SelectedItem
;
if
(
selItem.
Name
==
"something"
)
...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum.
Print
Pages: [
1
]
« previous
next »
Wintermute Engine Forum
>
Wintermute Engine
>
Technical forum
>
Topic:
query a selected object