Welcome, Guest. Please login or register.
Kingdoms of Ahln
Pages: [1]
  Print  
Author Topic: Why won't this work?  (Read 1063 times)
Saffire
Citizen
***
Posts: 136


View Profile
« on: June 22, 2009, 01:59:45 pm »

Code:
!action
give
!test
event[:to] == self
!reaction
item = event[:item].downcase
"say #{item.name}"

For some reason the give action isn't firing at all, and I can't figure out why Sad
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #1 on: June 22, 2009, 02:25:52 pm »

event[:to] will be the actual text from the command. All events should be standardized so that event[:target] will be the receiver of the action, so use that instead. Or object_is_me? event which does the same thing.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #2 on: June 22, 2009, 07:09:26 pm »

It still doesn't work when I use object_is_me? event. I had originally used event[:to] because of this line in components/commandparser:

when /^give\s+((\w+\s*)*)\s+to\s+(\w+)/i
{ :action => :give, :item => $2.strip, :to => $3 }
« Last Edit: June 22, 2009, 07:11:29 pm by Saffire » Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #3 on: June 22, 2009, 07:41:35 pm »

Yes, but that is just the text. The event which is actually sent to the object will be from the Generic::give method, which will set event[:target].

However, looking at your reaction more closely, the problem is likely because you are doing item.name when item just a string from the command. So it is causing an error when it runs the reaction. If you watch the server's output while trying to get the object to react, you will (probably?) see the error message.

Which makes me think I should make it so those errors show up in the logs.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #4 on: June 22, 2009, 07:51:34 pm »

Hmm, you're right, of course Tongue

I'm hosting the server on another computer in the back room, so it's a bit of a pain to go and look at it, and I just took for granted that any pertinent debugging info would be sent to the logs, and that's what was throwing me off.

Thanks for the help, it's fixed now Smiley
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #5 on: June 22, 2009, 08:33:12 pm »

Okay, here is an update for logging reaction errors.

I'd also recommend adding this and removing this so that the logs displaying in the game are up-to-date.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #6 on: June 22, 2009, 08:54:11 pm »

All right, I've got the new code. I'll let you know if I find any problems.

And thanks for your help tonight.
Logged
Saffire
Citizen
***
Posts: 136


View Profile
« Reply #7 on: June 24, 2009, 07:49:23 pm »

Are you having problems with your message boards after these changes? For some reason after these changes when I try to save a message I've written on my message board it lags the MUD for 2 or 3 minutes and then it finally starts going again and posts the message. Any ideas?
Logged
Justin
Administrator
Citizen
*****
Posts: 189



View Profile
« Reply #8 on: June 24, 2009, 08:41:06 pm »

I'm not seeing that happen. Kind of hard to see why these changes would cause that...unless you are getting an error that causing a gigantic amount of logs (from the backtrace). I would check the server output directly.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2006-2009, Simple Machines
Terra97 design by Bloc