ID:264728
 
Code:
var
tmp
Tourney_Status
Round
Order_Num=0
list
Players=list()
Order=list(50,100,150,200,250,300,350,400,450,500)

proc
Start_Tourney()

Order_Num++
if(Order_Num>10)
Order_Num=1
Tourney_Status="Recruiting"
sleep(10)
world <<output("<Center>Tournement Recruitments are now being held for [Order[Order_Num]-50]-[Order[Order_Num]].","output")
Round=1
sleep(300)
world<<output("<Center>Tournement Recruitments are now over.","output")
Pick_Fight()
Pick_Fight()
var/list/L=Players["Round [Round]"]
if(!length(L))
Round++
if(length(Players["Round [Round]"])>1)
world<<output("<Center>1.","output")
Pick_Fight()
else
if(!length(Players["Round [Round]"]))
world<<output("<Center>2.","output")// it stops here .i dont know why.
return
if(length(Players["Round [Round]"]==1))//<< Garthor said this is wrong
world<<output("<Center>3.","output")
for(var/mob/M in Players["Round [Round]"])
M.Level=100//Prize
world<<output("<Center>Winner [M].","output")
break
return
Players["Fighting"]=new/list()
if(length(L)>1)
var/mob/A=L[1]
var/mob/B=L[2]
var/mob/C
if(length(L)==3)
C=L[3]
var/list/D=Players["Fighting"]
D.Add(A,B,C)
A.loc=locate(6,168,1)
B.loc=locate(17,168,1)
if(D[3])
C.loc=locate(17,168,1)

End_Fight(mob/Winner)
for(var/mob/M in Players["Fighting"])
if(M!=Winner)
Players["Round [Round]"]-=M
Pick_Fight()
Players["Round [Round++]"]+=Winner
End_Tourney()
Players=list()
Tourney_Status=null
Round=null


mob
var
Level=1
verb
Join()
if(Players["Round [Round]"])
src <<output("You have already entered tournament.","output")
return
if(Tourney_Status=="Recruiting"&&Level>Order[Order_Num]-50&&Level<Order[Order_Num])
Players["Round [Round]"]+=src
src <<output("You have entered tournament.","output")
else
src <<output("You do not meet the requirements.","output")
return
View_Entries()
for(var/mob/M in world)
var/tmp/C = 0
if(M ==Players["Round [Round]"])
C ++
src <<output("[C].[M]","output")
Add_Entries(mob/M in world)
Players["Round [Round]"]+=M


proc
Check_Fighter(mob/Fighter)
for(var/mob/M in Players["Fighting"])
if(M==Fighter)
Players["Fighting"]-=Fighter
if(length(Players["Fighting"])==1)
for(var/mob/A in Players["Fighting"])
End_Fight(A)
break
break


Problem description:Ive posted this before but it got lost in all the pages so i wondering if anyone could help..
ok so i run tourny and everythings ok...it says the tourny has opened for recruit ments and then i join and i make someone else join..but it always stops where i said in the code.. i wrote the number there to show me where it stops..and it looks like only one person can join the tourny.
for some reason this code only allows one person to join the tournement and Garthor said

if(length(Players["Round [Round]"]==1))



The parentheses here are wrong.
But i dont know what to do or what to change

Vai God69 wrote:
but it always stops where i said in the code

If you don't know why it stops there, then you stole it from somewhere >.<

It stops because of return line below
Vai God69 wrote:
if(length(Players["Round [Round]"]==1))

The parentheses here are wrong.
But i dont know what to do or what to change

You could try running that line through your head until you figure out what, exactly, you're doing wrong.

You do know what parenthesis do, right?
In response to Garthor
Garthor wrote:
Vai God69 wrote:
if(length(Players["Round [Round]"]==1))

The parentheses here are wrong.
But i dont know what to do or what to change

You could try running that line through your head until you figure out what, exactly, you're doing wrong.

You do know what parenthesis do, right?

well i dont know in this case..so could u please help.
In response to Vai God69
Parenthesis are used to specify the order of operations. Operations which are inside parenthesis are performed before those outside parenthesis. So, to evaluate 2*(3+4), you have to add 3 and 4 before multiplying by 2, so you get 2*(3+4) = 2*7 = 14.

The exact same principle applies here.
In response to Garthor
so if they are in thre wrong place it means i should be doing that operation first?
could u tell me where to put it to get a better understanding.
In response to Vai God69
Vai God69 wrote:
so if they are in thre wrong place it means i should be doing that operation first?

It means you need to change where one or more of the parentheses are.

could u tell me where to put it to get a better understanding.

No, because you would not get a better understanding.
In response to Garthor
Garthor wrote:
Vai God69 wrote:
so if they are in thre wrong place it means i should be doing that operation first?

It means you need to change where one or more of the parentheses are.

could u tell me where to put it to get a better understanding.

No, because you would not get a better understanding.

well maybe if you tell me then ill understand why they go there..
In response to Vai God69
This is essentially the problem:
Lets say you want what Garthor showed you:
2*(3+4) = 14

You are telling the program to do something akin to this:
(2*3+4) = 6+4 = 10

