mob/verb/sheet()
world << "[usr] is makeing a new sheet"
sheet += new/obj/sheet
Thats the verb im using. It works fine but. How can I change the name of the sheet in that verb. Instead of making a change name verb?
ID:177016
![]() Nov 19 2002, 1:04 pm
|
|
That isn't what i meant.
I was wanting a text window to pop up and ask me what to name the sheet. hmm here is how the verb im using looks now mob/verb/sheet() var/promptbox = alert("Would you like to create a new sheet?","Create Sheet?","Yes","No") if(promptbox == "Yes") sheet += new/obj/Sheet world << "[usr] is creating a new sheet" if(promptbox == "No") ..() |
Jacob wrote:
That isn't what i meant. Ah, then you should have said so. This should work. Note, it's untested: mob/verb/sheet() Note, I used a switch statement, and removed the if("No") conditional, as it's uneeded here. You only want the code to execute if the user clicks "Yes", so that's the only condition you want to check for. Including an if("No") won't hurt, though. And you're still using usr where src is more appropriate. ~X |
usr is set equal to the LAST player to click the verb, yes. src, on the other hand is set to the actual player who clicked the verb. In some cases, you can get some strange bugs with usr in verbs, becuase someone else could call it, changing it to their verb. With src, you know that it's always the player that called the verb, not just the last one to do so.
~X |
Unless the verb is an object verb...
I could be wrong, but in an object verb, src seems to always be set to the object... Making usr the necessary thing to use to reference the player using the verb... I'm not sure if there's a way around this, but I've just gotten into the habit of always using usr in object verbs... |
I use usr in verbs that the player clicks. I think usr is set if the player themself chooses to use a verb (by clicking it).
|
Really? Hmm. Ah well. Guess I need to read LummoxJR's article on usr :P Pardon my confusion, hopefully it won't spread!
|
You better read that article you evil anti-usr person =P
btw, i have read that article well over 25 times |
OneFishDown wrote:
You better read that article you evil anti-usr person =P I'm curious, where can I find this article? |
Dream Tutor: usr Unfriendly by Lummox JR
http://www.byondscape.com/scape.dmb/content/000046/ index.html |
Well, usr should be src in this case, but to answer your question, sheet.name references the sheet's name variable, so doing sheet.name = "newname" should work.
mob/verb/sheet()
world << "[src] is makeing a new sheet"
sheet.name = "newname"
sheet += new/obj/sheet