ID:149725
 
I have posted this many times and no one seems to know how to help b/c they think i dont give enugh info so im trying again.My problem is in this line right here:
mob
Move()
switch(onbattlefield)
if ("battlearea1")
randomencounter1(src)
return ..()
else if ("battlearea2")
randomencounter2(src)
return ..()
else
return ..()
This seems to call the battlearea2 even when its null and null is what the just plain else is for.My areas fro this are:

area
battlearea1
Enter()
spawn()usr.onbattlefield = "battlearea1"
return 1
Exit()
usr.onbattlefield = null
return 1
area
battlearea2
Enter()
spawn()usr.onbattlefield = "battlearea2"
return 1
Exit()
usr.onbattlefield = null
return 1

Thats just to help you if you see a problem in it too. The code will call battlearea1 just fine if the code is
mob
Move()
switch(onbattlefield)
if ("battlearea1")
randomencounter1(src)
return ..()
else
return ..()
Does anyone know why? If im not telling you enugh to make a guess than tell me. I am useing Random Encounter demo by Zagreus if that heps any.
Don't use else in switch() procs. Take out the elses, and the problem is fixed.

Because I'm lazy, I'll let you figure out how to code that on your own. =P
In response to WizDragon
You can use else in switch() there's nothing wrong with it, it's best to use it if you only have two items in your list. else has no effect on how switch() works.
In response to WizDragon
I think WizDragon meant don't use <code>else if</code> statments.

WizDragon wrote:
Don't use else in switch() procs. Take out the elses, and the problem is fixed.

Because I'm lazy, I'll let you figure out how to code that on your own. =P
In response to Nadrew
thank you guys for answering, first ones to do so without asking for more info, ok i normaly dont use swich but it was in there so i though i would try it but i will take it out now. That is what you were teling me to do right?