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


Joined: 01 Sep 2005
Posts: 120

PostPosted: Fri May 25, 2007 6:37 pm   

Read Variable Off Another Session
 
I'm quite sure the below worked before, not sure why it is not working in CMUD.

:SES2: Follow @SES1.Member1

Anyway the intention is for my player is SES2 window to follow @Member1 specificed in SES1.

Please help.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon May 28, 2007 6:05 pm   
 
You have to put the variable into a shared module now. That old zMud syntax is no longer supported. Also there is a //module/variable syntax now.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: Tue May 29, 2007 4:13 pm   
 
ermm..

shared Module?? How to use that??

No idea how to use that...

zmud seems easier for a noob like me
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Tue May 29, 2007 4:49 pm   
 
I'd hope that the intention would be to make you less-newbish by posting this thread :)

First, I'm going to ask if you're sure you're talking about the right thing. Sessions and windows are different things in CMUD, but it's hard to tell just by looking at the screen. The easiest way to tell is that if you're dealing with two sessions, you have to open one on the Session select dialog that pops up when CMUD starts, and then press the sessions button to open the dialog again and then choose another session to open (you can also use the drop-down menu from the Sessions button).

You generally use two sessions if you're multiplaying on one MUD or if you're playing more than one MUD at the same time.

If you're dealing with two windows, you only need to click on one session icon, and if you click Settings, you'll see two window objects in the tree view part (they're easy to spot, their icon is a window).

You generally use more than one window when you want more than one window on the screen (for things like channel capture) but you only want one to receive MUD output.

Depending on whether you're dealing with two windows or two sessions, you have very different approaches to sharing variables between them:

1) If you have two windows:
a) Open the package editor by clicking the Settings button on the toolbar.
b) Choose New... Module. Name the module that results.
c) Create any variables (and any other settings, like triggers or aliases) you want to share between windows inside this module, or drag or cut+paste them from another window. Make sure you don't have variables with that name inside the windows still - when a script runs from inside a window it checks the current window first, and it'll never see the shared variable inside the module.

2) If you have two sessions:
a) With only one session open, open the package editor by clicking the Settings button on the toolbar.
b) Chose File-> New package. Give the new package a name and a new tab will appear in the package editor. The new package should have a globally-shared module inside it (the yellow pill-like icon will have a blue arrow on it). This means that windows and other settings outside that package can see what's inside it - normally, packages can't interact with each other.
c) Create or drag or cut+paste anything you want to share between your sessions inside the module on this new tab.
d) Close the session. Find the other session, the one that wasn't open when you created your package earlier.
f) Right-click its icon and chose Edit Session. On the Package Files tab, there are two small boxes (Filename and Layout) and a large box.
g) Click the plus icon next to the large box. In the list of .pkg files that appears, there should be one with the same name as the one you created. Open that package, and it should be added to the list of packages in the large box.
i) Save the changes to the session.

Now if you open both sessions, you should be able to refer to variables in the global module from both windows. Make sure you don't have settings with the same name in the module and the window, or only those in the window will be picked up when you run your aliases and so on. If you need to refer to a specific variable, use the syntax @//moduleorwindowname/classname/varname.
Reply with quote
Zugg
MASTER


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

PostPosted: Tue May 29, 2007 7:24 pm   
 
I think I can make this even easier. The proper command syntax in CMUD for what you want is:
Code:
:SES2:Follow @//SES1/Member1

The syntax from zMUD of session.variable isn't supported in CMUD, which has the new syntax of //session/variable as several people have mentioned. The reason for this change is that it makes it treats a session just like a "super folder" so that you don't have to learn two different syntaxes for referencing stuff.

One important thing to mention is be sure there is *no space* between the : and the "Follow" command.
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: Wed May 30, 2007 4:47 pm   
 
Thanks!

Although Zugg answer was easier, I want to tank Fang Xianfu especially for that detailed explanation.

Enlightened me alot about Cmud.

Thanks!
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: Fri Jun 01, 2007 7:07 pm   
 
Opsps

How can I make SES1 as a variable also?

:@SES2:Follow @//SES1/Member1

":@SES2:" does seem to work...
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Jun 01, 2007 7:29 pm   
 
Unfortunately, it's one of the limitations of CMUD's use of the : syntax. You can't do that sort of thing from the command line - you need to use the #exec command:

#exec :@SES2:Follow @//SES1/Member1
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ToyMage
Apprentice


Joined: 01 Sep 2005
Posts: 120

PostPosted: Sat Jun 02, 2007 11:17 am   
 
I'm not using off the command line.

I'm putting in as a Alias.

It doesn't seem to work.
Reply with quote
Zugg
MASTER


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

PostPosted: Sat Jun 02, 2007 5:04 pm   
 
Fang forgot the {} around the argument for #EXEC. And you should probably use %concat to get everything parsed correctly. Try:

#exec {%concat(":",@SES2,":Follow ",@//SES1/Member1)}

I'll see if I can add support for variables in the session specifier in a future version.
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