SphereCommunity
Check for Region Event? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Check for Region Event? (/Thread-Check-for-Region-Event)



Check for Region Event? - pinku - 12-04-2013 02:24 AM

Code:
[REGIONTYPE r_blocked]
ON=@ENTER
IF !(<SRC.ISNPC>)
SRC.SYSMESSAGE TEST.
ENDIF

Code:
[AREADEF a_pvp]
EVENTS=r_blocked,r_default
NAME=Test
FLAGS=my|flags|here
P=xxxx,xxxx
RECT=xxxx,xxxx,xxxx,xxxx

I got this AREA with a REGIONTYPE.
The message works and the area too.
But how can I check for this AREA EVENT when I use an item for example?
I want to search for r_blocked.

I tried:

Code:
IF (<SRC.REGION.EVENTS> == r_blocked)
SRC.SYSMESSAGE Can't use it here...
RETURN 1

Works, but this blocks everywhere, without really checking (I think) the r_blocked.

Code:
IF (<SRC.REGION.TYPE> == r_blocked)
SRC.SYSMESSAGE Can't use it here...
RETURN 1

Nope too. But doesn't make sense anyway. xD

I could use this on the item, but since it's a "virtual map", I'm going to set new AREAS with NAMES and everything, so it's not very practical to be adding every region name to the item...

Code:
IF STRMATCH( "Test", "<SRC.REGION.TYPE>" )
SRC.SYSMESSAGE Can't use it here...
RETURN 1

Can someone help me?

Thanks!


RE: Check for Region Event? - Extreme - 12-04-2013 02:52 AM

Try

IF STRMATCH(*Test*,*<SRC.REGION.TYPE>*)
SRC.SYSMESSAGE Can't use it here...
RETURN 1


RE: Check for Region Event? - XuN - 12-04-2013 03:37 AM

IF (<SRC.REGION.ISEVENT.r_blocked>)
SRC.SYSMESSAGE Can't use it here...
RETURN 1
ENDIF


RE: Check for Region Event? - pinku - 12-04-2013 03:40 AM

Thanks Extreme, but this is not exactly what I was looking for..
Like I said on the OP, that way works, but I'll have to add waaaaay too many AREA names on the checker.

If I create Test 2, Test 3, Test 4, etc etc.

I want a way to check if it's R_BLOCK and then block it, so it's all around the map, indifferent of the AREA name.

(12-04-2013 03:37 AM)XuN Wrote:  IF (<SRC.REGION.ISEVENT.r_blocked>)
SRC.SYSMESSAGE Can't use it here...
RETURN 1
ENDIF

Thanks XuN!!!
I'll give it a try!

Update:
I get an error.. Tongue

Can't Resolve (<SRC.REGION.ISEVENT.r_blocked>)


RE: Check for Region Event? - Shamino - 12-04-2013 05:37 AM

U can use a region TAG.

.REGION.TAG.BLOCKED=1

IF (<SRC.REGION.TAG0.BLOCKED>)
SRC.SYSMESSAGE Can't use it here...
RETURN 1
ENDIF


RE: Check for Region Event? - XuN - 12-04-2013 05:49 AM

TAG idea is good too, BTW you should not get errors if you are using nightlies:

27-10-2013, Ben
- Fixed #2227: Region.ISEVENT not working.


RE: Check for Region Event? - pinku - 12-04-2013 07:12 AM

I'm using 56c, not sure which release. But I couldn't get it to work.. Sad
Can someone please explain me a bit further how this REGION.TAG works?

No console errors, but does not work anyway.
What I did:

Code:
ELSEIF (<SRC.REGION.TAG0.BLOCKED> == 01)
SRC.SYSMESSAGE Summons are blocked in this area.
RETURN 1

I tried both:

Code:
[AREADEF a_pvp]
EVENTS=r_blocked,r_default
NAME=Test
FLAGS=my|flags|here
P=xxxx,xxxx
RECT=xxxx,xxxx,xxxx,xxxx
REGION.TAG.BLOCKED=1

and

Code:
[REGIONTYPE r_blocked]
ON=@ENTER
IF !(<SRC.ISNPC>)
REGION.TAG.BLOCKED=1
SRC.SYSMESSAGE TEST.
ENDIF

Tips?

Thanks again!


RE: Check for Region Event? - XuN - 12-04-2013 08:24 AM

This DOES works, i have just tested it before posting to be (more) sure that it's working. (Do you know that when you add events to a region they are not loaded untill you reboot sphere? try adding them manually for testing purposes)

Code:
[REGIONTYPE r_noenter]
ON=@Enter
if (<tag0.block>==1) || (<region.isevent.r_default_tree>) //tag0 is checked on the region itself, src is the char entering. IsEvent also works for me, if not for you... update your SphereSvr.exe
    src.say Blocked access
    return 1
else
    src.say Wellcome to <name>
endif