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
antsr
Newbie


Joined: 14 Feb 2012
Posts: 6

PostPosted: Wed Feb 15, 2012 2:45 am   

My client is running slowly
 
My Cmud is running so choppy slow. Is it possible i've loaded to much scripts and pkgs that it's running slowly? Is there something that can be done to speed it up?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Wed Feb 15, 2012 2:52 am   
 
It's far more likely you have badly-written scripts, particularly if there are any from ZMud.
_________________
EDIT: I didn't like my old signature
Reply with quote
antsr
Newbie


Joined: 14 Feb 2012
Posts: 6

PostPosted: Wed Feb 15, 2012 5:25 am   
 
ok so it's some bad scripts i wrote apparently.


Antsr leaves west.
Antsr leaves west, riding a warhorse.

What i've come up with is:

%1 leaves west.
#SUB %1 leaves <<WEST<<

%1 leaves west riding a %2
#SUB %1 leaves <<WEST<< riding a %2

Now i'd also like to color these white.
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Wed Feb 15, 2012 6:11 am   
 
this is how i would do the scripts may not be the best way but im lazy

^(%w) leaves ({north|east|south|west}).
#sub %1 leaves <<%2<<
#cw white

you can make it more complex by adding an if check to change the directions of the arrows if you want

second

^(%w) leaves ({north|east|south|west}) riding a (%w)
#sub %1 leaves <<%2<< riding a %3
#cw white

again can be made more complex by adding if checks, also the %w looks for one word mounts so something like war horse, would not be caught, if the mud has stuff like that, i would change the %w for the mount to a *
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
antsr
Newbie


Joined: 14 Feb 2012
Posts: 6

PostPosted: Wed Feb 15, 2012 5:02 pm   
 
ok that's cool, now im a little confused on the "if" commands yet. Haven't been able to figure it out. Also why the ^ in front of the command line, what does that do? I'm a learning here so thank you all for taking some time to help me learn some of this.

#IF (expression) {true-command} {false-command}

#IF (%1) leaves({north|east|south|west}) riding a (%w)({^^NORTH^^|>>EAST>>|vvSOUTHvv|<<WEST<<|}

IDK I'm just taking a stab in the dark.. Looking back at my scripts, understanding this will help a lot with some of the others like my tracking script.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Feb 15, 2012 5:39 pm   
 
"^(%w) leaves ({north|east|south|west})." was supposed to be the pattern for the trigger. The other lines were supposed to be the commands executed by the trigger. In a trigger pattern, ^ stands for the beginning of the line. There is no #IF involved here.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Feb 15, 2012 5:54 pm   
 
You hadn't made it clear before that you wanted the direction of the arrows to depend on what the direction was.

Hadar suggested two triggers, but didn't include any way to change the direction of the arrows. Here is how I would do it, with just one trigger. The trigger pattern would be:
Code:
^(%w leaves) ({north|east|south|west})(*)

I will use MXP to produce the colors, rather than the #CW command, and I will color only the arrows and direction. Here is the code to be executed by the trigger:
Code:

#LOCAL $arrows
#SWITCH (%2)
  (north) {$arrows = "^^"}
  (east) {$arrows = ">>"}
  (south) {$arrows = "VV"}
  (west) {$arrows = "<<"}

#SUB {%1 <c white>$arrows%2$arrows</c>%3</c>}
Reply with quote
antsr
Newbie


Joined: 14 Feb 2012
Posts: 6

PostPosted: Wed Feb 15, 2012 7:13 pm   
 
OK I'm totally confused.. I'm sorry I'm really trying to learn here and not just ask for a script handout. I've got some other ones that could be streamlined if I just could understand this.

What i'm ultimately trying to do is change this:

Antsr leaves (direction).
and
Antsr leaves (direction) riding a (horse)

into
Antsr leaves <<EAST<<
and
Antsr leaves <<EAST<< riding a (horse)

want it for all directions with corisponding arrows..
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Wed Feb 15, 2012 8:14 pm   
 
Rahabs shows that best

the pattern

^(%w leaves) ({north|east|south|west})(*)

the ^means capture the begining of the line
(%w leaves) is %w = word, so name leaves, and this captures this to the %1 function in the script
({north|east|south|west}) is a string list, where it can match those words and () makes it the %2 function
the last part (*) means capture anything and make it %3

so for the trigger text
#LOCAL $arrows <--- defines local variables that will be used in this script
#SWITCH (%2) <---- switch is like a bunch of #if commands, used with %2 (the direction)
(north) {$arrows = "^^"} <---- this following part takes the direction name from %2 and tells the local var what it is, in this case what direction he person moves
(east) {$arrows = ">>"}
(south) {$arrows = "VV"}
(west) {$arrows = "<<"}

#SUB {%1 <c white>$arrows%2$arrows</c>%3</c>} <--- this #sub changes the trigger text to something else, in this case it would change

Antsr leaves east to
Antst leaves >>east>>
or
Antsr leaves north riding a horse to
Antst leaves ^^north^^ riding a horse
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
antsr
Newbie


Joined: 14 Feb 2012
Posts: 6

PostPosted: Wed Feb 15, 2012 9:33 pm   
 
Ok that makes sence, but it's not letting me input it into the system and work though. keeps giving me a illegal token message. idk
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Feb 16, 2012 2:32 am   
 
Where are you trying to input it? You need to make a new trigger, use Rahab's first code block for the pattern and Rahab's second code block for the code of the trigger.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Feb 16, 2012 2:59 am   
 
As Daern says, you can create the trigger from the Package Editor. If you want to create the trigger by typing at the command line, this will do it:
Code:

#TRIGGER {^(%w leaves) ({north|east|south|west})(*)} {
#LOCAL $arrows
#SWITCH (%2)
  (north) {$arrows = "^^"}
  (east) {$arrows = ">>"}
  (south) {$arrows = "VV"}
  (west) {$arrows = "<<"}

#SUB {%1 <c white>$arrows%2$arrows</c>%3</c>}
}

Just cut and paste that at the command line.
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