Jump to content

User Variables


Chewett

Recommended Posts

  • Root Admin

It Is recommended that you read [topic='5494']Variables[/topic], Before reading this.

Copied From Murs initial Post (no code changed)

[b]User Vars[/b]
Properties of the user accessing the script are available to the script. Don't worry, private info is not available to the script.


Function to read user vars:
[php]mds_read_uvars(var);
uv(var);[/php]

The uv() function is much shorter and easyer to use. What it does is actualy call the mds_read_uvars() function in turn.

Parameters:
var = a keyword that indicates what value you want to know about that player.

Available vars:

'id' = player id
've' = vitality
'vp' = value points
'xpl' = exploring points
'maxve' = maximum vitality
'maxvp' = maximum value points
'land' = land id,
'alliance' = allaince/guild id
'age' = active days
'loyalty' = loyalty points
'honor' = honor points
'name' = playername
'mp' = mindpower
'heads' = heads
'won' = won fights
'lost' = lost fights
'avatar_level' = avatar level
'avatar' = avatar id
'xp' = experience,
'kills' = kills during torch competition
'illusion' = set if player in an illusion
'location' = current location of user
'stored_heat' = amount of heat player has stored in their erolin device

[php]if(uv('ve')>10000){
if(uv('heads')>1000){
echo 'Run, hide, protect your head..sss';
}else{
echo 'You are alive, but you don't have so many heads with you :) ';
}
}elseif(uv('won')-uv('lost')>300){
echo 'Well you are wery weak but you won a lot of fights so...';
}else{
echo 'get lost';
}[/php]



[php]echo "Hello ".uv('name')." ";[/php]


This function can not be used to change user variables.

Edited by Rendril
Added new variable 'stored_heat'
Link to comment
Share on other sites

and to display the variable, you would use
[code] echo uv(var);[/code]

and this would display all the variables, and the date, each on a seperate line:
[code]echo "player id: ".uv('id')." <br />";
echo "vitality: ".uv('ve')." <br />";
echo "vp: ".uv('vp')." <br />";
echo "exploring points: ".uv('xpl')." <br />";
echo "maximum vitality: ".uv('maxve')." <br />";
echo "maximum vp: ".uv('maxvp')." <br />";
echo "land id: ".uv('land')." <br />";
echo "alliance id: ".uv('alliance')." <br />";
echo "active days: ".uv('age')." <br />";
echo "loyalty points: ".uv('loyalty')." <br />";
echo "honor: ".uv('honor')." <br />";
echo "player name: ".uv('name')." <br />";
echo "mind power: ".uv('mp')." <br />";
echo "heads: ".uv('heads')." <br />";
echo "won fights: ".uv('won')." <br />";
echo "lost fights: ".uv('lost')." <br />";
echo "avatar level: ".uv('avatar_level')." <br />";
echo "avatar id: ".uv('avatar')." <br />";
echo "experience points: ".uv('xp')." <br />";
echo "kills during the torch competition: ".uv('kills')." <br />";
echo "illusion: ".uv('illusion')." <br />";
echo "and today is day".date('z')." <br />"; [/code]

Edited by I am Bored
Link to comment
Share on other sites

  • 2 weeks later...

just adding for clarification;
'avatar_level' = avatar level
this indicates what level avatar the player is able to get, not the level of the avatar itself

0 - No access
1 - Access to B/W avatars
2 - Access to Gold avatars




date('?');
(replacing ? with appropriate letter) - [u]NOT CONFIRMED[/u], just a quick check

a - am/pm?
b - none
c - YYYY-MM-DD "To" 'servertime' "+02:00"......e.g...2009-11-12T04:14:44+02:00
d - DD......e.g...
e - Europe/Helsinki ?!? - Time Zone?
f - none
g - (4) - No idea
h - (04) - Game Hour
i - (06) - Game Minutes
j - DD......e.g...
k - none
l - Day of the Week......e.g...Thursday
m - MM......e.g...11 (November)
n - MM......e.g...11 (November)
o - YYYY......e.g...2009
p - none
q - none
r - WWW, DD MMM YYYY 'servertime' "+02:00"......e.g...Thu, 12 Nov 2009 04:11:40 +0200
s - SS - Game Seconds
t - (30) - No idea
u - (000000) - No idea
v - none
w - (4) - No idea
x - none
y - (09) - YY
z - Game Day




uv('land')
possible values of;

1 - No Homeland
2 - Marind Bell
3 - Loreroot
4 - Golemus Golemicarum
5 - Necrovion
6 - Underground
7 - MagicDuel Archives
8 - ??No Mans Land??
9 - ??Labyrinth??
10 - Lands of the East



uv('alliance')
possible values of;

1 - No alliance
6 - Caretakers
7 - Archivists
8 - Knights of the Bell
9 - Crafters
10 - Seekers of Enlightenment
11 - Tainted Warriors
13 - Guardians of the Root
14 - Guerrilla Golemicarum
15 - Dimensional Shifters
18 - MR's Fraternity
19 - Necrovion Sentinals
20 - Shattered Illusions
21 - Seal of Six
23 - Advertisers
24 - Artisans
25 - Legend Speakers
26 - Soldiers of the Inner Sun
29 - Savelites Church
30 - Children of the Eclipse
32 - Kelle'tha Order


EDIT reason: see Next/Cutlers post

Edited by Grido
Link to comment
Share on other sites

  • 2 months later...

