change_door_state() //Close a door if it's open, open if it's closed
set src in view(1) //Must be within
if(density)
set name = "Open Door"
world << "You opened the door!"
density = 0
else
set name = "Close Door" //ERROR here
world << "You closed the door!"
density = 1
Problem description:
Hey guys. Got some downtime for my FINAL semester of college, and decided to check out BYOND again to see if it was still up and running, and after all these years, it was!
I decided to dive into the language, and now that I have 5 years of CS behind, I definitely understand the language a lot better than I did when I was 14, haha.
However, this is making me confused. I wanted a verb function that, depending on the door's density, would change names and do different things, like shutting and closing it. This gives me the error 26:error: =: conflicts with previous definition
Now, this totally could be because I just started an hour ago going through the DM Guide, but I don't understand why this doesn't work. It's not attempting to set the name to two different values at the same time. It's being set different when different conditions are met. While it'd be easy to just simply flip the density value with one function, I'd like to change the name and how it shows up in the menu to reflect this.
I'm sure this is an easy fix, but is there a way around this? Also, if anyone has an explanation on why something like this isn't allowed in BYOND, I'd love to hear it! Thanks guys!
You'll want to create two verbs and add/remove verbs from the src.verbs list.
Note: Untested code, but should be enough of an explanation.