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
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 53

PostPosted: Tue Sep 04, 2012 4:49 am   

Basic Alias's for new CMUD users
 
In this case i am the new cmud user.

i have an alias from zmud that was:
"gfp" which would run "open pack;get %1 from pack;close pack"
so if i enter "gfp boot" i would get "open pack;get boot from pack;close pack"

if i run the exact same alias i get through cmud i get
"open pack boot;get boot from pack;close pack"

i also tried using the help files and ended up with the following xml

<alias name="gfp" autoappend="true" id="228">
<value>open pack;
get $target from pack;
close pack</value>
<arglist>$target</arglist>
</alias>

this ironically gives you the same error...help please.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Sep 04, 2012 11:39 am   
 
Take the autoappend out of your definition. It's a checkbox on the lower right corner of the Package Editor.
Reply with quote
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 53

PostPosted: Tue Sep 04, 2012 8:16 pm   
 
awesome, thanks! works like charm...
Reply with quote
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 53

PostPosted: Sat Sep 08, 2012 2:39 pm   another issue i am having
 
so i build something for getting through doors, not compact from what i see in the forums but it works, the problem is when i go to lead, directions becoming aliases does not happen. n s e w and so one just stay n s e w instead of becoming lead n, lease s etc...
the guts of the alias are below, i just havn't figured out a simple method for changing the %1 line on on its on to lead and back again...zmud wasn't as picky i guess

#var diamond {%1}
unlock %1 door with diamond key
open %1 door
%1
#if (@diamond = n) {
close s door
lock s door
lock s door with diamond key
}
#if (@diamond = s) {
close n door
lock n door
lock n door with diamond key
}
#if (@diamond = e) {
close w door
lock w door
lock w door with diamond key
}
#if (@diamond = w) {
close e door
lock e door
lock e door with diamond key
}
#if (@diamond = se) {
close nw door
lock nw door
lock nw door with diamond key
}
#if (@diamond = nw) {
close se door
lock se door
lock se door with diamond key
}
#if (@diamond = sw) {
close ne door
lock ne door
lock ne door with diamond key
}
#if (@diamond = ne) {
close sw door
lock sw door
lock sw door with diamond key
}
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Sun Sep 09, 2012 12:12 am   
 
You can't have %1 on a line by itself. It has to have a Cmud command in front of it. This is documented in the Changes For Zmud Users, but there's a lot there to absorb so it's easy to miss something small like this. In this case, you want:
Code:
#SEND %1


I don't see anything in there which even tries to change %1 to "lead" and back again, so I don't understand how this worked in Zmud. I assume that you have left out some other code.

[edit]By the way, each separate problem should have it's own thread, rather than reusing an old thread for a new problem. It makes it easier to track specific problems. It's not a big deal, but it does help.
Reply with quote
miegorengman
Wanderer


Joined: 05 Sep 2008
Posts: 53

PostPosted: Mon Sep 10, 2012 11:08 pm   thanks
 
i my solution suddenly came to me...
replace %1 with #if (@showleadonoff = ON) {lead %1} {%1}
might be some easier way to do it, but i have notice i normally build things big with extra pieces hanging off :P

and i will post sepperate posts for sep issues, thanks for the heads up :)
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Sep 11, 2012 2:24 am   
 
Ah, you didn't make clear that you were _seeking_ some way to make it change to "lead" and back again. The
way you phrased it, it sounded like this worked under Zmud and you were just trying to convert it to Cmud.

You still really ought to change that to:
Code:

#if (@showleadonoff = ON) {lead %1} {#SEND %1}

or even
Code:

#if (@showleadonoff = ON) {#SEND lead %1} {#SEND %1}

The #SEND command will specifically tell Cmud that this is a command for the mud, not a Cmud command.
It is not truly necessary in front of "lead", but it definitely ought to be used in front of "%1" when it is at
the beginning of a line. One of the significant changes in Cmud is that you should never start a command line
with a global variable or a function (basically, anything starting with % or @). Zmud allowed such syntax (Zmud
allowed a lot of things it shouldn't have), but it should be avoided in Cmud. It works in some cases in Cmud,
and doesn't work in others, and even in cases where it works now there is no guarantee that it will continue to
work in future versions. So, while it probably works in this case, you ought to get in the habit of avoiding
starting a command line with % or @.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Oct 06, 2012 8:49 am   
 
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="Go" copy="yes">
    <value>// Initiate directions
$dirs = "n=s|s=n|e=w|w=e|sw=ne|ne=sw|nw=se|se=nw"
// Get reverse direction
$revDirection = %db($dirs,$direction)
// Determine if leading or just traveling
$cmd = %if(@leading,%concat("lead ",$direction),$direction)
// Send commands to unlock and travel direction
#sendraw {unlock $direction door with diamond key}
#sendraw {open $direction door}
#sendraw {$cmd}
// Send commands to close and lock door that you traveled through
#sendraw {close $revDirection}
#sendraw {lock $revDirection door}
#sendraw {lock $revDirection door with diamond key}</value>
    <arglist>$direction</arglist>
  </alias>
  <alias name="LeadOff" copy="yes">
    <value>leading = 0</value>
  </alias>
  <alias name="LeadOn" copy="yes">
    <value>leading = 1</value>
  </alias>
  <var name="leading" copy="yes">0</var>
</cmud>
Reply with quote
Private
Adept


Joined: 10 Jan 2002
Posts: 264
Location: USA

PostPosted: Thu Oct 18, 2012 10:05 am   
 
tech i had that issue with a lot of my zmud2cmud stuff...

%1 blah... where %1 is a channel
channelblah... is what i'd get

%1%char(32)blah works as expected...
channel blah...
hadn't ever used the #SEND command... will play with it.
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