I am trying to make a game where at the beginning the player is asked what color of shirt and such he wants, The code compiles fine but does nothing in the actual game:
turf
grass
icon = 'grass.dmi'
obj
overlays
shirtred
icon = 'redshirt.dmi'
shirtdarkred
icon = 'darkredshirt.dmi'
mob
Login()
icon = 'ablanderbase.dmi'
loc = locate(world.maxx/2, world.maxy/2, 1)
switch(alert("what color shirt do you want?",,"red","darkred"))
if("red")
overlays+=new/obj/overlays/shirtred
if("darkred")
overlays-=new/obj/overlays/shirtdarkred
ID:155061
Sep 30 2011, 7:36 am
|
|
In response to A. Ness
|
|
A. Ness wrote:
And try usings: <code>src.overlays</code> and <code>src.loc=locate</code>, need to use <code>src</code>'s when your telling your code who you want the overlay to be attached to, and when telling who's being set to what loc, etc... Unlabeled vars are assumed to be src by the compiler. There is no need to actually type "src." in front of them, though it can make things easier to identify at a glance. |
In response to A. Ness
|
|
He's using switch properly, he's using alert to return a string then comparing the value in the if statements. In fact, it looks like everything he wrote should work, there may be an issue elsewhere, either in the code, or in the graphics.
|
In response to Megablaze
|
|
I don't understand, how could the problem reside elsewhere? The code is all there as he explained. He wants it to give him the choice between the two t-shirts, which it does. The only problem I see is in the switch(input part.
|
In response to Robertbanks2
|
|
Thanks, I never really knew that because I've always labeled my predefined procedures with a <code>src</code> or <code>usr</code> depending on what it was under.
|
As for your problem.
When using a switch(input, you'll want to write it out like so:
And try usings: <code>src.overlays</code> and <code>src.loc=locate</code>, need to use <code>src</code>'s when your telling your code who you want the overlay to be attached to, and when telling who's being set to what loc, etc...