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


Joined: 24 Nov 2006
Posts: 17

PostPosted: Tue Jan 23, 2007 3:55 pm   

Converting custom function to CMUD
 
I have this function from ZMUD that I can't get to work in CMUD.

#func Targ($target) {%if( %len($target)=0 or %proper($target) = %left( @target, %len( $target)), @target, %exec( '#va target %proper($target);ass')$target)} targetinfo

I imagine part of it is the conversion of the $target (previously %1) within the %exec function, but I haven't be able to find a around that.
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Tue Jan 23, 2007 5:21 pm   
 
Further information:

Currently if I call the function from an alias it will attempt to call

Staffcast scintilla at @Targ(%1)

which results in this;

staffcast Scintilla at %exec( '#va target %proper($target);ass')$target
Reply with quote
Orfeo
Newbie


Joined: 23 Jan 2007
Posts: 7

PostPosted: Tue Jan 23, 2007 7:21 pm   
 
In both CMUD and ZMUD, the %exec function asks for quotes rather than apostrophes. It might not have mattered in ZMUD, but it's worth fixing to see if it'll work in CMUD.

Next: is ass an alias you have? I don't see how %exec is going to execute that as a command Question

Why not simplify and use an alias? This just looks like you're going a bit overboard to me for a scintilla. I might be missing what you're trying to do with the code, so feel free to punch me in the face.

(This post makes me feel nostalgic, I miss my scintilla.)

Code:
#ALIAS {staff} {#if (%1) {staffcast sctintilla at %1; #va target %1} {staffcast scintilla at @target}}
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Wed Jan 24, 2007 9:35 am   
 
The Targ function is used in nearly all my spells and attacks, it is designed to get some target information when a target is first selected, it also automatically sets a target variable to who I last attacked. The ass alias finds out their race and resists information and if they are in the room it also gets their health.

When I ported the function directly from zmud it was using the quotation marks but it still doesn't work in cmud. This is the line cut and paste from my working zmud system;

%if( %len( %1)=0 or %proper( %1) = %left( @target, %len( @target)), @target, %exec( "#va target %proper(%1);ass")%1)
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Wed Jan 24, 2007 5:44 pm   
 
I tried to work with this, but it seems to me that you've uncovered a bug or two. Obviously, the %exec isn't being called from the function expansion in the alias. I tried to force the expansion by putting {} around the @Targ(%1), but that gave the result of "staffcast scintilla at 60," which I presume is a stack address thing.
Reply with quote
Orfeo
Newbie


Joined: 23 Jan 2007
Posts: 7

PostPosted: Wed Jan 24, 2007 9:33 pm   
 
If you want the targ function in all your aliases, but can't get it to work, I'd just use what I posted and put it in every alias. It might make your aliases a bit larger, but it works. If you want your ass alias back (Should I be saying that like assess instead of ass?) just change it up to:

Code:
#ALIAS {staff} {#if (%1) {#if (%1 = @target) {staffcast scintilla at @target} {staffcast scintilla at %1;#va target %1;ass}} {staffcast scintilla at @target}}


type in staff. If you send in an argument (%1), it'll check to see if that's the current target. If it is, it just casts scintilla, if it's not, it'll cast it, set that to your new target and ass away. If there's no %1 argument it just casts it at @target.

Sorry, this still doesn't fix your current problem, but I think it's a solution you might want to consider. It's not nearly as versatile though Confused

Good luck!
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Thu Jan 25, 2007 8:03 am   
 
No, I guess I will give cmud a miss then.

I have already spent a couple of days rewriting stuff, holding off on implementing needed changes to my system and I can't really leave it any longer. I will try cmud again in a year or so, if I don't bite the bullet and rewrite completely for the apparently speedy mm2k.

Thanks for your help.
Reply with quote
Orfeo
Newbie


Joined: 23 Jan 2007
Posts: 7

PostPosted: Thu Jan 25, 2007 10:14 am   
 
I'm forcing myself to upgrade, I feel ya, Mozzie.

I'm having a lot of issues, so I'm just rewriting everything.

It's a pain, but hopefully it'll be worth it.
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Thu Jan 25, 2007 11:04 am   
 
