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
Gatsby
Novice


Joined: 19 Dec 2006
Posts: 30

PostPosted: Mon Dec 19, 2011 10:44 pm   

question
 
In zmud i have an alias tfb argument
this does
unsmuggle bag
take argument from bag$
smuggle bag


In cmud it keeps on doing
unsmuggle bag argument
take argument from bag$
smuggle bag

Tried playing with %p
Reply with quote
Gatsby
Novice


Joined: 19 Dec 2006
Posts: 30

PostPosted: Mon Dec 19, 2011 10:47 pm   bah...
 
....
Tried playing with %params and #local, but nothing help?



Secondly, why is speedwalking about 3 times slower than on zmod? Way too slow, keep on getting no eq at all after boot.

Cheers
Gatsby
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Dec 19, 2011 10:53 pm   
 
The likely reason it seems slower is because all your scripts are written in ZMud-era script code. ZMud scripts are compatible with CMud, yes, but they will be very far from efficient.
_________________
EDIT: I didn't like my old signature
Reply with quote
Gatsby
Novice


Joined: 19 Dec 2006
Posts: 30

PostPosted: Mon Dec 19, 2011 11:06 pm   
 
Well, it doesnt seem slower, it is slower, and i'm just double clicking a room in another zone (admitted, there are 25000 rooms, and 100's of zones, but zmud had no problem), no scripting involved. I can actually almost follow reading the directions as they come on the screen.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Dec 19, 2011 11:16 pm   
 
My map is approaching 40k rooms, and it's as fast as can be.
_________________
EDIT: I didn't like my old signature
Reply with quote
Gatsby
Novice


Joined: 19 Dec 2006
Posts: 30

PostPosted: Mon Dec 19, 2011 11:30 pm   
 
Well, i'm getting rif of my old xp computer and bought a decent win7 one. So i hope that will solve those speed problems. (besides, it's kinda fun playing with non-omfg bs eq:). Still stuck on the first question tho. Any place i can get more info than in the help alias topic?
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Tue Dec 20, 2011 12:40 am   
 
I fail to see how the following wouldn't work:
Code:

<alias name="tfb" id="1127">
  <value>#IF (%numparam( ) > 0) {
  unsmuggle bag
  take $item from bag
  smuggle bag
  }</value>
  <arglist>$item</arglist>
</alias>

_________________
Sic itur ad astra.
Reply with quote
mikeC130
Apprentice


Joined: 03 Jul 2006
Posts: 110

PostPosted: Tue Dec 20, 2011 12:26 pm   
 
Not an expert at reading XML, but I think you need to add a command there to assign follow on text to the local variable $item, either as the first or second command of that alias. I also thought you had to define the local variable, but it seems to work fine without a #LOCAL command

$item = %params

addded as the first or second command in your if statement will get you everything following your alias name, so if you type "tfb big brown spider" you should get "take big brown spider from bag"

Mike
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 20, 2011 1:22 pm   
 
No, Anaristos' code should work fine without that, because it has "<arglist>$item</arglist>". This automatically sets the first parameter to the local variable $item. As an alternative, you could delete that part of the XML and add "$item = %1" as the first line of the value, but Anaristos' code should work.

In general, when creating local variables you do want a #LOCAL statement to define them. However, there are two situations where you don't have to. 1) If you set the value of the local variable before you use the local variable, it will automatically define the variable for you without the need of a #LOCAL statement. It is still good coding practice to use #LOCAL, because it avoids mistakes where you don't actually set a value in some situation. Using #LOCAL also makes clear what variables are being used in a script.

2) The other situation where you don't need a #LOCAL is what Anaristos is doing: setting an argument list for an alias. In this case, the local variables are automatically created. When doing this, you need to be aware of certain things. First, you should _not_ specify a variable in both an argument list and a #LOCAL. That can actually cause problems, because an argument local variable is treated special in Cmud. Second, as a result of that special treatment, you should not change the value of a variable specified as an alias argument. Instead, treat it as a static value. Strictlly speaking, it is not actually static; the Cmud syntax checker does allow you to change the value. But you should treat them just like %1, %2, etc. They are not intended to change, and forcing them to change may cause problems in the future.
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