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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Mon Nov 03, 2003 5:15 pm   

Greeting Trigger and More!
 
Okay, I asked alittle while ago about how to get my greeting trigger to work, which you guys helped me with here: http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=13544

Now I'm toying with the idea of maybe setting up a variable to help make a check to see if the last person who logged in matches as the same person who logged in before so that instead of firing off a normal greet trigger, it would fire off a welcome back trigger instead. I've been messin with the variables but I can't seem to grasp exactly how to set this up. I know this will require at least 1 more additional trigger as well as some if statements in both probably. Any input would be greatly appreciated. :)
Reply with quote
hatespyware
Apprentice


Joined: 16 Dec 2002
Posts: 103

PostPosted: Mon Nov 03, 2003 9:30 pm   
 
Try storing a list of people you have already greeted. When a person enters, check to see if their name is in the list. Greet them appropriately, then add their name to the list if it is not already their. The help for additem and ismemeber would probably be useful.
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Wed Nov 05, 2003 2:29 am   
 
Thanks, I'll check out those helpfiles.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Nov 05, 2003 4:38 am   
 
Precisely as suggested by hatespyware

Trigger
Pattern: ^~[ INFO ~] (%w) has entered -+- Dark Haven -+-
Value: #IF ("%1" != %char) {#IF !(%ismember( %1, @greeted)) {#ADDI greeted {%1};#ALA +10 {ooc Hiya %1 :)}} {#ALA +10 {ooc Welcome back, %1}}}

Variable
Name: greeted
Default: %null
Use Default value checked
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Wed Nov 05, 2003 4:31 pm   
 
Thanks again Lightbulb, this'll help make my trigger a bit more life-like... :)
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Thu Nov 27, 2003 6:30 pm   
 
I know this topic was posted awhile ago, but I'm having some trouble again. I wanted to know if there was a way to delete the string list for the variable @greeted. With the current script givin, it would create a seperate variable also called @greeted in another folder with the additem command. What would happen is, the names of the people who logged in would be saved, and then everytime they'd login after that it would execute the wb message. Now this would be fine if everyone logged in 5 times a day, but some people on the list don't log for several days so its kinda awkward to give out the wb message when they do finally log back in. So other than deleting the extra variable, is there anything else I can do to maybe automatically nuke and recreate the variable when I log off?
Reply with quote
Toetag
Magician


Joined: 10 Oct 2000
Posts: 356
Location: USA

PostPosted: Fri Nov 28, 2003 3:40 pm   
 
why not reset the @greeted list at each login?

Trigger on something like:
Mud_Automater Just Logged In.

then command
#UNVAR greeted
#VAR greeted
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Fri Nov 28, 2003 4:00 pm   
 
even better than making a trigger, just add those 2 suggested commands from toetag to the system alias Atexit
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Nov 28, 2003 6:32 pm   
 
Set a default value for the variable and zMud will automatically reset the variable to that default value every time you connect or use the #RESET command.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Nov 28, 2003 6:38 pm   
 
As I originally suggested.
Variable
Name: greeted
Default: %null
Use Default value checked
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Mon Dec 01, 2003 11:03 pm   
 
When I have the box checked to Use Default Value, it never saves the names that logged in during the time I've been online during my session on the mud. Instead, it keeps the value as %null and never saves the names it encounters when people log onto the mud.
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Mon Dec 01, 2003 11:13 pm   
 
Oh and the other problem I'm having is that it keeps creating the variable @greeted in the first class folder I have for a totally different trigger set. It'll create a totally new variable and totally ignore the original @greeted that was created within the class folder I have specified for this trigger.
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Mon Dec 01, 2003 11:22 pm   
 
I tried changing the part where it says:
#ADDITEM greeted {%1} to #ADDITEM @greeted {%1} but it doesn't seem to add any values to the string list on that variable. And just using the original creates a completely new variable with the same name just in a different class folder.
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Mon Dec 01, 2003 11:29 pm   
 
If it has to create a new variable, is there any way to have the trigger specify the classfolder in which it's created?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 02, 2003 1:34 am   
 
quote:
So other than deleting the extra variable, is there anything else I can do to maybe automatically nuke and recreate the variable when I log off?

quote:
When I have the box checked to Use Default Value, it never saves the names that logged in during the time I've been online during my session on the mud.

Make up your mind which you want. You can either keep the list from one session to the next, or empty it and start over every session, but you can't do both simultaneously.

The correct syntax for #ADDITEM is varname, not @varname.
#ADDITEM greeted item adds the new item to @greeted.
#VAR greeted another puts "another" in @greeted.
#ADDITEM @greeted item adds the new item to the variable named in @greeted, which in this example would be @another.

I recommend against using the same name for another setting of the same type, particularly variables. The simplest and probably best solution is to change the variable name.
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Tue Dec 02, 2003 2:14 am   
 
#additem greeted doesn't even look at the fact that the variable @greeted was already created, therefore it creates another variable with same name in a different class folder. As a fix, I deleted the variable *I* created and left the one that the trigger created itself. Using the default with the current variable *DOES* reset the values of that variable back to the default. But why does it create a new variable, and create it in a different class folder which contains a completely different script to handle a completely different function? Why won't it simply create the variable in the classfolder that the trigger is in, or why won't it simply point to the variable I had created myself ORIGINALLY? :P I don't care which way its done, nuking the variable and recreating it is no problem, as well as setting the default. I just want the variable in the correct class folder. :P
Reply with quote
Mud_Automater
Beginner


Joined: 25 Aug 2003
Posts: 26

PostPosted: Tue Dec 02, 2003 2:17 am   
 
Actually nvm, I figured it out, all I had to do was move the variable that the trigger created into the correct classfolder and that seems to work. Thanks again for all your help guys, I really appreciate the input. :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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