checking if a room exists?

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Post Reply
poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

checking if a room exists?

Post by poppop »

Hello,

I need to check if a room exists, before it can be destroyed.

I have an array of rooms to delete, stored by their room id's

But some may have already been deleted.

I tried, just calling the room like this:

var AAa = _server.getCurrentZone().getRoom("test room number")

But when the room dosnt exist, i get an error.

So any help would be really great.

Thanks very much. :)
poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

Post by poppop »

Hi, I could really do with an answer to this question. I cannot do anything else on this project while i cannot check if a room exists???

I just need a simple way to see if a room exists??

Please?

Thanks for any help.
Xelius
Posts: 70
Joined: 06 Apr 2006, 15:16
Location: Sweden

Post by Xelius »

I tried passing a invalid room id to getRoom() and it isn't throwing any errors, it will return a null value.

Code: Select all

var r = _server.getCurrentZone().getRoom(10)
if(!r) {
	trace("room dosn't exist")
}
else {
	//Continue
}
poppop
Posts: 57
Joined: 07 Jul 2007, 10:24

Post by poppop »

Thanks mate, got it working now :lol:
tdous
Posts: 7
Joined: 08 Jun 2006, 08:23

Post by tdous »

delete if you want... stupid mistake... ok now
Post Reply