ID:138867
 
Code:
proc/set_obj_desc(obj/fountain,desc = "Drink water from fountains to restore health")
fountain.desc = desc
world << "Drink water from fountains to restore health."

obj
fountain
icon = 'fountain.dmi'
name = "stone fountain"
density = 1

/proc/set_obj_desc
world <<"Drink water from fountains to restore health"
mob
var
set_obj_desc = /proc/set_obj_desc
verb
call_set_obj_desc()
call(set_obj_desc)("Drink water from fountains to restore health")


Problem description:
I have worked on this all day and finally got it in a form the compiler would accept. I no longer get an error message so I assume that it is good code. What I want to do is disply the text listed whenever a player mouses over a fountain in the game. I tried to do this with mouse entered but it always told me I could not put a proc inside another proc and the usr << was undefined. Since I need to learn procs I started messing with this and I think I am almost there but I still get no response when I run the code.
Thanks
SD

The thing that you want is the fountain's <code>desc</code> showing in the status bar- at the bottom of the dream seeker window when hovering over it?
In response to Neimo
That would work as well Neimo but I would really like it to display in the vicinty of the icon itself on the game screen.
In response to Spindraft
So you want hovering text(like text under your name) when you're hovering over the fountain? Please go a bit more in depth, I'm a tad slow.
In response to Neimo
Sorry, yeah I want the text desc, name, istructions or other info that I desire to display at the icon when the player hovers the mouse over the icon.
In response to Spindraft
You should look up MouseEntered() and some of the screen text libraries. Those two should encompass everything you need to handle on-screen tooltips.
In response to Robertbanks2
OK, I finally figure out how to input MouseEntered() without it invalidating whatever line of code came next. This is what I have and it actually produces resuls in game in the form of a verb command window. Problem one is the verb is named call_set_obj_desc and I want the user to see something else. I tried to re-neme it in various paces and always get the response "bad input" or something similar to that. Second problem is when I clck on the verb I get a run time error message which is copied here directly following the code. I am reading the guides trying to figure this out but can't seem to get it all tied together.

proc/set_obj_desc(obj/fountain,desc = "Drink water from fountains to restore health")
fountain.desc = desc
usr << "Drink water from fountains to restore health."


proc/MouseEntered(fountain)
/proc/set_obj_desc
usr <<"Drink water from fountains to restore health"

mob
var
set_obj_desc = /proc/set_obj_desc
verb
call_set_obj_desc()
call(set_obj_desc)("Drink water from fountains to restore health")


runtime error: Cannot modify Drink water from fountains to restore health.desc.
proc name: set obj desc (/proc/set_obj_desc)
usr: Spindraft (/mob)
src: null
call stack:
set obj desc("Drink water from fountains to ...", "Drink water from fountains to ...")
Spindraft (/mob): call set obj desc()
In response to Spindraft
1. Use the dm tags when posting code.

2. You don't need to use call in the first place, as there aren't multiple different procs that could be run for that purpose. Just use set_obj_desc(fountain reference, text).

3. If you insist on using call, don't bother saving the proc into a var at compile and then using that to call the proc, just put the proc in like so: call(proc path)(arg1,arg2,etc).

4. With call()(), you need to make sure that your arguments are in the right order. You're sending a text message as the first argument, which is being typecasted into an obj/fountain and then having its non-existent desc var changed to null.

5. This code is incredibly redundant, you have the same line of text in at least 4 places that I can see, and you also have it saved to a variable.
In response to Robertbanks2
Code:
proc/set_obj_desc(fountain = "Drink water from fountains to restore health")

proc/MouseEntered(fountain)
/proc/set_obj_desc




Problem description:
I appreciate the thorough critique. I am new to code so I have a definite learning curve to deal with. The way I wrote it was exactly like the DM Guide described it. I have figured out that you have to be more creative when writing code than just following a guide book. I will get better as I go. I trimmed it down to the basics but get no response at all in run time.
I just want the instructions to appear when a player scrolls over a fountain.