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


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Fri Mar 30, 2007 5:55 pm   

Still learning, have a task but would like some support
 
The essential part of this is for me to get my hands into the code to get a better grasp on how it works. Having said that, I don't want "the answer" but I wouldn't mind incomplete examples broken down to show what it is doing.

This project I want to undertake would be to create a window with the title Online, and in that window display an up to date list of people who are online who are members of my clan or on my notify list. Both of those lists give me notification when someone logs on or off so I know I'll be using additem and delitem, but how to display it and keep it current? The commands and info I have to pull from are listed below.

Code:

[*]<644hp 625sp 630st>notify
 No.  Name          Status                            Idle
[--------------------------------------------------------------------------]
 1    Apple         Online                            Active
 2    Joe           Not Online                        Not Applicable
 3    Buddy         Not Online                        Not Applicable
 4    Nathan        Not Online                        Not Applicable
 5    Ravine        Not Online                        Not Applicable

[*]<644hp 625sp 630st> clan where
[Sam           ] [Winter Quarters               ] (Too far away to tell)
[Frodo         ] [Limbo                         ] (Too far away to tell)
[2] clan members located online.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Mar 30, 2007 8:28 pm   
 
This looks like a perfect example for using the Status window. Though I realize that you mentioned you want to make a separate window named online.
If you were NOT going to use the status window then you will need to use the #win command and the focus char which is :

#win Online
Creates the window

Online:#clr
Clears the window

Online:#say %expanddb(@Charsdb)
One example of how to display a database variable to that window.

So each time that the data changes you could send the clear and the show again to update the window.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Wyndle
Beginner


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Sat Mar 31, 2007 4:55 am   Now comes the thread hijack... wait, can you hijack your own thread?
 
I made a long alias that would get me from anywhere to a certain location. Problem is that now zMud is constantly sending movement commands (even offline, even with all included paths and the alias disabled).

This is the alias I set: cgohall
Code:

clan gohall
away Speedwalking like a mofo
#alarm +10 {.2s}
.halltorune1
#alarm +10 {.halltorune2}
#alarm +10 {.halltorune3}
#alarm +10 {.halltorune4}
#alarm +10 {..runen3}
#alarm +10 {..runen2}
#alarm +10 {..runen1}


When I looked at the debugger it keeps popping '..runen1' onto the stack (even disabled).

I really don't know if this can be fixed or if I'm going to be starting from scratch.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sat Mar 31, 2007 12:26 pm   
 
OI, looks like you got some erm, interestin, yea that's it interestin things going on here.

First answer YES you can hijack your own thread! About a month ago we were asked with help making a combat bot. It basically consisted of a back and forth conversation between him and me. Go have a look at that thread and you will see how bad things can get if you continue to ask new questions on different subjects.

I will let you search for it though, I will tell you his name starts with a P.

But wait there is More!

There are LOTS of good pieces of information in that thread that many people will likely over look because it is SO massive. ONE of which is an answer for another way to write the above code so that it is far less messy and doesn't keep going even when it is turned off.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Wyndle
Beginner


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Sat Mar 31, 2007 2:52 pm   
 
:p Ok, at least I have a clue of what to search for now. And since you state that you did post several times an easier way for me to find the thread is to look at your post history.

At least I managed to export my settings this time before deleting the character - now I can fix the error in notepad and then start anew.

Edit: When I went into the text file to edit I found an ALARM alias that did not have a + before the time increment. I don't remember setting this alias and it started right after I set up my alias. Once I removed this error and imported the text it all worked properly again. I have set each of the alarm times to be an appropriate increment longer than the previous so it works - it may not be pretty but it works.
Reply with quote
Wyndle
Beginner


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Sun Apr 01, 2007 12:10 am   Re: Now comes the thread hijack... wait, can you hijack your own thread?
 
Old:
Code:
clan gohall
away Speedwalking like a mofo
#alarm +10 {.2s}
.halltorune1
#alarm +10 {.halltorune2}
#alarm +10 {.halltorune3}
#alarm +10 {.halltorune4}
#alarm +10 {..runen3}
#alarm +10 {..runen2}
#alarm +10 {..runen1}


