Hey. I'm having trouble with making my signs display text that the user specifys when he/she creates the sign. I searched the forums for a similar problem and was so relived to find a post with my exact same problem. Except for the fact that when I used Sariat's code I get errors mid-game when i actually try to make the sign. Here is my code:
mob/verb/makeasign()
var/msg = input("Whats the thing say?") as message
var/obj/sign/T
new T(usr)
T.desc = msg
Obj
WoodenSign
icon = 'Objects.dmi'
icon_state = "1"
density = 1
Click()
usr << src.desc
Everything compiles just fine but after I type in what I want the sign to say (After i click makesign) I get the following errors:
runtime error: Cannot create objects of type null.
proc name: build (/mob/verb/build)
usr: (/mob/player)
src: (/mob/player)
call stack:
(/mob/player): build()
Anyone know how I can prevent this? Any help would be great. Thanx a lot!
ID:149106
![]() Jul 3 2002, 11:32 pm
|
|
![]() Jul 3 2002, 11:35 pm
|
|
Hey, Jolene. Thanx for the post but I still get the exact error that I used to. It's weird, I didn't get a new error or anything so the null didn't seem to make a difference. If anyone knows anything, it'd be really cool. Thanx again.
|
Thanks Nadrew, fixed that too, but still the same error mid-game.....hmmmm....I'm really stumped.....Does anyone know? Thanx.
|
You should also move the part where you set the desc var to before you create the sign (that's where your error is coming from) you're trying to append a var to something that no longer exsists (after you create it; it becomes it's own instance on the map in that case you'd have to loop over it with a for() loop and set it then).
|
"new T(usr)" tries to create a new datum of type T in usr.contents. T is null.
Replace it with T = new(usr.loc) That creates a new datum of T's type where the usr is standing and assigns it to the T var. |
Wow. After doing all those things, it finally works. Thanks a lot everyone! Woo! Been messin with that for hours now. Ahhhh, thanks again!
|
this is not working for me i have
mob/verb/makeasign() var/msg = input("Whats the thing say?") as null|text var/obj/sign/T T = new T(usr.loc) T.desc = msg Obj Sign icon = 'Turfs.dmi' icon_state = "sign" density = 1 Click() usr << src.desc and i get this Sign.dm:3: Inconsistent indentation. |
BYOND is very sensitive on how many tabs you make - it looks like there are too many tabs in the obj/sign... remove all of the spaces and use tab again... Or better yet, retype it all by hand, instead of copying and pasting. That should work.
splatty |