ID:262192
 
CountDown
        Count_Down_Budokai()
set category = "Admin"
set name = "Count Down Budokai"
for(var/mob/Characters/M in world)
if(M.client)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>5</i></b></font>"
sleep(10)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>4</i></b></font>"
sleep(10)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>3</i></b></font>"
sleep(10)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>2</i></b></font>"
sleep(10)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>1</i></b></font>"
sleep(10)
M << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>FIGHT!!!</i></b></font>"
CheckWinner
if(Budokai_Participants.len == 1)
for(M in world)
if(M.client)
if(M.Inbudokai == 1)
world << "<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>[M] has won the World Martial Arts Tournament.</i></b></font>"
if(prize == "1,000 Zennis")
M.Zenni += 1000
if(prize == "10,000 Zennis")
M.Zenni += 10000
if(prize == "10,000 Power Level")
M.MaxHitPoints += 10000
if(prize == "100,000 Power Level")
M.MaxHitPoints += 100000
M.Inbudokai = 0
return ..()
goto CheckWinner


List
            Budokai_List()
set category = "Interact"
for(var/mob/Characters/M in world)
if(M.client)
if(M.Inbudokai == 1)
src << "<font color=yellow size=1><b><u><i>Current Enrollment for Budokai</u></i></b></font>"
src << "<font color=olive size=1><b><i>[M]</i></b></font>"


////List/////
Current Enrollment for Budokai
Dave
Current Enrollment for Budokai
John
when people join it makes more than one list instead of just putting everyone into one list


////CountDown////
Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: Count Down Budokai (/mob/Admin/verb/Count_Down_Budokai)
usr: Dave (/mob/Characters/Saiyajin)
src: Dave (/mob/Characters/Saiyajin)
call stack:
Dave (/mob/Characters/Saiyajin): Count Down Budokai()
Yeah, it's giving you a new list every time because you told it to.
            Budokai_List()
set category = "Interact"
src << "<font color=yellow size=1><b><u><i>Current Enrollment for Budokai</u></i></b></font>"
for(var/mob/Characters/M in world)
if(M.client)
if(M.Inbudokai == 1)
src << "<font color=olive size=1><b><i>[M]</i></b></font>"


and... You do have an infinite loop, your goto procedure is waiting until there is a defined winner. You should create an event system for this kind of thing, you're on your own.
Why can't you send the Tenkaichi Budokai message to the NPCs as well, so it would be a simple
world<<"<center><font color=yellow size=3>Tenkaichi Budokai: </font><br><font color=blue size=3><b><i>5</i></b></font>"
sleep(10)
//...
//...

instead of using a loop which is what you're doing now. Also, look up switch() in the DM referance, as it's designed to replace your if(use.prize=="whatever") usr.zennis+=whatever.
Also, it's saying that there's an infinite loop because there is. You should make CheckWinner into a proc and call it in your DeathCheck proc instead of looping again and again.
In response to Ter13
You can also help reduce the load by putting that check onto a seperate proc of its own, and call it on your death check proc if the one dieing is in the Budokai.
Your use of goto is inappropriate. It should be a while() loop here.

Lummox JR
In response to Ter13
i told it to..... well how do i untell it too
In response to Dranzer_Solo
Basically, the for() repeats what ever is inside the loop, until it is complete. You put the "Enrollment for Budokai" in the loop, this will make it for everytime it finds someone in the loop in will say that. Ter fixed it I think.
In response to N1ghtW1ng
N1ghtW1ng wrote:
Basically, the for() repeats what ever is inside the loop, until it is complete.

No. You're getting the for() loop mixed up with while(). Incidentally, for() is just a condensed version of while:

for(var/x=0,x>=3,x++)
src << "[x]"

outputs:
0
1
2
3

This can be achieved with while() too:
var/x=0
while(x>=3)
src << "[x]"
x++

outputs:
0
1
2
3

Either proc can be used for anything that the other one can. This is because arguments can be left out of for()
while(1)//Infinite loop

for(,1,)//Infinite Loop


Of course, sometimes it makes more sense to use one proc over the other. In general, if you could utilize all args of for(), it makes more sense to use for(), but if you just want to say "Do [...] as long as [x] is true.", it makes sense to use while().
In response to Wizkidd0123
Whoops. Anyway I think the rest of my statement works with the for() list thing. Also you messed up your html >.>
In response to N1ghtW1ng
o god -_- i think ill skip this part for now all this INF loop is too confusing for me -_-
In response to Dranzer_Solo
Urm, it isn't really causing an infinite loop. They were talking about the teleporting part and using goto. You were using it incorrectly. The Budokai Who thing should work fine if you look at Ter's. He posted a few replies upward.
In response to Dranzer_Solo
All the solutions to this are there, you just have to do some reading.