Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Mon Dec 03, 2007 1:13 am   

[2.14a Pro] #T+ and #T- not working in reference to an Event
 
Code:
<class name="Events" id="1108">
  <event event="Afflict" priority="2" name="EXN_Afflict_Event" id="1109">
    <value>#loop %numitems(%db(@Affliction_Key,%1)) {
#local $temp1
$temp1=%expand(~@%item(%db(@Affliction_Key,%1),%i)~_afflictions.Current_afflictions)
#addkey %item(%db(@Affliction_Key,%1),%i)~_Afflictions Current_afflictions %additem(%1,$temp1)
#T+ onPrompt_PlantAffscan
}</value>
  </event>
  <event event="onPrompt" priority="11100" name="onPrompt_PlantAffscan" enabled="false" id="1110"/>
  <event event="UnAfflict" priority="3" id="1412">
    <value>#loop %numitems(%db(@Affliction_Key,%1)) {
#local $temp1
$temp1=%expand(~@%item(%db(@Affliction_Key,%1),%i)~_afflictions.Current_afflictions)
#addkey %item(%db(@Affliction_Key,%1),%i)~_Afflictions Current_afflictions %delitem(%1,$temp1)
#T- onPrompt_PlantAffscan
}</value>
  </event>
</class>


Neither #T+ nor #T- onPrompt_PlantAffscan works when called from the other events, it does work from the command line
_________________
Achaea
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 03, 2007 5:01 am   
 
Firstly this is NOT confirmed events work fine with #T- #T+

There are things wrong here though.

Quote:
<event event="Afflict" priority="2" name="EXN_Afflict_Event" id="9">
<value>#loop %numitems(%db(@Affliction_Key,%1)) {
#local $temp1
$temp1=%expand(~@%item(%db(@Affliction_Key,%1),%i)~_afflictions.Current_afflictions)
#addkey %item(%db(@Affliction_Key,%1),%i)~_Afflictions Current_afflictions %additem(%1,$temp1)
#T+ onPrompt_PlantAffscan
}</value>
</event>


Note the two portions of code that I have in red above. This event can be called using Afflict and NOT using the name EXN_Afflict_Event

#RaiseEvent EXN_Afflict_Event
Will NOT work

#RaiseEvent Afflict
Will work if you place a key from the @Affliction_Key variable as a parameter

#RaiseEvent Afflict Prone
Will work if prone is one of your afflictions

There DOES appear to be a bug here however as the Name parameter is showing up in the Event: box and one would assume that they could use this value to #Raise the Event...

If you create the Event manually using the package editor then copy it then delete the original and paste it back in the ID is placed into the Event Box as in this example.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Mon Dec 03, 2007 5:34 am   
 
I'd like to make the point that what's not working is the fact that the events "Afflict" and "UnAfflict" which employ the code #T+ onPrompt_PlantAffscan and #T- onPrompt_PlantAffscan respectively are not properly processing this code.

When these events are #RAISEd they do not execute #T+ and #T- properly. It never works, whereas the rest of the code runs properly.

From the command line #T+ onPrompt_PlantAffscan and #T- onPrompt_PlantAffscan work as expected.
_________________
Achaea
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Dec 03, 2007 7:50 am   
 
I'm actually surprised that you can enable/disable onPrompt_PlantAffscan that way, since it's an event. A better way to do it, in my opinion, is to have a generic onPrompt event in a PlantScan class folder and turn the folder on/off as needed. Works great for my system, and you just need to fire an onPrompt event to call all your healing queues then.
Reply with quote
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Mon Dec 03, 2007 8:07 am   
 
Oh that's what I'm doing.
all my healing queues are onPrompt events, this one just has the name onPrompt_PlantAffscan and if all else fails I'll put it in it's own class. But the main thrust of this post is to point out that the code doesn't have consistent behaviour between command line entry and being called via the script.
_________________
Achaea
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 03, 2007 2:26 pm   
 
Taking into account what I mentioned above can anyone else confirm this failing?

It worked properly for me...
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Dec 03, 2007 6:38 pm   
 
#RAISEEVENT *only* works with the event name (Afflict in the above example) and *not* with the IDName (EXN_Afflict_Event in the above example). The ID name allows you to give a short name to a specific event handler, but it doesn't change the fact that the event handler is assigned to a specific *event* (Afflict). You can't just raise a single event handler...you can only raise an entire event (and run *all* handlers assigned to that event).

So, there isn't any bug with #RAISEEVENT here.

But I haven't been able to reproduce any problem with using #T- or #T+ in an event. What are "onPrompt_PlantAffscan" assigned to? Are these Class names, or other trigger names? Do they exist in some other window or package, or in the same window that the event is defined in? We would need to see more details about these other items to help more.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 03, 2007 6:47 pm   
 
Zugg did you see the problem I mentioned above?

If you create an event manually in the package editor and export them the event ID is shown in the Event box and the ID box is left blank upon re-importing the XML.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Dec 03, 2007 6:52 pm   
 
Quote:
If you create an event manually in the package editor and export them the event ID is shown in the Event box and the ID box is left blank upon re-importing the XML.

I missed that, and that's definitely a bug, so I've added it to the list. Thanks for pointing that out.
Reply with quote
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Mon Dec 03, 2007 8:09 pm   
 
