ID:142736
 
Code:
if("Snow")
usr.leafS=0
usr.mistS=0
usr.waterfallS=0
usr.sandS=0
usr.snowS=1
usr.soundS=0
usr.earthS=0
usr.rainS=0
usr.grassS=0
usr.lightningS=0
usr.villageselected=1
usr.Village="Snow"


Problem description:
do i actually need to have it have every village as 0 for every svillage? or could i use

if("Snow")
usr.snowS=1
usr.villageselected=1
usr.Village="Snow"

and it be the same?
I'm fairly new at this coding stuff but as long as you've gotten:

usr.leafS=0
usr.mistS=0

Down for your vars already, you can just put in:


if("Snow")
usr.snowS=1
usr.villageselected=1
usr.Village="Snow"

Just as long as you've gotten the leaf to sand to earth vars at 0 it should work the same.
Bluntmonkey wrote:
do i actually need to have it have every village as 0 for every svillage? or could i use

> if("Snow")
> usr.snowS=1
> usr.villageselected=1
> usr.Village="Snow"

and it be the same?


No, you don't. Infact, it would be extremely better to just set Village to a string. Get rid of all those cumbersome variables. Now, not only do you have to set only one variable, but you also only have to check one variable. You can also output their village easily in a text string by just embedding it! Infact, you don't even need the "villageselected" variable, since Village will be null until set! Heck, you might even be able to get rid of that switch() statement.

Village = input(src,"What village are you from?","...") in list("Leaf","Sand","Rock","BYOND")


In response to DarkCampainger
how do i set them to a string? not sure if im understanding it correctly
In response to Bluntmonkey
Bluntmonkey wrote:
how do i set them to a string? not sure if im understanding it correctly

It's exactly what you were doing. A string is a combination-- or string--of characters (letters, numbers, symbols). "Snow" is a string, as is any other text surrounded in quotes, so by doing usr.Village="Snow", you are setting the usr's Village to the string "Snow".