ID:264193
 
Code:
mob/Trans
verb
Host_Class()
set category = "Trans Spells"
switch(input("Which year will you be teaching for this lesson?")in list("1st","2nd","3rd","4th","5th","6th","7th"))
if("1st")
class="1st"
if("2nd")
class="2nd"
if("3rd")
class="3rd"
if("4th")
class="4th"
if("5th")
class="5th"
if("6th")
class="6th"
if("7th")
class="7th"
for(var/turf/TransClass/T in world)
T.overlays += 'bluealert.dmi'
world<<"Attention all students in their [class] year! Proffessor [usr] is now hosting a [class] year Transfiguration class! The floor guidance is switched on, so follow it. You only have 5 minutes to get to class"
sleep(3000)
world<<"Proffessor [usr]'s [class] year Transfiguration class is now in session."
T.overlays -= 'bluealert.dmi'


Problem description: Well, the above verb should 'cause the designated turf to have an overlay, however no image appears when I do click it and go through the switch(input). I've even got the turf set to layer=999.

And if it helps, on the line after the switch(input) command it comes up with this: Programming\Teacher(Trans).dm:104::warning: empty switch statement.
not exacly sure i understand it but i think overlays have to be under procs instead of verbs
In response to William1of89
The only difference between a verb and proc is that a proc can be called at anytime once programmed as a proc, but a verb can only be called when the verb is used.
Demon_F0rce wrote:
Code:
>               T.overlays -=
'bluealert.dmi'




T.overlays.Add(icon('Hair.dmi',"long"))

maybe that would work and like i said before i wasnt sure i have jus always used procs :/
In response to William1of89
Not working, but I appreaciate your effort.
In response to Demon_F0rce
:( i tried
The usage of switch() is like this:
switch(2)
if(1) world << "ONE"
if(4) world << "FOUR"
if(2,3) world << "TWO or THREE"
if(5 to 10) world << "FIVE to TEN"
else world << "not ONE to TEN"

The if's and the else are indented inside the switch() proc.

You don't need the switch() proc anyway.
You could simply do this:
class = input("Which year will you be teaching for this lesson?")in list("1st","2nd","3rd","4th","5th","6th","7th")

In response to Jemai1
It got rid of the warning, but the overlays still aren't appearing.
You can't just add the DMI file directly to the overlays. You need to assign the DMI to an object first and assign that to the overlays.

mob/Trans
verb
Host_Class()
set category = "Trans Spells"
switch(input("Which year will you be teaching for this lesson?")in list("1st","2nd","3rd","4th","5th","6th","7th"))
if("1st")
class="1st"
if("2nd")
class="2nd"
if("3rd")
class="3rd"
if("4th")
class="4th"
if("5th")
class="5th"
if("6th")
class="6th"
if("7th")
class="7th"
for(var/turf/TransClass/T in world)
T.overlays += new/obj/BlueStuff
world<<"Attention all students in their [class] year! Proffessor [usr] is now hosting a [class] year Transfiguration class! The floor guidance is switched on, so follow it. You only have 5 minutes to get to class"
sleep(3000)
world<<"Proffessor [usr]'s [class] year Transfiguration class is now in session."
T.overlays -= new/obj/BlueStuff

obj
BlueStuff // <----- Made an Object that has the icon bluealert.dmi in it.
icon = 'bluealert.dmi'
In response to Zenglare
Ah, I see. This is the first time I've worked with overlays, so thanks for that.
Your problem is...

                sleep(3000)


that. When you sleep, you stop the proc and wait. View a loop as a monster destroying all the cities in the world. It destroys each separately, and when it sleeps, it takes huge breaks between going to the other cities to destroy them. You want spawn, in this case; spawn is like a branching off segment of your code. It will still wait, but it will continue looping, as well.

And you can add icon directly to the overlays, Zenglare =]. It just isn't as flexible.
In response to Jeff8500
I know the difference between spawn and sleep, I just always seem to use spawn in the wrong place and end up with what I want not happening so I tend to stray from using it. But thanks for telling me that.
In response to Demon_F0rce
You should only use spawn() if you want the proc to continue doing its thing, and sleep() should be used if you want to stop it completely.
In response to Jeff8500
Okay, thanks.