TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

VARIABLE UPDATE Event

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Valenin



Joined: 18 Jan 2014
Posts: 8

PostPosted: Sat Jan 18, 2014 1:43 am    Post subject: VARIABLE UPDATE Event Reply with quote

Maybe it's just me, if so I apologize in advance.

I had some trouble getting the new VARIABLE UPDATE events in 2.01.0 working. The command "#EVENT {VARIABLE UPDATE} {#SHOWME {Foo.};};" results in the output "#EVENT {VARIABLE UPDATE} IS NOT AN EXISTING EVENT."

Eventually I tracked it back to the source. It looks like there were some dev/testing warts left in the release and removing them makes things appear to function as documented. The changes I found to work are as follows:

$ diff -r tt tt.fixed
diff -r tt/src/nest.c tt.fixed/src/nest.c
380c380
< check_all_events(root->ses, SUB_ARG, 1, 2, "VARIABLE UPDATE %s", name, name, arg2);
---
> check_all_events(root->ses, SUB_ARG, 1, 2, "VARIABLE UPDATE", name, name, arg2);
diff -r tt/src/tables.c tt.fixed/src/tables.c
849c849
< { "VARIABLE UPDATE ", "Triggers on a variable update." },
---
> { "VARIABLE UPDATE", "Triggers on a variable update." },

If these are unnecessary and I'm missing something set me straight. Otherwise, I thought you'd like to know.
Back to top
View user's profile Send private message
Valenin



Joined: 18 Jan 2014
Posts: 8

PostPosted: Sat Jan 18, 2014 2:42 am    Post subject: Reply with quote

Upon further inspection, it may be just me. I'd assumed the event was to trigger on a variable update and then it was my responsibility to decide in the handler what to do based on %0.

I hadn't thought of adding the variable name to 'watch' to the event name, and for anyone as confused as I was the following works:

#EVENT {VARIABLE UPDATE foo} {#SHOWME {Variable %0 updated from $%0 to %1.};};
#EVENT {VARIABLE UPDATE foo} HAS BEEN SET TO {#SHOWME {Variable %0 updated from $%0 to %1.};}.
#variable foo bar
Variable foo updated from blah to bar.
#OK. VARIABLE {foo} HAS BEEN SET TO {bar}.
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3796

PostPosted: Sat Jan 18, 2014 10:32 pm    Post subject: Reply with quote

I thought about a generic variable update event, but figured it'd be a waste of cpu power.

#help event hints at how to use the event, and others like it.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group