No point waiting a year. 1.24 was the first public release and Zugg was expecting a host of bugs to be found since the number of users was going to rocket. Wait until the end of Feb if you're going to wait at all because I expect there'll be 1.25 at least released by then and bugs like you've found will be ironed out.
There are still plenty of things that annoy me about CMUD, but it's still enough of a step up that I can't go back to zMUD.
_________________
CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;)
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jan 25, 2007 3:39 pm   
 
And on the topic of speed, how much faster is mm2k compared to zMUD? Most scripts get about 50% speed increase over zMUD, I've seen. Very complicated ones can get as much as 90% faster.
_________________
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: Thu Jan 25, 2007 7:47 pm   
 
Correct me if I'm wrong, but I think the 50% to 90% faster that Fang is talking about is the speed of CMUD over zMUD.

I haven't played with mm2k in a while, but I was not at all impressed with it's speed back when I tried it. The old MudMaster client could scroll text faster than zMUD because it was a console-based text app instead of a graphical Windows app. When they went to MM2k (a graphical app), they lost that speed advantage. And there is no way scripts would be faster than CMUD if you use the features in CMUD such as local variables.

But back to the main poster's issue: I think the problem is that you are trying to implicitly concat the result of %exec with $target. You might just try using the explicit %concat function:

%concat( %exec( %concat( "#va target %proper(", $target, ");ass")), $target)

and yes, you need to use " quotes in CMUD, and not the ' single quotes.

In any case, this kind of "function" will be a lot easier once the new Function type is added to CMUD, which will allow you to write user-defined functions in a more traditional programming fashion (with return results, etc). Then you won't need to use the %exec trick.

But if you think advanced stuff like this is going to be any easier in any MUD client, then you are fooling yourself.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jan 25, 2007 8:12 pm   
 
Yes, I was talking about CMUD compared to zMUD. Sorry, I wasn't clear.

Basically, I'm thinking of the hassle of converting scripts to a new client (cmud versus mm2k) versus the payoff in terms of speed (which for cmud is practically a given).
_________________
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: Thu Jan 25, 2007 11:36 pm   
 
Yeah, I agree. And if someone is going to rewrite their zMUD scripts, it would be a *lot* easier to rewrite them into CMUD where at least it is *mostly* compatible with zMUD, rather than choosing a completely different client where they would need to rewrite everything completely from scratch and then hope that the other client had the features that they really needed. And after all of that work, they could easily end up with scripts that run a *lot* slower than CMUD...just because another web site *says* that their client is faster than zMUD doesn't make it true. People need to decide for themselves.

No other MUD client (that I'm aware of) is compiling their scripts. Some clients use the Microsoft Scripting engine (including zMUD!) which will sort of pre-compile scripts written in VBScript or JScript. That can make these scripts faster than normal zMUD scripts, but still not faster than CMUD scripts.

And I'd like to believe that the support that people get for zMUD and CMUD here (and via email) is a *lot* better than any kind of support you would get for any other MUD client. Nobody else has been doing this for 11 years like I have.

But, people will do whatever they want. And I know it can be frustrating for people who just want their scripts to work in CMUD *now* without any hassles or changes, and just don't want to wait for future features or bug fixes. Of course, they could just stick to zMUD if they wanted Wink
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jan 25, 2007 11:53 pm   
 
I talked to someone with an issue over Christmas that apparently took a while to be responded to, but I myself have had nothing but great support. I accidentally used up my half-price CMUD "credit" with an order that I didn't complete because my network went down - it took less than 12 hours for Chiara to restore it for me. I was dead chuffed.

I have to say, though, your response time on the forums (and that of the other people here) is great. Any problems I've had with scripting have been solved or confirmed damn fast.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Mozzie
Beginner


Joined: 24 Nov 2006
Posts: 17

PostPosted: Sat Jan 27, 2007 9:10 am   
 
Thanks for the assist Zugg, I was losing faith.

I have tried your suggested line but it is returning a syntax error, and unfortanately it seems the CTRL-K syntax checker is not available in the variable editor screen so I have had no luck narrowing down which bit is wrong. I am also not sure if the first %concat is correct.

Here is the entire of entry of my current attempt using your suggestion.

%if( %len($target)=0 or %proper($target) = %left( @target, %len( $target)), @target,%concat( %exec( %concat( "#va target %proper(", $target, ");ass")), $target))
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