Jump to content
Sign in to follow this  
Chewett

Old MD Script Language Reference

Recommended Posts

This MDScript language reference is OBSOLETE and kept for reference if needed for the future.

DO NOT RELY ON THIS

---------------------------------------------------------------------------------------------------------

MD Script v0.1 OBSOLETE, UPDATED VERSION WILL BE READY SOON.

some things are in work, for example key checking is not working properly yet

< Back

MD Script allows you to add logic to your quests.

Variables

You may use variables to store values or do math functions within your script. These variables are restricted to a fixed number and predefiend naming. You may use the following variables as you like:

var.a var.b var.c var.d var.e var.f var.g var.h var.i var.j

There default value is false.

IMPORTANT: When you assign values or compare a variable use it as is, example var.a = var.b +1, but when oyu use it to print out its value or combined in a string enclose it in curly brackets, example "print:This is variable a with value {var.a} points"

Example:

FOR   var.a=1;var.a<=5; var.a++ DO   print:Number {var.a} END

Logic

Conditional

IF ... DO ... ELSE ... END For loop

FOR var.i=0; var.i<100; var.i++ DO ... END

print:string

Will output the string below the content loaded on the page. You should use htm formatting for newline and other things. To use variables just write them in the string. This construct is best used for small bits of information and alerts. To display large segments of content use the printcontent:id construct (read below defaultcontent).

Example:

print:
this is bold print:
You have {uvars.ve} vital energy IF   uvars.ve == 0 DO  print:and you are dead! END

uvars.value

Returns a value from the player profile. Can not be used to set these values, only read.

Example:

IF   uvars.mp < 5 DO   print:only MP5 allowed! END Possible values: uvars.ve = vitality points, uvars.vp = value points, uvars.xpl = exploring points,' uvars.maxve = maximum vitality,' uvars.maxvp = maximum valuepoints, uvars.land = land ID the player belongs to,' uvars.alliance = alliance ID,' uvars.age = active days number,' uvars.loyalty = loyalty points, uvars.honor = honor points, uvars.name = playername, uvars.mp = MindPower level, uvars.heads = owned heads, uvars.won = fights won counter, uvars.lost = fights lost counter, uvars.avatar = avatar ID or zero if none, uvars.xp = player total experience points, uvars.kills = total kills during war, uvars.illusion = false if no illusion or timestamp of illusion cooldown;

has_keys[value,value,...]

Returns true or false if the player has all the specified keys

Example:

IF   has_keys[ggivorytower-door,loreroot-tower-key] DO   print:you have what you need to open this door END Usage: You can enter multiple keys as parameter separated by comma. The construct returns true if the player has all keys or false if one or more are missing. The key name appears on each clickable object in the editor title like "Editing Item Document: ggivorylighthouse-door". This is limited to clickable items keys and does not affect game hardcoded keys or storyline triggers. You can check any editable key including custom set keys of your own.

give_keys:value,value,...

Gives one or more keys, including custom keys you can define your own

Example:

give_keys[loreroot-tower-key] print:You found a rusty old key! Usage: You can give multiple keys at once by separating them with comma. To give a custom key that you will use along with your quests just enter its name without spaces. When a player receives a key named like one of the clickable items, the interface will no longer display the item interface when clicked but it will try to run the item for what it does, if the item is set to do nothing, and most are, it will simly become inactive and do nothing!

Naming convention for custom keys: Please use the following naming convention when using a custom key. This will avoid colliding of multiple keys from different players or with allready existing game keys. playername-abrev For the playername part use an cleaned form, without spaces, witout special chars, rpc dots, lho stars and without capital leters. Example: muratusdelmur-fireorb

remove_keys:value,value,...

Removes one or more keys, including custom keys defined by you

Example:

remove_keys[loreroot-hidden-entrance] print:Your action closed the entrance! Usage: Use it to remove keys the player received previously. When a key is removed the player will see the item interface when clicking a clickable object and will not be able to use it. For example if you dont have the key of a golden pot nd you click it, you will see what content/script was set for that item. If you do have the key for that item, the pot will give you its gold when clicked and you wont see the item interface nor will the script on it run! Most items do not have an action assigned so giving keys named after them will only make them do nothing (inactive) when clicked.

give_creature:creature id, level

Gives a creature of indicated type and level to the player

Example:

givecreature:21,3 givekeys[muratusdelmur-archerreinforcement] print:A level 3 archer joined your forces! Usage: Use for quest and reward purposes. To give more creatures use a for loop or use the construct multiple times. A table with creature ids will be added soon. This action is currently restricted untill it will be limited only to some creature types.

default_content:number

Replaces the default displayed content by an other content segment. Does not return anything.

Example:

IF   haskeys[muratusdelmur-archerreinforcement] DO   defaultcontent:2 END

Usage: In the content section you can define multipe content segments by separating them with a predefiend separator. Example to add more content segment:

This is the default content that shows when the item interface is opened. You can use also html in all this content segment.The above separator must be entered exactly the same. It will indicate that this is an other content segment. The count starts from zero, and first segment is equivalent to default_content:0 and also the default one.

For example this is content segment 3 and will be made visible instead of the default one by running default_content:3 Last content indicator executed will define what gets to be displayed. You can not capture its output.

Example:

defaultcontent:2 defaultcontent:3 default_content:1 Will display the content id 1, thats the first after the first separator.

print_content:string

Will output a content segment independent from default_content

Example:

defaultcontent:2 printcontent:2 /* this will output the 3rd content twice */

printcontent:1 printcontent:4 /* this will output the default content 0 anyway and the 2nd and 5th content segments after it */

Usage: Useful to display complex content segments with more text or html based on rules and mixed together, unlike the default_content construct that will display just one segment on top of all. Use this instead print: to display content defiend in the content editor and keep your code clean from excessive text.

regexp[pattern,string]

Will check if string matches the pattern. Uses case insesnsitive eregi regular expression function.

Example:

IF regexp[Mur,{uvars.name}] DO print:Hello Muratus del Mur END

Usage: The pattern is limited and cant use all the special characters you normaly have in regular expressions. You may not use round brackets. You should not enclose the pattern in quotes. The string should use variables enclosed in curly brackets like you use them in strings when you print them. This construct returns true or false therefor is desinged to work with if statements. Read more here

Future additions:

This language is still in work and will be extended soon with additional functionality such as integration with the different spells, profile changes, principle checks, story branches, creature inventory check, teleportation, voting tags, custom illusion effects, tag and description changes and many many more. This script will basicaly allow you to do even entire applications such as custom fixed value sacrifice altars or many more. Please use carefuly because like all the RPC abilities this one is very exploitable. Do not attepmt to gain personal benefits or to intentionaly aid other character by using these scripts or you will forfeit your RPC status forever. Best scripters will get access to more scripting freedom to build mre tools.

< Back

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Forum Statistics

    15,715
    Total Topics
    172,479
    Total Posts
  • Recently Browsing

    No registered users viewing this page.

  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×