[quote name='Grido' date='09 November 2009 - 04:23 AM' timestamp='1257740636' post='47048']
just adding for clarification;
'avatar_level' = avatar level
this indicates what level avatar the player is able to get, not the level of the avatar itself

0 - No access
1 - Access to B/W avatars
2 - Access to Gold avatars




date('?');
(replacing ? with appropriate letter) - not confirmed, just a quick check

a - am/pm?
b - none
c - YYYY-MM-DD "To" 'servertime' "+02:00"......e.g...2009-11-12T04:14:44+02:00
d - DD......e.g...
e - Europe/Helsinki ?!? - Time Zone?
f - none
g - (4) - Game Year
h - (04) - Game Hour
i - (06) - Game Minutes
j - DD......e.g...
k - none
l - Day of the Week......e.g...Thursday
m - MM......e.g...11 (November)
n - MM......e.g...11 (November)
o - YYYY......e.g...2009
p - none
q - none
r - WWW, DD MMM YYYY 'servertime' "+02:00"......e.g...Thu, 12 Nov 2009 04:11:40 +0200
s - SS - Game Seconds
t - (30) - No idea
u - (000000) - No idea
v - none
w - (4) - Game Year
x - none
y - (09) - YY
z - Game Day

[/quote]


I have been using the date function some and have noticed that some of the above info isn't correct, in particular there doesn't seem to be a MD year anywhere neither (w) nor (g) gives the correct value.


Here is the current printout of values:


a - pm
b - b
c - 2010-01-10T14:29:12+02:00
d - 10
e - Europe/Helsinki
f - f
g - 2
h - 02
i - 29
j - 10
k - k
l - Sunday
m - 01
n - 1
o - 2010
p - p
q - q
r - Sun, 10 Jan 2010 14:29:12 +0200
s - 12
t - 31
u - 000000
v - v
w - 0
x - x
y - 10
z - 9

Link to comment
Share on other sites

I don't know if anybody who can actually make changes ever reads this section (Mur) but there is an addition to the user variables section which would be very useful to have and should be easy to implement if it isn't already there (maybe just undocumented).

That is the user location uv('loc') which would return the Coordinates (ie: 1_-2x-1_2 for paper cabin study room) of the person running the script. This might seem pointless since the script is at a fixed location and the user has to run it from there, but for some quests with multiple clickable locations, it would make it much cleaner and easier to set up a single script that will run differently at several locations instead of making many different but similar scripts at different locations. (Which always ends up with errors and problems that have to go be debugged due to those small location changes.)

This would really help make MDscripting more powerful and user friendly.

Cutler

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...
  • 3 months later...

I wonder if there is a way to get uv("Principles") or similar.
I know it's listed in our Profile Pages by default, so somewhat publically accessible, and since the User Variables are read-only, I doubt they can be used to 'hack' our characters, but I was hoping to be able to compare the Principles someone took. Not in terms of specific ones, but in a general sense.

drat!

Link to comment
Share on other sites

  • 8 months later...

I wonder if it's possible to get [b]uv('player_tag')[/b] also?
This might be nice to limit clickies to specific groups or individuals.
(I'm thinknig about the '[i]Bringers of Light[/i]' and '[i]Death Guards[/i]' specifically, but many other uses are possible)

Link to comment
Share on other sites

  • 1 year later...
  • Root Admin

try using this:

 

[php]

echo uv('tag') . "<br />";
echo uv('descri'.'ption') . "<br />";
debug(uv('principles')); echo "<br />";
debug(uv('landscore'));

[/php]



[2013-08-01 22:45:32 - Stage 12]
MDScript additions
You can now use "tag" "description" "principles" and "landscore" in the uv(); script to access the respective details. Sadly with description you need to enter uv("descri"."ption"); since "script" is a reserved keyword.



-----

 

feel free to document this somewhere better if you want :)

Link to comment
Share on other sites

  • 2 weeks later...
  • Root Admin

When I'm testing my clickie code I can only be sure of the land id returned represents Loreroot as I do not have alts in all lands.

Yes? as long as they are in LR it will always return that number. Ask people to test if you want to be extra sure.

Link to comment
Share on other sites

Are the land IDs above correct. I need to be sure for a quest I'm planning, and can only test one land myself.

 

 

I can confirm the following:

[spoiler] @vy = @vl['landcitizenry'];

if (@vy == '1') {@vy = "No Homeland";}

if (@vy == '2') {@vy = "Marind Bell";}

if (@vy == '3') {@vy = "Loreroot";}

if (@vy == '4') {@vy = "Golemus Golemicarum";}

if (@vy == '5') {@vy = "Necrovion";}

if (@vy == '6') {@vy = "Underground";}

if (@vy == '7') {@vy = "MagicDuel Archives";}

if (@vy == '8') {@vy = "No Mans Land";}

if (@vy == '9') {@vy = "unknown lands";}

if (@vy == '10') {@vy = "Lands of the East";}[/spoiler]

Link to comment
Share on other sites

  • 3 weeks later...

requestin update first post to include new functions so they are all nicely listed on startup. :cool:

echo uv('tag') . "<br />";
echo uv('descri'.'ption') . "<br />";
debug(uv('principles')); echo "<br />";
debug(uv('landscore'));
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Forum Statistics

    17.5k
    Total Topics
    182.5k
    Total Posts
  • Recently Browsing

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
  • Recent Event Reviews

×
×
  • Create New...