Now that I have a better understanding of how the alarm works I realize that this is not only extremely bad code, but it does not allow for any events (such as being attacked).

I redid all of the affected paths from begining to final destination so that they are both shorter and named the same plus sequential numbers. Now I'm trying to come up with a way to trigger them in sequence instead of using the #alarm. I know I'll have to create an int variable that will increment and use that variable to name the next path. The problem I'm having is how can I trigger the next in line efficiently. So far the only thing I've been able to do to verify that combat does not mess up my route is to use #slow (at 250 instead of 5000) combined with a trigger on combat to #stop and at end of combat #step. I can not think of a viable way to verify that I am in the intended room at the end of the #slow since they are all outdoors and many duplicates exist. Is there a way to verify that a walk command has completed as planned? I don't want to use #alarm for this since combat is a varied amount of time each time.

I know the below code could be incorrect but I'm writing it to try to show my train of thought so far:
Code:
#tr {begins attacking you!$} {#stop}
#tr {^You receive %d experience points.$} {#step}
#var LegOfTrip 0
#alias hall2rune {#if (@LegOfTrip = 0) {#var LegOfTrip 1};#slow h2rune@LegOfTrip}
#tr {need to find something to go here} {#if (@LegOfTrip > 9) {rest;#var LegOfTrip 0} {#add LegOfTrip 1;.h2rune@LegOfTrip}}

I know there is room for improvement, plus I still need a way to trigger the continuation of the walk. Needless to say, the path from start to end is much too far for a single path to be used speedwalking. The first leg of the path is the only part that I am at risk of being attacked, hence the speedwalk in the trigger instead of the initial #slow. I guess I could do a work around for now by creating a huge path and slow walking the entire distance for now.
Reply with quote
Wyndle
Beginner


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Fri Apr 06, 2007 8:02 pm   
 
Arminas wrote:
This looks like a perfect example for using the Status window. Though I realize that you mentioned you want to make a separate window named online.
Getting back to the original subject of the thread - my Who is Online Status. I've looked into #stwin and some of what can be passed to it, now comes the part of how to go from the mud output to keeping a current status. For the sake of simplicity I want to focus just on the notify list.
Code:
[*]<644hp 625sp 630st>notify
 No.  Name          Status                            Idle
[--------------------------------------------------------------------------]
 1    Apple         Online                            Active
 2    Joe           Not Online                        Not Applicable
 3    Buddy         Not Online                        Not Applicable
 4    Nathan        Not Online                        Not Applicable
 5    Ravine        Not Online                        Not Applicable
Using this I can figure out how to trigger to pull the online status of my list but I don't know what to feed that raw data to or how to retrieve it. I'm guessing that the list will wind up in an array and a series of IF checks will sort out what is what, but I've got a feeling there has to be an easier way. The clan where list seems like it will be slightly easier since the name only shows up if they are online. Both lists send unique output when someone logs in or out.

It also seems like once I have this part sorted out that displaying the end result to the status window will be easy.
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Fri Apr 06, 2007 9:20 pm   
 
Make a trigger that puts someone into a list variable that ONLY contains people who are online.

1 Apple Online Active

%d%s(%w)%sOnline%sActive

#additem notify %1

Then in the status window
%expandlist(@notify,%cr"Clan ")
Obviously you will need to play with this and make changes as appropriate.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Wyndle
Beginner


Joined: 28 Mar 2007
Posts: 20
Location: < here and there >

PostPosted: Mon Apr 09, 2007 3:59 pm   
 
Ok, I've been going over this in my mind for a little while and something is not quite clicking. I understand the trigger and barely understand the use of the %expandlist(), but the %cr"Clan " has me mystified. I have no clue what that part of the code is doing. It may help to keep it in the context of the %expandlist() but any way you could break it down would be appreciated.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Mon Apr 09, 2007 4:23 pm   
 
If you take a look at the help file you'll see that the %cr"Clan " part is the delimiter string. %cr is a carriage return, so if your list was item1|item2|item3, that %expandlist code will produce:

Clan item1
Clan item2
Clan item3
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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