17 Sep, 2010, thaolen wrote in the 1st comment:
Votes: 0
Hello, I'm attempting a trigger that removes an object from the game. The triggers type is drop.
However the trigger isn't working, even though the trigger is attached to a object. In this case, a staff.
drop staff
You drop Staff of Ages.

and nothing happens
There are no errors in the log or the output. So I'm assuming the code is correct, however something is missing from the code.
me.room.send(me + "dissolves after it is dropped.")
extract(me)


The code should dissolve a object, well remove one as it says above once attached to any object via a trigger
17 Sep, 2010, Rudha wrote in the 2nd comment:
Votes: 0
from mud import extract

^ You need that.

Maya/Rudha
17 Sep, 2010, thaolen wrote in the 3rd comment:
Votes: 0
thanks Rudha

import extract?
import mud?
17 Sep, 2010, Stendec wrote in the 4th comment:
Votes: 0
Rudha said:
from mud import extract

^ You need that.

No. You don't.

Restricted code (meaning, triggers) runs with pretty much anything you need already imported. It basically does:

from mud import *
from char import *
from room import *
from obj import *
from event import *
import random
For you, to keep triggers as clean as possible. Then, you've also got the restricted built-ins and exit(), which is just sys.exit().


Also, as we told you last night in #nakedmud, you can't concatenate an obj.Obj instance to a string. You need to be using:

me.room.send(me.name + " dissolves after it is dropped.")
extract(me)
18 Sep, 2010, thaolen wrote in the 5th comment:
Votes: 0
I was wondering when you guys would catch on, yeah you caught me, its Almark lol

well I have been doing my homework on Python anyway, so using from first is the way I should do it?

from mud import *?
18 Sep, 2010, Stendec wrote in the 6th comment:
Votes: 0
thaolen said:
so using from first is the way I should do it?

……
Stendec said:
No. You don't.
18 Sep, 2010, thaolen wrote in the 7th comment:
Votes: 0
Thanks
18 Sep, 2010, thaolen wrote in the 8th comment:
Votes: 0
me.room.send(me.send + "dissolves after it is dropped.")
extract(me)


Sorry about that I forgot the other code, I tried this last night with the me.send, and yielded no results had no error message.

But now I know I should have added a import. I guess that was self explainatory
18 Sep, 2010, Rudha wrote in the 9th comment:
Votes: 0
Just reread this and I have to say, as regards this:

thaolen said:
There are no errors in the log or the output.


That's pretty problematic. If the problem is as Stendec says it is (which is likely if the str conversion function for the class obj doesn't exist) the interpreter should be reporting a type incompatibility error. Something like "Can't concactrate Obj.Obj and string types." If it's not, then frankly it needs to.

Maya\Rudha
18 Sep, 2010, chrisd wrote in the 10th comment:
Votes: 0
thaolen said:
But now I know I should have added a import.

Stendec said:
No. You don't.


When people give you help, you should read what they fucking say. Go back and read this thread again and you will find that the problem is not that you are missing an import, but that you are trying to concatenate a function and a string which will not work.
18 Sep, 2010, Stendec wrote in the 11th comment:
Votes: 0
Rudha said:
That's pretty problematic. If the problem is as Stendec says it is (which is likely if the str conversion function for the class obj doesn't exist) the interpreter should be reporting a type incompatibility error. Something like "Can't concactrate Obj.Obj and string types." If it's not, then frankly it needs to.

NakedMud does log errors in trigger scripts. With an entry like:

NakedMud said:
[LOG: Script terminated with an error:
me.room.send(me + "dissolves after it is dropped.")
extract(me)


Traceback (most recent call last):
File "<string", line 3, in <module>
TypeError: unsupported operand type(s) for +: 'obj.Obj' and 'str'

]



thaolen said:
me.room.send(me.send + "dissolves after it is dropped.")
extract(me)


Sorry about that I forgot the other code, I tried this last night with the me.send, and yielded no results had no error message.

But now I know I should have added a import. I guess that was self explainatory

No, No, No!!

How did you screw up the example of doing it right I gave ear...? (And last night in IRC, for that matter.) It's me.name and not me.send … I don't even know where you got me.send. me.send doesn't exist at all, and it certainly doesn't belong there.

Also, do not have any import statements in your trigger. They are unnecessary. As I've said.
18 Sep, 2010, thaolen wrote in the 12th comment:
Votes: 0
at least I try

Stendec I got that from what I saw in Nakedmud channel lastnight, and I haven't entered a import statement, I'm just asking.

