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
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Nov 25, 2001 9:23 am   

Bug? Triggers showing results in other windows
 
I've been trying to show the results of a trigger in another window for a while, and I think I need a little help.

What I am trying to do is show on the active window that my char is done trancing. I have a triggerset that trances until full and then turns off the trigger class that does so. On the command which also turns the trigger class off, I am trying to send to the active window "CharName is done trancing."

so far #all #show CharName is done trancing. works. But what I really want is for it to only show on my active window. The code that I have almost gotten to work is:

%curwin is the active window
/this is the command that executes when I am turning the class off/

What I need is a trigger that triggers off {(%w) is the active window} and shows, only on %1's window that I am done trancing.

I have just tried a lot of things that SHOULD have worked, and based on a few of the ways i did it, I think this might be a bug of some sort. You cannot seem to #show, #say, or #anything in a different window, because the # actually gets sent to the mud, unless you #all #show it. You cannot :charname: it either.

If there is a way to resolve this, please, enlighten me. If not, tho, let me know and I'll post a formal bug report.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Nov 25, 2001 4:53 pm   
 
Use the #ECHO command to sent text to the active window.

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Nov 25, 2001 6:21 pm   
 
#echo seems to work... but I am still having trouble setting up a script that will send an action based on %curwin to that window, since #, %, and @ have strange consequences when placed together. I have tried using #%curwin, along with the same statement with %curwin closed off in all manner of brackets. I have tried assigning %curwin to a variable and executing #@current_window, again with the variable enclosed, but none of them worked. I have also tried the same thing using : instead of #, same result.

Basically, what I had to do was to execute {@current_window #echo blah} with the trigger, and then create an alias for the name of the active window i would be sending to eg. #alias decantor :decantor:

This works, but I would really rather not create an aliasin every settings file i have for every single char I have.

Is there a simpler way? I sure hope so...
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Nov 25, 2001 9:06 pm   
 
I'm sure there is a simpeler way.....but I don't quite understand what you are trying to accomplish.

If you are trying to sent to the current active window that a certain character is doing something, then "#ECHO %char is doing blah" would work. If you are trying to refer to a variable with the name of a certain character, then @{%char} would do the trick. Could you please try to explain some more what exactly it is that you want?

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Nov 25, 2001 10:59 pm   
 
What I am trying to do is echo, in the window I am currently looking at, when a specific even happens in a different window.

For instance, lets say I have 3 windows open: Thief, Mage, and Cleric. Mage runs out of mana, and I execute an alias to turn on her auto-trance triggers. Since this takes a while, I go to another window and do other things. However, once she is done, I want a command to be sent to whichever window is currently active, saying that she is done. I have managed to do so in 2 ways, neither of which I really like. The first was to do #all #echo Mage is done trancing. I do not like this because I will probably think of other, more intricate and useful, situations to use this code, and I might want the action that occurs dependant on which character gets this command.

The other way that I managed to get this to work was the following:

#alias mage :mage:
#alias cleric :cleric:
#alias thief :thief:

#trigger {You gather mana from the cosmos} {#IF (@current_mana < @max_mana)
{
trance
}
{
#T- spam_trance
#var current_window %curwin
@current_window #echo %ansi( 23)Mage exits her trance.
}

Now, this does work. But it means that I have to create an alias for every single one of my characters... on every single one of them who trance to get mana.

#{%curwin} does not work
#{@current_window} does not work.

Baffled,
~~Dec
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Sun Nov 25, 2001 11:33 pm   
 
"#{%curwin} does not work"
"#{@current_window} does not work."

That is because there is no command aviable in zMUD with the name you are giving it, like #MAGE, #THIEF, etc.
The function %curwin in itself is a variable containing the name of the current window.

It seems to me like you're misunderstanding the use of #ECHO. The command #ECHO sends text to whatever window is active atm. So for instance, doing #ALL #ECHO is pointless, because it becomes the same as #ALL #SAY, which means it no longer sends to just the active, but to all windows. Doing :Mage: #ECHO is also pointless if the window "Mage" is the active one, because it was already going to send it to that window.

The line:
#ECHO %curwin exits her trance.

Makes the text "Mage exits her trance" be sent to whatever window is the active one, if the window that triggered it is called Mage, and "Cleric exits her trance" if that window was called cleric.

I hope this clarifies it a bit...

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Sun Nov 25, 2001 11:57 pm   
 
Indeed! #echo does work like this, which makes my specific example far easier! thanks!

But the reason that I am trying to code it the other way is so that I can send commands via the triggers to the active window.

Using #echo, I would have to have seperate triggers on all the windows which COULD be active, responding to the echoed text.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Nov 27, 2001 7:41 am   
 
Hmm, seems like I myself had misunderstood the true function of %curwin

Here's the real deal
%window: the name of the current window
%curwin: the name of the active window

So, all you have to do is put these in an #IF and you can #ECHO different texts corresponding to what window is active atm.

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Tue Nov 27, 2001 8:23 am   
 
I agree, but the problem lies in addressing the current window with anything but #echo.

For instance:
#{%curwin} say work, dagnabbit! does not work
if you make a variable based on %curwin,
#{@curwin} say work, dagnabbit! also does not work

The only way I have gotten around this is to create a variable for every character that could *possibly* be active based on the title of their window:
(e.g.)
#var thief :thief:
@thief say work, dagnabbit!

and it DOES work, but I happen to have a lot of characters who could possibly be active, and I would simply rather not go through them all and create a whole list of variable for every single one of my characters, simply to send a command to the active window.
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Nov 27, 2001 9:32 am   
 
"#{%curwin} say work, dagnabbit! does not work"

And why would you think that could work at all?
If the active window is called thief, then zMUD parses this into:

"#Thief say work, dagnabbit!"

And since there is no command called #Thief....

You could however do something like:

:%curwin: say work, dagnabbit

Which will send commands to the active window, or:

:%window: say work, dagnabbit

Which will send commands to the current window.

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Tue Nov 27, 2001 1:32 pm   
 
#thief would send the command to the window called 'thief'; it works the same as does :thief

However, :%curwin: doesn't work either. Nor does :{%curwin}:. nor does :[%curwin]:. nor does :<%curwin>:. Which has pretty much been the subject of this string from the very start ;)
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Nov 27, 2001 2:12 pm   
 
Okay, I must be stupid then, sorry. I didn't know about that #Thief thing, never thought it possible, but if you say so....Anyway, that :%curwin: works with me, I tested it. Don't know why it doesn't work for you though.

I'm out of ideas here, anyone else wanna give it a try?

Acaila
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Tue Nov 27, 2001 2:35 pm   
 
oh my god! it is I who is the stupid one. Since you said that it worked for you, I went back and retested it, and now it works ;) I must've typed it wrong before or something :( That will teach me to write pre-coffee scripts in the morning.

Sorry to have gone on and on about something that actually worked the way I was trying it in the beginning ;)
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Nov 27, 2001 4:28 pm   
 
Well, doh!

Grats though

Acaila
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