ID:145245
 
Code:
/*
Basically the problem is that once the proc reaches the point where it
is supposed to summon M1 through M8 to the arena to actually start
the tournament, nothing happens, I think it is in the line I commented
below, which explains how I tried to use a list to incorporate M1-8 into
one variable 'M' and then use that to summon all 8 at once... Its fully
commented, thanks for the help in advance, thanks.
*/


proc
global
Tournament()
global.tournament=1
var/global/mob/M1=null //M1 through M8 are the slots
var/global/mob/M2=null //for the contestants.
var/global/mob/M3=null //They get the slots in the order
var/global/mob/M4=null //of who chooses 'yes' in the switch
var/global/mob/M5=null //below.
var/global/mob/M6=null
var/global/mob/M7=null
var/global/mob/M8=null
var/global/gainp=1.1
var/global/zennip=1000
for(var/mob/M in world) spawn(0)
switch(input(M,"Do you want to enter this tournament?", "Choice", /*text*/) in list ("Yes", "No",))
if("Yes")
if(M1==null) //If there is not a contestant in slot 1.
M1=M //...Assign M to slot M1
alert(M,"You got slot 1") //And then tell them that.
else
if(M2==null) //Then do that again til it assigns 8
M2=M //contestants, then start.
alert(M,"You got slot 2")
else
if(M3==null)
M3=M
alert(M,"You got slot 3")
else
if(M4==null)
M4=M
alert(M,"You got slot 4")
else
if(M5==null)
M5=M
alert(M,"You got slot 5")
else
if(M6==null)
M6=M
alert(M,"You got slot 6")
else
if(M7==null)
M7=M
alert(M,"You got slot 7")
else
if(M8==null)
M.lastxx=M.x //after the final contestant, M8, is chosen
M.lastyy=M.y //it then saves M1-M8s location so they can
M.lastzz=M.z //be returned afterward.
var/global/mob/prelim1=null //Who won the 1st prelim match
var/global/mob/prelim2=null //and the second... and so on.
var/global/mob/prelim3=null
var/global/mob/prelim4=null
M8=M //assign the final M to slow M8
M=list(M1,M2,M3,M4,M5,M6,M7,M8) //This is a part that might
//be causing trouble, i am not good with lists right now,
//so... yea, if you know whats wrong thanks in advance for saying so =P
alert("You got slot 8")
world << "<b><font size=1><font color=red>A tournament is now in progress."
M << "<b>Eight contestants have entered, you will now be summoned to the location."
M.loc=locate(116,233,15) //Since I attempted to redefine M as the mobs in slots
//M1 through M8, I assume it should take all 8 of those mobs to this location.
M << "<b><font size=1><font color=red>The rules are as follows: Once it is your turn and you are summoned into the ring, do not leave the ring unless you wish to lose of forfeit the match do NOT enter the ring unless you are summoned by the announcer. Do not kill because this will cause you to be disqualified, and the person you kill will be revived to continue in the tournament."
//Below this is where the tournament actually begins
M << "<b><font color=red><center>PRELIMINARIES"
M << "<b>ANNOUNCER: First match! [M1] VS. [M2]!"
M1.loc=locate(119,228,15) //Brings M1 to the left side of the ring
M2.loc=locate(123,228,15) //And M2 to the right side.
M << "<b>ANNOUNCER: Ready!!!?"
sleep(10)
M << "<b>ANNOUNCER: THREE!"
sleep(10)
M << "<b>ANNOUNCER: TWO!!"
sleep(10)
M << "<b>ANNOUNCER: ONE!!!"
sleep(10)
M << "<b><center>ANNOUNCER:<font color=red>FIGHT!!!!"
watchprelim1 //Tag, so that the proc can continually return here
//to check if one of the fighters was KO'd.
if(M1.dead==1)
M << "[M1] WINS! [M2] is disqualified for killing [M1]."
prelim1=M1 //assigns M1 as the winner of the first prelim match
else
if(M2.dead==1)
M << "[M2] WINS! [M1] is disqualified for killing [M2]."
prelim1=M2
else
if(M1.KO==1)
M << "[M2] WINS!"
prelim1=M2
else
if(M2.KO==1)
M << "[M1] WINS!"
prelim1=M1
else
if(prelim1==null) //If no winner has yet been assigned to the prelim1 match...
sleep(10) //wait a second...
goto watchprelim1 //...and then return to the tag to check again til someone does win.
else //basically after this 'else' statement, if will move to the prelim2 match,
//and from there it will keep going til it finishes the finals, upon which it will hand out
//a money and power reward, and return all 8 contestants to their former locations.
spawn(12000) //wait 20 minutes.
global.Tournament() //then start another tournament.


Problem description:
Thanks in advance, the code is fully commented on the problem... Oh, guess I should mention the purpose of this proc is to start a tournament, see who wins, then wait 20 minutes, and start another tournament.

Not browsing through all that, either way
// For checking FALSE / TRUE values

if(thingy==1) // WRONG
if(thingy) // RIGHT!

if(thingy==0) // WRONG!
if(!thingy) // RIGHT!
Dude, what is with all the slot variables and checking?
var/slots[0]

mob/verb/SignUp()
if(slots.len >= 8)
alert("Sorry! The playing field is full, you must wait.")
else
slots += usr
alert("You are in slot [slots[slots.len]]")

Excuse me if I'm wrong, but wouldn't something like that make a lot more sense?
In response to Papoose
Nope, couldnt use .len, it has to actually record the NAMES of the mobs, not just how many slots there are... So as far as I know that wouldnt work either...

And as far as this...
if(thingy)
if(!thingy)
I really dont understand what they mean. I looked up !operator but the description was so short it didnt help anything.
In response to Dragonn
Eurgh. The post explained them properly.
Anyway, it DOES store them

var/list/testlist=list("Hi","Hello"=list("A","B"))
mob/verb/test()
usr<<testlist[1] // Outputs "Hi"
usr<<testlist["Hello"][1] // Outputs "A"


Excuse me if I made a mistake somewhere.