I understand I'm out

Thanks for the help all
18 Sep, 2010, chrisd wrote in the 13th comment:
Votes: 0
Here is the correct code for your trigger.

#nakedmud said:
05:28:04 <Stendec> me.room.send(me.name + " dissolves after it is dropped.")
extract(me)

05:28:51 <almark1> thanks Stendec


Stendec said:
me.room.send(me.name + " dissolves after it is dropped.")
extract(me)
18 Sep, 2010, Rudha wrote in the 14th comment:
Votes: 0
If it -is- reporting errors that you're not receiving, try making sure you're in the administrative usergroup: "wizard"/"admin", or "Immortal" in my mud. If it's not reporting errors - and I know for a fact that NakedMud has a tendancy to squelch some errors - then that's problematic. In the future, check the log file in ./logs/ as well; it will have all the errors caught and not supressed regardless of whether they were reported ingame or not.

As regards send: Me.send will exist if 'me' is a character object, but otherwise it won't. (This incidentally doesn't seem to differentiate between characters with and without attached sockets - the without cases can generate some obscure - and some not so obscure - errors.)

Send attempts to send a string TO something, what you're trying to do is get a string FROM something. The "obj", "char", and "room" classes you can get a string from by simply going me.name. Exits are a little trickier, if you want the direction; IIRC me.name maps to the name of the door. You have to get a direction from a room to get the actual exit name rather than the door.

Ah, and a note of caution: you may want to add some sanity checks to make sure things get properly taken care of when you're extracting objects from the world, especially characters, but also other objects.

Maya/Rudha
18 Sep, 2010, thaolen wrote in the 15th comment:
Votes: 0
Thanks chrisd and rudha, when I have some time I'll read this (throughly) and get back to you.

On a lighter note I don't have errors in the OLC editor and I check log and that too doesn't show them. however last night I had errors but that was before I changed it code to what it should be as you have said I should change
18 Sep, 2010, thaolen wrote in the 16th comment:
Votes: 0
Rudha, all I have is log/ directory

is there a hidden one or something? .log/


Ok I copied verbatium the code

[dissolve_drop@examples]
1) Name : Dissolve
2) Trigger type: drop (obj, room)
3) Script Code
me.room.send(me.name + " dissolves after it is dropped.")
extract(me)


I don't have one error for the me.room.send, in the log

my status inside of the mud is

human builder, player, scripter, admin, wizard

is immortal also available as you have said or is that just your mud that has that option?


ok… this is my staff that was edited with oedit
Current triggers:
dissolve_drop@examples

N) Add new trigger
D) Delete trigger


I honestly can't see what is wrong, the hours devoted to this should eventually yield results
18 Sep, 2010, chrisd wrote in the 17th comment:
Votes: 0
Quote
[dissolve_drop@examples]
1) Name : Dissolve Drop
2) Trigger type: drop (obj, room)
3) Script Code

me.room.send(me.name + " dissolves after it is dropped.")
extract(me)


Quote
[shirt@examples]
Current triggers:
dissolve_drop@examples

N) Add new trigger
D) Delete trigger


Quote
prompt> load obj shirt@examples
You create a shirt.

prompt> drop shirt
You drop a shirt.
a shirt dissolves after it is dropped.


The trigger works. You probably didn't reload the object after you attached the trigger to it.
18 Sep, 2010, thaolen wrote in the 18th comment:
Votes: 0
So that is how you create an object haha, and all this time I was doing it hard way.

Ok here is something that is odd, when I create set object with redit and R and add the object be in that room it doesn't work. When i used your load obj staff@examples It worked!

thanks I guess I needed to use load I didn't know about such a thing
18 Sep, 2010, chrisd wrote in the 19th comment:
Votes: 0
thaolen said:
So that is how you create an object haha, and all this time I was doing it hard way.

What is the "hard way"?

thaolen said:
Ok here is something that is odd, when I create set object with redit and R and add the object be in that room it doesn't work. When i used your load obj staff@examples It worked!

Whenever you change anything in the world you need to reload that thing. Just adding an object to a room's reset list won't make any difference if you don't then reset that room.
18 Sep, 2010, thaolen wrote in the 20th comment:
Votes: 0
Quote
chrisd:
Whenever you change anything in the world you need to reload that thing. Just adding an object to a room's reset list won't make any difference if you don't then reset that room.

Thanks chrisd, glad to know this, is this documented in the manual btw? Because I have read the OLC editor PDF I didn't see load.
Just glad to get this working
0.0/33