As Garthor mentioned, you are placing one of the parenthesis in the wrong position, it is pretty easy to spot it. Do not ask us to do it for you... just taking a moment and look over the particular snippet.
Vai God69 wrote:
Code:
> var
> tmp
> Tourney_Status
> Round
> Order_Num=0
> list
> Players=list()
> Order=list(50,100,150,200,250,300,350,400,450,500)
>
> proc
> Start_Tourney()
>
> Order_Num++
> if(Order_Num>10)
> Order_Num=1
> Tourney_Status="Recruiting"
> sleep(10)
> world <<output("<Center>Tournement Recruitments are now being held for [Order[Order_Num]-50]-[Order[Order_Num]].","output")
> Round=1
> sleep(300)
> world<<output("<Center>Tournement Recruitments are now over.","output")
> Pick_Fight()
> Pick_Fight()
> var/list/L=Players["Round [Round]"]
> if(!length(L))
> Round++
> if(length(Players["Round [Round]"])>1)
> world<<output("<Center>1.","output")
> Pick_Fight()
> else
> if(!length(Players["Round [Round]"]))
> world<<output("<Center>2.","output")// it stops here .i dont know why.
> return
> if(length(Players["Round [Round]"]==1))//<< Garthor said this is wrong
> world<<output("<Center>3.","output")
> for(var/mob/M in Players["Round [Round]"])
> M.Level=100//Prize
> world<<output("<Center>Winner [M].","output")
> break
> return
> Players["Fighting"]=new/list()
> if(length(L)>1)
> var/mob/A=L[1]
> var/mob/B=L[2]
> var/mob/C
> if(length(L)==3)
> C=L[3]
> var/list/D=Players["Fighting"]
> D.Add(A,B,C)
> A.loc=locate(6,168,1)
> B.loc=locate(17,168,1)
> if(D[3])
> C.loc=locate(17,168,1)
>
> End_Fight(mob/Winner)
> for(var/mob/M in Players["Fighting"])
> if(M!=Winner)
> Players["Round [Round]"]-=M
> Pick_Fight()
> Players["Round [Round++]"]+=Winner
> End_Tourney()
> Players=list()
> Tourney_Status=null
> Round=null
>
>
> mob
> var
> Level=1
> verb
> Join()
> if(Players["Round [Round]"])
> src <<output("You have already entered tournament.","output")
> return
> if(Tourney_Status=="Recruiting"&&Level>Order[Order_Num]-50&&Level<Order[Order_Num])
> Players["Round [Round]"]+=src
> src <<output("You have entered tournament.","output")
> else
> src <<output("You do not meet the requirements.","output")
> return
> View_Entries()
> for(var/mob/M in world)
> var/tmp/C = 0
> if(M ==Players["Round [Round]"])
> C ++
> src <<output("[C].[M]","output")
> Add_Entries(mob/M in world)
> Players["Round [Round]"]+=M
>
>
> proc
> Check_Fighter(mob/Fighter)
> for(var/mob/M in Players["Fighting"])
> if(M==Fighter)
> Players["Fighting"]-=Fighter
> if(length(Players["Fighting"])==1)
> for(var/mob/A in Players["Fighting"])
> End_Fight(A)
> break
> break
>
>
>

Problem description:Ive posted this before but it got lost in all the pages so i wondering if anyone could help..
ok so i run tourny and everythings ok...it says the tourny has opened for recruit ments and then i join and i make someone else join..but it always stops where i said in the code.. i wrote the number there to show me where it stops..and it looks like only one person can join the tourny.
for some reason this code only allows one person to join the tournement and Garthor said

if(length(Players["Round [Round]"]==1))

The parentheses here are wrong.
But i dont know what to do or what to change



Hi there i moved it and now theres another problem

my tourny only makes 1 person join and no one else can once someone has joined

i think its to do with

 mob
var
Level=1
verb
Join()
if(Players["Round [Round]"])
src <<output("You have already entered tournament.","output")
return
if(Tourney_Status=="Recruiting"&&Level>Order[Order_Num]-50&&Level<Order[Order_Num])
Players["Round [Round]"]+=src //<<<< That... i dont know what to do
src <<output("You have entered tournament.","output")
else
src <<output("You do not meet the requirements.","output")
return
In response to Vai God69
Please do not reply with a quote if the quote is absolutely useless (and only quote the important part), less cluster that way and more willing people will be able to help you.

It's because of this line:
 if(Players["Round [Round]"])
What you are stating here is "If Players is true (which is NOT 0, "" or null), tell the person they already joined."

To fix it, you should check if the person is in the list. (Hint: If you cannot see the tip... reply with quote to see all the underlines)
In response to GhostAnime
GhostAnime wrote:
Please do not reply with a quote if the quote is absolutely useless (and only quote the important part), less cluster that way and more willing people will be able to help you.

It's because of this line:
 if(Players["Round [Round]"])
What you are stating here is "If Players is true (which is NOT 0, "" or null), tell the person they already joined."
To fix it, you should check if the person is in the list. (Hint: If you cannot see the tip... reply with quote to see all the underlines)


ive done this :
if(src in Players["Round [Round]"])

but now it doesnt say anything when i press join..it used to say u have already but now it doesnt do anything. And if you try to add someone else it doesnt do it.