ID:264769
 
Code:
proc
doit2()
for(var/mob/M in world)
if(M.tourny)
var/A=pick(Entries)
var/B=pick(Entries)
var/C=pick(Entries)
var/D=pick(Entries)
if(A==B||A==C||A==D||B==C||B==D||D==C)
goto doit2
sleep(10)
M<<"<center><B>Tournament Announcer: Okay lets start this match!</center></B>"
sleep(20)
M<<"<center><B>Tournament Announcer: This match will be...</center></B>"
sleep(30)
M<<"<center><B>Tournament Announcer: [A] & [D].VS. [B] & [C]!</center></B>"
B:loc=locate(105,190,2)
A:loc=locate(50,61,48)
C:loc=locate(105,191,2)
D:loc=locate(50,61,48)
Team_Fight(A,B,C,D)
B:dir=WEST
C:dir=WEST
A:dir=EAST
D:dir=EAST
sleep(50)
M<<"<center><b>Fight!"
Team_Tournament_AI()
Team_Fight()
return
Team_Fight()

proc
Team_Fight(mob/A,mob/B,mob/C,mob/D)
if(A.health <= 0&&D.health <= 0)
world<<"[B] and [C] has won against [A] and [D]!"
B.loc=locate(118,168,2)
C.loc=locate(118,168,2)
A.tourny = 0
D.tourny = 0
A.loc=locate(11,320,3)
D.loc=locate(11,320,3)
A.health = A.maxhealth
B.health = B.maxhealth
C.health = C.maxhealth
D.health = D.maxhealth
Entries.Remove(A)
Entries.Remove(D)
Team_Tournament_AI()
return
else
spawn(1)
goto doit2
if(B.health <= 0&&C.health <= 0)
world<<"[A] [D] has won against [B] and [C]!"
A.loc=locate(118,168,2)
D.loc=locate(118,168,2)
B.loc=locate(11,320,3)
C.loc=locate(11,320,3)
B.tourny = 0
C.tourny = 0
A.health = A.maxhealth
B.health = B.maxhealth
C.health = C.maxhealth
D.health = D.maxhealth
Entries.Remove(B)
Entries.Remove(C)
Team_Tournament_AI()
return
else
spawn(1)
goto doit2


Problem description:

New AutoMated Tourney.dm:242:error: doit2: jump failed


OK I check over the code like 10 times... and I finnaly noticed well ok look i need Help i can get this on my own.


Try putting doit2() instead of goto doit2
In response to Tomy
Replace the goto doit2 with doit2() remove the goto.
Your error aside, there are quite a couple of flaws in this code snippet, so, what do you want to accomplish (in plain, proper English)?

The reason I'm asking this is simple. I want to help you design code to do what you have in mind, but the problem is that right now, I would have to guess at what you assume that the code you presented should do, meaning we have two points in the communication where somebody is blindly taking assumptions. That's never a good point, so by actually elaborating on what you have in mind, you grant the volunteers trying to assist you the chance to come up with a productive response that fits your need, instead of some random stuff you likely do not even want.
In response to Schnitzelnagler
I would like for where it has [goto doit] that should be like a proc that is like running. and when a person Die's it runs itself and starts the next match. or it will say the tournament is over and who ever wins. its like a AI system in progress
In response to Hokage Yondaime
You completely misunderstood me.
I was asking for a detailed functional specification of the function, since there are a lot of points in your original design that make little sense.

As a few examples:
  • You're looping through every instance of mob in the world, instead of narrowing down your choice (e.g. player controlled).
  • You check if a certain bit-flag is set, when it would likely be better to create a list to choose from right away.
  • You're picking four times from what is hopefully a list without ever removing your selection, then checking if you picked four different entries and if not I suppose that you try to start over again. That's quite bad design, as you can get quite a few iterations before accomplishing this goal. It would be far better to ensure picking different entries right away.
  • You fail to include various safety checks after sleeping, which means you can easily get a bunch of runtime errors.
  • You're using a lax operator, where you should be using the strict version. Thus you're shifting potential compile time errors to run-time.

And that is just the first of the two procedures you noted.
Thus, it would be essential that you describe in detail what you intend to achieve wit the procedures, not 'something like a system'.
In response to Schnitzelnagler
I fixed it.. btw Thank all of you who took time to stop by and try to help me out
In response to Hokage Yondaime
I'm sure that 'it works, so you must be right'.
*sighs*
I'm probably too late, but you should never, ever, ever, ever, ever, ever, under any circumstances, use goto. There are very few things that you could be doing that are WORSE than goto, when it comes to programming of any sort. The proper looping constructs are for() and while().