ID:143974
 
Didn't know where to put this so put it here.

Code:More Efficient
mob/Admin
verb
Tournament()
//set category = "Tournament"
switch(input("Host a tournament?","Tournament") in list ("Yes","No"))
if("Yes")
var/tname = input("What name for your tournament","Tournament") as null|text
if(!tname) {src << "Please, use an actual name!";return tname}
var/players = input("How, many players do you want to compete?","Tournament") as null|num
if(!players) {src<<"No player amount entered";return players}
else if(players > 8) {src<<"Only below an amount of 8 players can compete!";return players}
world << "<font color=red>WORLD EVENT!: [src] is hosting <b>[tname]</b> and only <i>[players] Players</i> can compete!</font>"
else if ("No") return 0


or

//This is not my code but i compiled this and it doesn't work whereas mine does i can't test it though since im at school
mob/verb
Tournament()//Forgot the brackets
set category = "Channels"
switch(alert("Host a tournament?","Tournament","Yeah!","I'll pass.."))
if("Yeah!")
var/tname = input("What name for your Tournament?","Tournament") as null|text
if(!tname)
src << "Please, use an actual name!"
return
var/players = input("How, many players do you want to compete?","Tournament") as null|num
else if(!players)
return
else if(players > 8)
src << "Only below <b>8</b> players can compete!"
return
world << "<font color=red>WORLD EVENT!: [src] is hosting <b>[tname]</b> and only <i>[players] Players</i> can compete!</font>"


Problem description: Just checking and want to know if like my return players will work etc

Just pointing out a quick error:
                    
else if(players > 8) {src<<"Only below an amount of 8 players can compete!";return players}


That should be if(players >= 8). Otherwise you could enter in 8 players and it wouldn't remind you to choose a number under 8.
Rickoshay wrote:
Didn't know where to put this so put it here.

Code:More Efficient
> mob/Admin
> verb
> Tournament()
> //set category = "Tournament"
> switch(input("Host a tournament?","Tournament") in list ("Yes","No"))
> if("Yes")
> var/tname = input("What name for your tournament","Tournament") as null|text
> if(!tname) {src << "Please, use an actual name!";return tname}
> var/players = input("How, many players do you want to compete?","Tournament") as null|num
> if(!players) {src<<"No player amount entered";return players}
> else if(players > 8) {src<<"Only below an amount of 8 players can compete!";return players}
> world << "<font color=red>WORLD EVENT!: [src] is hosting <b>[tname]</b> and only <i>[players] Players</i> can compete!</font>"
> else if ("No") return 0
>

or

> //This is not my code but i compiled this and it doesn't work whereas mine does i can't test it though since im at school
> mob/verb
> Tournament()//Forgot the brackets
> set category = "Channels"
> switch(alert("Host a tournament?","Tournament","Yeah!","I'll pass.."))
> if("Yeah!")
> var/tname = input("What name for your Tournament?","Tournament") as null|text
> if(!tname)
> src << "Please, use an actual name!"
> return
> var/players = input("How, many players do you want to compete?","Tournament") as null|num
> else if(!players)
> return
> else if(players > 8)
> src << "Only below <b>8</b> players can compete!"
> return
> world << "<font color=red>WORLD EVENT!: [src] is hosting <b>[tname]</b> and only <i>[players] Players</i> can compete!</font>"
>

Problem description: Just checking and want to know if like my return players will work etc


I'm no expert, but in the second code block your first else if should probably be just an if. You would probably get an indentation error. other than that, it's pretty much the same code (to the compiler).

In response to Elation
That the point i dont want it to be above 8.
In response to Rickoshay
Rickoshay wrote:
That the point i dont want it to be above 8.

In that case you should say "up to 8" instead of "below 8". Below 8 means, literally, less than 8. If 8 is acceptable, then you used the wrong choice of words.

Lummox JR
In response to Lummox JR
Yes i realised this after and changed it. Thanks anyways.