ID:177811
 
How would you rewrite this code to reset only one map? I'm using a bit of a difficult method to create zones and will be until I learn how to make child worlds.

proc/SpaceShip()
for()
spawn(6000)
world << "The top winners are:"
world << "Reboot will occur in five minutes."
for(var/mob/M in world)
world << "[M.name]: [M.worldscore] of [M.Team]"
sleep(3000)
world.Reboot()

Also, how would you sort the winners by there worldscore?
Drafonis wrote:
How would you rewrite this code to reset only one map? I'm using a bit of a difficult method to create zones and will be until I learn how to make child worlds.

proc/SpaceShip()
for()
spawn(6000)
world << "The top winners are:"
world << "Reboot will occur in five minutes."
for(var/mob/M in world)
world << "[M.name]: [M.worldscore] of [M.Team]"
sleep(3000)
world.Reboot()

Also, how would you sort the winners by there worldscore?

Bump due to the fact that I don't know the answer.
look up the max() proc.
In response to Ter13
Ter13 wrote:
look up the max() proc.

I can't figure out how to put in that function. Because I want one map to do a full Repop with all mobs relogged in.
In response to Drafonis
...... I can't even believe you just said that....
the max() proc has nothing to do with repopulation.

look, here's what you do, if you want to choose the highest scoring player... this is how you do it.

var/mob/M
var/list/scores
var/list/scorers
for(M in world)
if(M.client)
scores += M.worldscore
scorers += M.name
continue
else
continue
var/hiscore = max(scores)
var/position
position = scores.Find(hiscore)
world << "[scorers[position]] has won the game with [hiscore] points."

I'm not even sure if it really works, but I think it may with a little tweaking.
In response to Ter13
Now, it gives me these errors/warnings. Some I know, some I don't.
loading Inf.dme
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:440:vi sibility:warning: visibility is being phased out; use invisibility
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:946:er ror:position :duplicate definition
space.dm:13:error:position :previous definition
space.dm:1:error:space :invalid proc definition
space.dm:12:error:scores:undefined var
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:440:sr c.visibility:warning: visibility is being phased out; use invisibility
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:998:if :warning: if statement has no effect
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:999:if :warning: if statement has no effect
space.dm:14:error:position:duplicate definition
space.dm:14:error:hiscore:value not allowed here
space.dm:14:error:scores.Find:instruction not allowed here
space.dm:14:error::duplicate definition
space.dm:14:error:= :instruction not allowed here
space.dm:15:error:world:duplicate definition
space.dm:15:error:position:value not allowed here
space.dm:15:error:scorers:value not allowed here
space.dm:15:error::duplicate definition
space.dm:15:error:hiscore:value not allowed here
space.dm:15:error::duplicate definition
space.dm:15:error:text "[] has won the game with [] points.":value not allowed here
space.dm:15:error::duplicate definition
space.dm:15:error:<< :instruction not allowed here

Inf.dmb - 18 errors, 4 warnings (double-click on an error to jump to it)

proc/space
var/mob/M
var/list/scores
var/list/scorers
for(M in world)
if(M.client)
scores += M.worldscore
scorers += M.name
continue
else
continue
var/hiscore = max(scores)
var/position
position = scores.Find(hiscore)
world << "[scorers[position]] has won the game with [hiscore] points."