|
seannity Newbie
Joined: 15 Jul 2006 Posts: 6
|
Posted: Wed Oct 03, 2007 1:03 pm
Need help with automapper please :) |
Hi everyone,
I have one question and i do not know if it is possible in zmud. I would like to make a trigger to retrieve zone name by using room name.
For an example, when i say 'check bedroom', then zmud will show the zone name of that room.
Any helps would be greatly appreciated :) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Oct 03, 2007 3:01 pm |
The trouble is that unless you have one room with the literal name "bedroom" (which seems unlikely) then there's going to be more than one result.
Nevertheless, you can use the %mapquery function to do this. Something like:
#alias check {#forall %mapquery(%concat("[NAME] like %",%-1,"%")) {#say Room: %roomname(%i) Name: %zonename(%roomzone(%i))}}
This'll create a map query "[NAME] like %whateveryoutype%" and then loop through all the room ids that this query spits out, listing their name and the name of the zone that they're in. |
|
|
|
seannity Newbie
Joined: 15 Jul 2006 Posts: 6
|
Posted: Wed Oct 03, 2007 4:13 pm |
thank you so much Fang Xianfu...
I dont know i'm dumb or what, but i couldn't get it to work after copy and paste it,
but it gaves me an idea how it is going be and after I read some help file I comes out with this
and it works wonderfully.
#ALIAS check {#forall %mapquery( "[Name] LIKE '%-1'") {#say RoomName: %roomname( %i) AreaName: %zonename( %roomzone( %i))}}
by the way... is it possible to make it to show any room name with the same keyword?
Let say I type 'check bedroom' and it will show 'a bedroom','the bedroom', and so on...
thanks again :) |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Oct 03, 2007 4:51 pm |
The %s are important - they'll do what you're after.
Also, I reckon mine wasn't working because the capitalisation was wrong. Try:
#alias check {#forall %mapquery(%concat("[Name] LIKE '%",%-1,"%'")) {#say Room: %roomname(%i) Name: %zonename(%roomzone(%i))}}
Though just adding %s to yours should do the trick |
|
|
|
seannity Newbie
Joined: 15 Jul 2006 Posts: 6
|
Posted: Wed Oct 03, 2007 5:42 pm |
wow... this is perfect!
bow deeply... |
|
|
|
seannity Newbie
Joined: 15 Jul 2006 Posts: 6
|
Posted: Sat Oct 13, 2007 9:03 am |
Now i have another problem and anyone could help me please?
My problem is the automapper open for incorrect window and therefore it couldn't check the roomname
I have tried to put this into the check trigger but no lucks :(
#trigger {(%w) says 'check (%*)'.} {#menu {Windows|1};#menu {Windows|Automapper};check %2} |
|
|
|
Seb Wizard
Joined: 14 Aug 2004 Posts: 1269
|
Posted: Sat Oct 13, 2007 2:08 pm |
Just close the automapper that is in the wrong window and reopen it in the right window?
|
|
|
|
|
|