Zugg wrote:
#RAISEEVENT *only* works with the event name (Afflict in the above example) and *not* with the IDName (EXN_Afflict_Event in the above example). The ID name allows you to give a short name to a specific event handler, but it doesn't change the fact that the event handler is assigned to a specific *event* (Afflict). You can't just raise a single event handler...you can only raise an entire event (and run *all* handlers assigned to that event).



So, there isn't any bug with #RAISEEVENT here.



But I haven't been able to reproduce any problem with using #T- or #T+ in an event. What are "onPrompt_PlantAffscan" assigned to? Are these Class names, or other trigger names? Do they exist in some other window or package, or in the same window that the event is defined in? We would need to see more details about these other items to help more.




Dear god I'm not even talking about #RAISEEVENT or #RAISE not working.

I never said they don't work, they're working fine and I know how to use them.



What I'm saying is this.

When the following code

"#T+ onPrompt_PlantAffscan"

appears in the event which has an ID of "EXN_Afflict_Event" and is an "Afflict" event and I enter

#RAISE Afflict Addiction

into the command line and onPrompt_PlantAffscan (which is in the same package and class as the other event, and has an ID of onPrompt_PlantAffscan and is and "onPrompt" event) is already disabled the event is not enabled.



When I enter the command

#T+ onPrompt_PlantAffscan

into the command line on it's own, onPrompt_PlantAffscan is enabled as expected, its not #RAISEd or anything like that, and I don't want it to be, it's just enabled.



Get it?!
_________________
Achaea
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Dec 03, 2007 8:21 pm   
 
Sorry for the confusion...the part of my response dealing with #RAISEEVENT was for Arminas.
Quote:
onPrompt_PlantAffscan (which is in the same package and class as the other event, and has an ID of onPrompt_PlantAffscan and is and "onPrompt" event)

That is the information that I needed. Could you go into the XML tab for the class that contains both events and copy/paste the XML code into your post. Put it within a [code] and [/code] tag so that the forum will display it properly.
Reply with quote
Vesence
Beginner


Joined: 12 Mar 2006
Posts: 22

PostPosted: Mon Dec 03, 2007 8:30 pm   
 
Code:
<class name="Events" id="1108">
  <event event="Afflict" priority="2" name="EXN_Afflict_Event" id="1109">
    <value>#loop %numitems(%db(@Affliction_Key,%1)) {
#local $temp1
$temp1=%expand(~@%item(%db(@Affliction_Key,%1),%i)~_afflictions.Current_afflictions)
#addkey %item(%db(@Affliction_Key,%1),%i)~_Afflictions Current_afflictions %additem(%1,$temp1)
#T+ onPrompt_PlantAffscan
#RAISE StatusUpdate
}</value>
  </event>
  <event event="onPrompt" priority="11100" name="onPrompt_PlantAffscan" enabled="false" id="1110"/>
  <event event="UnAfflict" priority="3" id="1412">
    <value>#loop %numitems(%db(@Affliction_Key,%1)) {
#local $temp1
$temp1=%expand(~@%item(%db(@Affliction_Key,%1),%i)~_afflictions.Current_afflictions)
#addkey %item(%db(@Affliction_Key,%1),%i)~_Afflictions Current_afflictions %delitem(%1,$temp1)
#T- onPrompt_PlantAffscan
#RAISE StatusUpdate
}</value>
  </event>
  <event event="StatusUpdate" priority="15110" id="1511">
    <value>#Var Status_Update %if(@Status_Update,0,1)</value>
  </event>
</class>


Here's the variable I use so you can do some testing.
Code:
<class name="Variables" id="919">
  <var name="Plant_Afflictions" type="Record" id="1400">Current_afflictions</var>
  <var name="Affliction_Key" type="Record" id="1401">Asthma|Impatience|Mercy|Dizziness|Thinblood|Masochism|Venom|Tied|Dementia|Enlightened|Deafness|Generosity|Madness|Shyness|Mangled_torso|Addiction=Plant|Stupidity|Confusion|Mindclamp|Anorexia|Justice|Sleep|Sprawl|Stuttering|Voyria|Impaled|Hallucinations|Deadening|Levitation|Vertigo|Haemophilia|Aeon|Damned|Epilepsy|Shivering|Blackout|Burning|Love|Transfixed|Agoraphobia="Plant|Focus"|Nausea|Fear|Manaleech|Broken_arm=Salve|Claustrophobia|Weakness|Blindness|Damaged_arm|Concussion|Lostbond|Paralyis|Clumsiness|Tranquility|Darkshade|Pacifism|Damaged_head|Frozen|Mangled_Right_arm|Broken_leg=Salve|Mangled_Left_Leg|Damaged_leg|Loneliness|Amnesia|Lethargy|Hellsight|Dissonance|Hypochondria|Lust|Webbed|Paranoia|Sensitivity|Hindrance|Mangled_Right_Leg|Disloyalty|Hypersomnia|Slickness|Unconsciousness|Recklessness|Healthleech|Damaged_torso|Roped</var>
  <var name="Focus_Afflictions" type="Record" id="1411">Current_Afflictions</var>
  <var name="Other_Afflictions" type="Record" id="1438">Current_afflictions</var>
</class>
_________________
Achaea
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net