How to do If(region)

Need help with your JScripts? Got questions concerning the DFNs? Come forward, step inside :)
Post Reply
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

How to do If(region)

Post by dragon slayer »

How do i have a region check in the scripts

do i go by number like this

if(region = 5)
blah blah blah
else
blah
return;

or do i go by this
if(region = britain)
blah kill
else
blah love
return;
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

For some reason the ID of the regions doesn't seem to be available to the region JS objects, so I think the only way would be to check against specific region-names. Example:

Code: Select all

var region = pUser.region;

if( region.name.toLowerCase() == "the town of Britain".toLowerCase() )
{
blah
}
else
{
blah
}
The .toLowerCase() bit is just there to make it not be case-sensitive, and can probably be removed if you'd rather just type in the exact names.
-= Ho Eyo He Hum =-
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

thank you :) that helps a lot with what I'm working on i did region.name before and gae the region anew name i was like oops LOL
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

= assign value
== compare value
;)
-= Ho Eyo He Hum =-
Post Reply