ID:157104
 
I'm fairly new at coding so bare with me..


mob
Login()
usr.icon_state = input("What skin color would you like to have?") in list ("light","tan","dark")
loc = locate(/turf/start)
world << "[usr] has logged in!"

icon ='player.dmi'

1st question ^^how do i get this to choose from separate icon files, not within the same file?^^






mob/verb/
OCC(msg as text)
set category = "Social"
world << "[usr] says, [msg]"

mob/verb/
view() << "[usr] say, [msg]"

^^2nd question: How to I get "say to view", I thought this was it, but it did not work.

1st) Could You Explain More About What You Need

2nd)You Do It Like This

mob/verb
Say(msg as text)
view(src)<<"[src] Says, [msg]"//you don't have to use src but youu should :)
In response to Masschaos100
for #1:

I have 3 icon files. Light, tan, dark.

Now the current set up i have is making me use icon states in 1 file. So i tried finding a way to make it select between files instead of just one file, but I can't seem to figure it out. and no just getting rid of state does not do it. So any ideas?
In response to Komuroto
Komuroto wrote:
for #1:

I have 3 icon files. Light, tan, dark.

Now the current set up i have is making me use icon states in 1 file. So i tried finding a way to make it select between files instead of just one file, but I can't seem to figure it out. and no just getting rid of state does not do it. So any ideas?

Use a switch() statement to select the file based on their input.
In response to Garthor
not exactly sure how that would be worded:

switch(E)
if(A1,A2,...) Statement1
if(B1,B2,...) Statement1
else Statement3

thats what dream maker says...

soo
--------------------
This becomes....
____________
mob
Login()
usr.icon_state = input("What skin color would you like to have?") in list ("light","tan","dark")
loc = locate(/turf/start)
world << "[usr] has logged in!"
________________
what exactly?
_______

I mean i understand >>>if(something) icon = "file.dmi" or something along those lines? I feel like its something obvious that i'm over looking. Care to explain the entire thing?

In response to Komuroto
This is what i tried:

mob
Login()
switch( input("What skin color would you like to have?") in list ("light","tan","dark")
if("light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
user.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"



ERROR MESSAGE:
Mob.dm:8:error: if: missing comma ',' or right-paren ')'
________
I dont understand ? I thought i had it, can you tell me what I did wrong?
In response to Komuroto
Please encase your code in <dm></dm> tags. The forum will parse it so it looks like readable code. Which makes things much easier for us all.

You're also missing a closing ) for your switch statement. Add a ) to the end of that line.

As a rule of thumb to help you with parenthesis, always lay them out before adding the values inside them, like so:
switch( input() in list() )


It'll help you to remember.
In response to Tiberath
Thank you, but my issue is still not resolved:
__
Before applying your advice

mob
Login()
switch( input("What skin color would you like to have?") in list("light","tan","dark")
if(input "light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
user.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"

_____
After applying your advice

mob
Login()
switch() input()"What skin color would you like to have?") in list("light","tan","dark")
if(input "light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
user.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"



error 1st time: need right ',' or ')'.

New error: "What skin color would you like to have" : expected end of statement.

I thought this is how i could fix it but this revealed much more errors:
mob
Login()
switch()
input("What skin color would you like to have?") in list("light","tan","dark")
if("light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
user.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"


Mob.dm:7:error: list: undefined proc
Mob.dm:13:error: user.icon: undefined var
Mob.dm:6:error: switch: invalid expression
Mob.dm:7:warning: : empty switch statement
Mob.dm:7:error: input: expected "if" or "else"
Mob.dm:8:warning: : unused label
In response to Komuroto
You're not doing what he told you to, watch your parenthesis.
switch( input() in list() )

Also 3rd down is user. (unrelated)
In response to Leur
mob
Login()
switch(input("What skin color would you like to have?") in list("light","tan","dark")
if("light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
user.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"



Same error though but for the 1st if statement now.

Mob.dm:7:error: if: missing comma ',' or right-paren ')'

game.dmb - 5 errors, 0 warnings (double-click on an error to jump to it)

In response to Komuroto
again, look at how many open and close parenthesis there are and where they are / arn't placed.
In response to Leur
Got it!

mob
Login()
switch(input("What skin color would you like to have?") in list("light","tan","dark"))
if("light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
usr.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"


0 errors, 0 warnings
In response to Komuroto
this code still is not allowing my icon files to display in-game like i wanted.

What i wanted to do was have a player able to select their skin color at the start. And among other things, but this is how i wanted to start off.

So i did this:
mob
Login()
switch(input("What skin color would you like to have?") in list("light","tan","dark"))
if("light")
usr.icon ="light.dmi"
if("tan")
usr.icon ="tan.dmi"
if("dark")
usr.icon ="dark.dmi"
loc = locate(/turf/start)
world << "[usr] has logged in!"



Result? Play has no icon, as if using a null state that isn't there. But that is not the case. What happened?
In response to Komuroto
Never mind answered my own question, sorry thanks for everything !!

mob
Login()
switch(input("What skin color would you like to have?") in list("light","tan","dark"))
if("light")
usr.icon ='light.dmi'
if("tan")
usr.icon ='tan.dmi'
if("dark")
usr.icon ='dark.dmi'
loc = locate(/turf/start)
world << "[usr] has logged in!"
In response to Komuroto
Please note that using usr in Login() is a very bad idea (unless you are planning to have a one-player game)! Use src instead.

Please refer to this as to some reasons why: http://www.byond.com/members/ DreamMakers?command=view_post&post=35932
In response to GhostAnime
Thanks, you know everything worked out, but i changed the density of a item and got this error.

But the error must be false...i can see the file..
*note ignore baseball as title...just using it randomly*

loading Baseball.dme
error: Failed to remove 'Baseball.rsc'
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:94:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:97:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:100:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:103:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:106:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:109:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:112:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:115:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Baseball.dm:120:error: 'Misc.dmi': cannot find file
BYOND(467.1069) Error: the file C:\Documents and Settings\Administrator\Desktop\Baseball\Baseball.rsc is locked up!
Mob.dm:59:error: 'Misc.dmi': cannot find file

Baseball.dmb - 10 errors, 0 warnings (double-click on an error to jump to it)
In response to Komuroto
You are getting a locked rsc error because the game is currently running and has the rsc locked from modification.

Close the running game and recompile, you should not get the error.
In response to GhostAnime
thanks, I'll be sure to post again if i get stuck on anything else.

Thank you for your time.
God i was such a noob back then^