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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
farlcow
Newbie


Joined: 27 Feb 2007
Posts: 5

PostPosted: Tue Feb 27, 2007 4:25 am   

2 CMUD Questions - Session windows and module scope
 
Have just started making the conversion from zMUD to cMUD and I have a couple questions:

1) I have a session set up with 2 windows defined. When I double click on the session one of the windows comes up only and doesn't connect to the mud. If I tell it to open a new session (the same one) then both windows come up and the second connects to the mud (at this point I have 2 of the first windows open, neither connects, and 1 of the 2nd connected). Is there a way to have both windows open when I initially launch the session and have both connect to the mud?

2) I am in the process of understanding windows, classes, modules, and packages. I have created a set of aliases and triggers (the triggers are in a class) and placed them under a module (called buff). This seems to have created a buff.pkg. I have told my session to include buff.pkg and this seemed to give both windows (my 2 characters) access to the aliases and triggers.

My problem is, the main buff alias queues the buff spells to a list that I want stored as a variable for the character who called it. That doesn't seem to be happening. Say I have 2 characters: "john" and "bill" and I do this with john:

:bill:buff john
buff

What I would like to have happen is bill calls the buff alias which queues the spells his class has and casts them on john. At the same time john also calls the buff alias which queues his class's spells into his own queue and casts them on himself. What seems to be happening is all spells seem to be queueing on one list and the triggers (which are defined in the buff module) are turned on and off with #T+ and #T-, but it seems each character doesn't have their own instance of the triggers. So when bill turns on the triggers and john turns them off it messes up bill.

So I quess my question here is, am I looking at the idea of a "module" wrong? I want a session with 2 windows for my 2 characters. I want both characters to have access to the aliases and triggers defined in the "buff" module but I want each character to have their own instance of that module, and any variables created by those aliases or triggers are variables that exists only in the scope of that character.

Is this possible and if so how?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Feb 27, 2007 6:31 am   
 
I don't multiplay so I can't speak to the module multi-session stuff, but for your window problem make sure both windows are set to "Use Main Session Network Connection".
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue Feb 27, 2007 10:34 am   
 
1) Opening the same session more than once has problems that're fixed in the next version.

2) "placed them under a module (called buff). This seems to have created a buff.pkg"

It shouldn't have. I'm sure you're aware that each package corresponds to a tab in the settings editor - it's entirely possible to create a module in the same package that you have your windows. Just go onto the tab for the package that contains the windows and click New... -> Module. No new .pkg required.

The current class/module when you run an alias is set to the class that contains the alias, that's why it's creating the variable in the module rather than in the window that called the alias. You have a couple of options - in the new version, you can keep your "buff" module in a separate package and mark that package as not shared. This'll create two instances of the package, one for each character, allowing them to have their own buff queue. For now, you could work around it by naming each character's window after that character and using the %char variable to refer specifically to that window.
Reply with quote
farlcow
Newbie


Joined: 27 Feb 2007
Posts: 5

PostPosted: Tue Feb 27, 2007 3:42 pm   
 
Excellent, thanks for the help. Is the new version a version of cmud that has not yet been released?

Also, using the %char variable I can dynamically create the queue variable that I need, so that should fix that problem. In order to be able to turn on and off the shared class of triggers would I need to replicate that class under each window?
Reply with quote
farlcow
Newbie


Joined: 27 Feb 2007
Posts: 5

PostPosted: Wed Feb 28, 2007 2:51 pm   
 
Well, I've made some fixes and have run into new problems. First, if I replicate the trigger class to each window it seems both characters can turn them on and off independently. This isn't ideal but it seems to work. Eventually it would be nice to have each window have its own instance of the shared module.

What I'm really having a problem with is variables. By %char I assumed you meant %window. This would work except for in the example I gave. If I do:

:bill:buff joe

Then when bill calls the buff alias the %window call will return "joe" because joe is the currently focused window. There seems to be no way of getting the name of the window the script is being run from. I was able to work around this (again, not ideal) by having a variable in each window containing the character's name. So, instead of just using "BuffQueue" I'll call:

%concat(@CharName, "BuffQueue")

The problem I then run in to is when I call aliases from the module. An window alias using the above call will return "billBuffQueue", though a module alias will simply return "BuffQueue", since no @CharName variable exists in the module. I have not been able to find a way to reference windows variables in the shared module.

Also, on an unrelated note, I seem to be having a hard time using the tick timer while multiplaying. It works find on one character but doesn't start on the second. I click the start button and the timer doesn't do anything.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Feb 28, 2007 3:05 pm   
 
Do you have these two windows as part of the same session, or are they two different sessions open at the same time (or the same session opened twice)? If you give each character its own session and use the autologin feature, %char will contain the name of that character. This is the prescribed way of multiplaying, but it's bugged at the moment. New version is most likely going to be out by the end of the week - read the blog posts :)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
farlcow
Newbie


Joined: 27 Feb 2007
Posts: 5

PostPosted: Wed Feb 28, 2007 7:27 pm   
 
If I set up 2 sessions should I then move my module code into a package? Is it possible to share a module between 2 sessions?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Feb 28, 2007 7:44 pm   
 
Each session will have a package with it that holds the window and other settings for that session. You can either paste the module into that package, or you can create a separate package and add it to the list of packages for both sessions. In the new version you can also mark it as shared or not shared - shared packages will only be loaded once and used by both sessions, non-shared packages will be loaded twice. I think the second will be what you want.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
farlcow
Newbie


Joined: 27 Feb 2007
Posts: 5

PostPosted: Wed Feb 28, 2007 8:15 pm   
 
Excellent, thanks! Where do I find the blog posts regarding the new version? The Zugg blog seems to be outdated.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Feb 28, 2007 8:19 pm   
 
The latest two threads, bug fixing and real life, are both about the next version. Zugg replies to the blog threads with extra updates - if you scroll down on the forums front page, at the bottom, there's a link to the Blog forum where you can see the blog posts in thread form.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Feb 28, 2007 9:59 pm   
 
Or, just select "Zugg's Blog" from the Forums menu along the top of any page on this web site.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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