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
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Thu Sep 04, 2008 6:57 pm   

Newbie question - session based triggers
 
Hi all, and thanks in advance for any help.

I'm running zMUD 7.21, and I'm trying to figure out the best way to do something.

I have written a set of scripts for one character to auto-practice spells.

Here is a list of what I'm using now.

variables
........@spell = haste
........@action = cast '<@spell>'
........@prac = 1 (this is just a holder variable for a later trigger)
aliases
........my_practice_script = wake;eat bread;drink skin;#12 {<@action>};sleep;practice
triggers
........@spell%s&%d{prac}~%* sends title is practicing '<@spell>' - %1~% (AFK)

I run the timer, and call my_practice_script on the tick, and just let it run itself.

This works well for one character. So I started another character, and wanted to do it there as well,
but didn't want to create @spell_1, @action_1, @prac_1, etc.

It made sense to me that classes would be the way to go, so I created a class for each character, with
a different practice script for the new character.

I'd like to load a class based on which character I start running. I see that is available from %window.
So I could code one generic set of scripts/triggers, and logically figure out which character is running,
but that doesn't seem quite right.

I think I'd just like to load the particular class when I open the particular character, but I don't see how
to do that. The mud doesn't recognize me by name when I start it, so I can't trigger off of that. I'm not
sure where to go from here. Any suggestions would be most welcome.

Thanks again for any assistance.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4686
Location: Pensacola, FL, USA

PostPosted: Thu Sep 04, 2008 7:28 pm   
 
i believe zMUD uses %char as well.
Its a predefined variable thats supposed to hold your charecter name.
So you just need to test off of it.
_________________
Discord: Shalimarwildcat
Reply with quote
thomaspepon
Beginner


Joined: 04 Sep 2008
Posts: 16

PostPosted: Thu Sep 04, 2008 9:07 pm   
 
Thanks Shalimar, I'm going to implement it that way for now,
but I get the feeling that there is a better way to handle it.

I'm looking for an improvement over copy/pasting if statements
to handle multiple characters. Sure it works, and I've always been
about functionality before aesthetics, but it seems like there is a
more concise way to handle it.
Reply with quote
Rappy
Wanderer


Joined: 15 Jul 2005
Posts: 96

PostPosted: Thu Sep 04, 2008 9:40 pm   
 
I had the same problem with one of my scripts, I use #PICK at the beginning to set @nick variable, but you can use %char as shalimar suggested.

Check http://forums.zuggsoft.com/forums/viewtopic.php?t=30761&highlight= to see the results of what I ended up doing to implement this, it may be an alternative for you as well.

-Rappy
_________________
Windows 11 Pro,
cMUD 3.34
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