Is there is newbie guide to scripting?

Posted by Junkiee24 on Fri 25 Nov 2011 11:09 PM — 23 posts, 82,293 views.

#0
is there a newbie guide to how to set up scripting on MUSH? i been using this client to mud for a while but never understood how to set up a script. i am not fluent in coding so i have no idea what kinda line by line needs to be written and how to trigger it to script.

I usually play ncmud.org 9000 which uses a DIKU type mudding. any help would be nice.

thanks
Australia Forum Administrator #1
Try this:

http://www.gammon.com.au/forum/?id=10212
#2
thanks nick.. trying to figure it out..
#3
okay i followed the guide but when it came to the part when you edit a trigger (using the * in place of the numbers) .. my results didnt print the numbers
Australia Forum Administrator #4
Did the trigger fire? You can see a trigger fire count in dialog when you edit it.

Can you show the trigger?

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


And the text from the MUD that it was supposed to match?
#5
triggers work fine.. but i cant get the script and varibles to work.. triggers and alias work fine..
i dont think i can get the wild card to work also.. is that possible?


i ideally want to set a level script..
(i dont know how to run it from the beg)
i spd wlk to zone A and walk into first room, kill the mobs, then go to next room, etc..
when zone is cleared i go to zone B do the same..

how can i set (alias?) so that when my hp goes below certain % i grab heals from bag and quaf, when my exp is negative (since it count downs) and i am done with zone i go to trainer to train level..
#6
what i meant earlier is that when i set (h%1 m%2 e%3) doesnt return %1 %2 or %3..
#7
triggers work fine.. but i cant get the script and varibles to work.. triggers and alias work fine..
i dont think i can get the wild card to work also.. is that possible?


i ideally want to set a level script..
(i dont know how to run it from the beg)
i spd wlk to zone A and walk into first room, kill the mobs, then go to next room, etc..
when zone is cleared i go to zone B do the same..

how can i set (alias?) so that when my hp goes below certain % i grab heals from bag and quaf, when my exp is negative (since it count downs) and i am done with zone i go to trainer to train level..
Australia Forum Administrator #8
It would help to see what you are doing, and then we can suggest improvements:

Template:bug
Please help us by advising:
  • The version of MUSHclient you are using. Use the Help menu -> About MUSHclient.
  • A copy of the trigger, alias or timer you were using (see Copying XML)
  • The output from the MUD that caused the problem
  • The error message, if any, that you got (or other relevant output)

#9
hmm i am trying to figure out how to implement a script.
and how to run it
how can i show you what i have? email you the world i created?
#10
also i dont know how to turn on the script.. in the script config page, under script prefixes its says (not active) how do i turn it on?
i tried to make a simple script comment to see it actually do something like get heal bag but it doesnt even run that..
been stuck for a while.
do you have a simple short script that works on a particular mud so i can compare and see what i am doing wrong?
Australia Forum Administrator #11
Did you look at all the "Getting Started" stuff? How about this?

http://www.gammon.com.au/forum/?id=8411

Quote:

triggers work fine.. but i cant get the script and varibles to work.. triggers and alias work fine..
i dont think i can get the wild card to work also.. is that possible?


They work but they don't work? Of course you can get wildcards to work. They are used extensively by many people.

This is all very vague without showing what you are doing, and what you are expecting to match.

Can you please copy and paste the trigger you are working on ...

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


If it calls a script, copy and paste the script. I presume it isn't very long.
#12
that link is very useful.. i dont think i got that far.
the only items i have in my world is triggers and aliases..
eg
Alias (rune) (cast 'rune')
Trigger (You get a heal from your bag) triggers (quaf heal)

i havent got to the steps on the link.. will check it out and report back.. thanks NICK!
#13
k i still dont get how to write a script..
how do you input a wildcard as a trigger..
say mending equipment..
i will type <mend *> with * being the obj.
and the mud returns <You buff and polish * a bit.>

i want to keep sending <mend *> till it doesnt return the msg.
Australia Forum Administrator #14
I will ask you again, please show us your trigger:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
Amended on Sun 18 Dec 2011 06:57 PM by Nick Gammon
#15
i tried to copy and paste it but it was too long.. didnt let me save..
my triggers are random ones that i made for me mudding..
eg. i get a king endorsement from head; rem cd; put cd head; wear king

here is a link good for a week..
https://www.yousendit.com/download/T2dkVWRwMGsyWGUwYjhUQw
Australia Forum Administrator #16
Junkiee24 said:

i will type <mend *> with * being the obj.
and the mud returns <You buff and polish * a bit.>

i want to keep sending <mend *> till it doesnt return the msg.


Ah, if you want it to send mend something (that would be "mend %1" to mend the first wildcard) that is easy enough.


<aliases>
  <alias
   match="mend *"
   enabled="y"
   sequence="100"
  >
  <send>mend %1</send>
  </alias>
</aliases>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


But to send this until you *don't* get a message? You are you planning for doing that? Not getting a message can't trigger anything.

Do you mean, if you don't get the message "You buff and polish (whatever) a bit." within 5 seconds?
#17
well , by typing "mend suit" will prompt one of these responses
(not in any particular order):

"You bend suit WAY out of shape while trying to mend it!!"
"You brutally mangle suit in your attempt to mend it!!"
"You cringe at the condition of suit and you wish you had an anvil."
"You get out a huge hammer to repair suit."
"You get out a large hammer to repair suit."
"You get out a small hammer to repair suit."
"You work long and hard to make suit useable once again."

so for each of those (7) responses i made a trigger to send out "mend suit" again.

mending will either end in:
FIX IT:You look at an suit in amazement!!! It is obvious you have created a masterpiece!!

BREAK IT: The suit in your attempt to mend it and it is TOTALLY DESTROYED!!

so my problem is that for each item i mend i have to make a whole new set of these

eg;suit, sword, axe..

can i do it a simpler way?
thanks Nick.
Australia Forum Administrator #18
All you have to do is capture the line which tells you that you had problems mending <item> and mend it again, like this:


<triggers>
  <trigger
   enabled="y"
   match="You bend * WAY out of shape while trying to mend it!!"
   sequence="100"
  >
  <send>mend %1</send>
  </trigger>
</triggers>


Now make one of those for each message. Since it matches on a wildcard, it will apply to suits, swords etc.
#19
okay made a trig as shown for each but it doesnt work. the return after i enter mend bag comes up but doesnt trigger anything.


<triggers>
<trigger
custom_colour="2"
enabled="y"
match="You bend * WAY out of shape while trying to mend it!!"
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You brutally mangle * in your attempt to mend it!!"
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You buff and polish * a bit."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You cringe at the condition of * and you wish you had an anvil."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You get out a huge hammer to repair *."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You work long and hard to make * useable once again."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You get out a large hammer to repair *."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
<trigger
custom_colour="2"
enabled="y"
match="You get out a small hammer to repair *."
regexp="y"
sequence="100"
>
<send>mend %1</send>
</trigger>
</triggers>
Australia Forum Administrator #20
Well, not exactly as shown. I did not have "regular expression" checked, and you do have. Try doing without checking regular expressions.

Why did you change that, when it worked without it?
#21
okay changing to regular expression puts the item as "a bag"
so when it triggers the return to be "mend a bag", which doesnt work.
#22
Nick,

NM i got it going.. thanks a bunch!
Merry xmas!