ID:157308
 
im just wondering if its possible to have a random code for a login for instance

New
icon='New.bmp'
layer=3
Click()
switch(input("Select Your Nation.") in list ("The Arcadians","The Ancients","Sky Pirates","Furions"))

if("The Arcadians")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(148,28,4)

if("The Ancients")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(102,28,4)

if("Sky Pirates")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(/turf/landscape/start)

if("furions")

id like to have it on a random code so it would only appear in the last say 25% of the time, anyone got an idea?
You can do if(prob(25)) or if(rand(1, 4) == 1)
In response to Zaltron (#1)
New
icon='New.bmp'
layer=3
Click()
switch(input("Select Your Nation.") in list ("The Arcadians","The Ancients","Sky Pirates","Furion"))

if("The Arcadians")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(148,28,4)

if("The Ancients")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(102,28,4)

if("Sky Pirates")
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(/turf/landscape/start)

if(prob(25)("Furion"))
usr.icon='player.dmi'
usr.icon_state="male"
usr.loc=locate(/turf/landscape/start)

so it would look like this? but i get errors and ive tried a few combo's, man random code goes over my head X_x
In response to Thorpeous (#2)
To apply a 25 % chance in this code we would need to do it before the switch. (Don't want to let them see a nation they can't be. right?)

So we would define the list then add the chance nation before asking for the input.

>   New
> icon='New.bmp'
> layer=3
> Click()
> var/list/nations = list("The Arcadians","The Ancients","Sky Pirates")
> if(prob(25))
> nations+= "Furion"
> switch(input("Select Your Nation.") in nations)
>
> if("The Arcadians")
> usr.icon='player.dmi'
> usr.icon_state="male"
> usr.loc=locate(148,28,4)
>
> if("The Ancients")
> usr.icon='player.dmi'
> usr.icon_state="male"
> usr.loc=locate(102,28,4)
>
> if("Sky Pirates")
> usr.icon='player.dmi'
> usr.icon_state="male"
> usr.loc=locate(/turf/landscape/start)
>
> if("Furion")
> usr.icon='player.dmi'
> usr.icon_state="male"
> usr.loc=locate(/turf/landscape/start)
In response to Pirion (#3)
An associative list would seem smarter in such a case.
You could skip on all the redundant code and avoid the ugly switch ;)
In response to Pirion (#3)
still this solved the problem so thankies ^^ , im still fairly new to this so i have no idea what the other solution is lol
I realize this is somewhat out of scope, but the idea behind the code, having one nation only available to players 1/4 of the time? Is this when they create a new player? If it is, my experience is that most players will just keep resetting their account to get the nation they want. If you're really serious about making that 4th nation harder to get the others, you might need a different plan. Or at least some way of enforcing the current one.

Maybe I'm misreading what you're trying to do (since I'm obviously only basing this off the snippet of code you've shown), but it's worth considering.