Mud Master Discussion
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 9, 2010, 08:22:57 AM

Login with username, password and session length
Search:     Advanced search
18796 Posts in 3030 Topics by 1011 Members
Latest Member: lakme
* Home Help Search Login Register
Mud Master Discussion  |  Mud Master  |  Mud Master 2000  |  Topic: I need scripting help « previous next »
Pages: [1] Print
Author Topic: I need scripting help  (Read 1950 times)
Smilinsam
*
Offline Offline

Posts: 1


View Profile Email
« on: November 13, 2009, 07:16:23 AM »

Let's say i wanted to make an Action set a variable that is equal to the text in the string like this

They appear about %0 percent as fast as you.

how do I make my speed variable equal to the %0?
Logged
Oma
Global Moderator
*****
Offline Offline

Posts: 885


bah!


View Profile
« Reply #1 on: February 5, 2010, 11:47:14 PM »

Apologies for the VERY late reply, I rarely check this forum anymore.

The %0 (%1, %2, ... to %9) variables are system variables. They're wildcards. Think of them as placeholders. You use them in actions, aliases, etc where you don't know what the text will be (or don't care what it is exactly). %# == "something is here".

In actions, you can call up the value of the text that fills up the placeholder var(s), with a $0 ... to $9 (the number matches the number used in the % call).

eg:
/action {%0 says, '%1'.} {/var {WhoSaidIt} {$0}; /var {WhatWasSaid} {$1}}
If you get the text:
Joe says, 'Hey bob!'.
Then the vars will be:
WhoSaidIt == Joe
WhatWasSaid == Hey bob!

Another example, more practical to mud'n, say you get disarmed.
You previously setup a var with your weapon:
/variable {MyWeapon} {Gleaming Sword of Meh}

/action {%0 disarms you, sending your weapon flying!} {wield $MyWeapon}

Normal vars are called up with the dollar sign, just as system vars are. You NEVER use a percent sign (%) with normal vars though, they're only used for the wildcards %0 to %9.
Logged
Oma
Global Moderator
*****
Offline Offline

Posts: 885


bah!


View Profile
« Reply #2 on: February 5, 2010, 11:50:48 PM »

Let's say i wanted to make an Action set a variable that is equal to the text in the string like this

They appear about %0 percent as fast as you.

how do I make my speed variable equal to the %0?

oop, and to actually answer your question:
/action {They appear about %0 percent as fast as you.} {/var SpeedPercent $0}

...say My opponent's speed is $SpeedPercent as fast as me!
Logged
Pages: [1] Print 
Mud Master Discussion  |  Mud Master  |  Mud Master 2000  |  Topic: I need scripting help « previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!