Spell(mob/player/P,mob/monsters/M,list/monstergroup)
P.stage = "Spell Selection"
P.page = 1
MakeArrow(P,1,8)
P.arrows.menu = new/list(3,4)
var/list/pager = new/list()
if(P.page == 1)
Lister(P,P.spage[P.page])
pager = P.spage[P.page]
else if(P.page == 2)
Lister(P,P.spage[P.page])
pager = P.spage[P.page]
else if(P.page == 3)
Lister(P,P.spage[P.page])
pager = P.spage[P.page]
else if(P.page == 4)
Lister(P,P.spage[P.page])
pager = P.spage[P.page]
else if(P.page == 5)
Lister(P,P.spage[P.page])
pager = P.spage[P.page]
else
world << "ERROR: PAGE NUMBER INCORRECT! REPORT THIS BUG IMMEDIATLY! BUG ERROR #2!"
return
SpellListing(P,M,monstergroup)
while(!P.arrows.spellchoice)
sleep(1)
for(var/obj/O in P.chooselist)
del(O)
if((pager.len <= 4 && P.arrows.spellchoice == 5) || P.arrows.spellchoice == 9)
if(P.page >= 5)
P.page = 1
else if(!P.spage[P.page])
Battle(P,M,monstergroup)
return
else
if(P.spage[P.page + 1])
P.page ++
else
Battle(P,M,monstergroup)
return
Spell(P,M,monstergroup)
return
var/spell = P.spage[P.page][P.arrows.spellchoice]
AddInfo(P,"Sorry, but you cannot cast","spells yet.")
del(P.arrows)
page = 1
sleep(12)
P.Battle(P,M,monstergroup)
return
Problem description:
Okay, the problem here is simple. Selecting a spell works, and all, but when I try to change spell pages, if I go past the last page, it will just skip my turn, never go back to Battle(blah) and it will go on in the MasterBattle proc where the monsters start attacking. As if it just ended my turn arruptly.
You're doing the exact same thing in every one of those except the last else. So what you want to write is this;
Now as for your actual problem, I don't know what's happening inside of these other procs or how this proc is called so I can't follow the actual data 100%, but you return four times. Put an output before each of those returns and then one on the very first line of Battle().
For the outputs in Spell() I recommend just a simple 'return 1', 'return 2' type thing. For the one in Battle() you should output src along with all three arguments.
If I had to guess I'd say you're having problems because either you're calling src.Battle() when you're not meant to, or you're calling P.Battle() at the end instead of src.Battle().