mirror of
https://github.com/UOX3DevTeam/UOX3
synced 2026-08-13 12:27:04 -04:00
18438 lines
No EOL
825 KiB
HTML
18438 lines
No EOL
825 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="Documentation for UOX3's scripting engine, based on SpiderMonkey 1.8">
|
|
<script>document.getElementsByTagName("html")[0].className += " js";</script>
|
|
<link rel="stylesheet" href="assets/css/style.css" deferred>
|
|
<link rel="stylesheet" href="assets/css/all.css" deferred>
|
|
<link rel="stylesheet" href="assets/css/prism.css" deferred>
|
|
<title>UOX3 JavaScript Engine Docs</title>
|
|
</head>
|
|
<body>
|
|
<header class="cd-header flex flex-column flex-center">
|
|
<div class="text-component text-center">
|
|
<div style="margin: 0 auto; clear:both">
|
|
<img class="headerImg" src="logo.gif" alt="UOX3 logo" style="max-height: 150px;padding: 0 0"/>
|
|
</div>
|
|
<!--<h1>Ultima Offline eXperiment 3 - Docs</h1>-->
|
|
<h1>UOX3 JS Engine Docs</h1>
|
|
</div>
|
|
</header>
|
|
|
|
<div class="text-component text-center navbar-container">
|
|
<div class="navbar-wrapper">
|
|
<p class="navbar jsdocs"><a class="jsdocs" href="https://www.uox3.org" target="_blank" title="UOX3 Community Homepage">UOX3.org</a> | <a class="jsdocs" href="https://www.github.com/UOX3DevTeam/UOX3" rel="noopener" target="_blank" title="UOX3 @ GitHub - source and data repository">UOX3@GitHub</a> | <a class="jsdocs" href="https://discord.gg/uBAXxhF" rel="noopener" target="_blank" title="UOX3 Discord Server">UOX3@Discord</a> | <a class="jsdocs" href="index.html" rel='noopener' title="UOX3 Documentation">UOX3 Docs</a> | <a class="jsdocs" href="styleguide.html" rel='noopener' title="UOX3 Style Guide">UOX3 Style Guide</a></p>
|
|
</div>
|
|
</div>
|
|
|
|
<div style="text-align: center; margin-top: 0; margin-bottom: 0">
|
|
<p style="margin:0"><small>Last Updated: 5. August, 2025</small></p>
|
|
<p style="margin:0"><small>Written for UOX3 Version: v0.99.7b</small></p>
|
|
</div>
|
|
|
|
<section class="cd-faq js-cd-faq container max-width-lg margin-top-sm margin-bottom-md" style="margin-top: 5px">
|
|
<ul class="cd-faq__categories topicListJS">
|
|
<!--<img src="../gfx/docs.jpg" style="width:100%"/>-->
|
|
<li><a class="cd-faq__category cd-faq__category-selected truncate" href="#about">About</a></li>
|
|
<li><a class="cd-faq__category truncate" href="#events">JS Events</a></li>
|
|
<li><a class="cd-faq__category truncate" href="#functions">JS Functions</a></li>
|
|
<li><a class="cd-faq__category truncate" href="#methods">JS Object Methods</a></li>
|
|
<li><a class="cd-faq__category truncate" href="#properties">JS Object Properties</a></li>
|
|
<li><a class="cd-faq__category truncate" href="#tips">Tips and Tutorials</a></li>
|
|
</ul> <!-- cd-faq__categories -->
|
|
|
|
<div class="cd-faq__items">
|
|
<ul id="about" class="cd-faq__group">
|
|
<li class="cd-faq__title title-jsdoc"><h1>About UOX3 JSE</h1></li>
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#latestUpdates" id="latestUpdates"><span>About this Document</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>In this document you will find details on how to write scripts for the embedded scripting engine in <a href="index.html" title="UOX3 Documentation">UOX3</a>, with details about the JS Events, Functions, Methods and Properties available for use, examples on how to use them in your scripts, as well as basic tips and tricks for getting stuff done in JS.</p>
|
|
<p>A copy of this document specific to your downloaded version of UOX3 is included in the UOX3/docs/ folder, though the latest up-to-date version can always be found at <a href="https://www.uox3.org/docs/jsdocs.html" title="UOX3 JavaScript Engine Docs at UOX3.org" target="_blank">https://www.uox3.org/docs/jsdocs.html</a>!</p>
|
|
<input type="checkbox" id="spoiler_docs_updates"/>
|
|
<label for="spoiler_docs_updates">Latest Documentation Updates <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<h4>August 21st, 2025</h4>
|
|
<ul>
|
|
<li>Added details for using the TypeScript bindings</li>
|
|
</ul>
|
|
<h4>June 29th, 2025</h4>
|
|
<ul>
|
|
<li>Added details for new JS Events: onProfileRequest, onProfileUpdate</li>
|
|
</ul>
|
|
<h4>April 27th, 2025</h4>
|
|
<ul>
|
|
<li>Added details for new JS Events: onBoatTurn
|
|
<li>Added details for new JS Methods: TurnBoat, GetTiller</li>
|
|
</ul>
|
|
<h4>April 23rd, 2025</h4>
|
|
<ul>
|
|
<li>Added details for new JS Methods: AddSkill</li>
|
|
<li>Updated details for JS Method: Refresh</li>
|
|
<li>Updated details for JS Function: IterateOver</li>
|
|
<li>Updated details for JS Event: onIterate</li>
|
|
</ul>
|
|
<h4>October 27th, 2023</h4>
|
|
<ul>
|
|
<li>Updated details for JS Function: SetRandomName</li>
|
|
</ul>
|
|
<h4>October 14th, 2023</h4>
|
|
<ul>
|
|
<li>Added details for new JS Function: DoesCharacterBlock</li>
|
|
<li>Added details for new JS Methods: GetOrePref, AddAggressorFlag, RemoveAggressorFlag, CheckAggressorFlag, UpdateAggressorFlagTimestamp, IsAggressor, ClearAggressorFlags, AddPermaGreyFlag, RemovePermaGreyFlag, CheckPermaGreyFlag, UpdatePermaGreyFlagTimestamp, IsPermaGrey, ClearPermaGreyFlags</li>
|
|
<li>Added details for new JS Properties: totalPlayTime, playTime</li>
|
|
</ul>
|
|
<h4>July 1st, 2023</h4>
|
|
<ul>
|
|
<li>Updated details for JS Event: onNameRequest</li>
|
|
</ul>
|
|
<h4>June 21st, 2023</h4>
|
|
<ul>
|
|
<li>Added details for new JS Events: onSpellTargetSelect, onDamageDeal, onCreatePlayer</li>
|
|
</ul>
|
|
<h4>May 30th, 2023</h4>
|
|
<ul>
|
|
<li>Added details for new JS Methods: SetRandomName, FindItemSection, OpenContainer</li>
|
|
<li>Updated details for JS Events: onBuyFromVendor, onBoughtFromVendor, onSellToVendor, onSoldToVendor</li>
|
|
</ul>
|
|
<h4>May 4th, 2023</h4>
|
|
<ul>
|
|
<li>Added details for JS Event: onThirstChange</li>
|
|
</ul>
|
|
<h4>March 3rd, 2023</h4>
|
|
<ul>
|
|
<li>Added details for new JS Event: onMultiLogout</li>
|
|
</ul>
|
|
<h4>November 24th, 2022</h4>
|
|
<ul>
|
|
<li>Added details for new JS Event: onCarveCorpse</li>
|
|
<li>Added details for new JS Functions: CreateHouse, CreateBaseMulti</li>
|
|
<li>Added details for new JS Method: HasScriptTrigger</li>
|
|
</ul>
|
|
<h4>October 1st, 2022</h4>
|
|
<ul>
|
|
<li>Added details for new JS Events: onFacetChange, onDyeTarget</li>
|
|
</ul>
|
|
<h4>August 25th, 2022</h4>
|
|
<ul>
|
|
<li>Added details for new JS Function: GetStartTime</li>
|
|
</ul>
|
|
<h4>July 15th, 2022</h4>
|
|
<ul>
|
|
<li>Added details about new JS Methods: GetJSTimer, SetJSTimer, KillJSTimer</li>
|
|
</ul>
|
|
<h4>February 12th, 2022</h4>
|
|
<ul>
|
|
<li>Added details about new JS Events: onNameRequest, onScrollingGumpPress</li>
|
|
</ul>
|
|
<h4>January 24th, 2022</h4>
|
|
<ul>
|
|
<li>Added details about new JS Events: onHelpButton, onWarModeToggle, onAICombatTarget</li>
|
|
</ul>
|
|
<h4>January 9th, 2022</h4>
|
|
<ul>
|
|
<li>Initial version of document completed</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#faq" id="faq"><span>FAQ - Frequently Asked Questions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<input type="checkbox" id="spoiler_faq_language"/>
|
|
<label for="spoiler_faq_language">What language is UOX3's JavaScript Engine based on? <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>UOX3's JavaScript Engine is based on an embedded version of SpiderMonkey 1.8. This provides a similar feature-set to JavaScript 1.8 or ECMAScript 5, minus any web/browser-specific stuff.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_faq_global_vars"/>
|
|
<label for="spoiler_faq_global_vars">Are global variables unique per script? <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>UOX3's JS engine does not protect against global object pollution, which means care should be taken when using global variables - variables declared outside functions - as a change to one of these variables in one instance of a particular script will also be reflected in any other instances of the same script. General rule of thumb - only use global variables for constants, unchanging arrays/flags, etc.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_faq_scripts"/>
|
|
<label for="spoiler_faq_scripts">Are there any pre-written scripts available for downloads? <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>You can download JS scripts written and shared by other UOX3 users from <a href="https://www.uox3.org/forums/viewforum.php?f=5" title="UOX3.org Forums - The JScript Vault" target="_blank">The JScript Vault</a> section of the UOX3.org forums. Each such script should come with its own setup instructions.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_faq_support"/>
|
|
<label for="spoiler_faq_support">How can I get assistance with my scripts? <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>If you're having trouble with your scripts, or even just feel the need to bounce ideas off of someone, feel free to post in the <a href="https://www.uox3.org/forums/viewforum.php?f=3" title="UOX3.org Forums - Scripting Department" target="_blank">Scripting Department</a> section of the UOX3.org forums, or join us on the <a href="https://discord.gg/uBAXxhF" rel="noopener" title="Real-time chat in Discord" target="_blank">UOX3 Discord</a>!</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_faq_ideas"/>
|
|
<label for="spoiler_faq_ideas">How can I suggest new Events/Functions/Properties to be added? <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>You can either post your suggestion/request in the <a href="https://www.uox3.org/forums/viewforum.php?f=8" title="UOX3.org Forums - Feature Requests, Wishes, Suggestions" target="_blank">Feature Requests - Wishes - Suggestions</a> section of the UOX3.org forums, giving other users the chance to chime in and potentially back up your suggestion, or you can hop on to the <a href="https://discord.gg/uBAXxhF" rel="noopener" title="Real-time chat in Discord" target="_blank">UOX3 Discord</a> and air your idea in the chat!</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_faq_help"/>
|
|
<label for="spoiler_faq_help">I have a great idea for a feature, but I cannot script! Help! <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>The first and most obvious way to resolve this problem is to start learning how to script! Read the documentation, follow the examples, check out existing scripts and try out tweaks. You can either post your suggestion/request in the <a href="https://www.uox3.org/forums/viewforum.php?f=8" title="UOX3.org Forums - Feature Requests, Wishes, Suggestions" target="_blank">Feature Requests - Wishes - Suggestions</a> section of the UOX3.org forums, giving other users the chance to chime in and potentially back up your suggestion, or you can hop on to the <a href="https://discord.gg/uBAXxhF" rel="noopener" title="Real-time chat in Discord" target="_blank">UOX3 Discord</a> and air your idea in the chat!</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#typescriptBindings" id="typescriptBindings"><span>Validating with TypeScript</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>TypeScript bindings for the core functions, classes and events are now available for use in an optional validation scenario.</p>
|
|
<p>This will help to minimise logic problems prior to actually attempting to execute the script in UOX3. Note that this is not a foolproof system and because we're not operating in a browser, may be slightly inaccurate.</p>
|
|
<input type="checkbox" id="spoiler_docs_ts_overview"/>
|
|
<label for="spoiler_docs_ts_overview">Overview <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>The bindings consist of a few key components:</p>
|
|
<ul>
|
|
<li>The extensible core JSON file from which the definitions are built (data/js/coreDefinitions.json)</li>
|
|
<li>The TypeScript definition file (data/js/definitions.d.ts)</li>
|
|
<li>A tsconfig.json file that configures an editor to use the definitions and force analysis of the Javascript</li>
|
|
<li>The updated scripts themselves</li>
|
|
<li>A set of PowerShell scripts to refresh the definitions and existing scripts</li>
|
|
</ul>
|
|
<p>As a user of UOX3, you are going to be most interested in how to use the TypeScript definition file, the updated scripts, and the PowerShell script updExistingScripts that can be used to refresh any definitions in your scripts.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_docs_ts_ide"/>
|
|
<label for="spoiler_docs_ts_ide">Setting up your IDE <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>If you're using VS Code, this becomes a straight forward exercise. You have TypeScript support natively.</p>
|
|
<p>Simply open up a VS Code workspace in the root of your application, or at least the data/js folder.</p>
|
|
<p>At this point, you can open existing shipped scripts and see the validation in play. Typed variables will show Intellisense for the supported properties and methods they know about.</p>
|
|
<p>If you're not using VS Code, ensure that your IDE of interest has a TypeScript plugin of some sort installed.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_docs_ts_custom_scripts"/>
|
|
<label for="spoiler_docs_ts_custom_scripts">Adding validation to your custom scripts <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>As long as your script lives under the data/js folder, adding validation to your script is a straightforward process.</p>
|
|
<p>Firstly, open your script in your IDE of choice. Add the following code to the top of the script and save it:</p>
|
|
<pre><code class="language-javascript">/// <reference path="../../definitions.d.ts" /> <br />
|
|
// @ts-check</code></pre>
|
|
<p>Ensure that you adjust the reference path based on how deeply nested your script is in the JS folder structure.</p>
|
|
<p>Once saved, validation will start occurring. But you'll now need to add some JSDoc to any event implementations or functions you write.</p>
|
|
<p>For implemented events, the simplest way is to run the updExistingScripts PowerShell script. This will walk through all the JavaScript files
|
|
and refresh any JSDoc for implemented events. This will ensure that the implemented events have the right type definitions. For example, the onPacketReceive event would look like:</p>
|
|
<pre><code class="language-javascript">/** @type { ( mSock: Socket, packetNum: number ) => boolean } */
|
|
function onPacketReceive( pSocket, packetNum )</code></pre>
|
|
<p>Note the variable names in the JSDoc are less important than the type. But this indicates onPacketReceive takes a Socket and a number, and should return a boolean.</p>
|
|
<p>For any functions you write, just follow the same sort of pattern.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_docs_ts_internal_syntax"/>
|
|
<label for="spoiler_docs_ts_internal_syntax">Syntax for types, etc (Developers) <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<h4>Function definition syntax</h4>
|
|
<p>Whether it's a global function or a class method, the function definition syntax is the same. A function appears as a JSON object like so:</p>
|
|
<pre><code class="language-javascript"> {
|
|
"name": "StringToNum",
|
|
"cppName": "SE_StringToNum",
|
|
"params": {
|
|
"num": 1,
|
|
"max": 1,
|
|
"list": [
|
|
{ "name": "value", "type": "string", "required": true }
|
|
]
|
|
},
|
|
"returns": "number"
|
|
}</code></pre>
|
|
<p>The name is how JavaScript will see it. The cppName is the name as implemented in the core code.</p>
|
|
<p>Parameters wise, num is the minimum number of arguments it accepts and max (optional, assumed to be num) is the maximum</p>
|
|
<p>From there, there is an entry for each parameter in the list. This is another JSON object, and has a name (variable name), type (data type) and an indicator if it's mandatory (required) </p>
|
|
<p>And lastly, there is the returns field, which indicates the data type that will be returned (if any).</p>
|
|
<p>There is an alternative syntax for functions that take different parameter sets, but these are much rarer and shouldn't be encouraged. Look at FindMulti for an example of this.</p>
|
|
<h4>Data type syntax</h4>
|
|
<pre><code class="language-javascript"> {
|
|
"name": "BaseObject",
|
|
"aka": "InternalType",
|
|
"extends": "ParentType",
|
|
"type": "optional",
|
|
"properties": [],
|
|
"methods": [],
|
|
"comments": "If any - ignored"
|
|
}</code></pre>
|
|
<p>That is the syntax for a standard type. Note that "extends" isn't used for most things, unless it truly is an inherited situation. Omitting it will cause no trouble if it's not got a parent.</p>
|
|
<p>"aka" sets up a type alias you can use if you're more comfortable using the internal name (if one is supplied). It is optional.</p>
|
|
<p>Likewise, "type" is optional, but sometimes required if it needs to be defined as a "class" rather than the default of "interface" (e.g. if it needs an explicit constructor).</p>
|
|
<h4>Enum syntax</h4>
|
|
<pre><code class="language-javascript"> {
|
|
"name": "CommandLevels",
|
|
"values": [
|
|
{ "label": "CL_PLAYER", "value": 0 },
|
|
{ "label": "CL_CNS" , "value": 1 },
|
|
{ "label": "CL_GM" , "value": 2 },
|
|
{ "label": "CL_ADMIN" , "value": 3 }
|
|
]
|
|
}</code></pre>
|
|
<p>In this case because it has a "values" element, it's treated like an enum. Each label is defined as a concrete known value with the associated value.</p>
|
|
<h4>Property syntax</h4>
|
|
<pre><code class="language-javascript"> {
|
|
"name": "id",
|
|
"cppName": "CSP_ID",
|
|
"cppType": "JSPROP_ENUMANDPERM",
|
|
"readOnly": true,
|
|
"type": "number"
|
|
}</code></pre>
|
|
<p>The "name" reflects the property name as seen in your script.</p>
|
|
<p>The "cppName" and "cppType" are internal identifiers (and currently documentation only)</p>
|
|
<p>The "readOnly" field is optional, but will tell JavaScript that it cannot update that value if true</p>
|
|
<p>And "type" indicates the TypeScript type associated with it, be it built in or one of our custom ones.</p>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_docs_ts_adding_new_event_prop"/>
|
|
<label for="spoiler_docs_ts_adding_new_event_prop">Adding new event, function or property definition (Developers) <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>If a new event, function or property has been added in the core, then you'll need to ensure it is documented. The key to this will be updating the coreDefinitions.json file, and recreating the definitions.d.ts file</p>
|
|
<p>To recreate the file, navigate to the data/js folder from a PowerShell prompt and execute <pre>./crtTypeDefs.ps1 > definitions.d.ts</pre></p>
|
|
<p>Also ensure you use the updExistingScripts PowerShell script if you have added a new event or changed the signature of a global function or event.</p>
|
|
<h4>Adding a new Global function</h4>
|
|
<p>Open up the coreDefinitions.json file and look for the "globalFuncs" array. Add another element at the end of the list using the syntax as described above.</p>
|
|
<h4>Adding a new data type</h4>
|
|
<p>Within the coreDefinitions.json file, look for the "types" section. Define a new type using the syntax from above.</p>
|
|
<h4>Adding a new property</h4>
|
|
<p>Within the coreDefinitions.json file, look for the type of interest. This should be in a "types" section. Using the property syntax from above, add to the list of properties.</p>
|
|
<h4>Adding a new method</h4>
|
|
<p>Within the coreDefinitions.json file, look for the type of interest that will receive the method. This should be in a "types" section. Using the function syntax from above, add to the list of methods.</p>
|
|
<h4>Adding a new Event</h4>
|
|
<p>Open up the coreDefinitions.json file and look for the "events" array. Add another element at the end of the list using the syntax as described above.</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
</ul> <!-- cd-faq__group -->
|
|
|
|
<ul id="events" class="cd-faq__group">
|
|
<li id="eventsHeader" class="cd-faq__title title-jsdoc"><h1>JS Events</h1><div id="filterInputEvents" contenteditable="true" placeholder="(Filter)" style="float:right; margin-top: -40px; margin-right: 10px; background-color: #fff; padding: 5px; width: 200px"></div></li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventScriptRegistration" id="eventScriptRegistration"><span>[Script]Registration</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function [Script]Registration()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Registers specific types of global scripts with the JS engine</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>These events are triggered on UOX3 startup, and on reloads of the script-engine</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The name of the event depends on the type of script being registered. Supported types:
|
|
<ul>
|
|
<li>Command scripts - <strong>CommandRegistration()</strong></li>
|
|
<li>Console scripts - <strong>ConsoleRegistration()</strong></li>
|
|
<li>Packet scripts - <strong>PacketRegistration()</strong></li>
|
|
<li>Skill scripts - <strong>SkillRegistration()</strong></li>
|
|
<li>Spell scripts - <strong>SpellRegistration()</strong></li>
|
|
</ul>
|
|
</p>
|
|
<p>Scripts from each type need to be assigned scriptIDs in specific sections of jse_fileassociations.scp:
|
|
<ul>
|
|
<li>Command scripts - <strong>[COMMAND_SCRIPTS]</strong></li>
|
|
<li>Console scripts - <strong>[CONSOLE_SCRIPTS]</strong></li>
|
|
<li>Packet scripts - <strong>[PACKET_SCRIPTS]</strong></li>
|
|
<li>Skill scripts - <strong>[SKILLUSE_SCRIPTS]</strong></li>
|
|
<li>Spell scripts - <strong>[MAGIC_SCRIPTS]</strong></li>
|
|
<li>All other scripts - <strong>[SCRIPT_LIST]</strong></li>
|
|
</ul>
|
|
</p>
|
|
<p>Access levels (or command levels) are specified in <strong>dfndata/command/commands.dfn</strong>, and the default setup goes like this:
|
|
<ul>
|
|
<li>Admin - <strong>5</strong></li>
|
|
<li>GM - <strong>2</strong></li>
|
|
<li>CNS - <strong>1</strong></li>
|
|
<li>Player - <strong>0</strong></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// --------COMMAND SCRIPTS----------- //
|
|
function CommandRegistration()
|
|
{
|
|
// Register a command with name "myCustomCommand",
|
|
// usable by characters with access level 3 or higher
|
|
RegisterCommand( "myCustomCommand", 3, true );
|
|
}
|
|
|
|
function command_MYCUSTOMCOMMAND( socket, cmdString )
|
|
{
|
|
// ...handle command functionality here
|
|
}
|
|
|
|
// --------CONSOLE SCRIPTS----------- //
|
|
function ConsoleRegistration()
|
|
{
|
|
// Register a few different keys/keycodes as global listeners for keypresses in UOX3 console
|
|
RegisterKey( 'q', "shutdown" );
|
|
RegisterKey( 'Q', "shutdown" );
|
|
RegisterKey( 27, "shutdown" ); // escape
|
|
}
|
|
|
|
function shutdown()
|
|
{
|
|
Console.BeginShutdown();
|
|
}
|
|
|
|
// --------PACKET SCRIPTS----------- //
|
|
function PacketRegistration()
|
|
{
|
|
// Register script as global listener for packet 0x7F
|
|
RegisterPacket( 0x7F, 0x0 );
|
|
}
|
|
|
|
function onPacketReceive( pSocket, packetNum, subCommand )
|
|
{
|
|
// ...handle packet hook functionality here
|
|
}
|
|
|
|
// --------SKILL SCRIPTS----------- //
|
|
function SkillRegistration()
|
|
{
|
|
// Register script as a global listener for skill 35 (Animal Taming)
|
|
RegisterSkill( 35, true );
|
|
}
|
|
|
|
function onSkill( pUser, objType, skillUsed )
|
|
{
|
|
// ...handle sksill functionality here
|
|
}
|
|
|
|
// --------SPELL SCRIPTS----------- //
|
|
function SpellRegistration()
|
|
{
|
|
// Register script as global listener for spell 1 from spells.dfn
|
|
RegisterSpell( 1, true );
|
|
}
|
|
|
|
function onSpellCast( socket, character, directCast, spellNum )
|
|
{
|
|
// ...handle spell functionality here
|
|
}
|
|
</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventInRange" id="eventInRange"><span>inRange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function inRange( pChar, objInRange )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Useful for when you want to do something when a certain thing comes into range. You could yell out guards when a murderer comes into range, for instance, if you're in a guarded region.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>objInRange comes into visible range of pChar. pChar's script is activated</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Only triggers once per object that comes within range, and will not trigger for that object again unless it goes out of range and then comes in range again. The range is dependent on pChar's update range, which for players is partially controlled by the client and can be up to 24 tiles away depending on the client version (before 7.0.55.27 max range is 18, after it's 24).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function inRange( pChar, objInRange )
|
|
{
|
|
if( objInRange.isItem ) // An item came into range
|
|
{
|
|
pChar.DoStaticEffect( 0x376A, 9, 0, ); // Make some sparkles!
|
|
if( objInRange.id == 0x1416 ) // Ooh, it's a purty piece of armour
|
|
{
|
|
pChar.EmoteMessage( "*ooooooooooooo*" );
|
|
}
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOutOfRange" id="eventOutOfRange"><span>outOfRange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function outOfRange( pChar, objVanish )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To take actions based on when things go out of range. For instance, if you ran out of range of your attacker, you might decide to automatically try and hide.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When objVanish goes out of range of pChar, pChar's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Only triggers once per object that goes out of range, and will not trigger for that object again unless it comes back into range and then goes out of range again. The range is dependent on pChar's update range, which for players is partially controlled by the client and can be up to 24 tiles away depending on the client version (before 7.0.55.27 max range is 18, after it's 24).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function outOfRange( pChar, objVanish )
|
|
{
|
|
if( objVanish.isChar ) // A character went out of range
|
|
{
|
|
pChar.DoStaticEffect( 0x376A, 9, 0, ); // Make some sparkles!
|
|
if( objVanish.id == 0x0017 ) // it's a direwolf!
|
|
{
|
|
pChar.TextMessage( "Phew, I escaped the wolf!" );
|
|
}
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnAISliver" id="eventOnAISliver"><span>onAISliver</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onAISliver( npcChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Great for creating custom AI behaviours, while being mindful of the fact that the event runs every single AI when attached to an NPC. Optimization of how much work the script does per cycle can be important to keep performance up if having many NPCs with the event active.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Every AI loop, during their AI slice</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to allow hard-coded AI to execute</li>
|
|
<li><strong>return true</strong> to prevent hard-coded AI from executing, though does not prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// This example would probably be better handled using the onStatChange event, but is included here to show how it'd work with the onAISliver event
|
|
function onAISliver( aiChar )
|
|
{
|
|
// If RandomNumber equals 0, and aiChar is still alive...
|
|
if( !RandomNumber( 0, 49 ) && !aiChar.dead )
|
|
{
|
|
// If health is below 25%...
|
|
if((( aiChar.health * 100 ) / aiChar.maxhp ) < 25 )
|
|
{
|
|
// ... and aiChar is not already in "berserk mode"...
|
|
if( !aiChar.GetTag( "zerkMode" ))
|
|
{
|
|
// ... enter berserk mode!
|
|
aiChar.EmoteMessage( "*enters berserk mode*" );
|
|
aiChar.SetTag( "zerkMode", true );
|
|
|
|
// Set temp buff stats to equal real stats in order to temporarily boost that stat by 2x
|
|
aiChar.tempdex = aiChar.dexterity;
|
|
aiChar.tempint = aiChar.intelligence;
|
|
aiChar.tempstr = aiChar.strength;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// If health is above or equal to 25%...
|
|
if( aiChar.GetTag( "zerkMode" ))
|
|
{
|
|
// ... exit berserk mode!
|
|
aiChar.EmoteMessage( "*exits berserk mode*" );
|
|
aiChar.SetTag( "zerkMode", false );
|
|
|
|
// Revert temp buff stats
|
|
aiChar.tempdex -= aiChar.actualDexterity;
|
|
aiChar.tempint -= aiChar.actualIntelligence;
|
|
aiChar.tempstr -= aiChar.actualStrength;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnAttack" id="eventOnAttack"><span>onAttack</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onAttack( pAttacker, pDefender, hitStatus, hitLoc, damageDealt )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Flesh out attacking code/add additional effects to attacks.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>After pAttacker has attacked pDefender in each "round" of combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>After pAttacker's script has been triggered, pDefender's onDefense event also triggers. Note that these events run <em>in addition</em> to hard-coded combat (and/or other combat events), after everything else is done, and do not replace these. hitStatus will be false if attack missed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onAttack( pAttacker, pDefender, hitStatus, hitLoc, damageDealt )
|
|
{
|
|
if( hitStatus )
|
|
{
|
|
pAttacker.TextMessage( "Hah! I hit my target for " + damageDealt + "damage" );
|
|
}
|
|
else
|
|
{
|
|
pDefender.TextMessage( "Help! Help! I'm being repressed!" );
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnBuy" id="eventOnBuy"><span>onBuy</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onBuy( pSock, Vendor )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow more control over who can access NPC vendors.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Runs on NPC vendor before trade gump opens</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to block vendor trade gump</li>
|
|
<li><strong>return true</strong> to allow it</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can be used to completely block access to a vendor based on criteria of one's choosing!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onBuy( pSock, Vendor )
|
|
{
|
|
// If player does not belong to the undead race, vendor wants nothing to do with him!
|
|
if( pSock.currentChar.raceID != 11 )
|
|
{
|
|
Vendor.TextMessage( "Sorry, I don't sell to the likes of you!" );
|
|
return false;
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnBuyFromVendor" id="eventOnBuyFromVendor"><span>onBuyFromVendor</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onBuyFromVendor( pSock, npcVendor, iBought, iAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow restricting the purchase of specific items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Runs on item and/or NPC vendor after player verifies purchase, but before purchase has gone through</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> will block the sale from going through, without closing the menu.</li>
|
|
<li><strong>return true</strong> will make the purchase go through as normal.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onBuyFromVendor( pSock, npcVendor, iBought, iAmount )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
pUser.TextMessage( "I am buying " + iAmount + " item(s) ("+iBought.name+") from a vendor!" );
|
|
npcVendor.TextMessage( "I am selling an item!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnBoatTurn" id="eventOnBoatTurn"><span>onBoatTurn</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onBoatTurn( iBoat, oldDir, newDir, iTiller )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reacting to boat being turned</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Runs on boat item after boat has successfully turned</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>oldDir refers to previous direction boat was pointing in, while newDir refers to the new updated direction.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> allows other scripts with same event from running, if any</li>
|
|
<li><strong>return true</strong> prevents other scripts with same event from running, if any</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onBoatTurn( iBoat, oldDir, newDir, iTiller )
|
|
{
|
|
iTiller.TextMessage( "Yarr, capt'n! She's come about!")
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnBoughtFromVendor" id="eventOnBoughtFromVendor"><span>onBoughtFromVendor</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onBoughtFromVendor( pSock, npcVendor, iBought, iAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p> To allow manipulating the item that has been bought, immediately after it reaches the player's backpack.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Runs on item and/or NPC vendor after purchase has gone through and item has reached player's backpack.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Used, amongst other things, for automatically turning pet-statues bought from animal-trainers into actual pets.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onBoughtFromVendor( pSock, npcVendor, iBought, iAmount )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
pUser.TextMessage( "I bought " + iAmount + " item(s) ("+iBought.name+") from a vendor!" );
|
|
npcVendor.TextMessage( "I just sold an item to some random dude!" );
|
|
return true;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCallback" id="eventOnCallback"><span>onCallback</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCallback#( socket, target )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To handle callbacks from targeting cursors</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggered for player who selects a target initiated from a CustomTarget method</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p># behind onCallback function-name in prototype is linked to the ID used in the CustomTarget method that initiated the targeting cursor, and should use the same value</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// The following example includes the registration and handling of a 'disconnect GM command, which then prompts the GM to select a target, but note that CustomTarget + onCallback event combination an also be used in any other scripts/events.
|
|
function CommandRegistration()
|
|
{
|
|
// Register a new GM command
|
|
RegisterCommand( "disconnect", 2, true );
|
|
}
|
|
function command_DISCONNECT( socket, cmdString )
|
|
{
|
|
// Fetch system message 196 from dictionary files
|
|
var targMsg = GetDictionaryEntry( 196, socket.Language );
|
|
|
|
// Prompt GM to select a target
|
|
socket.CustomTarget( 0, targMsg );
|
|
}
|
|
|
|
// This onCallback event is called for a target selected with a target cursor initiated with CustomTarget ID 0
|
|
function onCallback0( socket, ourObj )
|
|
{
|
|
// Ensure a valid target has been selected before continuing
|
|
if( !socket.GetWord( 1 ) && ValidateObject( ourObj ) && ourObj.isChar && ourObj.online )
|
|
{
|
|
var targSock = ourObj.socket;
|
|
if( targSock && targSock != socket )
|
|
{
|
|
socket.SysMessage( GetDictionaryEntry( 1029, socket.Language ) );
|
|
targSock.SysMessage( GetDictionaryEntry( 1030, targSock.Language ) );
|
|
|
|
// Disconnect the target player
|
|
targSock.Disconnect();
|
|
}
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCarveCorpse" id="eventOnCarveCorpse"><span>onCarveCorpse</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCarveCorpse( pChar, iCorpse )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour when players carves corpses</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggered for corpse object when player tries to carve it</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to prevent hardcoded carving of corpse, and prevent other scripts with same event from running</li>
|
|
<li><strong>return true</strong> to proceed with hardcoded carving of corpse and/or allow other scripts with same event to run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCarveCorpse( pChar, iCorpse )
|
|
{
|
|
pChar.TextMessage( "I'll just carve this corpse..." );
|
|
iCorpse.TextMessage( "But I'm not dead yet!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCharDoubleClick" id="eventOnCharDoubleClick"><span>onCharDoubleClick</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCharDoubleClick( pUser, targChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater customization of double-clicking on characters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser double-clicks targChar, targChar's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to prevent opening of paperdoll, and prevent other scripts with same event from running</li>
|
|
<li><strong>return true</strong> to allow opening of paperdoll. Other scripts with same event can also run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCharDoubleClick( pUser, targChar )
|
|
{
|
|
targChar.TextMessage( "If you think you'll be allowed to see my paperdoll, think again!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnClick" id="eventOnClick"><span>onClick</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onClick( pSock, objClicked )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater customization on clicking on items.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player single-clicks objClicked, objClicked's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to allow default hard-coded behaviour for clicking on objects</li>
|
|
<li><strong>return true</strong> to override default hard-coded behaviour for clicking on an object (such as showing name of object clicked)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This event will also trigger for characters with script attached if AllNames client macro is used, and for incoming character names showing at edge of screen. Note that depending on client version, this event might not trigger when clicking certain types of objects, because clients more recent than X (?) won't send requests on click, but will instead send requests for details (including names) for all objects in range ahead of time, with name being displayed client-side on hover/click.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onClick( pSock, objClicked )
|
|
{
|
|
pSock.SysMessage( "You have clicked on: "+objClicked.name );
|
|
objClicked.TextMessage( "Zug, zug!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCollide" id="eventOnCollide"><span>onCollide</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCollide( targSock, pColliding, objCollidedWith )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Replacement of collision based triggers, increase teleporter abilities, custom behaviour when pushing past other characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pColliding collides with objCollidedWith (stepped on basically)</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to continue checking any additional scripts with same event, while preventing hard-coded collision handling from running</li>
|
|
<li><strong>return true</strong> to allow default hard-coded handling of collision (prevents other scripts with event from running)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>targSock is -1 if pColliding is an NPC</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCollide( trgSock, srcChar, trgItem )
|
|
{
|
|
srcChar.Teleport( srcChar.x + 5, srcChar.y +5, srcChar.z, 0 );
|
|
srcChar.EmoteMessage( "*Eegads, I am teleported!*" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnAICombatTarget" id="eventOnAICombatTarget"><span>onAICombatTarget</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onAICombatTarget( pAttacker, pTarget )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding target selection for combat that normally takes place in hard-coded AI behaviours</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pAttacker loops through nearby characters as part of their AI behaviour, this event triggers once for every character found (pTarget) - or until event returns true</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to deem the current target invalid for selection and look for another</li>
|
|
<li><strong>return true</strong> to deem the current target valid for selection, and stop looking for other targets</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onAICombatTarget( pAttacker, pTarget )
|
|
{
|
|
// Don't attack NPCs with ai AI_HEALER_G (good aligned healers)
|
|
if( pTarget.aitype == 1 )
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
|
|
// See js/npc/ai/orcs.js for a more elaborate example</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCombatStart" id="eventOnCombatStart"><span>onCombatStart</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCombatStart( pAttacker, pDefender )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding combat functionality</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pAttacker attacks someone, pAttacker's script is triggered.</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override existing hard-coded combat completely and/or disallow combat from being started</li>
|
|
<li><strong>return true</strong> to let hard-coded combat run its course</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCombatStart( pAttacker, pDefender )
|
|
{
|
|
pAttacker.TextMessage( "I'm attacking!" );
|
|
pDefender.TextMessage( "I'm being attacked!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCombatEnd" id="eventOnCombatEnd"><span>onCombatEnd</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCombatEnd( currChar, targChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allow to override what happens when combat between two characters ends.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When either currChar or targChar dies or goes out of range, the script is fired for currChar</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override what happens after combat ends. Usually this is handled by hard code, which takes care of setting targets and attacker properties to null, invalidates first attacker status, toggles combat mode, etc.</li>
|
|
<li><strong>return true</strong> to allow hard-coded implementation to run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCombatEnd( currChar, targChar )
|
|
{
|
|
if( currChar.health != 0 )
|
|
currChar.TextMessage( "Whee! I survived combat!" );
|
|
if( targChar.health != 0 )
|
|
targChar.TextMessage( "Yay! I survived combat!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCombatDamageCalc" id="eventOnCombatDamageCalc"><span>onCombatDamageCalc</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCombatDamageCalc( attacker, defender, getFightSkill, hitLoc )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allow to override the combat damage calculation</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Every time combat damage calculation occurs this event is fired for attacker</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return a negative value</strong> to use hard-coded combat damage calculations</li>
|
|
<li><strong>return a positive value</strong> to override hard-coded combat damage calculations and to use this value as the damage value</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onCombatDamageCalc( pAttacker, pDefender, fightSkill, hitLoc )
|
|
{
|
|
// Get attacker's base damage
|
|
var baseDamage = pAttacker.attack;
|
|
|
|
if( baseDamage == -1 ) // No damage if weapon breaks
|
|
return 0;
|
|
|
|
// Apply hard-coded damage bonuses based on race weakness, character skills and stats, etc
|
|
var damage = ApplyDamageBonuses( 1, pAttacker, pDefender, fightSkill, hitLoc, baseDamage );
|
|
|
|
if( damage < 1 )
|
|
return 0;
|
|
|
|
// Apply hard-coded defense modifiers based on armor, resistances etc
|
|
damage = ApplyDefenseModifiers( 1, pAttacker, pDefender, fightSkill, hitLoc, damage, true);
|
|
|
|
// If damage after defense modifiers is below 0, do a small random amount of damage still
|
|
if( damage <= 0 )
|
|
damage = RandomNumber( 0, 4 );
|
|
|
|
// Half remaining damage by 2 if PUB15 or earlier
|
|
damage /= 2;
|
|
|
|
// If defender is a player, damage is divided by this modifier from uox.ini (modifier defaults to 1)
|
|
if( !pDefender.npc )
|
|
damage /= GetServerSetting( "NPCDAMAGERATE" );
|
|
|
|
return damage;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCommand" id="eventOnCommand"><span>onCommand</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>onCommand( mySock, cmdString )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Can be used as a "catch-all" event for handling unknown commands (suggest other similar commands that actually exists, for instance?), or to implement multiple custom commands in the same script.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When player executes a command that's not otherwise handled by code or dedicated command scripts</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to provide default system message about unrecognized command - unless command is handled in another script with same event</li>
|
|
<li><strong>return true</strong> to indicate that the command has been handled by script, and prevent UOX3 from displaying system message about unrecognized command</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">//Example 1
|
|
function onCommand( mySock, cmdString )
|
|
{
|
|
mySock.SysMessage( "Command entered: " + cmdString );
|
|
return false;
|
|
}
|
|
|
|
// Example 2
|
|
function onCommand( mySock, cmdString )
|
|
{
|
|
mySock.SysMessage( "Unknown command (" + cmdString + "). Try 'validcmd for a list of commands available to you, or 'howto for more info on specific commands." );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnContextMenuRequest" id="eventOnContextMenuRequest"><span>onContextMenuRequest</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onContextMenuRequest( socket, targObj )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions to player attempts at opening context menus for chars/items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player attempts to trigger context menu on items or characters, script activates on said item/character</p>
|
|
<p>Usable in Global script? <span class="hl">Yes</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override and prevent hard-coded context menus from showing</li>
|
|
<li><strong>return true</strong> to let code handle context menu instead</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onContextMenuRequest( socket, targObj )
|
|
{
|
|
// handle your own packet with context menu here
|
|
var pUser = socket.currentChar;
|
|
var offset = 12;
|
|
var numEntries = 1; // Increase with number of Entries
|
|
|
|
// Prepare packet
|
|
var toSend = new Packet();
|
|
var packetLen = ( 12 + ( numEntries * 8 ));
|
|
toSend.ReserveSize( packetLen );
|
|
toSend.WriteByte( 0, 0xBF );
|
|
toSend.WriteShort( 1, packetLen );
|
|
toSend.WriteShort( 3, 0x14 ); // subCmd
|
|
toSend.WriteShort( 5, 0x0001 ); // 0x0001 for 2D client, 0x0002 for KR (maybe this needs to be 0x0002?)
|
|
toSend.WriteLong( 7, targObj.serial );
|
|
toSend.WriteByte( 11, numEntries ); // Number of entries
|
|
|
|
// Context Menu Entry 1 - Open Paperdoll Context menu
|
|
toSend.WriteShort( offset, 0x000a ); // Unique ID
|
|
toSend.WriteShort( offset += 2, 6123);
|
|
toSend.WriteShort( offset += 2, 0x0020 ); // Flag, color enabled
|
|
toSend.WriteShort( offset += 2, 0x03E0 ); // Hue of text
|
|
|
|
offset += 2; // for each additional entry
|
|
|
|
// Context Menu Entry 2 - Unlink pet
|
|
toSend.WriteShort( offset, 0x000b ); // Unique ID
|
|
toSend.WriteShort( offset += 2, 6182 );
|
|
toSend.WriteShort( offset += 2, 0x0020 ); // Flag, color enabled
|
|
toSend.WriteShort( offset += 2, 0x03E0 ); // Hue of text
|
|
|
|
//Send packet
|
|
socket.Send( toSend );
|
|
toSend.Free();
|
|
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnContextMenuSelect" id="eventOnContextMenuSelect"><span>onContextMenuSelect</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onContextMenuSelect( socket, targObj, popupEntry )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom handling of context menu selection for chars/items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player selects a popup from a context menu on an item/character, script activates on said item/character</p>
|
|
<p>Usable in Global script? <span class="hl">Yes</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override and prevent hard-coded context menu selection handling</li>
|
|
<li><strong>return true</strong> to let code handle context menu selection handling</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onContextMenuSelect( socket, targObj, popupEntry )
|
|
{
|
|
switch( popupEntry )
|
|
{
|
|
case 0x000A: // Open Paperdoll
|
|
// Show custom paperdoll?
|
|
break;
|
|
case 0x000B: // Unlink Pet
|
|
// Handle unlinking of pet here
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnContRemoveItem" id="eventOnContRemoveItem"><span>onContRemoveItem</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onContRemoveItem( iCont, objRemoved, pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions to items being removed from a container</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When an item has already been removed from a container, script activates on container</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<p>No return values supported</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onContRemoveItem( iCont, objRemoved, pChar )
|
|
{
|
|
// ... do something when an item has been removed from container
|
|
}
|
|
|
|
// For additional examples of how to use this event, check the following scripts in your UOX3 folder:
|
|
// js/server/misc/dungeon_treasure_decay.js</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCreateDFN" id="eventOnCreateDFN"><span>onCreateDFN</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCreateDFN( objMade, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used for tinkering with newly created items/NPCs</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<ul>
|
|
<li>When an non-player character object is created, event will trigger in script for the created object</li>
|
|
</ul>
|
|
<p>Usable in Global script (scriptID 0)? For NPCs/Items, <span class="hl">No</span>.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates an item</li>
|
|
<li>objType == 1 indicates a character</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// When this script is setup as "global id" (0) in JSE_FILEASSOCIATIONS.SCP,
|
|
// it will send a textmessage for all new NPC characters that enters the world.
|
|
function onCreateDFN( objMade, objType )
|
|
{
|
|
if( objType == 1 )
|
|
{
|
|
objMade.TextMessage( "I have SPAWNED! Tremble before me, world!" );
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCreatePlayer" id="eventOnCreatePlayer"><span>onCreatePlayer</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCreatePlayer( pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used for customization of players at creation</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<ul>
|
|
<li>For player characters, this is triggered in global script when they first enter the world</li>
|
|
</ul>
|
|
<p>Usable in Global script (scriptID 0)? For Players, <span style="color:green">Yes</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// When this script is setup as "global id" (0) in JSE_FILEASSOCIATIONS.SCP,
|
|
// it will send the sysmessage to all new PLAYER characters that enters the world.
|
|
function onCreatePlayer( pChar )
|
|
{
|
|
pChar.SysMessage( "Welcome to Our Unique World(TM)!" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnCreateTile" id="eventOnCreateTile"><span>onCreateTile</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onCreateTile( objMade, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used for customization of non-DFN based items at creation.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a non-DFN based item is created.</p>
|
|
<p>Usable in Global script (scriptID 0)? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates an item</li>
|
|
<li>objType == 1 indicates a character (unused for onCreateTile)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Only scripts using script-id 0 or ones assigned through harditems.dfn will work with this event.
|
|
function onCreate( objMade, objType )/
|
|
{
|
|
objMade.name = "A renamed item";
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDamage" id="eventOnDamage"><span>onDamage</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDamage( damaged, attacker, damageValue, damageType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Custom reactions to damage, or to prevent damage from taking place</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When the char "damaged" gets damaged</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override and prevent damage from taking place</li>
|
|
<li><strong>return true</strong> to allow damage to go through and continue with hard-coded application of damage</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The attacker can be a char or NULL, damageType is the type of damage being dealt. Supported damageTypes: 1 (Physical), 2 (Light), 3 (Rain), 4 (Cold/Ice), 5 (Heat/Fire), 6 (Lightning/Magic/Energy), 7 (Poison), 8 (Snow)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDamage( damaged, attacker, damageValue, damageType )
|
|
{
|
|
var dmgTypeString = "";
|
|
switch( damageType )
|
|
{
|
|
case 1:
|
|
dmgTypeString = "Physical";
|
|
break;
|
|
case 2:
|
|
dmgTypeString = "Light";
|
|
break;
|
|
case 3:
|
|
dmgTypeString = "Rain";
|
|
break;
|
|
case 4:
|
|
dmgTypeString = "Cold";
|
|
break;
|
|
case 5:
|
|
dmgTypeString = "Heat";
|
|
break;
|
|
case 6:
|
|
dmgTypeString = "Lightning/Magic";
|
|
return false; // Character is immune to Lightning/Magic damage!
|
|
case 7:
|
|
dmgTypeString = "Poison";
|
|
break;
|
|
case 8:
|
|
dmgTypeString = "Snow";
|
|
break;
|
|
}
|
|
damaged.TextMessage( "Ouch, those "+damageValue+" points of " + dmgTypeString + " damage really hurt." );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDamageDeal" id="eventOnDamageDeal"><span>onDamageDeal</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDamageDeal( attacker, damaged, damageValue, damageType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Custom reactions to damage, or to prevent damage from taking place</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When the char "attacker" deals damage</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override and prevent damage from taking place</li>
|
|
<li><strong>return true</strong> to allow damage to go through and continue with hard-coded application of damage</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Unlike the onDamage event, neither attacker nor damaged can be NULL in this one. damageType is the type of damage being dealt. Supported damageTypes: 1 (Physical), 2 (Light), 3 (Rain), 4 (Cold/Ice), 5 (Heat/Fire), 6 (Lightning/Magic/Energy), 7 (Poison), 8 (Snow)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDamageDeal( attacker, damaged, damageValue, damageType )
|
|
{
|
|
var dmgTypeString = "";
|
|
switch( damageType )
|
|
{
|
|
case 1:
|
|
dmgTypeString = "Physical";
|
|
break;
|
|
case 2:
|
|
dmgTypeString = "Light";
|
|
break;
|
|
case 3:
|
|
dmgTypeString = "Rain";
|
|
break;
|
|
case 4:
|
|
dmgTypeString = "Cold";
|
|
break;
|
|
case 5:
|
|
dmgTypeString = "Heat";
|
|
break;
|
|
case 6:
|
|
dmgTypeString = "Lightning/Magic";
|
|
return false; // Character is immune to Lightning/Magic damage!
|
|
case 7:
|
|
dmgTypeString = "Poison";
|
|
break;
|
|
case 8:
|
|
dmgTypeString = "Snow";
|
|
break;
|
|
}
|
|
attacker.TextMessage( "Look at me, I'm dealing " + damageValue + " points of " + dmgTypeString + " damage to a target! *manic laughter*" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDeath" id="eventOnDeath"><span>onDeath</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDeath( pDead, iCorpse )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Add custom effect/behaviour after default death sequence</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>After the player or NPC pDead dies</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>iCorpse is the newly created corpse of pDead (the character who died)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDeath( pDead, iCorpse )
|
|
{
|
|
// If pDead is a player, teleport them to a specific location after dying
|
|
if( !pDead.npc )
|
|
pDead.Teleport( 1000, 1000, 0 );
|
|
|
|
// Prevent other scripts with onDeath event from running
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDeathBlow" id="eventOnDeathBlow"><span>onDeathBlow</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDeathBlow( pKilled, pKiller )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Custom reactions after a killing blow has been made</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a killing blow has been made, this event triggers for pKilled</p>
|
|
<p>Usable in Global script? <span class="hl">No</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent deathblow from killing character</li>
|
|
<li><strong>return true</strong> to allow deathblow to kill character</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDeathBlow( pDead, pKiller )
|
|
{
|
|
pDead.health = pDead.health + 10;
|
|
pDead.TextMessage( "But I'm not dead!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDecay" id="eventOnDecay"><span>onDecay</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDecay( iDecayed )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To interrupt the decay of items to do something special before it's deleted - or prevent the decay of certain items under any circumstance</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When iDecayed is about to decay, the event triggers for iDecayed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent code from decaying/deleting item</li>
|
|
<li><strong>return true</strong> to allow default hard-coded decay process</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Note that if event returns false, yet never disabled decay for item, the event will keep triggering <em>every time</em> UOX3 checks item decay</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDecay( iDecaying )
|
|
{
|
|
// Disable decay for the item so the event doesn't trigger again on next check!
|
|
iDecaying.decay = false;
|
|
iDecaying.decaytime = 10;
|
|
|
|
// Do something with the item and start a timer to delete it
|
|
iDecaying.TextMessage( "I don't feel so good..." );
|
|
iDecaying.StartTimer( 5000, 1, true );
|
|
|
|
// Return false to prevent code from actually decaying the item!
|
|
return false;
|
|
}
|
|
|
|
function onTimer( timerObj, timerID )
|
|
{
|
|
// Timer is up, go through with deletion of the item
|
|
timerObj.Delete();
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDefense" id="eventOnDefense"><span>onDefense</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDefense( pAttacker, pDefender, hitStatus, hitLoc, damageReceived )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customization/fleshing out of combat mechanics</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pAttacker attacks pDefender (in each "round" of combat), event triggers for pDefender, right after onAttack event is triggered for pAttacker</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The event runs at the end of each hard-coded combat "round". hitStatus will be false if attack missed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDefense( pAttacker, pDefender, hitStatus, hitLoc, damageReceived )
|
|
{
|
|
if( hitStatus )
|
|
{
|
|
pAttacker.TextMessage( "Hah! I hit my target for " + damageReceived + "damage" );
|
|
}
|
|
else
|
|
{
|
|
pDefender.TextMessage( "Help! Help! I'm being repressed!" );
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDelete" id="eventOnDelete"><span>onDelete</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDelete( objDestroyed, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Add custom behaviour when certain items/NPCs are deleted via logging, world broadcasts, spawn new items, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Right before an item or character is deleted from the server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates an item</li>
|
|
<li>objType == 1 indicates a character</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDelete( objDestroyed, objType )
|
|
{
|
|
if( objType == 0 )
|
|
Console.Print( objDestroyed.name + " has been deleted from the world.\n" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDismount" id="eventOnDismount"><span>onDismount</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDismount( pUser, npcMount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows triggering effects upon dismounting.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser dismounts npcMount, npcMount's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This runs after a successful dismount. No return values supported.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Randomly change color of mount while riding it, stop the show when dismounting
|
|
function onCharDoubleClick( pUser, targChar )
|
|
{
|
|
// Store player's serial as a string in a tag on mount, and start a timer
|
|
targChar.SetTag( "mountedBy", pUser.serial.toString() );
|
|
targChar.StartTimer( 1000, 1, 19701 );
|
|
return true;
|
|
}
|
|
|
|
function onDismount( pUser, npcMount )
|
|
{
|
|
// Dismounting, so let's stop the disco effect
|
|
npcMount.KillJSTimer( 1, 19701 );
|
|
|
|
// Clear the tag we set earlier
|
|
npcMount.SetTag( "mountedBy", null );
|
|
}
|
|
|
|
function onTimer( npcMount, timerID )
|
|
{
|
|
// Apply random color to mount
|
|
npcMount.skin = RandomNumber( 0, 2000 );
|
|
|
|
// Find who is riding the mount
|
|
var pUser = CalcCharFromSer( parseInt( npcMount.GetTag( "mountedBy" )));
|
|
if( ValidateObject( pUser ))
|
|
{
|
|
// Find the "mount item" equipped on character
|
|
var mountItem = pUser.FindItemLayer( 0x19 );
|
|
|
|
// Apply same color to mount item as mount has
|
|
mountItem.color = npcMount.skin;
|
|
}
|
|
|
|
// Restart timer
|
|
npcMount.StartTimer( 1000, 1, 19701 );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDispel" id="eventOnDispel"><span>onDispel</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDispel( objDispelled, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Add custom behaviour for when an object is dispelled (such as letting NPCs resist being dispelled)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When objDispelled is dispelled, event in objDispelled's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to allow default hard-coded dispel process</li>
|
|
<li><strong>return true</strong> to prevent object from being dispelled by code. Also prevents other scripts with same event from running.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates a character</li>
|
|
<li>objType == 1 indicates an item</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Example 1
|
|
function onDispel( objDispelled, objType )
|
|
{
|
|
Console.Print( objDispelled.name + " has been dispelled.\n" );
|
|
}
|
|
|
|
// Example 2
|
|
function onDispel( objDispelled, objType )
|
|
{
|
|
// Check magic resistance of objDispelled
|
|
if( objType == 0 )
|
|
{
|
|
if(( objDispelled.skills.magicresistance / 10 ) > RandomNumber( 0, 100 ))
|
|
{
|
|
Console.Print( objDispelled.name + " resisted being dispelled!\n" );
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDrop" id="eventOnDrop"><span>onDrop</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDrop( iDropped, pDropper )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allowing control over dropping items from cursor</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pDropper drops iDropped, event in iDropped's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to reject drop and bounce item back to where it came from</li>
|
|
<li><strong>return true/1</strong> to allow drop and proceed with default hard code behaviour</li>
|
|
<li><strong>return 2</strong> to handle drop entirely in script; don't bounce, don't run hard code</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p>
|
|
<span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDrop( iDropped, pDropper )
|
|
{
|
|
var pSock = pDropper.socket;
|
|
|
|
// Client version 6.0.1.7+ has an additional byte before serial of target container
|
|
// Will contain a value for backpack grid index item was dropped in when using clients that support grid containers
|
|
// Will contain a value of -1 in regular 2D UO client and 0 in ClassicUO
|
|
var serOffset = (pSock.clientMajorVer > 6 || ( pSock.clientMajorVer == 6 && pSock.clientSubVer >= 1 && pSock.clientLetterVer >= 7)) ? 11 : 10;
|
|
targSer1 = pSock.GetByte( serOffset + 0 ); // 0 = dropped on character, 0xFF = ground/item
|
|
targSer2 = pSock.GetByte( serOffset + 1 );
|
|
targSer3 = pSock.GetByte( serOffset + 2 );
|
|
targSer4 = pSock.GetByte( serOffset + 3 )
|
|
|
|
if( targSer1 == 0 ) // Target is a character
|
|
{
|
|
var targetChar = CalcCharFromSer( targSer1, targSer2, targSer3, targSer4 )
|
|
if( ValidateObject( targetChar ))
|
|
{
|
|
pDropper.TextMessage( "I've dropped this item on a character, deny if not my own character!!" );
|
|
if( targetChar.serial != pDropper.serial )
|
|
{
|
|
pDropper.TextMessage( "DENIED!" );
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
else if( targSer1 == 0xFF ) // Target is ground or another non-container item
|
|
{
|
|
pDropper.TextMessage( "I've dropped this item on the ground or on another item, let's approve!" );
|
|
}
|
|
|
|
// Default to allow dropping, let code handle it!
|
|
return true;
|
|
}
|
|
</code></pre>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDropItemOnItem" id="eventOnDropItemOnItem"><span>onDropItemOnItem</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDropItemOnItem( iDropped, cDropper, iDroppedOn )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adding custom behaviour when dropping items <strong>on/inside containers</strong></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When iDropped is dropped by cDropper on iDroppedOn, first event in iDropped's script is triggered, then if it doesn't bounce, same event is triggered for iDroppedOn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to reject drop and bounce item back to where it came from</li>
|
|
<li><strong>return true/1</strong> to allow drop and proceed with default hard code behaviour</li>
|
|
<li><strong>return 2</strong> to handle drop entirely in script; don't bounce, don't run hard code</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>iDroppedOn can only be items that are recognized by the client as containers, via the tiledata "container" flag in the client data. The client will not register attempts to drop items on non-container items, and it's not enough to set a container type on an item in UOX3 to overcome this. Modifications to client tiledata is required in order to make client recognize items as potential containers.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDropItemOnItem( iDropped, cDropper, iDroppedOn )
|
|
{
|
|
if( iDropped.id == 0x1f14 ) //If the item being dropped is a recall rune
|
|
{
|
|
if( iDroppedOn.id == 0x0efa ) //If the item being dropped on is a spellbook - which is a container
|
|
{
|
|
cDropper.TextMessage("I am dropping "+iDropped.name+" on a "+iDroppedOn.name );
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
cDropper.TextMessage( "Generic error message!" );
|
|
return false;
|
|
}
|
|
}
|
|
|
|
function onDropItemOnItem( iDropped, pDropper, iDroppedOn )
|
|
{
|
|
if( !ValidateObject( iDroppedOn ))
|
|
return false;
|
|
|
|
pDropper.TextMessage( "I've dropped this item in/on a container, deny if it's not my main pack!" );
|
|
var iPack = pDropper.pack;
|
|
if( !ValidateObject( iPack ) || iPack.serial != iDroppedOn.serial )
|
|
{
|
|
pDropper.TextMessage( "DENIED!" );
|
|
return false;
|
|
}
|
|
|
|
// Default to allow dropping, let code handle it!
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDropItemOnNpc" id="eventOnDropItemOnNpc"><span>onDropItemOnNpc</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDropItemOnNpc( pDropper, pDroppedOn, iDropped )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adding custom behaviour when dropping items on NPCs</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When iDropped is dropped on pDroppedOn, first event in iDropped's script is triggered, then if it doesn't bounce, same event is triggered for pDroppedOn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to reject drop and bounce item back to where it came from</li>
|
|
<li><strong>return true/1</strong> to allow drop and proceed with default hard code behaviour</li>
|
|
<li><strong>return 2</strong> to handle drop entirely in script; don't bounce, don't run hard code</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDropItemOnNpc( pDropper, pDroppedOn, iDropped )
|
|
{
|
|
pDropper.TextMessage( "Here, I offer you my this object as a gift of friendship." );
|
|
|
|
// Move item to NPC's backpack, if he has one
|
|
var targPack = pDroppedOn.pack;
|
|
if( ValidateObject( targPack ))
|
|
{
|
|
pDroppedOn.TextMessage( "Wow! Exactly what I wanted, that's amazing!" );
|
|
iDropped.container = targPack;
|
|
return 2;
|
|
}
|
|
|
|
// Otherwise, reject the item drop and bounce it back where it came from
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnDyeTarget" id="eventOnDyeTarget"><span>onDyeTarget</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onDyeTarget( pUser, dyeTub, targItem )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allowing custom behaviour when targeting items to dye with a dye tub</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser attempts to use dyeTub to dye targItem, the event is triggered from dyeTub's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to override hard coded dye behaviour</li>
|
|
<li><strong>return true/1</strong> to allow hard coded dye behaviour to proceed as normal</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onDyeTarget( pUser, dyeTub, targItem )
|
|
{
|
|
if( targItem.type == 11 )
|
|
{
|
|
pUser.TextMessage( "I can't dye doors!" );
|
|
return false;
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnEnterEvadeState" id="eventOnEnterEvadeState"><span>onEnterEvadeState</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onEnterEvadeState( mNPC, enemyChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom reactions when NPCs enter evasion state. Could for instance have the NPC lash out in panic and destroy nearby dynamic, non-locked down and blocking items...</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When mNPC enters evasion state in combat due to being unable to reach enemyChar, event triggers in mNPC's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>As part of entering evasion state, the NPC's health will automatically be reset to maximum</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onEnterEvadeState( mNPC, enemyChar )
|
|
{
|
|
mChar.TextMessage( "I've entered the Evade state! My HP will be replenished..." );
|
|
enemyChar.TextMessage( "Oops, I caused the NPC to enter Evade state!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnEnterRegion" id="eventOnEnterRegion"><span>onEnterRegion</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onEnterRegion( pEntering, regionEntered )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom reactions when players enter regions</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pEntering enters regionEntered, event is triggered in pEntering's script, before same event is triggered in regionEntered's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Region-scripts can be attached to regions through regions.dfn, using one or more script=# tags</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">
|
|
function onEnterRegion( pEntering, regionEntered )
|
|
{
|
|
if( pEntering.raceID != 11 )
|
|
{
|
|
//sound the alarm! non-undead intruder to region
|
|
//spawn undead guards
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnEntrance" id="eventOnEntrance"><span>onEntrance</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onEntrance( iEntered, objEntering, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour/reactions when objects enter a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When objEntering enters the multi object iEntered, event triggers in iEntered's script, then same event triggers in objEntering's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates objEntering is a character</li>
|
|
<li>objType == 1 indicates objEntering is an item</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onEntrance( iEntered, objEntering, objType )
|
|
{
|
|
if( objType == 0 && !objEntering.npc )
|
|
objEntering.SysMessage("You have entered "+iEntered.name);
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnEquip" id="eventOnEquip"><span>onEquip</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onEquip( pEquipper, iEquipped )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Can be used to apply special effects (stat changes, skill changes, VFX) when players equip certain items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pEquipper equips iEquipped, event triggers in iEquipped's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Event will only ever trigger for items that can actually be equipped!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onEquip( pEquipper, iEquipped )
|
|
{
|
|
pEquipper.StaticEffect( 0x376A, 9, 6 );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnEquipAttempt" id="eventOnEquipAttempt"><span>onEquipAttempt</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onEquipAttempt( pEquipper, iEquipped )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding what happens when a player attempts to equip an item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pEquipper attempts to equip iEquipped, event triggers in iEquipped's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to reject attempt to equip iEquipped</li>
|
|
<li><strong>return true</strong> to allow equip code to continue running like normal (with additional equip checks done there).</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This event runs before the onEquip event, and if script returns false, onEquip event will never run</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onEquipAttempt( pEquipper, iEquipped )
|
|
{
|
|
if( pEquipper.race == 0 )
|
|
{
|
|
pEquipper.TextMessage( "This item cannot be equipped by humans!" );
|
|
return false;
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnFacetChange" id="eventOnFacetChange"><span>onFacetChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onFacetChange( mChar, oldFacet, newFacet )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows custom behaviour to be added for characters that moves from one facet to another, or to deny this change altogether</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When character with event attached in a script moves from one facet to another</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to disallow facet change</li>
|
|
<li><strong>return true</strong> to allow facet change</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This event only runs for characters, and using the event in the global script is not supported.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onFacetChange( mChar, oldFacet, newFacet )
|
|
{
|
|
// Add a specific script to all characters that switch to the Trammel facet,
|
|
// but remove said script if character moves to any other facet
|
|
switch( newFacet )
|
|
{
|
|
case 1: // Trammel
|
|
mChar.AddScriptTrigger( X ); // X is a scriptID
|
|
break;
|
|
default:
|
|
mChar.RemoveScriptTrigger( X ); // X is a scriptID
|
|
break;
|
|
|
|
}
|
|
|
|
// Return true allows the facet change to happen like normal
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnFall" id="eventOnFall"><span>onFall</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onFall( pFall, fallDistance )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Can be used to apply custom effects/behaviour (like taking damage) when character takes a fall (as determined by <em>client</em>!)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pFall is determined by server to be falling, event triggers in pFall's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>pFall can be either an NPC or PC, will only trigger (by the client) if fallDistance is over 20, so it does not trigger whenever a character walks down steps/off small ledges/down hills, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onFall( pFall, fallDistance )
|
|
{
|
|
if( fallDistance > 20 )
|
|
pFall.SysMessage("Yikes! That was a long fall! I fell " + fallDistance + " meters!" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnFlagChange" id="eventOnFlagChange"><span>onFlagChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onFlagChange( pChanging, newStatus, oldStatus )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow detecting and acting on flag changes, such as performing a special action when a player becomes a criminal or murderer.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pChanging's flag (criminal system, innocent, criminal, murderer, etc) changes, event triggers in pChanging's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to allow other scripts with event to run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Might take a few seconds to trigger for NPCs after a flag update has taken place, based on what NPCFLAGUPDATETIMER in UOX.INI is set to.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onFlagChange( pChanging, newStatus, oldStatus )
|
|
{
|
|
if( newStatus == 0x01 ) // Murderer
|
|
BroadcastMessage( "Announcement! " + pChanging.name + " has been declared a murderer, and may be killed on sight! Bounty available!" );
|
|
else if( newStatus == 0x02 ) // Criminal
|
|
BroadcastMessage( "Rumor has it that " + pChanging.name + " has fallen afoul of the law! Keep those coin purses safe!" );
|
|
else if( newStatus == 0x04 ) // Innocent
|
|
BroadcastMessage( "Good news, everyone! " + pChanging.name + " has returned to the straight and narrow path!" );
|
|
else if( newStatus == 0x08 ) // Neutral
|
|
BroadcastMessage( "Filthy neutrals like " + pChanging.name + "... you never know where you stand with them. It sickens me!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#onGumpInput" id="onGumpInput"><span>onGumpInput</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onGumpInput( pSock, pButtonID, gumpText )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customizing behaviour from player input via old-school gump text entry dialogues</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When text is entered and submitted via the old-school gump text entry dialogue</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Gump text entry dialogue sent from server via packet 0xAB, response sent from client via packet 0xAC. Primarily used for stuff like entering gold donation amount in townstone menus, entering guild-name when creating/renaming guild, guild-abbreviation, guild master's title, guild-charter</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onGumpInput( pSock, pButtonID, gumpText )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
pUser.TextMessage( "I pressed a button with ID " + pButtonID );
|
|
pUser.TextMessage( "The text entry gump contained this text: " + gumpText );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#onGumpPress" id="onGumpPress"><span>onGumpPress</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onGumpPress( pSock, pButton, gumpData )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions to button presses in gumps</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player presses a button in a Gump from the same script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>pButton is the button-ids for normal gump-buttons, while gumpData handles radiobutton-ids, checkbox-ids, and text-entry-ids(and the text-entries).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onGumpPress( pSock, pButton, gumpData )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
switch(pButton)
|
|
{
|
|
case 0:
|
|
// abort and do nothing
|
|
break;
|
|
case 1:
|
|
var Text1 = gumpData.getEdit(0);
|
|
pUser.SysMessage( "The first TextEntry was: "+Text1 );
|
|
var Text2 = gumpData.getEdit(1);
|
|
pUser.SysMessage( "The second TextEntry was: "+Text2 )
|
|
var OtherButton = gumpData.getButton(0);
|
|
switch(RadioButton)
|
|
{
|
|
case 0:
|
|
pUser.SysMessage( "You selected RadioButton number: "+OtherButton );
|
|
pUser.DoAction( 15 );
|
|
break;
|
|
case 1:
|
|
pUser.SysMessage( "You selected RadioButton number: "+OtherButton );
|
|
pUser.DoAction( 11 );
|
|
break;
|
|
case 2:
|
|
pUser.SysMessage( "The Checkbox with ID "+OtherButton+" was checked." );
|
|
pUser.DoAction( 18 );
|
|
break;
|
|
|
|
}
|
|
break;
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnHelpButton" id="eventOnHelpButton"><span>onHelpButton</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onHelpButton( pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding the behaviour of the Help button in the player paperdoll, for instance to do custom Help gumps</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player clicks the Help button in their character paperdoll</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to prevent hard-coded response and/or other scripts with event from running</li>
|
|
<li><strong>return true</strong> to allow hard-coded button response to run like normale</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onHelpButton( pChar )
|
|
{
|
|
pChar.TextMessage( "I pressed the Help button! Let's override the menu." );
|
|
|
|
// Do custom Help gump here
|
|
// ...
|
|
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnHouseCommand" id="eventOnHouseCommand"><span>onHouseCommand</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onHouseCommand( pSocket, iMulti, cmdID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To bring house command handling from hard code to JS engine, making it easier to adjust and extend the housing system in the future.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player speaks a house command while inside a house, event triggers in iMulti's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to allow hard-coded response and/or other scripts with event from running</li>
|
|
<li><strong>return true</strong> to prevent hard-coded response and/or other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>cmdID is the ID of a triggerword uttered by the player. These triggerwords are defined client-side, and depending on the client version range from 0 to 255. See Speech tab in UOFiddler for a complete list!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onHouseCommand( pSocket, iMulti, cmdID )
|
|
{
|
|
if( ValidateObject( iMulti ) && iMulti.IsInMulti( pSocket.currentChar ))
|
|
{
|
|
switch( cmdID )
|
|
{
|
|
case 34: // Remove Thyself
|
|
pSocket.CustomTarget( 0, "Who do you want to remove from your house?" );
|
|
break;
|
|
default:
|
|
Console.Log( "Unhandled house command detected with cmdID: " + cmdID );
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnHungerChange" id="eventOnHungerChange"><span>onHungerChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onHungerChange( pChanging, newStatus )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customization of behaviour when a character's hunger level changes. Could be used for wilding of pets, or for changing AI of monsters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player's hunger level changes, event triggers in pChanging's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override hard-code and handle hunger in script</li>
|
|
<li><strong>return true</strong> to proceed with hard-code, and/or let other scripts with event handle hunger change</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If overridden, the normal hunger messages are not displayed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onHungerChange( pChanging, newStatus )
|
|
{
|
|
pChanging.TextMessage( "ooooo, I feel more hungry" );
|
|
if( newStatus == 0 )
|
|
{
|
|
TextMessage( pChanging, "I'm melting, I'm melting!" );
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnIterate" id="eventOnIterate"><span>onIterate</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onIterate( object[, socket] )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To perform checks or make changes to each object iterated over by the IterateOver() function</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When IterateOver() function is called from a script, event will trigger (in the same script) for every object the iterator comes across</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to continue iterating over objects without including the current object in the count of objects iterated over</li>
|
|
<li><strong>return true</strong> to continue iterating over objects while including the current object in the count of objects iterated over</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The IterateOver() function will return a count of all objects that onIterate returned true for. It also supports an optional socket parameter, which can be passed in via the IterateOver Function.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Example without socket parameter
|
|
function KillNPCs( socket, pUser )
|
|
{
|
|
socket.SysMessage( "Killing all NPCs (including invulnerable ones!)" );
|
|
var numKilled = IterateOver( "CHARACTER" );
|
|
socket.SysMessage( "Killed " + NumToString( numKilled ) + " NPCs " );
|
|
}
|
|
|
|
function onIterate( charCheck )
|
|
{
|
|
if( ValidateObject( charCheck ) && charCheck.npc )
|
|
{
|
|
charCheck.Kill();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Example with the optional socket parameter:
|
|
function KillAllMurderers( socket, pUser )
|
|
{
|
|
var numKilled = IterateOver( "CHARACTER", socket );
|
|
pUser.TextMessage( "I killed " + numKilled + " murderers!" );
|
|
}
|
|
|
|
function onIterate( charCheck, socket )
|
|
{
|
|
if( ValidateObject( charCheck ) && !charCheck.npc && charCheck.murderer )
|
|
{
|
|
socket.SysMessage( "Found a murderer by the name of " + charCheck.name + "! Killing..." );
|
|
charCheck.Kill();
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnLeaveRegion" id="eventOnLeaveRegion"><span>onLeaveRegion</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onLeaveRegion( pLeaver, regionLeft )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions when characters leave regions</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pLeaver leaves regionLeft, event first triggers in pLeaver's script, then triggers in regionLeft's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Region-scripts can be attached to regions through on or more script=# tags in regions.dfn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onLeaveRegion( pLeaver, regionLeft )
|
|
{
|
|
// if pLeaver is not allowed to leave the region
|
|
// turn him into a criminal and spawn guards to go after him!
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnLeaving" id="eventOnLeaving"><span>onLeaving</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onLeaving( iMultiLeft, objLeaving, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reaction to/custom behaviour for when an object leaves a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>when objLeaving leaves iMultiLeft, event triggers in iMultiLeft's script, then event triggers in objLeaving's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates objLeaving is a character</li>
|
|
<li>objType == 1 indicates objLeaving is an item</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onLeaving( iLeft, objLeaving, objType )
|
|
{
|
|
if( objType == 0 && !objType.npc )
|
|
objLeaving.SysMessage( "You have left " + iLeft.name );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnLightChange" id="eventOnLightChange"><span>onLightChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onLightChange( myObject, lightLevel )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour on objects when light level changes. Could for instance be used to automatically turn on lights/lamps when it becomes dark out, and turn them off when it becomes bright</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers in script of myObject (char or item) when lightLevel changes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with same event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can also be put in global script (scriptID 0) to trigger for all objects</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onLightChange( myObject, lightLevel )
|
|
{
|
|
// (pseudo-code)
|
|
if( ValidateObject( myObject ) && myObject.isItem )
|
|
{
|
|
if( myObject.id == [insert_unlit_lamppost_id] )
|
|
{
|
|
if( lightLevel > 10 ) //high light levels = dark, low light levels = bright
|
|
{
|
|
myObject.id = [insert_lit_lamppost_id];
|
|
return true;
|
|
}
|
|
}
|
|
else if( myObject.id == [insert_lit_lamppost_id] )
|
|
{
|
|
if( lightLevel < 10 )
|
|
{
|
|
myObject.id = [insert_unlit_lamppost_id]
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnLogin" id="eventOnLogin"><span>onLogin</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onLogin( sockPlayer, pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customization of what happens when a player logs in. Could pop up custom gumps, or do certain things (say everyone ALWAYS starts in one spot, no matter where they logged out. Diabloesque hall logins).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for pChar's script when pChar logs in to the world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>sockPlayer is never -1</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onLogin( sockPlayer, pChar )
|
|
{
|
|
pChar.Teleport( 1000, 1000, 0, 0 );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnLogout" id="eventOnLogout"><span>onLogout</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onLogout( sockPlayer, pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customization of what happens when a player logs out, like do certain things with the character (teleport them to a specific location, set some properties, etc)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for pChar's script when pChar logs out of the world. Event can also be put in global script (with scriptID 0) to trigger for all player characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>sockPlayer is never -1</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onLogin( sockPlayer, pChar )
|
|
{
|
|
sockPlayer.SysMessage( "Farewell! Come back soon." );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnMakeItem" id="eventOnMakeItem"><span>onMakeItem</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onMakeItem( socket, crafter, craftedItem, createEntryID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow special handling of newly crafted items.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Immediately after a character has attempted to craft an item, the even triggers in scripts attached to the character.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If character failed to create an item, the event still triggers, but craftedItem be null</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onMakeItem( socket, crafter, craftedItem, createEntryID )
|
|
{
|
|
// Have crafter say a message
|
|
if( ValidateObject( crafter ))
|
|
{
|
|
if( ValidateObject( craftedItem ))
|
|
{
|
|
crafter.TextMessage( "I crafted an item based on createEntryID " + createEntryID );
|
|
}
|
|
else
|
|
{
|
|
crafter.TextMessage( "I failed to craft an item with createEntryID " + createEntryID );
|
|
}
|
|
}
|
|
|
|
if( ValidateObject( craftedItem ))
|
|
{
|
|
// ... Do something with craftedItem
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnMoveDetect" id="eventOnMoveDetect"><span>onMoveDetect</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onMoveDetect( srcObj, pChar, rangeToChar, oldCharX, oldCharY )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow detection of movement near an object (items only, for now). Distance at which it triggers determined by part 1 of the item's MORE property.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When an object detects movement by a character nearby, based on range defined in item's MORE property</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Use long ranges with care!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onMoveDetect( srcObj, pChar, rangeToChar, oldCharX, oldCharY )
|
|
{
|
|
// .. do something when character is in range of object
|
|
}
|
|
|
|
// For examples of how this can be used, check out the following scripts in your UOX3 folder:
|
|
// js/server/misc/warning_trigger.js
|
|
// js/server/misc/dungeon_trap.js</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnMultiLogout" id="eventOnMultiLogout"><span>onMultiLogout</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onMultiLogout( iMulti, cPlayer )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To validate/allow custom behaviour for players attempting to safely log out while inside a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When cPlayer logs out while inside iMulti, event triggers in iMulti's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to disallow player's attempt to safely log out from inside multi</li>
|
|
<li><strong>return true</strong> to allow player's attempt to safely log out from inside multi. Prevents same event from running in other scripts</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>When a safe logout attempt (by just logging out normally while inside multi) is allowed, script informs code that a safe/instant logout can be attempted. Code then performs other hard-coded checks before allowing this (checking for criminal status, aggressor status, etc). When safe logout attempt is disallowed, server rejects the instant log out, and character remains behind in the world for the normal logout timer, and additionally gets booted out of the multi they're in.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onMultiLogout( iMulti, cPlayer )
|
|
{
|
|
if( ValidateObject( iMulti.owner ) && iMulti.owner == cPlayer )
|
|
{
|
|
// Owner of house! Allow safe logout
|
|
return true;
|
|
}
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnNameRequest" id="eventOnNameRequest"><span>onNameRequest</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onNameRequest( myObj, requestedBy, requestSource )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow better control of what names are sent to the client for a given object, by making it possible to override the object's name when it's requested. Can be used to create systems where players have to learn the names of other characters, or "incognito" systems, or even a setup where players can know each other by different names!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for myObj whenever their name is retrieved by UOX3, if they have a script attached with the event present - or if the event is present in the global script (ID 0), in which case it would trigger for _all_ characters and items.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return empty string/false/true</strong> to use default name of object</li>
|
|
<li><strong>return [string]</strong> to use custom name for object</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>requestedBy is a reference to the character (if any) that requested the name, for instance via dragging myObj's health-bar, using all-names macro, opening of paperdoll or just from general client requests for info about myObj</li>
|
|
<li>If an attempt to retrieve myObj's name is done from within the onNameRequest event, it will return the real name of the object (to avoid infinite loop situations)</li>
|
|
<li>requestSource is a value that indicates where the name request originated, to allow scripts to tailor the response accordingly
|
|
<pre><code class="language-javascript">0 - Speech/System Messages
|
|
1 - Guild Menus
|
|
2 - Stat Window (self)
|
|
3 - Stat Window (other)
|
|
4 - Tooltip
|
|
5 - Paperdoll Journal
|
|
6 - Paperdoll
|
|
7 - Single Click / All-Names
|
|
8 - System
|
|
9 - Secure Trade Window</code></pre></li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onNameRequest( myObj, requestedBy, requestSource )
|
|
{
|
|
if( myObj.isChar )
|
|
{
|
|
if( ValidateObject( requestedBy ))
|
|
{
|
|
// Return "Unknown" as name when name is requested by another character who doesn't "know" myObj
|
|
if( requestedBy.serial != myObj.serial && !myObj.GetTag( "knowsMe" + requestedBy.serial ))
|
|
{
|
|
return "Unknown";
|
|
}
|
|
}
|
|
|
|
// Return an empty string (or true/false) to have UOX3 use/send the object's default name
|
|
return "";
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnPacketReceive" id="eventOnPacketReceive"><span>onPacketReceive</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onPacketReceive( socket, packetNum, subCommand )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Similar to "packet-hooks" in other emulators - allows overriding the handling of incoming network packets without modifying the server source-code</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When receiving a network packet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>OVERLOADPACKETS needs to be enabled in UOX.INI and each specific packet script must be registered in jse_fileassociations.scp and registered with UOX3 via the PacketRegistration/RegisterPacket functions. Note that subCommand is currently not supported; can be left as 0.<br><br></p>
|
|
<p><strong>IMPORTANT:</strong> Once a packet has been registered this way, it needs to be handled in its entirety through the script, including any and all responses expected by the client. Not sending the correct response to a packet, or reading the wrong amount of bytes for the packet can result in unexpected behaviour in client/server.</p>
|
|
</div>
|
|
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function PacketRegistration()
|
|
{
|
|
RegisterPacket( [packetID], [subCommand] );
|
|
}
|
|
|
|
function onPacketReceive( pSocket, packetNum, subCommand )
|
|
{
|
|
var cmd = pSocket.GetByte( 0 );
|
|
if( cmd != packetNum )
|
|
return;
|
|
|
|
... // Read packet data here, using ReadBytes, GetByte, GetWord, GetDWord, GetSByte, GetSWord, GetSDWord and GetString socket methods
|
|
return;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnPathfindEnd" id="eventOnPathfindEnd"><span>onPathfindEnd</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onPathfindEnd( tChar, pathfindResult )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Can be used to detect and/or do something when NPC pathfinding comes to an end</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When NPC pathfinding after JS methods WalkTo()/RunTo() comes to an end, event triggers in tChar's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with same event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>pathfindResult parameter contains...</p>
|
|
<ul>
|
|
<li>-1 if pathfinding failed</li>
|
|
<li>0 if pathfinding partially succeeded but final location was blocked by a character</li>
|
|
<li>1 if pathfinding succeeded and NPC reached target location</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onPathfindEnd( tChar, pathfindResult )
|
|
{
|
|
if( ValidateObject( tChar ))
|
|
{
|
|
tChar.TextMessage( "Pathfinding ended! Result of pathfinding was... ");
|
|
switch( pathfindResult )
|
|
{
|
|
case -1: // Pathfinding failed
|
|
tChar.TextMessage( "...a failure! I couldn't move at all." );
|
|
break;
|
|
case 0: // Pathfinding partially succeeded, but didn't make it all the way to target destination
|
|
tChar.TextMessage( "...a partial success! I made it part of the way there." );
|
|
break;
|
|
case 1: // Reached end of the path
|
|
tChar.TextMessage( "...a success! I reached my target location." );
|
|
break;
|
|
default:
|
|
tChar.TextMessage( "...a success? A failure? I have no idea. Result unknown!" );
|
|
break;
|
|
}
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnPickup" id="eventOnPickup"><span>onPickup</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onPickup( iPickedUp, pGrabber, containerObj )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow controlling whether characters are allowed to pickup certain items, or what happens if they do</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pGrabber picks up iPickedUp, the event triggers in iPickedUp's script, then in pGrabber's script - then finally in containerObj's script (if not null)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent the pickup from happening, and bounce item back</li>
|
|
<li><strong>return true</strong> to allow the pickup</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onPickup( iPickedUp, pGrabber, containerObj )
|
|
{
|
|
var pSock = pGrabber.socket;
|
|
|
|
//Check the value of pSock.pickupSpot to determine where the item was picked up from
|
|
switch( pSock.pickupSpot )
|
|
{
|
|
case 0: //nowhere
|
|
pGrabber.TextMessage( "I picked up this item from... NOWHERE!" );
|
|
break;
|
|
case 1: //ground
|
|
pGrabber.TextMessage( "I picked up this item from the ground." );
|
|
break;
|
|
case 2: //ownpack
|
|
pGrabber.TextMessage( "I picked up this item from my own backpack." );
|
|
break;
|
|
case 3: //otherpack
|
|
var contName = ValidateObject( containerObj ) ? containerObj.name : "unknown";
|
|
pGrabber.TextMessage( "I picked up this item from a container (" + contName + ")." );
|
|
break;
|
|
case 4: //paperdoll
|
|
pGrabber.TextMessage( "I picked up this item from my paperdoll." );
|
|
break;
|
|
case 5: //bank
|
|
pGrabber.TextMessage( "I picked up this item from my bank box." );
|
|
break;
|
|
default:
|
|
pGrabber.TextMessage( "Error. Redo from Start." );
|
|
break;
|
|
}
|
|
|
|
//Use return false to disallow the pickup and bounce item
|
|
//return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnProfileRequest" id="eventOnProfileRequest"><span>onProfileRequest</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onProfileRequest( socket, profileOwnerChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To control what text is shown from the paperdoll profile of profileOwnerChar to the requesting client (socket)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When client (socket) requests data for a paperdoll profile (belonging to profileOwnerChar). Any text returned from the event will be sent to the client.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return ""</strong> to not show anything</li>
|
|
<li><strong>return someString</strong> to display the contents of someString to the client</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onProfileRequest( socket, profileOwnerChar )
|
|
{
|
|
return "This is an example of some text displayed in a paperdoll profile";
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnProfileUpdate" id="eventOnProfileUpdate"><span>onProfileUpdate</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onProfileUpdate( socket, updatedProfileText )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To retrieve updates to a player's paperdoll profile, which could then (for instance) be stored in a persistent file on the server.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When client sends updated data from the paperdoll profile (i.e. paperdoll profile is closed after changing it)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<p>No return values supported</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onProfileUpdate( socket, updatedProfileText )
|
|
{
|
|
socket.currentChar.TextMessage( "Updated Profile Text:" + updatedProfileText );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnQuestGump" id="eventOnQuestGump"><span>onQuestGump</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onQuestGump( pUser )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow providing a response to players who click the Quest button in paperdoll, for instance by showing a custom quest gump?</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers in pUser's script when quest button in paperdoll is pressed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to allow other scripts with same event to run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with same event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onQuestGump( pUser )
|
|
{
|
|
pUser.TextMessage( "I pressed the Quest button in paperdoll!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnReleasePet" id="eventOnReleasePet"><span>onReleasePet</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onReleasePet( player, pet )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Lets script authors override or block the release of a pet by a player. Return <code>false</code> to prevent the release and handle it through script (e.g., open a confirmation gump), or <code>true</code> to allow the default UOX3 behavior.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player attempts to release a pet using the “release” context menu or other command.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The pet must be valid and under the control of the player. Script can check bonded status, or open a custom UI to confirm release. Be sure to <strong>return true or false explicitly</strong>; omitting a return will default to false (blocking release).</p>
|
|
</div>
|
|
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onReleasePet( player, pet )
|
|
{
|
|
if( pet.GetTag("isBondedPet") == 1 )
|
|
{
|
|
player.SysMessage("You cannot release a bonded pet!");
|
|
return false;
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnResurrect" id="eventOnResurrect"><span>onResurrect</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onRessurect( pAlive )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow control over what happens when a player is returned to life</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player pAlive is being resurrected, event triggers in pAlive's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent resurrection</li>
|
|
<li><strong>return true</strong> to allow resurrection</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Only applies to PCs, since NPCs cannot currently be in a state of "death" (they're either alive, or don't exist)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onResurrect( pAlive )
|
|
{
|
|
var ResAmount = pAlive.GetTag( "ResAmount" );
|
|
if( ResAmount && ResAmount < 5 )
|
|
{
|
|
pAlive.SysMessage( "You still have some spirit left... have a good one!" );
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
pAlive.SysMessage( "You've resurrected too many times already! Have fun in the gray world... FOREVER!" );
|
|
return false;
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnScrollCast" id="eventOnScrollCast"><span>onScrollCast</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onScrollCast( pUser, spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding spellcasting from magic scrolls</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a spell is cast using a magic scroll, event triggers in pUser's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return -2</strong> to use normal spellcasting</li>
|
|
<li><strong>return -1</strong> to cancel normal spellcasting, and handle everything in script</li>
|
|
<li><strong>return a value</strong> between 0 to 32767 to use normal spellcasting, but with a delay matching the value provided in ms</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onScrollCast( pUser, spellID )
|
|
{
|
|
if( spellID == 18 )
|
|
{
|
|
pUser.TextMessage( "I'm casting a fireball from a fireball-scroll!" );
|
|
return -2;
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnScrollingGumpPress" id="eventOnScrollingGumpPress"><span>onScrollingGumpPress</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onScrollingGumpPress( pSock, gumpID, buttonID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow handling gump presses from old-school horizontally scrolling T2A gumps displayed in client via packet 0x76</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When player clicks an entry in the old-school horizontally scrolling T2A gump displayed in client via packet 0x76, as long as said gump uses a gumpID between 0x4000 and 0xFFFF, and the event itself is present in the global script (script ID 0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// The below example sends instructions to the client to open
|
|
// a horizontally scrolling gump with 4 options - one for Repair, one to craft Shields, one to craft
|
|
// Armor, and one to craft Weapons. Note that this example does not handle submenus sent after player press an
|
|
// initial option.
|
|
|
|
// For testing purposes, we double-click an item to open the gump
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var socket = pUser.socket;
|
|
|
|
var pStream = new Packet; // Create new packet stream and reserve a size of 83 bytes
|
|
pStream.ReserveSize( 83 );
|
|
|
|
// Register packet ID 0x7c
|
|
pStream.WriteByte( 0, 0x7C );
|
|
|
|
// Send size of packet
|
|
pStream.WriteShort( 1, 0x0053 ); // 83 bytes
|
|
pStream.WriteLong( 3, 0x00000000 ); // Irrelevant?
|
|
pStream.WriteShort( 7, 0x5000 ); // ID of gump, must be between 0x4000 and 0xffff
|
|
|
|
// Register text at top of menu window
|
|
pStream.WriteByte( 9, 0x1d );
|
|
pStream.WriteString( 10, "What would you like to make?", 0x1d );
|
|
|
|
// Inform client we want to show 4 menu options
|
|
pStream.WriteByte( 39, 4 );
|
|
|
|
// Register menu option 1
|
|
pStream.WriteShort( 40, 0x0faf );
|
|
pStream.WriteShort( 42, 0x0000 );
|
|
pStream.WriteByte( 44, 6 );
|
|
pStream.WriteString( 45, "Repair", 6 );
|
|
|
|
// Register menu option 2
|
|
pStream.WriteShort( 51, 0x1b72 );
|
|
pStream.WriteShort( 53, 0x0000 );
|
|
pStream.WriteByte( 55, 6 );
|
|
pStream.WriteString( 56, "Shield", 6 );
|
|
|
|
// Register menu option 3
|
|
pStream.WriteShort( 62, 0x1415 );
|
|
pStream.WriteShort( 64, 0x0000 );
|
|
pStream.WriteByte( 66, 5 );
|
|
pStream.WriteString( 67, "Armor", 5 );
|
|
|
|
// Register menu option 4
|
|
pStream.WriteShort( 72, 0x13b9 );
|
|
pStream.WriteShort( 74, 0x0000 );
|
|
pStream.WriteByte( 76, 6 );
|
|
pStream.WriteString( 77, "Weapon", 6 );
|
|
|
|
// Send menu to player
|
|
socket.Send( pStream );
|
|
pStream.Free();
|
|
return false;
|
|
}
|
|
|
|
// Let's handle the player's clicks in the gump
|
|
function onScrollingGumpPress( pSock, gumpID, buttonID )
|
|
{
|
|
pSock.SysMessage( "I pressed button: " + buttonID + " in gump with ID " + gumpID );
|
|
// ... craft additional packets with submenu content etc. based on which button player clicked
|
|
}
|
|
</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSell" id="eventOnSell"><span>onSell</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSell( pSock, Vendor )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater control over who can sell stuff to specific vendors.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for Vendor's script before trade gump opens</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent hard code from executing and trade gump from opening</li>
|
|
<li><strong>return true</strong> to let trade gump open like normal, via hard code</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSell( pSock, Vendor )
|
|
{
|
|
// If player does not belong to the undead race, vendor wants nothing to do with him!
|
|
if( pSock.currentChar.raceID != 11 )
|
|
{
|
|
Vendor.TextMessage( "RIGHT! As if I would buy from you..." );
|
|
return false;
|
|
}
|
|
else
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSellToVendor" id="eventOnSellToVendor"><span>onSellToVendor</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSellToVendor( pSock, Vendor, iSold, iAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater control over the selling of specific items to vendors</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for iSold's (and/or Vendor's) script after player verifies sale, but before sale has actually gone through</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> will prevent sale from going through, without closing the menu</li>
|
|
<li><strong>return true</strong> will make the sale go through as normal</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSellToVendor( pSock, Vendor, iSold, iAmount )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
pUser.TextMessage( "I am selling " + iAmount + " item(s) (" + iSold.name + ") to a vendor!" );
|
|
Vendor.TextMessage( "I am buying an item!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSoldToVendor" id="eventOnSoldToVendor"><span>onSoldToVendor</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSoldToVendor( pSock, Vendor, iSold, iAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater control over what happens after specific items have been sold to NPCs</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for iSold's (and/or Vendor's) script after the item has already been sold and has reached the NPC vendor's "bought items"-backpack</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If the item sold to the vendor stacks with items already there, the script will run on the entire stack, not just the one item specifically sold!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">
|
|
function onSoldToVendor( pSock, Vendor, iSold, iAmount )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
pUser.TextMessage( "I sold " + iAmount + " item(s) (" + iSold.name + ") to a vendor!" );
|
|
Vendor.TextMessage( "I just bought an item from some random dude!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkill" id="eventOnSkill"><span>onSkill</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkill( objUsing, skillUsed, objType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Complements the use of current skill code</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When objUsing uses skill skillUsed, event triggers for objUsing's script. If no event is found, event directly attached to skill triggers instead. Fires before any existing skill usage code kicks in</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>objType == 0 indicates objUsing is a character</li>
|
|
<li>objType == 1 indicates objUsing is an item</li>
|
|
</ul>
|
|
<p>If used with RegisterSkill() in a script listed under SKILLUSE_SCRIPTS in jse_fileassociations.scp, event will trigger for only the registered skill. If used in a stand-alone script listed under SCRIPT_LIST section instead, event will be a global listener for all skills used.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkill( objUsing, skillUsed, objType )
|
|
{
|
|
switch( skillUsed )
|
|
{
|
|
case 0:
|
|
objUsing.TextMessage("Time to do some alchemy work!");
|
|
break;
|
|
case 1:
|
|
objUsing.TextMessage("Now using Anatomy skill!");
|
|
break;
|
|
case 2:
|
|
objUsing.TextMessage("Animal Lore usage Enabled!");
|
|
break;
|
|
//case etc.:
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkillChange" id="eventOnSkillChange"><span>onSkillChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkillChange( pPlayer, skill, skillChangeAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows you to take action when your skill level changes (positively or negatively)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>This event is fired if onSkillLoss or onSkillGain return true, or if those events are not defined. If the events returned false, onSkillChange will not trigger</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkillChange( pPlayer, skill, skillChangeAmount )
|
|
{
|
|
if( skillChangeAmount > 0 )
|
|
pPlayer.TextMessage( "Oh wow, I've gained some points in skill number " + skill + "!" );
|
|
else
|
|
pPlayer.TextMessage( "Oh noes, I've lost some points in skill number " + skill + "!" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkillCheck" id="eventOnSkillCheck"><span>onSkillCheck</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkillCheck( pUser, skillID, lowSkill, highSkill, forceResult )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>For taking additional action when skillchecks are performed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for pUser's script when a skillcheck is performed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to allow hard-coded skillcheck to run</li>
|
|
<li><strong>return true</strong> to prevent hard-coded skillcheck and other scripts with event from running. Skillcheck is then optionally handled in script</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Runs just prior to skillcheck. lowSkill is minimum skill requirement for successful use of the skill (as passed into the skill check), while highSkill is the maximum skill the player can reach (as passed into the skill check). forceResult will one of three values: -1 if result of skill check was forced to fail, 0 if a normal skillcheck was performed, and 1 if result of skill check was forced to succeed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkillCheck( pUser, skillID, lowSkill, highSkill, forceResult )
|
|
{
|
|
pUser.TextMessage( "A skillcheck is being done for skill with ID " + skillID + "!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkillGain" id="eventOnSkillGain"><span>onSkillGain</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkillGain( pPlayer, skill, skillGainAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allow preventing or taking special action before skill gain takes place</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pPlayer gains in skill skill</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent skill gain from taking place, and prevent event in other scripts from executing</li>
|
|
<li><strong>return true</strong> to allow skill gain from taking place, and allow events in other scripts and/or hard code to execute</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkillGain( pPlayer, skill, skillGainAmount )
|
|
{
|
|
pPlayer.TextMessage( "Aww, I was about to gain " + ( skillGainAmount / 10 ) + " points in skill number " + skill + ", but got denied!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkillLoss" id="eventOnSkillLoss"><span>onSkillLoss</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkillLoss( pPlayer, skill, skillLossAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allow preventing or taking special action before skill loss takes place</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Just before pPlayer loses skillLossAmount in skill skill</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent skill loss from taking place, and prevent event in other scripts from executing</li>
|
|
<li><strong>return true</strong> to allow skill loss from taking place, and allow events in other scripts and/or hard code to execute</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkillLoss( pPlayer, skill, skillLossAmount )
|
|
{
|
|
pPlayer.TextMessage( "Phew, I was about to lose " + ( skillLossAmount / 10 ) + " points in skill number " + skill + ", but it didn't happen!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSkillGump" id="eventOnSkillGump"><span>onSkillGump</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSkillGump( pUser )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>For overriding the client's request to open the default skillgump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser tries opening the skill-gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to prevent default skill gump from opening</li>
|
|
<li><strong>return true</strong> to proceed with opening default skill gump</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSkillGump( pUser )
|
|
{
|
|
pUser.SysMessage( "Overriding default skillgump, opening custom one instead..." );
|
|
// Insert custom skillgump here!
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSnooped" id="eventOnSnooped"><span>onSnooped</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSnooped( pSnooped, pSnooping, bSuccess )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow for behavioural change on snooping behaviour</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>After pSnooping snoops into pSnooped's pack</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow same event in other scripts to trigger (if snooping succeeded), or to let hard code handle result of failed snooping (if snooping failed)</li>
|
|
<li><strong>return true</strong> to prevent same event in other scripts from triggering (if snooping succeeded), or to prevent hard code from handling result (if snooping failed)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>bSuccess is true if snooping succeeded, false if it failed. If false, the script must handle things that would otherwise be handled by hard code, like turning snooper criminal, handling loss of karma, calling for guards, sending messages snooper/snooped, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSnooped( pSnooped, pSnooping, bSuccess )
|
|
{
|
|
if( !bSuccess && !pSnooping.criminal )
|
|
{
|
|
pSnooped.TextMessage( "Oi! You! Stop snooping, or I'll call the guards!" );
|
|
pSnooping.criminal = true;
|
|
}
|
|
else if( !bSuccess && pSnopping.criminal )
|
|
{
|
|
pSnooped.TextMessage( "That's it, you've crossed the line! GUARDS!" );
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSnoopAttempt" id="eventOnSnoopAttempt"><span>onSnoopAttempt</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSnoopAttempt( pSnooped, iCont, pSnooping )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow for custom behaviour when players attempt to snoop into other characters' iCont</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pSnooping attempts to snoop into pSnooped's iCont container</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent hard-code and other snooping-related events from running</li>
|
|
<li><strong>return true</strong> to allow hard-code and other snooping-events to run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSnoopAttempt( pSnooped, iCont, pSnooping )
|
|
{
|
|
pSnooping.SysMessage( "The target is protected and cannot be snooped!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpeech" id="eventOnSpeech"><span>onSpeech</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpeech( strSaid, pTalking, pTalkingTo )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Greatly improve the speech handling capabilities</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pTalking says strSaid to pTalkingTo. pTalkingTo's script is activated. Can also trigger in item scripts, if ITEMSDETECTSPEECH is enabled in UOX.INI.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return -1</strong> No such function or bad call (usually by code)</li>
|
|
<li><strong>return 0</strong> Let other NPCs and PCs see strSaid (default)</li>
|
|
<li><strong>return 1</strong> Let other PCs see strSaid (but not NPCs)</li>
|
|
<li><strong>return 2</strong> Let no one else see strSaid</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSpeech( strSaid, pTalking, pTalkingTo )
|
|
{
|
|
// This is a simple mimic NPC. Everything that someone says to it is quoted back verbatim<
|
|
pTalkingTo.TextMessage( strSaid );
|
|
|
|
// Return value of 1 means NPC "absorbs" strSaid and doesn't allow other NPCs to see and react to it - though other PCs can still see it
|
|
return 1;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpeechInput" id="eventOnSpeechInput"><span>onSpeechInput</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpeechInput( pUser, pItem, pSpeech, pSpeechID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow action after speech-input has been requested</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When the SpeechInput method is executed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
pUser.SysMessage( "What do you want to rename this item to:" );
|
|
pUser.SpeechInput( 1, iUsed );
|
|
}
|
|
|
|
function onSpeechInput( pUser, iUsed, pSpeech, pSpeechID )
|
|
{
|
|
if( pSpeech == null || pSpeech == " ")
|
|
{
|
|
pUser.SysMessage( "You didn't type anything!" );
|
|
return;
|
|
}
|
|
switch( pSpeechID )
|
|
{
|
|
case 1:
|
|
pUser.SysMessage( "You rename the item to: "+pSpeech );
|
|
iUsed.name = pSpeech;
|
|
break;
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpecialMove" id="eventOnSpecialMove"><span>onSpecialMove</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpecialMove( pUser, abilityID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow implementation of special abilities used during combat (or otherwise) when players toggle these from client.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Event triggers for pUser's script when player toggles a special move from a combat book in client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can be used in global scripts, or individual scripts attached to player characters. Lookup packet 0xD7, subCmd 0x19 in packet guides for updated details on special moves that are available, whose IDs range from 0x00 to 0x1D, or see list below (might be out of date):</p>
|
|
<input type="checkbox" id="spoiler_special_moves"/>
|
|
<label for="spoiler_special_moves">List of Special Moves sent from Client <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>0x00 = Cancel Ability Attempt<br>
|
|
0x01 = Armor Ignore<br>
|
|
0x02 = Bleed Attack<br>
|
|
0x03 = Concusion Blow<br>
|
|
0x04 = Crushing Blow<br>
|
|
0x05 = Disarm<br>
|
|
0x06 = Dismount<br>
|
|
0x07 = Double Strike<br>
|
|
0x08 = Infecting<br>
|
|
0x09 = Mortal Strike<br>
|
|
0x0A = Moving Shot<br>
|
|
0x0B = Paralyzing Blow<br>
|
|
0x0C = Shadow Strike<br>
|
|
0x0D = Whirlwind Attack<br>
|
|
0x0E = Riding Swipe<br>
|
|
0x0F = Frenzied Whirlwind<br>
|
|
0x10 = Block<br>
|
|
0x11 = Defense Mastery<br>
|
|
0x12 = Nerve Strike<br>
|
|
0x13 = Talon Strike<br>
|
|
0x14 = Feint<br>
|
|
0x15 = Dual Wield<br>
|
|
0x16 = Double shot<br>
|
|
0x17 = Armor Peirce<br>
|
|
0x18 = Bladeweave<br>
|
|
0x19 = Force Arrow<br>
|
|
0x1A = Lightning Arrow<br>
|
|
0x1B = Psychic Attack<br>
|
|
0x1C = Serpent Arrow<br>
|
|
0x1D = Force of Nature</p>
|
|
</div>
|
|
<p>Server can send packet 0xBF, subCommand 0x21 to cancel the red highlighted state of the ability icon in the client, and reset the status of them.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Example where a timer is used to disable special move after two seconds
|
|
function onSpecialMove( pUser, abilityID )
|
|
{
|
|
pUser.TextMessage( "I'm activating ability #" + abilityID );
|
|
pUser.StartTimer( 2000, abilityID, true );
|
|
return true;
|
|
}
|
|
|
|
function onTimer( timerObj, timerID )
|
|
{
|
|
// Toggle ability off after 2 second timer has elapsed
|
|
var toSend = new Packet;
|
|
toSend.ReserveSize( 7 )
|
|
toSend.WriteByte( 0, 0xbf ); // Packet
|
|
toSend.WriteShort( 1, 0x07 ); // Length
|
|
toSend.WriteShort( 3, 0x21 ); // SubCmd
|
|
toSend.WriteByte( 5, timerID ); // Ability ID
|
|
toSend.WriteByte( 6, 0 ); // On/off
|
|
timerObj.socket.Send( toSend );
|
|
toSend.Free();
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellCast" id="eventOnSpellCast"><span>onSpellCast</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellCast( pUser, spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding spellcasting on a spell-per-spell basis</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When any spell is cast</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return -2</strong> to use normal spellcasting</li>
|
|
<li><strong>return -1</strong> to cancel normal spellcasting, and handle everything in script</li>
|
|
<li><strong>return a value</strong> between 0 to 32767 to use normal spellcasting, but with a delay matching the value provided in ms</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">
|
|
function onSpellCast( pUser, spellID )
|
|
{
|
|
if( spellID == 18 )
|
|
{
|
|
pUser.CustomTarget( 0, "What do you want to target with your fireball?" );
|
|
return -1;
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellGain" id="eventOnSpellGain"><span>onSpellGain</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellGain( spellBook, spellNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow doing something whenever spells are added to spellbooks</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggered for spellbooks when spells are added to them</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This event runs <strong>before</strong> the spell is actually added to the spellBook, and won't have any effect on whether this succeeds</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSpellGain( spellBook, spellNum )
|
|
{
|
|
Console.Log( "Spell number " + spellNum + " was added to spellBook with serial " + spellBook.serial, "server.log" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellLoss" id="eventOnSpellLoss"><span>onSpellLoss</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellLoss( spellBook, spellNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow doing something whenever spells are removed from spellbooks</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggered for spellbooks when spells are removed from them</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This event runs <strong>before</strong> the spell is actually removed from the spellBook, and won't have any effect on whether this succeeds</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSpellLoss( spellBook, spellNum )
|
|
{
|
|
Console.Log( "Spell number " + spellNum + " was removed from spellBook with serial " + spellBook.serial, "server.log" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellSuccess" id="eventOnSpellSuccess"><span>onSpellSuccess</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellSuccess( pCaster, spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour (or effects) after a spell has successfully been cast</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When successfully casting a spell, event triggers in scripts attached to pCaster</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">
|
|
function onSpellSuccess( pCaster, spellID )
|
|
{
|
|
if( spellID == 18 )
|
|
{
|
|
pCaster.TextMessage( "Yes! I managed to cast a fireball!" );
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellTarget" id="eventOnSpellTarget"><span>onSpellTarget</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellTarget( myTarget, pCaster, spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour when targeting specific objects with spells</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When targeting something/someone with a spell, event triggers in myTarget's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>myTarget can be both items and characters. Check target type using myTarget.isChar or .isItem</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to allow other scripts with event to also run.</li>
|
|
<li><strong>return true/1</strong> to prevent other scripts with event from running</li>
|
|
<li><strong>return 2</strong> to reject spell being cast on target</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Script attached to an NPC that's immune to magic, where event returns 2 to reject spell being cast
|
|
function onSpellTarget( myTarget, pCaster, spellID )
|
|
{
|
|
var socket = pCaster.socket;
|
|
if( socket != null )
|
|
pCaster.SysMessage( GetDictionaryEntry( 9056, socket.language )); // That target is immune to magic!
|
|
return 2;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSpellTargetSelect" id="eventOnSpellTargetSelect"><span>onSpellTargetSelect</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSpellTargetSelect( myTarget, pCaster, spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour when caster with event attached targets an object with spells</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When targeting something/someone with a spell, event triggers in caster's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>myTarget can be both items and characters. Check target type using myTarget.isChar or .isItem</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to allow other scripts with event to also run.</li>
|
|
<li><strong>return true/1</strong> to prevent other scripts with event from running</li>
|
|
<li><strong>return 2</strong> to reject spell being cast on target</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Script attached to an NPC that's immune to magic, where event returns 2 to reject spell being cast
|
|
function onSpellTargetSelect( myTarget, pCaster, spellID )
|
|
{
|
|
var socket = pCaster.socket;
|
|
if( socket != null )
|
|
pCaster.SysMessage( GetDictionaryEntry( 9056, socket.language )); // That target is immune to magic!
|
|
return 2;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnStatChange" id="eventOnStatChange"><span>onStatChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onStatChange( pPlayer, stat, statChangeAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows taking action when a character's base stat changes (positively or negatively)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>This event is fired if onStatLoss or onStatGained return true, or if those events are not defined. If the events returned false, onStatChange will not trigger. Stat numbers: Strength - 59, Dexterity - 60, Intelligence - 61</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onStatChange( pPlayer, stat, statChangeAmount )
|
|
{
|
|
if( statChangeAmount > 0 )
|
|
pPlayer.TextMessage( "Oh wow, I've gained some points in stat number " + stat + "!" );
|
|
else
|
|
pPlayer.TextMessage( "Oh noes, I've lost some points in stat number " + stat + "!" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnStatGained" id="eventOnStatGained"><span>onStatGained</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onStatGained( pPlayer, stat, statGainedAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows taking action when a character's base stat is about to increase</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pPlayer gains statGainedAmount points in stat. Stat numbers: Strength - 59, Dexterity - 60, Intelligence - 61</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent stat gain from taking place, and prevent event in other scripts and/or hard code from executing</li>
|
|
<li><strong>return true</strong> allow stat gain to take place, and allow events in other scripts and/or hard code to execute</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onStatGained( pPlayer, stat, statGainedAmount )
|
|
{
|
|
pPlayer.TextMessage( "Aww, I was about to gain " + statGainedAmount + " points in stat number " + tat + ", but got denied!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnStatLoss" id="eventOnStatLoss"><span>onStatLoss</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onStatLoss( pPlayer, stat, statLossAmount )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>For taking action when a person loses points in a stat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pPlayer loses statLossAmount points in stat. Stat numbers: Strength - 59, Dexterity - 60, Intelligence - 61</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent stat loss from taking place, and prevent event in other scripts and/or hard code from executing</li>
|
|
<li><strong>return true</strong> allow stat loss to take place, and allow events in other scripts and/or hard code to execute</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onStatLoss( pPlayer, stat, statLossAmount )
|
|
{
|
|
pPlayer.TextMessage( "Phew, I was about to lose " + statLossAmount + " points in stat number " + stat + ", but it didn't happen!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSteal" id="eventOnSteal"><span>onSteal</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSteal( pThief, iStolen, pVictim )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Specialization of stealing</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When iStolen is stolen from pVictim, iStolen's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Works, but gives a console error: ERROR: Chars[-1] referenced is invalid. Crash averted!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false/0</strong> (or nothing) to allow code to run like normal</li>
|
|
<li><strong>return true/1</strong> to prevent hard code from running, as well as the onStolenFrom event (theft failed?)</li>
|
|
<li><strong>return 2</strong> to prevent hard code from executing, but allow onStolenFrom event to run like normal (theft succeeded, but handled in script?)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSteal( pThief, iStolen, pVictim )
|
|
{
|
|
pThief.SysMessage( "You attempt to steal the "+iStolen.name );
|
|
pVictim.TextMessage( "Who does this hand in my pocket belong to???" );
|
|
ConsoleMessage( iStolen.name+" has been attempted stolen!" );
|
|
return false; // allow stealing code to run like normal
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnStolenFrom" id="eventOnStolenFrom"><span>onStolenFrom</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onStolenFrom( pThief, pVictim, iStolen )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow for response when items are stolen from a player/npc</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When the player pThief steals the item iStolen from the character pVictim, the event in pVictim's script is triggered</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event and/or hard code to run like normal</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event and/or hard code from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onStolenFrom( pThief, pVictim, iStolen )
|
|
{
|
|
pVictim.TextMessage( "Hey you, get your hands off my banana!" );
|
|
pVictim.YellMessage( "GUARDS!!!!!!!" );
|
|
|
|
// Have pVictim attack pThief
|
|
pVictim.target = pThief;
|
|
pVictim.attackFirst = false;
|
|
pVictim.attacker = pThief;
|
|
pVictim.atWar = true;
|
|
|
|
// Prevent other scripts with event and/or hard-code from running
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnSwing" id="eventOnSwing"><span>onSwing</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onSwing( iSwung, pSwinging, pSwingAt )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow more control over what happens when one character takes a swing at another in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pSwinging swings iSwung at pSwingAt</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Event can trigger for either pSwinging character or iSwung item, depending on which object script is attached to</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent swing and subsequent combat (damage, etc) code from happening</li>
|
|
<li><strong>return true</strong> to allow swing and let subsequent combat events and/or hard code execute</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onSwing( iSwung, pSwinging, pSwingAt )
|
|
{
|
|
pSwinging.TextMessage( "Have at thee, knave!" );
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTalk" id="eventOnTalk"><span>onTalk</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTalk( pTalking, strSaid )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Greatly improve the speech handling capabilities</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pTalking says strSaid, pTalking's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent hard code from running and speech from being displayed</li>
|
|
<li><strong>return true</strong> to allow hard code to run and display speech</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onTalk( myChar, mySpeech )
|
|
{
|
|
// This is a simple script that will make the character talking perform the digging animation upon saying "'dig".
|
|
// (Note: 'DIG won't be displayed as speech, since script intercepts the text before it is spoken out loud)
|
|
// If anything else is said, the script returns true so speech can proceed as normal.
|
|
if( mySpeech == "'dig")
|
|
myChar.DoAction(11);
|
|
else
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTempChange" id="eventOnTempChange"><span>onTempChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTempChange( myObject, temperature )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions for characters/items when temperature changes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggers for myObject (char/item) when temperature changes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can also be put in a global script (script ID 0) to run for all objects</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onTempChange( myObject, temperature )
|
|
{
|
|
myObject.TextMessage( "I detected a temperature change! The temperature is now " + temperature + " degrees." );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnThirstChange" id="eventOnThirstChange"><span>onThirstChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onThirstChange( pChanging, newStatus )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow customization of behaviour when a character's thirst level changes. Could be used for changing AI of monsters, display custom messages to player, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When a player's thirst level changes, event triggers in pChanging's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> to override hard-code and handle thirst in script</li>
|
|
<li><strong>return true</strong> to proceed with hard-code, and/or let other scripts with event handle thirst change</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If overridden, the normal thirst messages are not displayed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onThirstChange( pChanging, newStatus )
|
|
{
|
|
pChanging.TextMessage( "ooooo, I feel more thirsty" );
|
|
if( newStatus == 0 )
|
|
{
|
|
TextMessage( pChanging, "I'm melting, I'm melting!" );
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTimer" id="eventOnTimer"><span>onTimer</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTimer( timerObj, timerID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To be used for custom timer information for objects</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When tempeffect 40 (StartTimer) duration has elapsed for timer timerID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onTimer( timerObj, timerID )
|
|
{
|
|
if( timerID == 0 )
|
|
{
|
|
timerObj.StaticEffect( 0x376A, 9, 6 ); // Make some sparkles!
|
|
}
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTooltip" id="eventOnTooltip"><span>onTooltip</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTooltip( myObject, pSocket )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow adding new/custom object properties for objects when server sends tooltip data to client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggers for object (char/item) when server is about to send tooltip data to client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Display remaining uses left in a tooltip, based on item's UsesLeft tag
|
|
function onTooltip( myObj, pSocket )
|
|
{
|
|
var tooltipText = "";
|
|
var usesLeft = myObj.GetTag( "UsesLeft" );
|
|
if( usesLeft > 0 )
|
|
{
|
|
tooltipText = GetDictionaryEntry( 9403 ); // uses remaining: %i
|
|
tooltipText = ( tooltipText.replace(/%i/gi, (usesLeft).toString()) );
|
|
|
|
// Set a temporary tag on item to tell server which cliloc ID to use for the tooltip
|
|
myObj.SetTempTag( "clilocTooltip", 1042971 ); // ~1_NOTHING~
|
|
}
|
|
return tooltipText;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<!-- <li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTransfer" id="eventOnTransfer"><span>onTransfer</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTransfer( iTransferred, pSrc, pTrg )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pSrc transfers iTransferred to pTrg, iTransferred's script is activated</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>NOT IMPLEMENTED YET</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow custom behaviour to run after a player has transferred an item to another player using a secure trade window</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onTransfer( iTransferred, pSrc, pTrg )
|
|
{
|
|
pSrc.TextMessage( "Whee I'm transferring this item to you, " + pTrg.name + "!" );
|
|
pTrg.TextMessage( "Thank you, " + pSrc.name + "!" );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> --> <!-- cd-faq__content -->
|
|
<!-- </li> -->
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnTooltip" id="eventOnTooltip"><span>onTurnBoat</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onTurnBoat( iBoat, oldDir, newDir, iTiller )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions in script after a boat has successfully turned</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggers for boat objects after boat has successfully turned. oldDir is old direction, newDir is new direction after turning, iTiller is tillerman reference.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> or nothing to prevent other scripts from triggering same event</li>
|
|
<li><strong>return true</strong> to allow other scripts from triggering same event</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">// Make Tillerman respond after boat has turned
|
|
function onTurnBoat( iBoat, oldDir, newDir, iTiller )
|
|
{
|
|
if( oldDir != newDir )
|
|
{
|
|
iTiller.TextMessage( "Everything's different now!" );
|
|
}
|
|
else
|
|
{
|
|
iTiller.TextMessage( "Nothing ever changes." );
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnUnequip" id="eventOnUnequip"><span>onUnEquip</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onUnequip( pEquipper, iUnequipped )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow something to happen when player has finished unequipping an item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pEquipper has unequipped iUnequipped, event is triggered in iUnequipped's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to also run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUnequip( pUnequipper, iUnequipped )
|
|
{
|
|
pUnequipper.StaticEffect( 0x376A, 9, 6 );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnUnEquipAttempt" id="eventOnUnEquipAttempt"><span>onUnEquipAttempt</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onUnequipAttempt( pEquipper, iUnequipped )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow overriding what happens when player attempts to unequip an item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pEquipper attempts to unequip iUnequipped, event is triggered in iUnequipped's script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to reject the attempt to unequip the item</li>
|
|
<li><strong>return true</strong> to allow unequip code to run like normal (with additional checks being done there)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUnequipAttempt( pUnequipper, iUnequipped )
|
|
{
|
|
if( /* check if item is cursed */ )
|
|
{
|
|
pUnequipper.TextMessage( "The item is cursed! You cannot unequip it..." );
|
|
return false;
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnUseBandageMacro" id="eventOnUseBandageMacro"><span>onUseBandageMacro</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onUseBandageMacro( pSock, targChar, iUsed )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater control of bandage self macro</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pSock uses iUsed on targChar</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This can be put in the global script (scriptID 0) to handle what should happen when a player attempts to use the Bandage Self macro in the client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with event to run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUseBandageMacro( pSock, targChar, bandageItem )
|
|
{
|
|
if( pSock && bandageItem && bandageItem.amount >= 1 )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
TriggerEvent( 4000, "onUseCheckedTriggered", pUser, targChar, bandageItem );
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// ...then, in scriptID 4000 - skill\healing.js, add this at the top of the file:
|
|
function onUseCheckedTriggered( pUser, targChar, iUsed )
|
|
{
|
|
if( pUser && iUsed && iUsed.isItem )
|
|
{
|
|
var socket = pUser.socket;
|
|
if( socket )
|
|
{
|
|
if( pUser.skillsused.healing || pUser.skillsused.veterinary )
|
|
{
|
|
socket.SysMessage( "You are too busy to do that." );
|
|
}
|
|
else if( socket.GetTimer( Timer.TIMEOUT ) <= GetCurrentClock() )
|
|
{
|
|
socket.tempObj = iUsed;
|
|
socket.SetTimer( Timer.TIMEOUT, 5000 );
|
|
onCallback1( socket, targChar );
|
|
}
|
|
else
|
|
{
|
|
socket.SysMessage( GetDictionaryEntry( 473, socket.Language ) );
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnUseChecked" id="eventOnUseChecked"><span>onUseChecked</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onUseChecked( pUser, iUsed )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater customization on using items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser uses iUsed, iUsed's script is triggered</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent hard code and/or other scripts with event from running</li>
|
|
<li><strong>return true</strong> to allow hard code and/or other scripts with event to run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
// Open player's bank box, if they're within range of the item being used
|
|
var trgSock = pUser.socket;
|
|
if( pUser.InRange( iUsed, 8 ))
|
|
pUser.OpenBank( trgSock );
|
|
|
|
// Prevent hard-code from running
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnUseUnChecked" id="eventOnUseUnChecked"><span>onUseUnChecked</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onUseUnChecked( pUser, iUsed )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow greater customization on using items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When pUser uses iUsed, iUsed's script is triggered</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Unlike the onUseChecked event this one runs without any hardcoded checks like distance-check, LoS-check, etc. These will need to be handled in the script as needed!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent hard code and/or other scripts with event from running</li>
|
|
<li><strong>return true</strong> to allow hard code and/or other scripts with event to run</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onUseUnChecked( pUser, iUsed )
|
|
{
|
|
// Open player's bank box, if they're within range of the item being used
|
|
var trgSock = pUser.socket;
|
|
if(pUser.InRange( iUsed, 8 ))
|
|
pUser.OpenBank( trgSock );
|
|
|
|
// Prevent hard-code from running
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnVirtueGumpPress" id="eventOnVirtueGumpPress"><span>onVirtueGumpPress</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onVirtueGumpPress( mChar, tChar, buttonID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow a custom response/custom behaviour when player clicks Virtue Gump button in client paperdoll</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>When the Virtue Gump is pressed in the client's paperdoll</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can also be put in global script (scriptID 0) to trigger for all characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to allow other scripts with same event to run</li>
|
|
<li><strong>return true</strong> to prevent other scripts with same event from running</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onVirtueGumpPress( mChar, tChar, buttonID )
|
|
{
|
|
// .. open custom gump here
|
|
return true;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnWarModeToggle" id="eventOnWarModeToggle"><span>onWarModeToggle</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onWarModeToggle( pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions for when players enter/exit war mode</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggers for player pChar when they attempt to toggle war mode on/off</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can be put in global script (scriptID 0) to trigger for all player characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Return Values</span></p>
|
|
<ul>
|
|
<li><strong>return false</strong> (or nothing) to prevent the toggling of war mode</li>
|
|
<li><strong>return true</strong> to allow the toggling of war mode to continue</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onWarModeToggle( pChar )
|
|
{
|
|
pChar.TextMessage( "I tried toggling my war mode via the button in paperdoll, but was denied!" );
|
|
return false;
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#eventOnWeatherChange" id="eventOnWeatherChange"><span>onWeatherChange</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>function onWeatherChange( myObject, weatherType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow reactions for characters/items when weather changes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">When Triggered</span></p>
|
|
<p>Triggers for myObject (char/item) when weather changes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can also be put in global script (scriptID 0) to trigger for all objects. Weather types: 0 = NONE, 1 = Physical (used for weapons/armor only), 2 = Light, 3 = Rain, 4 = Cold, 5 = Heat/Fire, 6 = Lightning/Energy, 7 = Poison, 8 = Snow, 9 = Storm, 10 = Storm Brewing</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span><br>
|
|
<pre><code class="language-javascript">function onWeatherChange( myObject, weatherType )
|
|
{
|
|
myObject.TextMessage( "I detected a weather change! New weather-type: " + weatherType );
|
|
}</code></pre></p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
</ul> <!-- cd-faq__group -->
|
|
|
|
<ul id="functions" class="cd-faq__group">
|
|
<li id="functionsHeader" class="cd-faq__title title-jsdoc"><h1>JS Functions</h1><div id="filterInputFunctions" contenteditable="true" placeholder="(Filter)" style="float:right; margin-top: -40px; margin-right: 10px; background-color: #fff; padding: 5px; width: 200px"></div></li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsCharacter" id="functionsCharacter"><span>Character Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_char_AreaCharacterFunction"/>
|
|
<label for="spoiler_function_char_AreaCharacterFunction">AreaCharacterFunction <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int AreaCharacterFunction( "myAreaFunc", radiusObject, radius, socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows script to look for characters within specified radius of the defined radiusObject (Item or Character), and run a custom function for each Character found.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The custom script run for each Character found can return true or false to allow AreaCharacterFunction to return a value indicating how many characters were found (if all return true) or how many were altered in some way (if function only returns true when altering a character). socket parameter can be null.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, pSock );
|
|
{
|
|
var numCharsFound = AreaCharacterFunction( "myAreaFunc", pUser, 10, pSock );
|
|
pUser.SysMessage( "Number of characters found: " + numCharsFound );
|
|
}
|
|
function myAreaFunc( srcChar, trgChar, pSock )
|
|
{
|
|
trgChar.TextMessage( "Oh no I've been found!" );
|
|
pSock.SysMessage( "Found character: " + trgChar.name );
|
|
return true;
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_char_CalcCharFromSer"/>
|
|
<label for="spoiler_function_char_CalcCharFromSer">CalcCharFromSer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER CalcCharFromSer( serial );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the character object associated with the specified serial, or null if no character is found</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var myChar = CalcCharFromSer( serial );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_char_CalcTargetedChar"/>
|
|
<label for="spoiler_function_char_CalcTargetedChar">CalcTargetedChar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER CalcTargetedChar( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns character object if target serial stored on socket is a character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Essentially a shortcut for doing this: <em>var targetChar = CalcCharFromSer( socket.GetDWord( 7 ));</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var targetChar = CalcTargetedChar( socket );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_char_DoesCharacterBlock"/>
|
|
<label for="spoiler_function_char_DoesCharacterBlock">DoesCharacterBlock <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DoesCharacterBlock( x, y, z, worldNum, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if any character exists at given coordinate, within z +/- 4</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var isBlocked = DoesCharacterBlock( targX, targY, targZ, pUser.worldnumber, pUser.instanceID );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_char_spawnNPC"/>
|
|
<label for="spoiler_function_char_spawnNPC">SpawnNPC <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER SpawnNPC( sectionName/npclist, x, y, z, worldNumber, instanceID, useNpcList )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Spawns a character from a DFN entry or NPCLIST (sectionName)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>sectionName can be an section ID from NPC DFNs to spawn from, or the name of an NPCLIST. useNpcList is a boolean to indicate if sectionName is a NPCLIST (true) or not (false). Defaults to false if not specified.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Spawn a horse when an item is double-clicked
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var nSpawned = SpawnNPC( "brownhorse", pUser.x, pUser.y, pUser.z, pUser.worldnumber, pUser.instanceID );
|
|
if( nSpawned != null )
|
|
pUser.SysMessage( "Wheee - a brown horse just spawned at my location!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsCombat" id="functionsCombat"><span>Combat Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_combat_applydefensemodifiers"/>
|
|
<label for="spoiler_function_combat_applydefensemodifiers">ApplyDefenseModifiers <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ApplyDefenseModifiers( dmgType, pAtt, pDef, skillNum, hitLoc, baseDmg, armorDmg );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a netDmg value after applying defense modifiers to baseDmg, with a boolean at the end deciding whether or not armor gets damaged.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var netDmg = ApplyDefenseModifiers( dmgType, pAtt, pDef, fightSkill, hitLoc, baseDmg, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_combat_applydamagebonuses"/>
|
|
<label for="spoiler_function_combat_applydamagebonuses">ApplyDamageBonuses <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ApplyDamageBonuses( dmgType, pAttacker, pDefender, fightSkill, hitLoc, baseDmg );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a newDmg value after applying combat bonus modifiers to baseDmg</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var newDmg = ApplyDamageBonuses( dmgType, pAttacker, pDefender, fightSkill, hitLoc, baseDmg );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_combat_CheckTimeSinceLastCombat"/>
|
|
<label for="spoiler_function_combat_CheckTimeSinceLastCombat">CheckTimeSinceLastCombat <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CheckTimeSinceLastCombat( pUser, 120 );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if a character has engaged in combat within a specified time frame (in seconds).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if the player has been in combat within the last 120 seconds (2 minutes)
|
|
if( CheckTimeSinceLastCombat( pUser, 120 ))
|
|
{
|
|
pUser.SysMessage( "You must wait two minutes after engaging in combat before you can use this item." );
|
|
}
|
|
else
|
|
{
|
|
pUser.SysMessage( "You are free to use the item." );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsCommand" id="functionsCommand"><span>Command Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_commandlevelreq"/>
|
|
<label for="spoiler_function_command_commandlevelreq">CommandLevelReq <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int CommandLevelReq( cmdName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the command level required to execute cmdName</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( CommandLevelReq( "add" ) <= pUser.commandlevel )
|
|
{
|
|
pUser.TextMessage( "I can execute the add command!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_commandexists"/>
|
|
<label for="spoiler_function_command_commandexists">CommandExists <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CommandExists( cmdName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the command cmdName exists</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !CommandExists( "fllerugh" ))
|
|
{
|
|
pUser.TextMessage( "No such command exists!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_commandregistration"/>
|
|
<label for="spoiler_function_command_commandregistration">CommandRegistration <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CommandRegistration();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Registers one or more scripted commands (using RegisterCommand function) in the JS command table</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Each command registered using <strong>RegisterCommand( commandName, accessLevel, isEnabled )</strong> within the CommandRegistration function will look for a function within the same script, the name of which is based on the command in question, using the syntax <strong>function command_[COMMANDNAME]( socket, cmdString )</strong></p>
|
|
<p>Access levels (or command levels) are specified in <strong>dfndata/command/commands.dfn</strong>, and the default setup goes like this:
|
|
<ul>
|
|
<li>Admin - <strong>5</strong></li>
|
|
<li>GM - <strong>2</strong></li>
|
|
<li>CNS - <strong>1</strong></li>
|
|
<li>Player - <strong>0</strong></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Register two test commands in the same script
|
|
// First command is called "testcommand1", and can be accessed by GMs (command level 2) or above
|
|
// Second command is called "testcommand2", and can be accessed by Counselors (command level 1) or above
|
|
function CommandRegistration()
|
|
{
|
|
RegisterCommand( "testcommand1", 2, true );
|
|
RegisterCommand( "testcommand2", 1, true );
|
|
}
|
|
|
|
function command_TESTCOMMAND1( socket, cmdString )
|
|
{
|
|
socket.SysMessage( "You've successfully executed testcommand1!" );
|
|
}
|
|
|
|
function command_TESTCOMMAND2( socket, cmdString )
|
|
{
|
|
socket.SysMessage( "You've successfully executed testcommand2!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_DisableCommand"/>
|
|
<label for="spoiler_function_command_DisableCommand">DisableCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DisableCommand( cmdName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Disables specified command on server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">DisableCommand( "istats" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_EnableCommand"/>
|
|
<label for="spoiler_function_command_EnableCommand">EnableCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void EnableCommand( cmdName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Enables specified command on server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">EnableCommand( "istats" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_finishedCommandList"/>
|
|
<label for="spoiler_function_command_finishedCommandList">FinishedCommandList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string FinishedCommandList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if there are no more commands left in the (hard-coded) command table</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Print first name of first command in the hard-coded command table
|
|
var cmdName = FirstCommand();
|
|
Console.Print( cmdName + "\n" );
|
|
|
|
// As long as there's commands left in the command table, print the next command name
|
|
while( !FinishedCommandList() )
|
|
{
|
|
cmdName = NextCommand();
|
|
Console.Print( cmdName + "\n" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_firstcommand"/>
|
|
<label for="spoiler_function_command_firstcommand">FirstCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string FirstCommand();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the name of the first command in the (hard-coded) command table, or an empty string if there are no commands</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var cmdName = FirstCommand();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_nextcommand"/>
|
|
<label for="spoiler_function_command_nextcommand">NextCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string NextCommand();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the name of the next command in the (hard-coded) command table, or an empty string if there are no commands</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var cmdName = NextCommand();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_command_registercommand"/>
|
|
<label for="spoiler_function_command_registercommand">RegisterCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RegisterCommand( commandName, commandLevel, isEnabled );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Registers a scripted command in the JS command table, usually as part of the CommandRegistration function</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">RegisterCommand( "testcommand1", 2, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsConsole" id="functionsConsole"><span>Console Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_console_DisableKey"/>
|
|
<label for="spoiler_function_console_DisableKey">DisableKey <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DisableKey( keyCode );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Disables specified key in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">DisableKey( 27 ); // Disables Esc key in UOX3 console</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_console_EnableKey"/>
|
|
<label for="spoiler_function_console_EnableKey">EnableKey <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void EnableKey( keyCode );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Enables specified key in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">EnableKey( 27 ); // Enables Esc key in UOX3 console</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_console_RegisterKey"/>
|
|
<label for="spoiler_function_console_RegisterKey">RegisterKey <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RegisterKey( key/keyCode, functionName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>When used in conjunction with the <a href="#eventScriptRegistration">ConsoleRegistration</a> event, it registers the current JS script as a global listener for a specific keypress in the UOX3 console, and triggers the specified function in the same script when that key is pressed.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Script must be added under the [CONSOLE_SCRIPTS] section of jse_fileassocations.scp to work.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example from js/console/shutdown.js
|
|
function ConsoleRegistration()
|
|
{
|
|
RegisterKey( 'q', "shutdown" );
|
|
RegisterKey( 'Q', "shutdown" );
|
|
RegisterKey( 27, "shutdown" ); // escape
|
|
}
|
|
|
|
function shutdown()
|
|
{
|
|
Console.BeginShutdown();
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsEffect" id="functionsEffect"><span>Effect Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_effect_DoMovingEffect"/>
|
|
<label for="spoiler_function_effect_DoMovingEffect">DoMovingEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>DoMovingEffect( srcObject, trgObject, effect, speed, loop, explode, [hue], [renderMode] );<br>
|
|
DoMovingEffect( srcObject, targX, targY, targZ, effect, speed, loop, explode, [hue], [renderMode] );<br>
|
|
DoMovingEffect( srcX, srcY, srcZ, targX, targY, targZ, effect, speed, loop, explode, [hue], [renderMode] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Does a moving effect (eg fireball) from srcObject to trgObject, from srcObject to targ location or from src location to targ location!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p><strong>effect</strong> = the ID of the art effect to play<br>
|
|
<strong>speed</strong> = the speed of the effect?<br>
|
|
<strong>loop</strong> = ???<br>
|
|
<strong>explode</strong> = 0 no explosion, 1 explodes<br>
|
|
<strong>hue</strong> = the colour of the effect<br>
|
|
<strong>rendermode</strong> = how to render the effect. Available options: 0 - normal, 1 - transparent, 2 - additive, 3 - dark colors transparent, 4 - bright colors transparent, 5 - semi transparent, 6 - subtractive/negative colors, 7 - inverted colors?</p><br>
|
|
<p><em>hue and renderMode are OPTIONAL, none, one or both can be left out, but if setting renderMode, hue MUST be specified. Hue for effects also seems to be offset by 1 compared to hues for items; if you have a staff with hue 0x0480 and you want an effect with same hue, try 0x047f for the effect (in some cases combined with a different renderMode - like 0xa for 0x047f)</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">DoMovingEffect( pUser, pUser, 0x36D5, 0x07, 0x00, true, 0x1EC );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_effect_doStaticEffect"/>
|
|
<label for="spoiler_function_effect_doStaticEffect">DoStaticEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DoStaticEffect( targX, targY, targZ, effectID, speed, loop, explode );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays a static effect at a target location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p><strong>effectID</strong> = the ID of the art effect to play<br>
|
|
<strong>speed</strong> = the speed of the effect?<br>
|
|
<strong>loop</strong> = ???<br>
|
|
<strong>explode</strong> = 0 no explosion, 1 explodes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">DoStaticEffect( pUser.x, pUser.y, pUser.z, 0x352D, 0x3, 0x10, false );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_effect_doTempEffect"/>
|
|
<label for="spoiler_function_effect_doTempEffect">DoTempEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DoTempEffect( iType, srcObj, trgObj, tempEffectID, more1, more2, more3, [itemPtr] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a temporary effect (things like protection, night sight, agility, etc.) to trgObj</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Depending on the type of effect, the strength and/or duration can be derived from srcObj's skills or provided more# values. If iType = 0, then it's a character, otherwise it's an item</p>
|
|
<input type="checkbox" id="spoiler_temporary_effects"/>
|
|
<label for="spoiler_temporary_effects">List of Temporary Effects handled by Server <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>Note: Effect ID corresponds to tempEffectID in DoTempEffect function parameter</p>
|
|
<p><span class="hl">1 = Paralyze</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj</p>
|
|
<p><span class="hl">2 = NightSight</span> - duration either srcObj's Magery skill / 2, or more2 param if no srcObj</p>
|
|
<p><span class="hl">3 = Clumsy</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect duration halved if resisted. Effect strength from more1 param</p>
|
|
<p><span class="hl">4 = Feeblemind</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect duration halved if resisted. Effect strength from more1 param</p>
|
|
<p><span class="hl">5 = Weaken</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect duration halved if resisted. Effect strength from more1 param</p>
|
|
<p><span class="hl">6 = Agility</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect strength from more1 param</p>
|
|
<p><span class="hl">7 = Cunning</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect strength from more1 param</p>
|
|
<p><span class="hl">8 = Strength</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect strength from more1 param</p>
|
|
<p><span class="hl">9 = Grind Necro Reagent</span> - more2 is time it takes to finish grinding</p>
|
|
<p><span class="hl">10 = Craft Potion</span> - ???</p>
|
|
<p><span class="hl">11 = Bless</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect strength from more1 param</p>
|
|
<p><span class="hl">12 = Curse</span> - duration either srcObj's Magery skill / 10, or more2 param if no srcObj. Effect duration halved if resisted. Effect strength from more1 param</p>
|
|
<p><span class="hl">15 = Reactive Armor</span> - duration either srcObj's Magery skill / 10, or 6 seconds if no srcObj</p>
|
|
<p><span class="hl">16 = Explosion Potion message</span> - Used by JS script potion.js to show countdown for explosion potions. more1 is serial of potion, more2 is time until explosion, more3 is countdown #</p>
|
|
<p><span class="hl">18 = Polymorph</span> - more1 is first part of polymorph ID, more2 is second part(?). Duration dependent on UOX.INI setting POLYDURATION (defaults to 90 seconds)</p>
|
|
<p><span class="hl">19 = Incognito</span> - params not used, lasts 90 seconds</p>
|
|
<p><span class="hl">21 = Protection</span> - duration either 120 seconds if srcObj exists, otherwise uses more2 param. Boosts trgObj's Parrying skill by value in more1 param for duration of effect</p>
|
|
<p><span class="hl">25 = Disable Item</span> - disables item for duration specified in more1 param</p>
|
|
<p><span class="hl">26 = Temporarily Disable Potion Usage</span> - disables usage of potions for a duration of 10 seconds</p>
|
|
<p><span class="hl">27 = Explosion</span> - if srcObj is provided, will deal fire damage after delay set in Explosion spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">28 = Magic Arrow</span> - if srcObj is provided, will deal fire damage after delay set in Magic Arrow spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">29 = Harm</span> - if srcObj is provided, will deal cold damage after delay set in Harm spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">30 = Fireball</span> - if srcObj is provided, will deal fire damage after delay set in Fireball spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">31 = Lightning</span> - if srcObj is provided, will deal lightning damage after delay set in Lightning spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">32 = Mind Blast</span> - if srcObj is provided, will deal cold damage after delay set in Mind Blast spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">33 = Energy Bolt</span> - if srcObj is provided, will deal lightning damage after delay set in Energy Bolt spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">34 = Chain Lightning</span> - if srcObj is provided, will deal lightning damage after delay set in Chain Lightning spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">35 = Flamestrike</span> - if srcObj is provided, will deal fire damage after delay set in Flamestrike spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">36 = Meteor Swarm</span> - if srcObj is provided, will deal fire damage after delay set in Meteor Swarm spell definition, base amount of damage provided by more1 param, with srcObj as caster</p>
|
|
<p><span class="hl">40 = JS Timers</span> - Special case. JS timers are added via the obj.StartTimer() function rather than DoTempEffect, and will not work correctly if added via DoTempEffect</p>
|
|
<p><span class="hl">41 = Crafting</span> - crafting duration provided by more1 param (100 = 1.00 second), ID of item to craft via more2, crafter via srcObj</p>
|
|
<p><span class="hl">42 = Crafting Sound</span> - delay for crafting sound effect provided via more1 param (100 = 1.00 second), sound FX to play provided via more2 param</p>
|
|
<p><span class="hl">43 = Regrow Sheep Wool</span> - delay in seconds for when wool will regrow on a sheep provided via more1 param</p>
|
|
</div>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Add effect of a lesser Agility potion to pUser (copied from js/items/potion.js)
|
|
DoTempEffect( 0, pUser, pUser, 6, RandomNumber( 6, 15 ), 0, 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsGuild" id="functionsGuild"><span>Guild Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_guild_CompareGuildByGuild"/>
|
|
<label for="spoiler_function_guild_CompareGuildByGuild">CompareGuildByGuild <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int CompareGuildByGuild( srcGuild, trgGuild );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Compares the relations between two guilds</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Potential relationships:
|
|
<ul>
|
|
<li>0 - Neutral</li>
|
|
<li>1 - At War</li>
|
|
<li>2 - Allied</li>
|
|
<li>3 - Unknown</li>
|
|
<li>4 - Same</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var pUserGuild = pUser.guild;
|
|
var pCharGuild = pChar.guild;
|
|
if( pUserGuild && pCharGuild && CompareGuildByGuild( pUserGuild, pCharGuild ) == 2 )
|
|
{
|
|
pUser.TextMessage( "Oh hey, we're allied!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_guild_CreateNewGuild"/>
|
|
<label for="spoiler_function_guild_CreateNewGuild">CreateNewGuild <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>object CreateNewGuild();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Creates a new guild and assigns the calling character to it. Returns the JS Guild object.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>
|
|
The character calling this function (via script) will automatically become a member of the new guild.<br/>
|
|
Use returned object to customize the guild's name, abbreviation, etc.
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var newGuild = CreateNewGuild();
|
|
if( newGuild )
|
|
{
|
|
newGuild.name = "The Taming Order";
|
|
newGuild.abbreviation = "TTO";
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsItem" id="functionsItem"><span>Item Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_AreaItemFunction"/>
|
|
<label for="spoiler_function_item_AreaItemFunction">AreaItemFunction <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int AreaItemFunction( "myAreaFunc", radiusObject, radius, socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Allows script to look for dynamic items within specified radius of the defined radiusObject (Item or Character), and run a custom function for each Item found.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The custom script run for each Item found can return <strong>true or false</strong> to allow AreaItemFunction to return a value indicating how many Items were found (if all return true) or how many were altered in some way (if function only returns true when altering an Item)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, pSock );
|
|
{
|
|
var numItemsFound = AreaItemFunction( "myAreaFunc", pUser, 10, pSock );
|
|
pUser.SysMessage( "Number of characters found: " + numItemsFound );
|
|
}
|
|
function myAreaFunc( srcChar, trgItem, pSock )
|
|
{
|
|
trgItem.TextMessage( "Oh no I've been found!" );
|
|
pSock.SysMessage( "Found item: " + trgItem.name );
|
|
return true;
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_CalcItemFromSer"/>
|
|
<label for="spoiler_function_misc_CalcItemFromSer">CalcItemFromSer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM CalcItemFromSer( serial );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the Item object associated with the specified serial, or null if no Item is found</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var myItem = CalcItemFromSer( serial );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_CheckInstaLog"/>
|
|
<label for="spoiler_function_misc_CheckInstaLog">CheckInstaLog <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>JSBool CheckInstaLog( x, y, world, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if a specific location ( x, y, world, instanceID ) is within an instant logout zone.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if the player is in an instant logout zone
|
|
var isInstaLog = CheckInstaLog(targX, targY, worldNumber, instanceID);
|
|
|
|
if( isInstaLog )
|
|
{
|
|
// Handle instant logout
|
|
}
|
|
else
|
|
{
|
|
// Handle other logout scenarios
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_CalcTargetedItem"/>
|
|
<label for="spoiler_function_item_CalcTargetedItem">CalcTargetedItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM CalcTargetedItem( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns Item object if target serial stored on socket is a Item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Essentially a shortcut for doing this: <em>var targetItem = CalcItemFromSer( socket.GetDWord( 7 ));</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var targetItem = CalcTargetedItem( socket );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_CreateBaseMulti"/>
|
|
<label for="spoiler_function_item_CreateBaseMulti">CreateBaseMulti <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MULTI CreateBaseMulti( multiID, x, y, z, worldNum, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Creates a base multi based on ID from client's multi files, at specified location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters (<strong>check Prototype for correct order</strong>):
|
|
<ul>
|
|
<li>multiID - ID from client's multi files</li>
|
|
<li>x, y, z - coordinates to create house at</li>
|
|
<li>worldNum - world to create house in</li>
|
|
<li>instanceID - instance to create house in</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a base multi exactly at pUser's location:
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var multiID = 0x13ed; // Multi ID for a 7x8 house foundation
|
|
var myMulti = CreateBaseMulti( multiID, pUser.x, pUser.y, pUser.z, pUser.worldNum, pUser.instanceID );
|
|
return false;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_CreateBlankItem"/>
|
|
<label for="spoiler_function_item_CreateBlankItem">CreateBlankItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM CreateBlankItem( socket, character, amount, itemName, itemID, colour, objectType, inPack );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Spawns a "blank" item with values from the UO client's tiledata file.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters:
|
|
<ul>
|
|
<li>socket - socket to refresh to (and ensure weight is added)</li>
|
|
<li>character - required to know the pack/character to spawn it to</li>
|
|
<li>amount - The amount of items to spawn</li>
|
|
<li>itemName - the name to give to the newly spawned item</li>
|
|
<li>itemID - itemID(hex) to spawn item from</li>
|
|
<li>colour - colour of the spawned item</li>
|
|
<li>objectType - specify the type of object being added: "ITEM", "SPAWNER"</li>
|
|
<li>inPack - True/false whether to spawn in pack or not</li>
|
|
<li>bSend - Whether or not to send update to all players</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var myItem = CreateBlankItem( pUser.socket, pUser, 10, "apple", 0x09d0, 0x0, "ITEM", true );
|
|
pUser.SysMessage( "Oh my, 10 apples just appeared in my backpack! Magic!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_CreateDFNItem"/>
|
|
<label for="spoiler_function_item_CreateDFNItem">CreateDFNItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM CreateDFNItem( socket, character, sectionToMake[, [int Amount], [objectType], [bool inPack] );</em></p>
|
|
<p><em>ITEM CreateDFNItem( null, null, sectionToMake, [int Amount], [objectType], [bool inPack], [int Color], [worldNumber], [instanceID] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Spawns an item from a DFN section number/id.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters (<strong>check Prototype for correct order</strong>):
|
|
<ul>
|
|
<li>socket - socket to refresh to (and ensure weight is added)</li>
|
|
<li>character - required to know the pack/character to spawn it to</li>
|
|
<li>sectionToMake - section # to spawn from</li>
|
|
<li>int Amount - Amount of items to spawn (Optional)</li>
|
|
<li>objectType - specify the type of object being added: "ITEM", "SPAWNER"</li>
|
|
<li>bool inPack - True/false whether to spawn in pack or not (Optional - default is FALSE).</li>
|
|
<li>int Color - Color of item to spawn (Optional)</li>
|
|
<li>Function can also be used to add items without relying on a character. In this case, the socket and character parameters are null, the inPack parameter is false, and two additional parameters are provided - worldNumber and instanceID. This relies on optional parameter Color also being specified.</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var myItem = CreateDFNItem( pUser.socket, pUser, "0x09d0", 10, "ITEM", true );
|
|
pUser.SysMessage( "Oh my, 10 apples just appeared in my backpack! Magic!" );
|
|
}
|
|
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var myItem = CreateDFNItem( pUser.socket, pUser, "0x09d0", 10, "ITEM", false, 0x0001 );
|
|
iUsed.TextMessage( "Oh my, 10 black apples just spawned on top of me! Magic!" );
|
|
}
|
|
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var myItem = CreateDFNItem( null, null, "0x09d0", 10, "ITEM", false, 0, iUsed.worldnumber, iUsed.instanceID );
|
|
iUsed.TextMessage( "Oh my, 10 apples just spawned on top of me! Magic!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_CreateHouse"/>
|
|
<label for="spoiler_function_item_CreateHouse">CreateHouse <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MULTI CreateHouse( houseID, x, y, z, worldNum, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Creates a house based on houseID from house.dfn, at specified location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters (<strong>check Prototype for correct order</strong>):
|
|
<ul>
|
|
<li>houseID - from house.dfn</li>
|
|
<li>x, y, z - coordinates to create house at</li>
|
|
<li>worldNum - world to create house in</li>
|
|
<li>instanceID - instance to create house in</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a house exactly at pUser's location:
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var houseID = 1; // Small Brick house from house.dfn
|
|
var myHouse = CreateHouse( houseID, pUser.x, pUser.y, pUser.z, pUser.worldNum, pUser.instanceID );
|
|
return false;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_FindItem"/>
|
|
<label for="spoiler_function_item_FindItem">FindItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM FindItem( xLoc, yLoc, zLoc, world, idToCheck[, instanceID] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns item reference to item of given ID that is closest (within immediate nearby internal map regions) to specified coordinates</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch item reference for item with id 0x04a9 closest to player's location
|
|
var closestItem = FindItem( pUser.x, pUser.y, pUser.z, pUser.worldnumber, 0x04a9 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_FindRootContainer"/>
|
|
<label for="spoiler_function_item_FindRootContainer">FindRootContainer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM FindRootContainer( iObj, type );</em></p>
|
|
<p><em>ITEM FindRootContainer( iObjSerial, type );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Finds the root container of a provided item object, or item object serial - if any</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters:
|
|
<ul>
|
|
<li>iObj/iObjSerial - item or item serial to find root container for</li>
|
|
<li>type - indicate type of lookup; 0 = item, 1 = item serial</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var rootContainer = FindRootContainer( iUsed, 0 );
|
|
if( ValidateObject( rootContainer ))
|
|
pUser.TextMessage( "The item is in a container! The root container's name is " + rootContainer.name );
|
|
else
|
|
pUser.TextMessage( "The item has no root container." );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_GetItem"/>
|
|
<label for="spoiler_function_item_GetItem">GetItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>ITEM GetItem( xLoc, yLoc, zLoc, world );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns item closest to specified coordinates</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Find closest item to player's location
|
|
var closestItem = GetItem( pUser.x, pUser.y, pUser.z, pUser.worldnumber );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_item_GetPackOwner"/>
|
|
<label for="spoiler_function_item_GetPackOwner">GetPackOwner <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER GetPackOwner( item/serial, argType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns owner of container item is contained in (if any)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If the first argument is an Item, argType should be 0. If first argument is an item serial, argType should be 1!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch owner of object based on object
|
|
var objOwner = GetPackOwner( myItem, 0 );
|
|
|
|
// Fetch owner of object based on object's serial
|
|
var objOwner = GetPackOwner( myItemSerial, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsMagic" id="functionsMagic"><span>Magic Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_magic_DisableSpell"/>
|
|
<label for="spoiler_function_magic_DisableSpell">DisableSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DisableSpell( spellID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Disables specified spell on server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">DisableSpell( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_magic_EnableSpell"/>
|
|
<label for="spoiler_function_magic_EnableSpell">EnableSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void EnableSpell( spellID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Enables specified spell on server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">EnableSpell( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_magic_RegisterSpell"/>
|
|
<label for="spoiler_function_magic_RegisterSpell">RegisterSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RegisterSpell( spellID, enabledBool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>If called from within SpellRegistration() function in a script registered under the [MAGIC_SCRIPTS] section of jse_fileassociations.scp, will register the onSpellCast() event in the same script as a global listener for use of the specified magic spell.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function SpellRegistration()
|
|
{
|
|
// Register script as global listener for spell 1 from spells.dfn
|
|
RegisterSpell( 1, true );
|
|
}
|
|
|
|
function onSpellCast( socket, character, directCast, spellNum )
|
|
{
|
|
// ...handle spell functionality here
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsMapStatics" id="functionsMapStatics"><span>Map, Statics and Tiledata Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_CheckDynamicFlag"/>
|
|
<label for="spoiler_function_mapstatics_CheckDynamicFlag">CheckDynamicFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CheckDynamicFlag( x, y, z, world, instanceID, tileFlagID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if <em>any</em> dynamic tile at given coordinates has specified tile flag.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported tileFlags:
|
|
<pre><code class="language-javascript">0 - TF_FLOORLEVEL // "Background"
|
|
1 - TF_HOLDABLE // "Weapon"
|
|
2 - TF_TRANSPARENT // "SignGuildBanner"
|
|
3 - TF_TRANSLUCENT // "WebDirtBlood"
|
|
4 - TF_WALL // "WallVertTile"
|
|
5 - TF_DAMAGING // ??
|
|
6 - TF_BLOCKING // "Impassable"
|
|
7 - TF_WET // "LiquidWet"
|
|
8 - TF_UNKNOWN1 // "Ignored"
|
|
9 - TF_SURFACE // "Standable"
|
|
10 - TF_CLIMBABLE // "Bridge"
|
|
11 - TF_STACKABLE // "Generic"
|
|
12 - TF_WINDOW // "WindowArchDoor"
|
|
13 - TF_NOSHOOT // "CannotShootThru"
|
|
14 - TF_DISPLAYA // "Prefix A"
|
|
15 - TF_DISPLAYAN // "Prefix An"
|
|
16 - TF_DESCRIPTION// "Internal"
|
|
17 - TF_FOLIAGE // "FadeWithTrans"
|
|
18 - TF_PARTIALHUE // Partial hue can be applied to item (0x8000 + regular hue)
|
|
19 - TF_UNKNOWN2 // ??
|
|
20 - TF_MAP // ??
|
|
21 - TF_CONTAINER // ??
|
|
22 - TF_WEARABLE // "Equipable"
|
|
23 - TF_LIGHT // "LightSource"
|
|
24 - TF_ANIMATED // ??
|
|
25 - TF_NODIAGONAL // "HoverOver" in SA clients and later, to determine if tiles can be moved on by flying gargoyles
|
|
26 - TF_UNKNOWN3 // "NoDiagonal" in SA clients and later?
|
|
27 - TF_ARMOR // "WholeBodyItem"
|
|
28 - TF_ROOF // "WallRoofWeap"
|
|
29 - TF_DOOR // "Door"
|
|
30 - TF_STAIRBACK // "ClimbableBit1"
|
|
31 - TF_STAIRRIGHT // "ClimbableBit2"
|
|
|
|
// Following flags were added in HS expansion? Purpose unknown
|
|
32 - TF_ALPHABLEND
|
|
33 - TF_USENEWART
|
|
34 - TF_ARTUSED
|
|
35 - TF_NOSHADOW
|
|
36 - TF_PIXELBLEED
|
|
37 - TF_PLAYANIMONCE
|
|
38 - TF_MULTIMOVABLE
|
|
</code></pre>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Is there a tile with TF_BLOCKING flag at user's location?
|
|
var tileFlagFound = CheckDynamicFlag( pUser.x, pUser.y, pUser.z, pUser.worldnumber, pUser.instanceID, 6 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_CheckStaticFlag"/>
|
|
<label for="spoiler_function_mapstatics_CheckStaticFlag">CheckStaticFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CheckStaticFlag( x, y, z, world, tileFlagID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if <em>any</em> static tile at given coordinates has specified tile flag.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported tileFlags:
|
|
<pre><code class="language-javascript">0 - TF_FLOORLEVEL // "Background"
|
|
1 - TF_HOLDABLE // "Weapon"
|
|
2 - TF_TRANSPARENT // "SignGuildBanner"
|
|
3 - TF_TRANSLUCENT // "WebDirtBlood"
|
|
4 - TF_WALL // "WallVertTile"
|
|
5 - TF_DAMAGING // ??
|
|
6 - TF_BLOCKING // "Impassable"
|
|
7 - TF_WET // "LiquidWet"
|
|
8 - TF_UNKNOWN1 // "Ignored"
|
|
9 - TF_SURFACE // "Standable"
|
|
10 - TF_CLIMBABLE // "Bridge"
|
|
11 - TF_STACKABLE // "Generic"
|
|
12 - TF_WINDOW // "WindowArchDoor"
|
|
13 - TF_NOSHOOT // "CannotShootThru"
|
|
14 - TF_DISPLAYA // "Prefix A"
|
|
15 - TF_DISPLAYAN // "Prefix An"
|
|
16 - TF_DESCRIPTION// "Internal"
|
|
17 - TF_FOLIAGE // "FadeWithTrans"
|
|
18 - TF_PARTIALHUE // Partial hue can be applied to item (0x8000 + regular hue)
|
|
19 - TF_UNKNOWN2 // ??
|
|
20 - TF_MAP // ??
|
|
21 - TF_CONTAINER // ??
|
|
22 - TF_WEARABLE // "Equipable"
|
|
23 - TF_LIGHT // "LightSource"
|
|
24 - TF_ANIMATED // ??
|
|
25 - TF_NODIAGONAL // "HoverOver" in SA clients and later, to determine if tiles can be moved on by flying gargoyles
|
|
26 - TF_UNKNOWN3 // "NoDiagonal" in SA clients and later?
|
|
27 - TF_ARMOR // "WholeBodyItem"
|
|
28 - TF_ROOF // "WallRoofWeap"
|
|
29 - TF_DOOR // "Door"
|
|
30 - TF_STAIRBACK // "ClimbableBit1"
|
|
31 - TF_STAIRRIGHT // "ClimbableBit2"
|
|
|
|
// Following flags were added in HS expansion? Purpose unknown
|
|
32 - TF_ALPHABLEND
|
|
33 - TF_USENEWART
|
|
34 - TF_ARTUSED
|
|
35 - TF_NOSHADOW
|
|
36 - TF_PIXELBLEED
|
|
37 - TF_PLAYANIMONCE
|
|
38 - TF_MULTIMOVABLE
|
|
</code></pre>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Is there a tile with TF_CLIMBABLE flag at user's location?
|
|
var tileFlagFound = CheckStaticFlag( pUser.x, pUser.y, pUser.z, pUser.worldnumber, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_CheckTileFlag"/>
|
|
<label for="spoiler_function_mapstatics_CheckTileFlag">CheckTileFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CheckTileFlag( tileID, tileFlag );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if a specific tile ID has given flag</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported tileFlags:
|
|
<pre><code class="language-javascript">0 - TF_FLOORLEVEL // "Background"
|
|
1 - TF_HOLDABLE // "Weapon"
|
|
2 - TF_TRANSPARENT // "SignGuildBanner"
|
|
3 - TF_TRANSLUCENT // "WebDirtBlood"
|
|
4 - TF_WALL // "WallVertTile"
|
|
5 - TF_DAMAGING // ??
|
|
6 - TF_BLOCKING // "Impassable"
|
|
7 - TF_WET // "LiquidWet"
|
|
8 - TF_UNKNOWN1 // "Ignored"
|
|
9 - TF_SURFACE // "Standable"
|
|
10 - TF_CLIMBABLE // "Bridge"
|
|
11 - TF_STACKABLE // "Generic"
|
|
12 - TF_WINDOW // "WindowArchDoor"
|
|
13 - TF_NOSHOOT // "CannotShootThru"
|
|
14 - TF_DISPLAYA // "Prefix A"
|
|
15 - TF_DISPLAYAN // "Prefix An"
|
|
16 - TF_DESCRIPTION// "Internal"
|
|
17 - TF_FOLIAGE // "FadeWithTrans"
|
|
18 - TF_PARTIALHUE // Partial hue can be applied to item (0x8000 + regular hue)
|
|
19 - TF_UNKNOWN2 // ??
|
|
20 - TF_MAP // ??
|
|
21 - TF_CONTAINER // ??
|
|
22 - TF_WEARABLE // "Equipable"
|
|
23 - TF_LIGHT // "LightSource"
|
|
24 - TF_ANIMATED // ??
|
|
25 - TF_NODIAGONAL // "HoverOver" in SA clients and later, to determine if tiles can be moved on by flying gargoyles
|
|
26 - TF_UNKNOWN3 // "NoDiagonal" in SA clients and later?
|
|
27 - TF_ARMOR // "WholeBodyItem"
|
|
28 - TF_ROOF // "WallRoofWeap"
|
|
29 - TF_DOOR // "Door"
|
|
30 - TF_STAIRBACK // "ClimbableBit1"
|
|
31 - TF_STAIRRIGHT // "ClimbableBit2"
|
|
|
|
// Following flags were added in HS expansion? Purpose unknown
|
|
32 - TF_ALPHABLEND
|
|
33 - TF_USENEWART
|
|
34 - TF_ARTUSED
|
|
35 - TF_NOSHADOW
|
|
36 - TF_PIXELBLEED
|
|
37 - TF_PLAYANIMONCE
|
|
38 - TF_MULTIMOVABLE
|
|
</code></pre>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Checks if tile ID for iUsed has the TF_BLOCKING (6) flag
|
|
var doesTileBlock = CheckTileFlag( iUsed.id, 6 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_DoesDynamicBlock"/>
|
|
<label for="spoiler_function_mapstatics_DoesDynamicBlock">DoesDynamicBlock <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DoesDynamicBlock( x, y, z, world, instance, checkWater, waterWalk, checkOnlyMultis, checkOnlyNonMultis );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if dynamics at/above given location blocks character movement.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters: x, y, z, world, instance = coordinates, worldnumber and instanceID<br>
|
|
checkWater = true if water should block, false if not (for creatures that can swim, for instance)<br>
|
|
waterWalk = true if creature can move on water surfaces, false if not<br>
|
|
checkOnlyMultis = only multis will be checked, other dynamic items are ignored<br>
|
|
checkOnlyNonMultis = multis are ignored, all other dynamic items are checked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var doesDynamicBlock = DoesDynamicBlock( pUser.x + 1, pUser.y, pUser.z, pUser.worldnumber, pUser.instanceID, false, false, false, false );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_DoesMapBlock"/>
|
|
<label for="spoiler_function_mapstatics_DoesMapBlock">DoesMapBlock <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DoesMapBlock( x, y, z, world, checkWater, waterWalk, checkMultiPlacement, checkForRoad );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if map tile at given coordinates would block character movement.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters: x, y, z, world = coordinates and worldnumber<br>
|
|
checkWater = true if water should block, false if not (for creatures that can swim, for instance)<br>
|
|
waterWalk = true if creature can move on water surfaces, false if not<br>
|
|
checkMultiPlacement = if true, map tile has to be at exact same Z as provided coordinate, or it will count as blocked<br>
|
|
checkForRoad = true if roads and paths should count as blocking. checkMultiPlacement must be true for this to be checked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var doesMapBlock = DoesMapBlock( pUser.x + 1, pUser.y, pUser.z, pUser.worldnumber, false, false, true, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_DoesStaticBlock"/>
|
|
<label for="spoiler_function_mapstatics_DoesStaticBlock">DoesStaticBlock <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DoesStaticBlock( x, y, z, world, checkWater );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if statics at/above given location blocks character movement</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters: x, y, z, world = coordinates and worldnumber, checkWater = true if water should count as blocking, false if not (for creatures that can swim, for instance)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var doesStaticBlock = DoesStaticBlock( pUser.x + 1, pUser.y, pUser.z, pUser.worldnumber, false );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_GetMapElevation"/>
|
|
<label for="spoiler_function_mapstatics_GetMapElevation">GetMapElevation <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetMapElevation( x, y, world );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the map elevation at specified coordinates</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var mapElev = GetMapElevation( pUser.x, pUser.y, pUser.worldnumber );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_GetTileHeight"/>
|
|
<label for="spoiler_function_mapstatics_GetTileHeight">GetTileHeight <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetTileHeight( tileID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the height of the static tile with specified ID.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Among other things, useful for getting the surface Z of targeted statics in client version 7.0.8.2 or lower, as these don't automatically include this in the target Z for socket as more recent clients do.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var tileHeight = GetTileHeight( tileID );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_GetTileIDAtMapCoord"/>
|
|
<label for="spoiler_function_mapstatics_GetTileIDAtMapCoord">GetTileIDAtMapCoord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetTileIDAtMapCoord( xLoc, yLoc, worldNumber );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns ID of the map tile at xLoc and yLoc in world worldNumber</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get map tile ID at 0,0 in Felucca
|
|
var mapTileID = GetTileIDAtMapCoord( 0, 0, 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_SendStaticStats"/>
|
|
<label for="spoiler_function_mapstatics_SendStaticStats">SendStaticStats <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SendStaticStats( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Builds a gump with map or tile information for recently targeted location.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">SendStaticStats( mSock );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_StaticAt"/>
|
|
<label for="spoiler_function_mapstatics_StaticAt">StaticAt <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool StaticAt( xLoc, yLoc, worldNumber, tileID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks for static at specified location.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no tileID parameter is specified, will match ANY static at said location.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Checks if there's a static tile with ID 0x04a9 (wooden floor) at a specific location
|
|
var staticFound = StaticAt( pUser.x, pUser.y, pUser.worldnumber, 0x04a9 );
|
|
|
|
// Checks if there's ANY static tile at specific location
|
|
var staticFound = StaticAt( pUser.x, pUser.y, pUser.worldnumber );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_mapstatics_StaticInRange"/>
|
|
<label for="spoiler_function_mapstatics_StaticInRange">StaticInRange <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool StaticInRange( xLoc, yLoc, worldNumber, radius, tileID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks for static item within specified range of given location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Checks for a static tile with ID 0x04a9 (wooden floor) within a 3 tile radius from pUser's location
|
|
var staticFound = StaticInRange( pUser.x, pUser.y, pUser.worldnumber, 3, 0x04a9 );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsMisc" id="functionsMisc"><span>Miscellaneous Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_CodeConstants"/>
|
|
<label for="spoiler_function_misc_CodeConstants">Code Constants <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int BASEITEMSERIAL();</em></p>
|
|
<p><em>int INVALIDSERIAL();</em></p>
|
|
<p><em>int INVALIDID();</em></p>
|
|
<p><em>int INVALIDCOLOUR();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p><strong>BASEITEMSERIAL()</strong> - Gets the constant that defines the base value used as starting point for item serials. If an object serial is lower than this, it probably belongs to a character. If it's higher, it belongs to an item.<br>
|
|
<strong>INVALIDSERIAL()</strong> - Gets the constant defining an invalid serial. If an object serial matches this, it's invalid!<br>
|
|
<strong>INVALIDID()</strong> - Gets the constant defining an invalid ID. If an object's ID matches this, it's probably not a valid ID!<br>
|
|
<strong>INVALIDCOLOUR()</strong> - Gets the constant defining an invalid colour. If an object's colour is equal or higher than this, it's probably not a valid colour!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var baseItemSerial = BASEITEMSERIAL();
|
|
var invalidSerial = INVALIDSERIAL();
|
|
var invalidID = INVALIDID();
|
|
var invalidColour = INVALIDCOLOUR();
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_CreateParty"/>
|
|
<label for="spoiler_function_misc_CreateParty">CreateParty <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>PARTY CreateParty( partyleader );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Create a new party/group with the specified character as leader</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a new party (myParty) with pUser as the leader
|
|
var myParty = CreateParty( pUser );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_DistanceBetween"/>
|
|
<label for="spoiler_function_misc_DistanceBetween">DistanceBetween <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int DistanceBetween( x1, y1, x2, y2 );</em></p>
|
|
<p><em>int DistanceBetween( x1, y1, z1, x2, y2, z2 );</em></p>
|
|
<p><em>int DistanceBetween( objA, objB );</em></p>
|
|
<p><em>int DistanceBetween( objA, objB, checkZ );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get the distance between two sets of coordinates or objects on either 2D or 3D plane</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters: x1, y1, z1, x2, y2, z2 = coordinates<br>
|
|
checkZ = true if distance between two objects should take into account Z axis</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get distance between two sets of x, y coordinates
|
|
var distance1 = DistanceBetween( pUser.x, pUser.y, iUsed.x, iUsed.y );
|
|
|
|
// Get distance between two sets of x, y, z coordinates
|
|
var distance2 = DistanceBetween( pUser.x, pUser.y, pUser.z, iUsed.x, iUsed.y, iUsed.z );
|
|
|
|
// Get distance between pUser and iUsed using 2D coordinates
|
|
var distance2 = DistanceBetween( pUser, iUsed );
|
|
|
|
// Get distance between pUser and iUsed using 3D coordinates
|
|
var distance2 = DistanceBetween( pUser, iUsed, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_DoesEventExist"/>
|
|
<label for="spoiler_function_misc_DoesEventExist">DoesEventExist <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DoesEventExist( scriptID, eventToCheck );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check for existence of a named JS event/function in another script</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Parameters: scriptID = ID of the script to check<br>
|
|
eventToCheck = name of event/function to look for</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if a custom function exists in a specific script (0), and trigger it with TriggerEvent() if it does:
|
|
if( DoesEventExist( 0, "MyCustomFunction" ))
|
|
{
|
|
TriggerEvent( 0, "MyCustomFunction", [additional parameters] );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetAccountCount"/>
|
|
<label for="spoiler_function_misc_GetAccountCount">GetAccountCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetAccountCount();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets the total amount of accounts on the server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var totalAccounts = GetAccountCount();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetClientFeature"/>
|
|
<label for="spoiler_function_misc_GetClientFeature">GetClientFeature <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool GetClientFeature( ClientFeaturesBitNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if a specific client features is enabled. For a list of features that can be checked this way, see [settings]->clientFeatures List in the <a href="https://www.uox3.org/docs/index.html#uoxINISettings">UOX.INI Settings section of the UOX3 Documentation</a>.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// AoS bit from list of client features
|
|
var aosFeaturesEnabled = GetClientFeature( 0x10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetDictionaryEntry"/>
|
|
<label for="spoiler_function_misc_GetDictionaryEntry">GetDictionaryEntry <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string GetDictionaryEntry( entryNum [, language ] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Pulls entry from the dictionary file based on language (or server default, if no language parameter is ).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var textString = GetDictionaryEntry( 1, socket.language );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetMurderThreshold"/>
|
|
<label for="spoiler_function_misc_GetMurderThreshold">GetMurderThreshold <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetMurderThreshold();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the number of kills needed to be branded as a murderer and turn red.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>See also: Character <strong>.murderCount</strong> and <strong>.murderer</strong> properties</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( GetMurderThreshold() > pTalking.murderCount )
|
|
{
|
|
TextMessage( pTalkingTo, "Surely sir, you must be a murderer. I bid you adieu" );
|
|
EmoteMessage( pTalkingTo, "*scampers off*" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetPlayerCount"/>
|
|
<label for="spoiler_function_misc_GetPlayerCount">GetPlayerCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetPlayerCount();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets the total amount of players online on the server</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var totalOnlinePlayers = GetPlayerCount();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetRandomSOSArea"/>
|
|
<label for="spoiler_function_misc_GetRandomSOSArea">GetRandomSOSArea <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>SOSObject GetRandomSOSArea( worldNum, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets a random SOS area from list of such areas loaded from [SOSAREAS] section of regions.dfn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to a random SOS area
|
|
var sosArea = GetRandomSOSArea( pUser.worldNum, pUser.instanceID );
|
|
|
|
// Pick a random location within the selected sosArea
|
|
var rndX = RandomNumber( sosArea[0], sosArea[2] );
|
|
var rndY = RandomNumber( sosArea[1], sosArea[3] );
|
|
|
|
// Add location to sos message item
|
|
sosMsg.morex = rndX;
|
|
sosMsg.morey = rndY;
|
|
sosMsg.morez = worldNum;
|
|
sosMsg.more = sosMsg.instanceID;
|
|
|
|
// See UOX3/js/item/waterstainedsos.js for full example, including validation for whether the chosen location is suitable, and not blocked by dynamic items, static items or map tiles</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetServerFeature"/>
|
|
<label for="spoiler_function_misc_GetServerFeature">GetServerFeature <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool GetServerFeature( ServerFeaturesBitNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if a specific server features is enabled. For a list of features that can be checked this way, see [settings]->serverFeatures List in the <a href="https://www.uox3.org/docs/index.html#uoxINISettings">UOX.INI Settings section of the UOX3 Documentation</a>.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// ContextMenus bit from list of server features
|
|
var contextMenusEnabled = GetServerFeature( 0x08 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetServerSetting"/>
|
|
<label for="spoiler_function_misc_GetServerSetting">GetServerSetting <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string GetServerSetting( serverSettingString );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Fetches the value of a specified server setting and returns it as a string. Wrap in parseInt() if expected value returned is an int.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Returns 1 if GUARDSACTIVE is set to 1 in UOX.INI, or 0 if set to 0.
|
|
var guardsActive = GetServerSetting( "GUARDSACTIVE" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_GetSocketFromIndex"/>
|
|
<label for="spoiler_function_misc_GetSocketFromIndex">GetSocketFromIndex <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>SOCKET GetSocketFromIndex( socketIndex );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Create a socket-object based on the specified socketIndex</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch whichever socket is connected to the server as socket/connection 0
|
|
var socket = GetSocketFromIndex( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_IsInBuilding"/>
|
|
<label for="spoiler_function_misc_IsInBuilding">IsInBuilding <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsInBuilding( x, y, z, world, instance, checkHeight );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if specified location is inside a static building (underneath static items), or if player is inside a multi.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If checkHeight argument is true, player is only deemed inside a multi if there are multi-items above the player's head. If player is in a courtyard/on a rooftop, they will be deemed to be NOT in the building. checkHeight is not used for the static part of the function, only for multis.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var isCharInBuilding = IsInBuilding( myChar.x, myChar.y, myChar.z, myChar.worldnumber, myChar.instanceID, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_IterateOver"/>
|
|
<label for="spoiler_function_misc_IterateOver">IterateOver <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int IterateOver( objectType[, socket] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Iterates over all objects of specified type in the world.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>For every object it comes across, the iterator will call a function <strong>onIterate( object[, socket] )</strong> in the same script. Supported object types: "BASEOBJ", "CHARACTER", "ITEM", "SPAWNER", "MULTI", "BOAT". If the optional socket parameter is included in IterateOver, it will be passed to the onIterate event.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var itemCount = IterateOver( "ITEM" );
|
|
Console.log( itemCount + " items found!" );
|
|
...
|
|
function onIterate( myObject )
|
|
{
|
|
myObject.TextMessage( "I'm an item!" );
|
|
// ... optionally do something here
|
|
return true;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_Moon"/>
|
|
<label for="spoiler_function_misc_Moon">Moon <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Moon( moonNum );</em></p>
|
|
<p><em>void Moon( moonNum, newVal );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get and set the server moon values for the two moons Felucca (0) and Trammel (1)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var feluccaMoonphase = Moon( 0 );
|
|
var TrammelMoonphase = Moon( 1 );
|
|
Moon( 0, 7 ); //Set the moon Felucca to moonphase 7
|
|
Moon( 1, 3 ); //Set the moon Trammel to moonphase 3</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_RandomNumber"/>
|
|
<label for="spoiler_function_misc_RandomNumber">RandomNumber <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int RandomNumber( loNum, hiNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a random number between loNum (inclusive) and hiNum (inclusive)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iNum = RandomNumber( 0, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_Reload"/>
|
|
<label for="spoiler_function_misc_Reload">Reload <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Reload( subSystemID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Dynamically reloads one (or all) of UOX3's subsystems without having to restart UOX3</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported subSystemIDs:
|
|
<ul>
|
|
<li>0 - Regions/TeleportLocations</li>
|
|
<li>1 - Spawn Regions</li>
|
|
<li>2 - Spells</li>
|
|
<li>3 - Commands</li>
|
|
<li>4 - DFNs/Skills</li>
|
|
<li>5 - JScripts</li>
|
|
<li>6 - HTML Templates</li>
|
|
<li>7 - INI</li>
|
|
<li>8 - Everything</li>
|
|
<li>9 - Accounts</li>
|
|
<li>10 - Dictionaries</li>
|
|
</ul></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Reload all DFNs (and Skill system)
|
|
Reload( 4 );
|
|
|
|
// Reload INI file
|
|
Reload( 7 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_ReloadJSFile"/>
|
|
<label for="spoiler_function_misc_ReloadJSFile">ReloadJSFile <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ReloadJSFile( scriptID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Dynamically reloads script with specified scriptID from jse_fileassociations.scp without having to restart UOX3</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Cannot be used to validate sockets</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example of how this is used by 'reloadjsfile command
|
|
function CommandRegistration()
|
|
{
|
|
RegisterCommand( "reloadjsfile", 3, true ); //Reload JavaScript file
|
|
}
|
|
|
|
function command_RELOADJSFILE( socket, cmdString )
|
|
{
|
|
var scriptID = parseInt( cmdString );
|
|
socket.SysMessage( "Attempting Reload of JavaScript (ScriptID " + cmdString + ")" );
|
|
ReloadJSFile( scriptID );
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_RollDice"/>
|
|
<label for="spoiler_function_misc_RollDice">RollDice <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int RollDice( numDie, faces, addition );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Rolls a faces sided die numDie times and adds addition. The example is for a DnD style dice like: 2d3+1</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Roll a DnD style dice of type 2d3+1 (2 dice with 3 faces, add 1 to result)
|
|
var mDie = RollDice( 2, 3, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_TriggerEvent"/>
|
|
<label for="spoiler_function_misc_TriggerEvent">TriggerEvent <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool/int/string/object TriggerEvent( scriptID, "functionName", argument1, argument2 );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Calls script with specified scriptID, runs function in said script that matches "functionName", with the defined function arguments. The called upon script can return a value in the form of a boolean, int, string or an object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Calls script with ID 8000 and runs function "onUseChecked" with function parameters pUser and iUsed
|
|
var returnVal = TriggerEvent( 8000, "onUseChecked", pUser, iUsed );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_TriggerTrap"/>
|
|
<label for="spoiler_function_misc_TriggerTrap">TriggerTrap <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>TriggerTrap( pChar/pSock, iTrap );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>pChar/pSock triggers trap on iTrap object (if any trap is present on object)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Trap will only trigger if both first two parts of MOREZ value is set on object; first part needs to be set to 1 to indicate object is trapped, second part needs to specify damage amount to apply.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Setup trap on iTrap object
|
|
// First part of value (01) indicates object is trapped
|
|
// Second part of value (32) defines damage dealt (32 = 0x32 = 50 damage)
|
|
// Third (00) and Fourth (00) parts, unused here, normally indicate the min/max skill required to disarm trap
|
|
iTrap.morez = 0x01320000;
|
|
|
|
// Trigger the trap
|
|
TriggerTrap( pChar, iTrap );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_UseItem"/>
|
|
<label for="spoiler_function_misc_UseItem">UseItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void UseItem( pSock/mChar, iToUse );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>To allow characters (and NPCs in particular) to trigger item-use functionality of items</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Either a socket or a character can be passed in as a parameter of the UseItem function. If a socket is passed in, UOX3 will derive the character using the item from said socket.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// If an item has type 12, make NPC use the door to open it
|
|
if( myItem.type == 12 )
|
|
{
|
|
mChar.TextMessage( "A door! What's on the other side?" );
|
|
UseItem( mChar, iToUse );
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_ValidateObject"/>
|
|
<label for="spoiler_function_misc_ValidateObject">ValidateObject <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ValidateObject( object );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if argument is a valid object (Item, Character, Multi, Boat, Spawner)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Cannot be used to validate sockets</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !ValidateObject( iUsed ))
|
|
return;</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_WorldBrightLevel"/>
|
|
<label for="spoiler_function_misc_WorldBrightLevel">WorldBrightLevel <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>[int] WorldBrightLevel( [lightlevel] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set the "maximum brightness" light-level for daytime across the entire world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no parameter is provided, function will return current "maximum brightness" light-level for daytime instead.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Set maximum world brightness level to 1
|
|
WorldBrightLevel( 1 );
|
|
|
|
// Get current maximum world brightness level
|
|
var lightLevel = WorldBrightLevel();
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_WorldDarkLevel"/>
|
|
<label for="spoiler_function_misc_WorldDarkLevel">WorldDarkLevel <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>[int] WorldDarkLevel( [lightlevel] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set the "minimum brightness" light-level for night-time across the entire world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no parameter is provided, function will return current "minimum brightness" light-level for night-time instead.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Set minimum world brightness level to 15
|
|
WorldDarkLevel( 15 );
|
|
|
|
// Get current maximum world brightness level
|
|
var lightLevel = WorldDarkLevel();
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_misc_WorldDungeonLevel"/>
|
|
<label for="spoiler_function_misc_WorldDungeonLevel">WorldDungeonLevel <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>[int] WorldDungeonLevel( [lightlevel] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set the fixed light-level for any regions marked as dungeons</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no parameter is provided, function will return current fixed light-level for dungeons instead.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Set fixed dungeon light level to 12
|
|
WorldDungeonLevel( 12 );
|
|
|
|
// Get current fixed light level of dungeons
|
|
var lightLevel = WorldDungeonLevel();
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsMulti" id="functionsMulti"><span>Multi Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_multi_CalcMultiFromSer"/>
|
|
<label for="spoiler_function_multi_CalcMultiFromSer">CalcMultiFromSer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MULTI CalcMultiFromSer( serial );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Calculates a multi object from a serial</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMultiSerial = parseInt(pUser.GetTag( "iMultiSerial" ));
|
|
var iMultiSerial1 = ( iMultiSerial >> 24 );
|
|
var iMultiSerial2 = ( iMultiSerial >> 16 );
|
|
var iMultiSerial3 = ( iMultiSerial >> 8 );
|
|
var iMultiSerial4 = ( iMultiSerial % 256 );
|
|
var iMulti = CalcMultiFromSer( iMultiSerial1, iMultiSerial2, iMultiSerial3, iMultiSerial4 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_multi_FindMulti"/>
|
|
<label for="spoiler_function_multi_FindMulti">FindMulti <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MULTI FindMulti( ourObj );</em></p>
|
|
<p><em>MULTI FindMulti( x, y, z, worldNumber[, instanceID] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Finds the multi that is in the area of the coordinates x, y, z, worldNumber (and optionally, instanceID), or in the area of the specified object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>WorldNumbers: 0 = Felucca, 1 = Trammel, 2 = Ilshenar, 3 = Malas, 4 = Tokuno, 5 = Ter-mur</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Find Multi at pChar's location
|
|
var iMulti = FindMulti( pChar );
|
|
if( iMulti )
|
|
{
|
|
pChar.TextMessage( "You know, I'm standing in the same spot as a multi!" );
|
|
}
|
|
|
|
// Find Multi at specific set of coordinates (or in this case, myItem's location)
|
|
var iMulti = FindMulti( myItem.x, myItem.y, myItem.z, myItem.worldnumber );
|
|
if( iMulti )
|
|
{
|
|
myItem.TextMessage( "I am an item, in the same spot as a multi!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsPacket" id="functionsPacket"><span>Packet Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_packet_RegisterPacket"/>
|
|
<label for="spoiler_function_packet_RegisterPacket">RegisterPacket <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RegisterPacket( packetID, subCommand );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Register JS script as a global listener for a specific network packet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Triggers onPacketReceive() event in same script when this network packet is sent - IF script is added under the PACKET_SCRIPTS section of jse_fileassociations.scp, and the RegisterPacket() function is called from a PacketRegistration() function.<br><br></p>
|
|
<p>See also: <a href="#eventScriptRegistration">[Script]Registration()</a> and <a href="#eventOnPacketReceive">onPacketReceive()</a> events</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">function PacketRegistration()
|
|
{
|
|
RegisterPacket( 0x05, subCommand );
|
|
}
|
|
|
|
function onPacketReceive( socket, packetNum, subCommand )
|
|
{
|
|
switch( packetNum )
|
|
{
|
|
case 0x05: //Request Attack sent from client
|
|
{
|
|
//do stuff??
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsReputation" id="functionsReputation"><span>Reputation Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_reputation_WillResultInCriminal"/>
|
|
<label for="spoiler_function_reputation_WillResultInCriminal">WillResultInCriminal <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool WillResultInCriminal( srcChar, targChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if hostile action done by one character versus another will result in criminal flag</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Function compares flagging, race, guilds, aggressor flags, owners of each character to determine if a hostile action towards targChar would result in a criminal flag for srcChar</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var willBeCriminal = WillResultInCriminal( srcChar, targChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsResource" id="functionsResource"><span>Resource Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_resource_ResourceAmount"/>
|
|
<label for="spoiler_function_resource_ResourceAmount">ResourceAmount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ResourceAmount( resourceType );</em></p>
|
|
<p><em>void ResourceAmount( resourceType, int );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used to get/set the maximum amount of resources per area of a specific resourceType ("ORE", "LOGS" or "FISH").</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var maxLogAmount = ResourceAmount( "LOGS" );
|
|
//or...
|
|
ResourceAmount( "LOGS", 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_resource_ResourceArea"/>
|
|
<label for="spoiler_function_resource_ResourceArea">ResourceArea <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ResourceArea( resourceType );</em></p>
|
|
<p><em>void ResourceArea( resourceType, int );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used to get/set the amount of resource areas to split the world into for a specific resourceType ("ORE", "LOGS" or "FISH").</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var resourceAreas = ResourceArea( "ORE" );
|
|
//or...
|
|
ResourceArea( "ORE", 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_resource_ResourceRegion"/>
|
|
<label for="spoiler_function_resource_ResourceRegion">ResourceRegion <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>RESOURCEOBJ ResourceRegion( x, y, worldnumber );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a resource object allowing JS to modify resource data</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var mResource = ResourceRegion( pUser.x, pUser.y, pUser.worldnumber );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_resource_ResourceTime"/>
|
|
<label for="spoiler_function_resource_ResourceTime">ResourceTime <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ResourceTime( resourceType );</em></p>
|
|
<p><em>void ResourceTime( resourceType, int );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used to get/set the spawn timer of a resourceType ("ORE", "LOGS" or "FISH").</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var logTimer = ResourceTime( "LOGS" );
|
|
//or...
|
|
ResourceTime( "LOGS", 600 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsRace" id="functionsRace"><span>Race Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_race_GetRaceCount"/>
|
|
<label for="spoiler_function_race_GetRaceCount">GetRaceCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetRaceCount();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Counts all Races available on the Server.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var totalRaceCount = GetRaceCount();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_race_IsRaceWeakToWeather"/>
|
|
<label for="spoiler_function_race_IsRaceWeakToWeather">IsRaceWeakToWeather <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsRaceWeakToWeather( raceID, weatherType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if race is weak to weatherType</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The list of weather types are:
|
|
<ul>
|
|
<li>0 - Light</li>
|
|
<li>1 - Rain</li>
|
|
<li>2 - Cold</li>
|
|
<li>3 - Heat</li>
|
|
<li>4 - Lightning</li>
|
|
<li>5 - Snow</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var myRace = pUser.race;
|
|
if( IsRaceWeakToWeather( myRace.id, 0 ))
|
|
{
|
|
pUser.TextMessage( "Eee, bright light!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_race_GetRaceSkillAdjustment"/>
|
|
<label for="spoiler_function_race_GetRaceSkillAdjustment">GetRaceSkillAdjustment <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetRaceSkillAdjustment( raceID, skillNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the % increase (or penalty) that raceID gets for skillNum.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var myRace = pUser.race;
|
|
if( GetRaceSkillAdjustment( myRace.id, 32 ) > 10 )
|
|
{
|
|
pUser.TextMessage( "Woah, that's a big increase to Spirit Speak you've got there!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_race_RaceCompareByRace"/>
|
|
<label for="spoiler_function_race_RaceCompareByRace">RaceCompareByRace <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int RaceCompareByRace( srcRaceID, trgRaceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the relationship of the two specified races.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If the relationship is 0, then they're neutral. If it's greater than 0 and less than 100, then they're allies. If it's less than 0 and greater than -100, then they're enemies.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( RaceCompareByRace( pUser.race.id, pChar.race.id ) < 0 )
|
|
{
|
|
pUser.TextMessage( "Ahhh we hate each other, for some reason! Fight me!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsSkill" id="functionsSkill"><span>Skill Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_skill_MakeItem"/>
|
|
<label for="spoiler_function_skill_MakeItem">MakeItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MakeItem( socket, player, itemNum[, hueNum]);</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Player makes the item itemNum. itemNum points to a create.dfn (SECTION ITEM itemNum) entry. The hueNum is optional</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">MakeItem( socket, player, 1, 0x45 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_skill_MakeMenu"/>
|
|
<label for="spoiler_function_skill_MakeMenu">MakeMenu <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>MakeMenu( socket, menuID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens up make menu with specified ID and sends it to socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">MakeMenu( sock, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsSpeech" id="functionsSpeech"><span>Speech Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_speech_BroadcastMessage"/>
|
|
<label for="spoiler_function_speech_BroadcastMessage">BroadcastMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BroadcastMessage( messageToSend );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends messageToSend string to every client in the world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">BroadcastMessage( "You're all going to die a hideous and painful death... j/k!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_speech_Yell"/>
|
|
<label for="spoiler_function_speech_Yell">Yell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Yell( socket, messageToYell, commandLevel );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Globally sends the message to anyone matching the provided command level</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported commandLevel values: 0 - Players, 1 - Counselors, 2 - GMs, 3 - Admins</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Yell( pSock, "Isn't the world great?", 2 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsSpawnRegion" id="functionsSpawnRegion"><span>SpawnRegion Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_SpawnRegion_GetSpawnRegion"/>
|
|
<label for="spoiler_function_SpawnRegion_GetSpawnRegion">GetSpawnRegion <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>SpawnRegion GetSpawnRegion( spawnRegionNum );</em></p>
|
|
<p><em>SpawnRegion GetSpawnRegion( x, y, worldNum, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns SpawnRegion object for specified spawnRegionNum, or for specified set of coordinates</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Returns SpawnRegion object for spawn region #1 from spawns.dfn
|
|
var spawnRegion = GetSpawnRegion( 1 );
|
|
pUser.TextMessage( "The name of this SpawnRegion is: " + spawnRegion.name );
|
|
|
|
// Returns SpawnRegion object for spawn region at specified coordinates:
|
|
var spawnRegion = GetSpawnRegion( pUser.x, pUser.y, pUser.worldnumber, pUser.instanceID );
|
|
pUser.TextMessage( "The name of this SpawnRegion is: " + spawnRegion.name );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_SpawnRegion_GetSpawnRegionCount"/>
|
|
<label for="spoiler_function_SpawnRegion_GetSpawnRegionCount">GetSpawnRegionCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSpawnRegionCount()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns amount of SpawnRegions that exist.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get count of all spawn regions on the server
|
|
var spawnRegionCount = GetSpawnRegionCount();
|
|
pUser.TextMessage( "There are " + spawnRegionCount + " SpawnRegions on this server!" );
|
|
|
|
// Iterate through all spawn regions on the server
|
|
var spawnRegion;
|
|
for( var i = 0; i < spawnRegionCount; i++ )
|
|
{
|
|
spawnRegion = GetSpawnRegion( i );
|
|
Console.Print( "SpawnRegion Name: " + spawnRegion.name + "\n" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_SpawnRegion_GetSpawnRegionFacetStatus"/>
|
|
<label for="spoiler_function_SpawnRegion_GetSpawnRegionFacetStatus">GetSpawnRegionFacetStatus <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSpawnRegionFacetStatus( facetNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns enabled state for Spawn Regions in specified facet (controlled by SPAWNREGIONSFACETS setting in UOX.INI, or SetSpawnRegionFacetStatus() method)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Function returns 0 if Spawn Regions are disabled for a given facet, or 1 if they're enabled</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get enabled state for Spawn Regions in Felucca
|
|
var feluccaSpawnStatus = GetSpawnRegionFacetStatus( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_SpawnRegion_IterateOverSpawnRegions"/>
|
|
<label for="spoiler_function_SpawnRegion_IterateOverSpawnRegions">IterateOverSpawnRegions <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void IterateOverSpawnRegions();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Iterates over all SpawnRegions on the server.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>For every object it comes across, the iterator will call onIterateSpawnRegions( SpawnRegionObject ) in the calling script.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var count = IterateOverSpawnRegions();
|
|
..
|
|
function onIterateSpawnRegions( toCheck )
|
|
{
|
|
Console.Print( "Spawn Region Number: " + toCheck.regionNum + "\n" );
|
|
Console.Print( "Spawn Region Name: " + toCheck.name + "\n" );
|
|
Console.Print( "Spawn Region World: " + toCheck.world + "\n" );
|
|
return true;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_SpawnRegion_SetSpawnRegionFacetStatus"/>
|
|
<label for="spoiler_function_SpawnRegion_SetSpawnRegionFacetStatus">SetSpawnRegionFacetStatus <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetSpawnRegionFacetStatus( spawnRegionFacetStatus );</em></p>
|
|
<p><em>void SetSpawnRegionFacetStatus( facetNum, newSpawnRegionStatus );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sets enabled state of spawn regions in a given facet (2 arguments) - or across all facets (1 argument)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The single-argument spawnRegionFacetStatus should be a bitmask with combined settings for which facets Spawn Regions should be enabled for:
|
|
<ul>
|
|
<li>0 = No facets enabled (default)</li>
|
|
<li>1 = Felucca</li>
|
|
<li>2 = Trammel</li>
|
|
<li>4 = Ilshenar</li>
|
|
<li>8 = Malas</li>
|
|
<li>16 = Tokuno</li>
|
|
<li>32 = Ter Mur</li>
|
|
</ul></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Enable Spawn Regions for Felucca specifically
|
|
SetSpawnRegionFacetStatus( 1, true );
|
|
|
|
// Enable Spawn Regions in Felucca, Ilshenar and Malas at the same time
|
|
SetSpawnRegionFacetStatus( 13 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsTime" id="functionsTime"><span>Time Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_GetCurrentClock"/>
|
|
<label for="spoiler_function_time_GetCurrentClock">GetCurrentClock <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetCurrentClock();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a timestamp for current time <em>since server startup</em>. Starts from 0 on every server startup.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iTime = GetCurrentClock();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_GetDay"/>
|
|
<label for="spoiler_function_time_GetDay">GetDay <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetDay();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the day number of the server (UO days since server start)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iDay = GetDay();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_GetHour"/>
|
|
<label for="spoiler_function_time_GetHour">GetHour <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetHour();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the hour of the current UO day</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iHour = GetHour();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_GetMinute"/>
|
|
<label for="spoiler_function_time_GetMinute">GetMinute <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetMinute();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the minute of the current UO day</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMin = GetMinute();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_GetStartTime"/>
|
|
<label for="spoiler_function_time_GetStartTime">GetStartTime <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetStartTime();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a timestamp from when server was initially started up</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var startupTime = GetStartTime();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_time_SecondsPerUOMinute"/>
|
|
<label for="spoiler_function_time_SecondsPerUOMinute">SecondsPerUOMinute <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int SecondsPerUOMinute();</em></p>
|
|
<p><em>void SecondsPerUOMinute( newNumSecs );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets and sets the amount of real life seconds associated with a minute in the game</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iNumSecs = SecondsPerUOMinute();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#functionsTown" id="functionsTown"><span>Town Functions</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_town_GetTownRegion"/>
|
|
<label for="spoiler_function_town_GetTownRegion">GetTownRegion <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>REGION GetTownRegion( regionID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a Region JS Object reference for specified region ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to a region (region ID from regions.dfn)
|
|
var townRegion = GetTownRegion( regionID );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_function_town_PossessTown"/>
|
|
<label for="spoiler_function_town_PossessTown">PossessTown <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PossessTown( targetTown, sourceTown );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Source town takes control over target town</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>???</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to source Town Region
|
|
var sourceTownRegion = GetTownRegion( sourceRegionID );
|
|
|
|
// Fetch reference to target Town Region
|
|
var targetTownRegion = GetTownRegion( targetRegionID );
|
|
|
|
// Have sourceTownRegion possess targetTownRegion
|
|
PossessTown( targetTownRegion, sourceTownRegion );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
</ul> <!-- cd-faq__group -->
|
|
|
|
<ul id="methods" class="cd-faq__group">
|
|
<li id="methodsHeader" class="cd-faq__title title-jsdoc"><h1>JS Object Methods</h1><div id="filterInputMethods" contenteditable="true" placeholder="(Filter)" style="float:right; margin-top: -40px; margin-right: 10px; background-color: #fff; padding: 5px; width: 200px"></div></li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsBaseObject" id="methodsBaseObject"><span>BaseObject Methods (Characters/Items)</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_AddScriptTrigger"/>
|
|
<label for="spoiler_method_baseObj_AddScriptTrigger">AddScriptTrigger <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddScriptTrigger( scriptID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a scriptTrigger to an object's list of scriptTriggers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myObject.AddScriptTrigger( 8000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_applySection"/>
|
|
<label for="spoiler_method_baseObj_applySection">ApplySection <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ApplySection( scriptSection )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Applies a DFN section to an item/character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">object.ApplySection( "orcishlord" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_delete"/>
|
|
<label for="spoiler_method_baseObj_delete">Delete <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Delete()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes the object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myObject.Delete();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_distanceTo"/>
|
|
<label for="spoiler_method_baseObj_distanceTo">DistanceTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int DistanceTo( object )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the distance between two objects</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">objectOne.DistanceTo( objectTwo );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_finishedItems"/>
|
|
<label for="spoiler_method_baseObj_finishedItems">FinishedItems <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool FinishedItems()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if there are no more items left to look through in the container, character or multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">See FirstItem Method!</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_firstItem"/>
|
|
<label for="spoiler_method_baseObj_firstItem">FirstItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void FirstItem()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a handle to the first item in the container, character or multi. If it's null, then there are no items.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Looping through all items equipped on character
|
|
// (including backpack, bankbox, hair, etc) upon clicking an item with script attached
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var mItem;
|
|
for( mItem = pUser.FirstItem(); !pUser.FinishedItems(); mItem = pUser.NextItem() )
|
|
{
|
|
if( ValidateObject( mItem ))
|
|
{
|
|
pUser.SysMessage( "Item found on my character: " + mItem.name + " (" + mItem.id + ")" );
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre>
|
|
|
|
<pre><code class="language-javascript">// Looping through all items in character's backpack upon clicking an item with script attached
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var mItem;
|
|
for( mItem = pUser.pack.FirstItem(); !pUser.pack.FinishedItems(); mItem = pUser.pack.NextItem() )
|
|
{
|
|
if( ValidateObject( mItem ))
|
|
{
|
|
pUser.SysMessage( "Item found in my backpack: " + mItem.name + " (" + mItem.id + ")" );
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre>
|
|
|
|
<pre><code class="language-javascript">// Looping through all items in a container upon using a container with script attached
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var mItem;
|
|
for( mItem = iUsed.FirstItem(); !iUsed.FinishedItems(); mItem = iUsed.NextItem() )
|
|
{
|
|
if( ValidateObject( mItem ))
|
|
{
|
|
pUser.SysMessage( "Item found in container: " + mItem.name + " (" + mItem.id + ")" );
|
|
}
|
|
}
|
|
return false;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_GetJSTimer"/>
|
|
<label for="spoiler_method_baseObj_GetJSTimer">GetJSTimer/SetJSTimer/KillJSTimer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetJSTimer( timerID, scriptID );</em></p>
|
|
<p><em>bool SetJSTimer( timerID, timeInMilliseconds, scriptID );</em></p>
|
|
<p><em>bool KillJSTimer( timerID, scriptID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets or sets expiry timestamp for JS timer with specified timerID associated with specified scriptID, or kills timer completely</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>
|
|
<ul>
|
|
<li>If GetJSTimer method returns 0, no JS timer with specified ID/script association was found on the object. Otherwise, it returns a timestamp for when timer will expire.</li>
|
|
<li>If SetJSTimer/KillJSTimer methods return 0, no JS timer with specified ID/script association was found on the object. Otherwise, it returns 1 to indicate that timer was successfully updated/killed.</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// (GetJSTimer) Fetches expiry timestamp for timer (ID 0) associated with a script (ID 4500, doors.js) on an object (an open door, in this example)
|
|
var expiryTimestamp = myDoor.GetJSTimer( 0, 4500 );
|
|
var currentTimestamp = GetCurrentClock();
|
|
pSock.SysMessage( "Timer expires in " + ((expiryTime - currentTime)/1000).toString() + " seconds." );
|
|
|
|
// (SetJSTimer) Sets expiry time (15 seconds from now) for an active timer (ID 0) associated with a script (ID 4500, doors.js) on object (an open door, in this example)
|
|
myDoor.SetJSTimer( 0, 15000, 4500 );
|
|
|
|
// (KillJSTimer) Kills a specific timer (ID 0) associated with a script (ID 4500, doors.js) on an object (an open door, in this example)
|
|
myDoor.KillJSTimer( 0, 4500 );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_getNumTags"/>
|
|
<label for="spoiler_method_baseObj_getNumTags">GetNumTags <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetNumTags()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the number of Tags assigned to an Object.<br><br></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.SysMessage( "Number of Tags on targeted object: " + myTarget.GetNumTags() );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_getSerial"/>
|
|
<label for="spoiler_method_baseObj_getSerial">GetSerial <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSerial( part )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets part (1-4) of an object's serial. An alternative is to use .serial object property instead, which fetches whole serial of object instead of just one part.<br><br></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iSerialPart1 = myItem.GetSerial( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_getTagSetTag"/>
|
|
<label for="spoiler_method_baseObj_getTagSetTag">GetTag/SetTag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>boolean/int/string GetTag( "TagName" );</em></p>
|
|
<p><em>void SetTag( "TagName", value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets/Sets a persistent value (boolean/int/string) for the tag with name "TagName" on Object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The tags you store on Objects are persistent, which means they're stored in the worldsave.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Store the value 42 in a tag called "myTag" on myObject
|
|
myObject.SetTag( "myTag", 42 );
|
|
|
|
// Spit out a system message with the value of "myTag" tag on myObject
|
|
pUser.SysMessage( "Value of persistent tag myTag on object: " + myObject.GetTag( "myTag" ));</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_GetTempEffect"/>
|
|
<label for="spoiler_method_baseObj_GetTempEffect">GetTempEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetTempEffect( tempEffectID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns timestamp for when temp effect with specified ID expires, or 0 if it doesn't exist/has already expired</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch timestamp for when paralysis temp effect expires
|
|
var expireTime = myChar.GetTempEffect( 1 );
|
|
if( expireTime > 0 )
|
|
{
|
|
myChar.TextMessage( "Paralysis expires in " + ( expireTime - GetCurrentClock() ) + " seconds!" );
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_GetTempTagSetTempTag"/>
|
|
<label for="spoiler_method_baseObj_GetTempTagSetTempTag">GetTempTag/SetTempTag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>boolean/int/string GetTempTag( "TagName" );</em></p>
|
|
<p><em>void SetTempTag( "TagName", value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets/Sets a temporary value (boolean/int/string) for the tag with name "TagName" on Object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Temporary tags are not persistent, and will not be stored in worldsaves. Good for tags that don't need to last past a server restart!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Store the value 42 in a temporary tag called "myTag" on myObject
|
|
myObject.SetTempTag( "myTag", 42 );
|
|
|
|
// Spit out a system message with the value of "myTag" tag on myObject
|
|
pUser.SysMessage( "Value of temporary tag myTag on object: " + myObject.GetTempTag( "myTag" ));</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_HasScriptTrigger"/>
|
|
<label for="spoiler_method_baseObj_HasScriptTrigger">HasScriptTrigger <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void HasScriptTrigger( scriptID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if object has script with specified ID attached</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// hasScript is true if script 8000 is present on object
|
|
var hasScript = myObject.HasScriptTrigger( 8000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseobj_hasSpell"/>
|
|
<label for="spoiler_method_baseobj_hasSpell">HasSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool HasSpell( spellNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>If used with a character, scans through player's backpack and looks for spell with ID spellNum in first spellbook found. If used with an item (such as a spellbook), looks for spell with ID spellNum in item.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if player (pUser) has spell with ID 3
|
|
if( pUser.HasSpell( 3 ))
|
|
{
|
|
// Do something here...
|
|
}
|
|
|
|
// Check if a spellbook item (iUsed) has spell with ID 7
|
|
if( iUsed.HasSpell( 7 ))
|
|
{
|
|
// Do something here...
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_inRange"/>
|
|
<label for="spoiler_method_baseObj_inRange">InRange <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool InRange( trgObj, distance )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the distance to trgObj is less than distance</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( myItem.InRange( trgObj, 18 ))
|
|
{
|
|
myItem.TextMessage( "trgObj is within range; it's closer than 18 tiles!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_KillTimers"/>
|
|
<label for="spoiler_method_baseObj_KillTimers">KillTimers <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool Killtimers( [timerID] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>If no timerID is specified, kills all JS timers on the object. If timerID is specified, kills only specified JS timer on object <strong>regardless of script</strong>(!)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Kills all JS timers on myObject
|
|
myObject.KillTimers();
|
|
|
|
// Kills JS timer(s) with ID 1 on myObject
|
|
myObject.KillTimers( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_nextItem"/>
|
|
<label for="spoiler_method_baseObj_nextItem">NextItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void NextItem()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the next item found in the container, character or multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">See FirstItem Method!</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_pauseresumeJsTimer"/>
|
|
<label for="spoiler_method_baseObj_pauseresumeJsTimer">PauseJSTimer/ResumeJSTimer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PauseJSTimer( timerID, scriptID )</em></p>
|
|
<p><em>void ResumeJSTimer( timerID, scriptID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Pauses or resumes JS Timer on character/item based on provided timerID and scriptID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.StartTimer( 5000, 1, [scriptID] );
|
|
myChar.PauseJSTimer( 1, [scriptID] );
|
|
myChar.ResumeJSTimer( 1, [scriptID] );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_pauseresumeTempEffect"/>
|
|
<label for="spoiler_method_baseObj_pauseresumeTempEffect">PauseTempEffect/ResumeTempEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PauseTempEffect( tempEffectID )</em></p>
|
|
<p><em>void ResumeTempEffect( tempEffectID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Pauses or resumes Temp Effect on character/item based on provided tempEffectID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.PauseTempEffect( 1 ); // Pause paralysis effect. Character remains paralysed
|
|
myChar.ResumeTempEffect( 1 ); // Paralysis effect timer continues where it left off</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_Refresh"/>
|
|
<label for="spoiler_method_baseObj_Refresh">Refresh <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Refresh( [socket] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the Character/Item to be refreshed for nearby sockets in range to see it. If a specific socket is specified, object will be refreshed only for that socket.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Refreshes myObj by sending it to all nearby sockets
|
|
myObj.Refresh();
|
|
|
|
// Refreshes myObj for a specific socket/player only
|
|
myObj.Refresh( mySocket );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_RemoveScriptTrigger"/>
|
|
<label for="spoiler_method_baseObj_RemoveScriptTrigger">RemoveScriptTrigger <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveScriptTrigger( scriptID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes a scriptTrigger from an object's list of scriptTriggers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myObject.RemoveScriptTrigger( 8000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_RemoveSpell"/>
|
|
<label for="spoiler_method_baseObj_RemoveSpell">RemoveSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveSpell( spellNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes spellNum from spellbook (if method is run on a spellbook Item), or from first spellbook found in player's backpack (if run on a Character)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Remove spellNum from first spellbook found in myChar's inventory
|
|
myChar.RemoveSpell( 0 );
|
|
|
|
// Remove spellNum from a specific spellbook Item
|
|
spellbookItem.RemoveSpell( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_ResourceCount"/>
|
|
<label for="spoiler_method_baseObj_ResourceCount">ResourceCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ResourceCount( realItemID );</em></p>
|
|
<p><em>int ResourceCount( realItemID, colour );</em></p>
|
|
<p><em>int ResourceCount( realItemID, colour, moreVal );</em></p>
|
|
<p><em>int ResourceCount( realItemID, colour, moreVal, sectionID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the amount of items with specified ID realItemID, colour (optional) and MORE value (optional), SectionID (optional) from character's or Items packs</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>A colour value of -1 will make UOX3 count ANY item of the specified realItemID regardless of colour. If moreVal is specified, UOX3 will only count items with a matching MORE value.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">
|
|
// Count all items in character's or item's packs with specified ID (0x1bf2) and colour (0)
|
|
var iCount = myChar.ResourceCount( 0x1bf2, 0 );
|
|
|
|
// Count all items in character's or item's packs with specified ID (0x1bf2), of ANY colour
|
|
var iCount = myChar.ResourceCount( 0x1bf2, -1 );
|
|
|
|
// Count all items in character's or item's packs with specified ID (0x1bf2), colour (0x0482) and MORE value (1)
|
|
var iCount = myChar.ResourceCount( 0x1bf2, 0x0482, 1 );
|
|
|
|
// Count all items in character's or item's packs with specified ID (0x1bf2), colour (0x0482) and MORE value (1) and sectionID ("0x1bf2")
|
|
var iCount = myChar.ResourceCount( 0x1bf2, 0x0482, 1, "0x1bf2");
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_Resist"/>
|
|
<label for="spoiler_method_baseObj_Resist">Resist <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Resist( type );</em></p>
|
|
<p><em>void Resist( type, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets and sets the resistance values of a char or item.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Available item types:
|
|
<ul>
|
|
<li>1 - Armor</li>
|
|
<li>2 - Light</li>
|
|
<li>3 - Water</li>
|
|
<li>4 - Cold</li>
|
|
<li>5 - Heat</li>
|
|
<li>6 - Energy</li>
|
|
<li>7 - Poison</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Set the Armor value of an item to 25:
|
|
mItem.Resist( 1, 25 );
|
|
|
|
// Get the armor value of an item:
|
|
value = mItem.Resist( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_ReverseTempEffect"/>
|
|
<label for="spoiler_method_baseObj_ReverseTempEffect">ReverseTempEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ReverseTempEffect( tempEffectID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Force revert a temp effect on item or character based on specified temp effect ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Force revert paralysis effect on character
|
|
var expireTime = myChar.GetTempEffect( 1 );
|
|
if( expireTime > 0 )
|
|
{
|
|
myChar.ReverseEffect( 1 );
|
|
myChar.TextMessage( "I'm free!" );
|
|
}
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_SetLocation"/>
|
|
<label for="spoiler_method_baseObj_SetLocation">SetLocation <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p>Alias of <span class="hl">Teleport</span> Method</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_SoundEffect"/>
|
|
<label for="spoiler_method_baseObj_SoundEffect">SoundEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SoundEffect( soundID, bAllHear[, creatureSoundNum] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays a sound originating from Character or Item. Can optionally play monster sounds associated with Character.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<ul>
|
|
<li>SoundID is the ID of the sound to play. If bAllHear is true, then everyone nearby hears it. If it's false, then only the Character hears it.</li>
|
|
<li>Beware that if you use sound IDs from UOFiddler, the sound IDs you see there are offset by +1 from what the client will play when you use those sound IDs. Subtract -1 from the sound ID when using it with UOX3 to get the correct sound!</li>
|
|
<li>If the optional parameter creatureSoundNum is included, and the object is a Character, UOX3 will look up the associated creature sound from creatures.dfn (0=SOUND_STARTATTACK, 1=SOUND_IDLE, 2=SOUND_ATTACK, 3=SOUND_DEFEND, 4=SOUND_DIE) for the character and play that instead of soundID</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Play sound effect originating from myChar, which only myChar can hear
|
|
myChar.SoundEffect( 568, false );
|
|
|
|
// Play sound effect originating from myItem, which all other nearby characters can also hear
|
|
myItem.SoundEffect( 568, true );
|
|
|
|
// Play SOUND_DIE sound from creatures.dfn for a character
|
|
myChar.SoundEffect( 0, true, 4 );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_StartTimer"/>
|
|
<label for="spoiler_method_baseObj_StartTimer">StartTimer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void StartTimer( numMiliSec, timerID, callback );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Starts a timer on Character/Item that will elapse after numMiliSec milliseconds pass.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p> timerID must be between 0 and 100. Resulting onTimer event will be triggered. Which script it triggers in depends on the (optional, defaults to false) third parameter, which can be true (calls back to existing script), false (calls back into object's script) or an int (scriptID to call back to). See also: <strong><em>onTimer event</em></strong> and <strong><em>KillTimers()</em></strong> BaseObject method.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Timer calls back to myObj's script. myObj can be a Char or an Item
|
|
myObj.StartTimer( 600, 0, true );
|
|
|
|
// Timer calls back to current script
|
|
myObj.StartTimer( 1200, 0, false );
|
|
|
|
// Timer calls back to script with ID 2012
|
|
myObj.StartTimer( 1200, 0, 2012 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_StaticEffect"/>
|
|
<label for="spoiler_method_baseObj_StaticEffect">StaticEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void StaticEffect( effectID, speed, loop );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays a static effect on Character/Item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myObj.StaticEffect( 0x376A, 9, 6 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_Teleport"/>
|
|
<label for="spoiler_method_baseObj_Teleport">Teleport <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Teleport();</em></p>
|
|
<p><em>void Teleport( object );</em></p>
|
|
<p><em>void Teleport( location );</em></p>
|
|
<p><em>void Teleport( x, y );</em></p>
|
|
<p><em>void Teleport( x, y, z );</em></p>
|
|
<p><em>void Teleport( x, y, z, world );</em></p>
|
|
<p><em>void Teleport( x, y, z, world, instanceID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Teleports Character/Item to specified location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no parameter is provided, object is teleported to their current location and resent to all nearby players. location parameter refers to a location ID from dfndata/location/location.dfn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Teleports object to Moonglow
|
|
myObj.Teleport( 4467, 1284, 5 );
|
|
|
|
// Teleports object to Lord British Castle Entrance location
|
|
myObj.Teleport( 21 );
|
|
|
|
// Teleports object to the location of an item iUsed
|
|
myObj.Teleport( iUsed );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_TextMessage"/>
|
|
<label for="spoiler_method_baseObj_TextMessage">TextMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TextMessage( message );</em></p>
|
|
<p><em>void TextMessage( message, allHear, txtHue )</em></p>
|
|
<p><em>void TextMessage( message, allHear, txtHue, speechTarget, speechTargetSerial, speechFontType );</em></p>
|
|
<p><em>void TextMessage( message, allHear, txtHue, speechTarget, speechTargetSerial, speechFontType, speechType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends a TextMessage for the Character/Item, which is displayed as speech, either to Character only or all nearby characters - depending on parameters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The function has 5 extra optional arguments (if including an optional parameter, make sure to also include the preceding argument):</p>
|
|
<ul>
|
|
<li>allHear (broadcast true/false)</li>
|
|
<li>txtHue (colour of the text sent to the client)</li>
|
|
<li>speechTarget (intended target of message. 0 = only visible to sender and receiver, 1 = visible to all players in range, 2 = visible to all NPCs and players in range, 3 = visible to all PCs everywhere + NPCs in range, 4 = visible to all PCs everywhere (broadcast), 5 = only visible to receiver)</li>
|
|
<li>speechTargetSerial (serial of the receiver of the message, used if speechTarget is 0 or 5)</li>
|
|
<li>speechFontType (type of font to use. Defaults to normal. 0 = bold, 1 = normal with shadow, 2 = bold with shadow, 3 = normal, 4 = gothic, 5 = italic, 6 = small and dark, 7 = colourful, 8 = runic (only works with CAPS), 9 = small and light)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myObj.TextMessage( "Hello world!" );
|
|
myChar.TextMessage( "Public, ice-coloured message sent to everyone as if I said it.", true, 0x0480 );
|
|
myChar.TextMessage( "Private, ice-coloured message just for me!", false, 0x0480 );
|
|
myItem.TextMessage( "This is a private message from an item to a character!", false, 0, 0, myChar.serial );
|
|
myItem.TextMessage( "THIS IS A MESSAGE IN RUNIC LETTERS VISIBLE TO ALL", true, 0, 3, null, 8 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_UseResource"/>
|
|
<label for="spoiler_method_baseObj_UseResource">UseResource <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int UseResource( amount, itemID );</em></p>
|
|
<p><em>int UseResource( amount, itemID, colour );</em></p>
|
|
<p><em>int UseResource( amount, itemID, colour, moreVal );</em></p>
|
|
<p><em>int UseResource( amount, itemID, colour, moreVal, sectionID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes amount of items with specified itemID, colour (optional) and MORE value (optional) from character's or items Packs, and returns amount deleted</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If an item of the specified resource is found with .usesLeft property higher than 1, the appropriate amount of uses is extracted from said item before eventually deleting the resource item itself.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">
|
|
// Use resource of specific ID, with specific color (0)
|
|
myChar.UseResource( 5, 0x1bf2, 0 );
|
|
|
|
// Use resource of specific ID, and colour
|
|
myChar.UseResource( 5, 0x1bf2, 0x0482 );
|
|
|
|
// Use resource of specific ID, colour and MORE value
|
|
myChar.UseResource( 5, 0x1bf2, 0x0482, 1 );
|
|
|
|
// Use resource of specific ID, colour and MORE value and sectionID
|
|
myChar.UseResource( 5, 0x1bf2, 0x0482, 1, "0x1bf2" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_baseObj_UpdateStats"/>
|
|
<label for="spoiler_method_baseObj_UpdateStats">UpdateStats <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void UpdateStats( statType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends update to client with specified stat (health, mana or stamina) for object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>
|
|
Can be used with any character, as well as with items/multis with damageable flag enabled. Supported stat types:
|
|
<ul>
|
|
<li>0 - Health (Characters and Items</li>
|
|
<li>1 - Mana (Characters only)</li>
|
|
<li>2 - Stamina (Characters only)</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Update health stat for character or damageable object
|
|
myObj.UpdateStats( 0 );
|
|
|
|
// Update mana stat for character
|
|
myChar.UpdateStats( 1 );
|
|
|
|
// Update stamina stat for character
|
|
myChar.UpdateStats( 2 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsCharacter" id="methodsCharacter"><span>Character Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_AddAggressorFlag"/>
|
|
<label for="spoiler_method_char_AddAggressorFlag">AddAggressorFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddAggressorFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds aggressor flag for character towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.AddAggressorFlag( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_AddFriend"/>
|
|
<label for="spoiler_method_char_AddFriend">AddFriend <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddFriend( pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a player to an NPC pet/follower's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myPet.AddFriend( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_AddPermaGreyFlag"/>
|
|
<label for="spoiler_method_char_AddPermaGreyFlag">AddPermaGreyFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPermaGreyFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds permagrey flag for character towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.AddPermaGreyFlag( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_addSkill"/>
|
|
<label for="spoiler_method_char_addSkill">AddSkill <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddSkill( skillID, skillAmt, triggerEvents [true/false] )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Grant skill points to a character without triggering skillchange JS events. Useful if adding skill points from within a skillchange event, to avoid infinite loops!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.AddSkill( 0, 10, false ); // Adds 1.0 skillpoints to skill with ID 0 (Alchemy) without triggering skill change JS events</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_addSpell"/>
|
|
<label for="spoiler_method_char_addSpell">AddSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddSpell( spellNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds specified spell to the first spellbook in character's pack</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.AddSpell( 3 ); //adds Feeblemind spell to myChar's spellbook (if he has one)</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_boltEffect"/>
|
|
<label for="spoiler_method_char_boltEffect">BoltEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BoltEffect()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays the lightning bolt effect on specified character to all nearby players</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.BoltEffect();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_breakConcentration"/>
|
|
<label for="spoiler_method_char_breakConcentration">BreakConcentration <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BreakConcentration()<br>
|
|
void BreakConcentration( socket )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Break a caster's concentration</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.BreakConcentration(); //for NPCs, who have no sockets
|
|
myPlayer.BreakConcentration( mSocket ); //for players, who DO have sockets</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_buyFrom"/>
|
|
<label for="spoiler_method_char_buyFrom">BuyFrom <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BuyFrom( targNPC )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Brings up targNPC's shopkeeper gump or player vendor backpack for buying</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.BuyFrom( myNPC );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_CalculateControlChance"/>
|
|
<label for="spoiler_method_char_CalculateControlChance">CalculateControlChance <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int CalculateControlChance( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns chance (in values ranging from 0 to 1000) of pChar (player) successfully controlling a pet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var controlChance = myPet.CalculateControlChance( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_canSee"/>
|
|
<label for="spoiler_method_char_canSee">CanSee <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CanSee( object );<br>
|
|
bool CanSee( x, y, z );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>LineOfSight-checking; check if character/socket can see a specified object/target location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !myChar.CanSee( targetChar ))
|
|
return;
|
|
|
|
if( myChar.CanSee( targetChar.x, targetChar.y, targetChar.z )
|
|
{
|
|
// ...Do stuff here
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_castSpell"/>
|
|
<label for="spoiler_method_char_castSpell">CastSpell <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CastSpell( spellNum [, directCast])</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes character to cast spellNum. Character can be an NPC or PC, and spellNum can be any valid spell number from 0 to 65. The optional boolean parameter directCast can be used to make the character automatically cast the spell at their current target (if spell is targeted)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Player casts recall spell
|
|
pUser.CastSpell( 32 );
|
|
|
|
// NPC casts lightning bolt at their current target
|
|
myNPC.CastSpell( 30, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_CheckAggressorFlag"/>
|
|
<label for="spoiler_method_char_CheckAggressorFlag">CheckAggressorFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CheckAggressorFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if character has an aggressor flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( pUser.CheckAggressorFlag( otherChar ))
|
|
{
|
|
// ... do something
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_CheckPermaGreyFlag"/>
|
|
<label for="spoiler_method_char_CheckPermaGreyFlag">CheckPermaGreyFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CheckPermaGreyFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if character has an active permagrey flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( pUser.CheckPermaGreyFlag( otherChar ))
|
|
{
|
|
// ... do something
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_checkSkill"/>
|
|
<label for="spoiler_method_char_checkSkill">CheckSkill <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CheckSkill( skillNum, minSkill, maxSkill )</em></p>
|
|
<p><em>bool CheckSkill( skillNum, minSkill, maxSkill, isCraftSkill )</em></p>
|
|
<p><em>bool CheckSkill( skillNum, minSkill, maxSkill, isCraftSkill, forceResult )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the result of a skillcheck for skill skillNum is between minSkill and maxSkill</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If the optional parameter isCraftSkill is set to true, UOX3 uses an alternate skill check formula that provides a minimum 50% chance of success if player at least meets minimum requirements for crafting an item. If the optional parameter forceResult is set to -1, the skillcheck result is forced to failure, 0 does nothing, and 1 forces a success.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// If result of skill check for myChar's skill #1 (alchemy) is between 20.0 and 100.0
|
|
if( myChar.CheckSkill( 1, 200, 1000 ))
|
|
{
|
|
...
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_ClearAggressorFlags"/>
|
|
<label for="spoiler_method_char_ClearAggressorFlags">ClearAggressorFlags <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ClearAggressorFlags()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all the character's aggressor flags towards other characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.ClearAggressorFlags();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_ClearPermaGreyFlags"/>
|
|
<label for="spoiler_method_char_ClearPermaGreyFlags">ClearPermaGreyFlags <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ClearPermaGreyFlags()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all the character's aggressor flags towards other characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.ClearPermaGreyFlags();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_ClearFriendList"/>
|
|
<label for="spoiler_method_char_ClearFriendList">ClearFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ClearFriendList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears an NPC pet/follower's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myPet.ClearFriendList();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_customTarget"/>
|
|
<label for="spoiler_method_char_customTarget">CustomTarget <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CustomTarget( targetNum, toSay )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Very similar to PopUpTarget. It's a callback situation instead. targetNum must be between 0 and 255. Character says toSay, and is shown a cursor. Re-enters the script associated with the socket's player (i.e. player who gets the cursor). Enters function name based on the value of tNum. if tNum is 0, then the function would be onCallback0. Prototype of callback is:<br>
|
|
function onCallback0( pSock, myTarget )</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// User double-clicks an item, which brings up a custom target cursor
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
pUser.CustomTarget( 0, "Select your custom target:" );
|
|
}
|
|
|
|
// After player targets something, onCallback0 is called
|
|
function onCallback0( pSock, myTarget )
|
|
{
|
|
// ... do something with target here
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_damage"/>
|
|
<label for="spoiler_method_char_damage">Damage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Damage( amount )<br>
|
|
void Damage( amount, damageType )<br>
|
|
void Damage( amount, damageType, attacker )<br>
|
|
void Damage( amount, damageType, attacker, doRepSys )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Cause damage to a character.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>damageType represents the type of damage done (1 = Physical, 2 = Light, 3 = Rain, 4 = Cold, 5 = Heat, 6 = Lightning/Energy, 7 = Poison, 8 = Snow). doRepSys true/false defines whether a criminal check should be done for attacker</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Deal 15 damage to myChar (defaults to Physical damage)
|
|
myChar.Damage( 15 );
|
|
|
|
// Deal 15 Heat/Fire damage to myChar, with attackerChar as source
|
|
myChar.Damage( 15, 5, attackerChar );
|
|
|
|
// Deal 15 Lightning damage to myChar, with attackerChar as source, and flag set to do rep check for criminal flag
|
|
myChar.Damage( 15, 6, attackerChar, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_defense"/>
|
|
<label for="spoiler_method_char_defense">Defense <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Defense( hitLoc, damageType, doArmorDamage[, ignoreMedable, includeShield] )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the defense value against damageType of the armor item at the location hitLoc and does armor damage if needed, and can also exclude medable armor (optional) and include shield defense value (optional)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p><strong>hit locations</strong>:0 = whole char, 1 = body, 2 = arms, 3 = head, 4 = legs, 5 = neck, 6 = the rest<br>
|
|
<strong>damage types</strong>: 0 = None, 1 = Physical, 2 = Light, 3 = Rain, 4 = Cold, 5 = Heat, 6 = Lightning, 7 = Poison, 8 = Snow, 9 = Storm</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get the defense value of the head armor against Physical damage and damage the armor:
|
|
value = mChar.Defense( 3, 1, true);
|
|
|
|
// Get the total physical defense value for character, excluding medable armor, including shield
|
|
value = mChar.Defense( 0, 1, false, false, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_directionTo"/>
|
|
<label for="spoiler_method_char_directionTo">DirectionTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int DirectionTo( trgObj )<br>
|
|
int DirectionTo( x, y );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the direction (0 = North, 1 = North-East, 2 = East, 3 = South-East, 4 = South, 5 = South-West, 6 = West, 7 = North-West) from character to trgObj/location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var dir = myChar.DirectionTo( trgChar );
|
|
var dir = myChar.DirectionTo( trgChar.x, trgChar.y );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_dismount"/>
|
|
<label for="spoiler_method_char_dismount">Dismount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Dismount()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Dismounts character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Dismount()</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_doAction"/>
|
|
<label for="spoiler_method_char_doAction">DoAction <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DoAction( trgAction subAction )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Makes character play the action trgAction. If subAction is specified, will play action using the "new" animation packet 0xE2, which supports subActions. This is also required for any gargoyle-specific animations.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p><strong>Pre-v7.0.0.0:</strong><br>
|
|
Human/Elf actions range from 0x01 to 0x22.<br>
|
|
Animals have animations in 0x00 to 0x0c range.<br>
|
|
Monsters have animations in 0x00 to 0x15 range, though not all monsters support all these animations.</p>
|
|
<p><strong>v7.0.0.0+:</strong><br>
|
|
All character actions range from 0x00 to 0x0f, with some animations registered as sub-actions</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.DoAction( 0x0B );
|
|
// or a gargoyle action & subAction
|
|
myChar.DoAction( 0x00, 0x03 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Dupe"/>
|
|
<label for="spoiler_method_char_Dupe">Dupe <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER Dupe();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Dupes specified character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Location of duped character must be manually set</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a duplicate of myChar
|
|
var dupedChar = myChar.Dupe();
|
|
|
|
// Teleport the duped character to the same location as myChar
|
|
dupedChar.Teleport( myChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_emoteMessage"/>
|
|
<label for="spoiler_method_char_emoteMessage">EmoteMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void EmoteMessage( message )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the Char to emote message. You have to put the start and end * manually in!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.EmoteMessage( "*looks around*" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_executeCommand"/>
|
|
<label for="spoiler_method_char_executeCommand">ExecuteCommand <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ExecuteCommand( cmdString )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Executes the command cmdString (should include any params)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.ExecuteCommand( "add 0x04a9" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_explodeItem"/>
|
|
<label for="spoiler_method_char_explodeItem">ExplodeItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ExplodeItem( myItem, damage, damageType, explodeNearby )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes specified item by exploding it, dealing damage to the character and potentially nearby characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Explode item and deal damage only to myChar
|
|
myChar.ExplodeItem( myItem, 25, 5, false );
|
|
|
|
// Explode item and deal damage to all characters within a radius of 2 tiles (hardcoded range)
|
|
myChar.ExplodeItem( myItem, 25, 5, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_findItemLayer"/>
|
|
<label for="spoiler_method_char_findItemLayer">FindItemLayer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>Item FindItemLayer( layer )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>A return value of -1 indicates there was no item at that particular layer. A common list of layers follow:</p>
|
|
<p>0x01 - Single-Hand item/weapon<br>
|
|
0x02 - Two-Hand item/weapon (including Shield)<br>
|
|
0x03 - Foot Covering/Armor<br>
|
|
0x04 - Leg Covering (including Pants, Shorts, Bone/Chain/Ring legs)<br>
|
|
0x05 - Chest Clothing/Female Chest Armor<br>
|
|
0x06 - Head Covering/Armor<br>
|
|
0x07 - Hand Covering/Armor<br>
|
|
0x08 - Ring<br>
|
|
0x09 - N/A (not used)<br>
|
|
0x0A - Neck Covering/Armor<br>
|
|
0x0B - Hair<br>
|
|
0x0C - Waist (Half-Apron)<br>
|
|
0x0D - Torso (inner)(Chest Armor)<br>
|
|
0x0E - Bracelet<br>
|
|
0x0F - N/A (no info)<br>
|
|
0x10 - Facial Hair<br>
|
|
0x11 - Torso (Middle)(Surcoat, Tunic, Full Apron, Sash)<br>
|
|
0x12 - Earrings<br>
|
|
0x13 - Arm Covering/Armor<br>
|
|
0x14 - Back (Cloak)<br>
|
|
0x15 - BackPack<br>
|
|
0x16 - Torso (outer)(Robe)<br>
|
|
0x17 - Legs (outer)(Skirt/Kilt)<br>
|
|
0x18 - Legs (inner)(Leg Armor)<br>
|
|
0x19 - Mount (Horse, Ostard, etc.)<br>
|
|
0x1A - NPC Buy Restock Container<br>
|
|
0x1B - NPC Buy No Restock Container<br>
|
|
0x1C - NPC Sell Container<br>
|
|
0x1D - Bank Box</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var leftHand = myChar.FindItemLayer( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_findItemSection"/>
|
|
<label for="spoiler_method_char_findItemSection">FindItemSection <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>Item FindItemSection( sectionID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Looks for item with specific sectionID in character's backpack</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var runebook = myPlayer.FindItemSection( "runebook" ); // does the player have a runebook?</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_findItemType"/>
|
|
<label for="spoiler_method_char_findItemType">FindItemType <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>Item FindItemType( itemType )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Look for items of a certain type in character's pack</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var spellBook = myPlayer.FindItemType( 9 ); //does the player have a spellbook?</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_follow"/>
|
|
<label for="spoiler_method_char_follow">Follow <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Follow( followTarget )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Forces NPC to follow specified target</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.Follow( followTarget );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_gate"/>
|
|
<label for="spoiler_method_char_gate">Gate <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Gate( item )<br>
|
|
void Gate( x, y, z, world )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens a gate to the location marked on an item, or to a specific set of coordinates</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Opens a gate to coordinates from a recall rune (targItem)
|
|
myChar.Gate( targItem );
|
|
|
|
// Opens a gate to Lord British's throne room
|
|
myChar.Gate( 1329, 1624, 50 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_GetFriendList"/>
|
|
<label for="spoiler_method_char_GetFriendList">GetFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>FRIENDLIST GetFriendList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets an NPC pet/follower's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get pet's friend list
|
|
var friendList = myPet.GetFriendList();
|
|
for( var i = 0; i < friendList.length; i++ )
|
|
{
|
|
if( ValidateObject( friendList[i] ))
|
|
{
|
|
myPet.TextMessage( friendList[i].name + " is my friend!" );
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_GetPetList"/>
|
|
<label for="spoiler_method_char_GetPetList">GetPetList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>PETLIST GetPetList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets list of character's pets/followers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get myChar's pet/follower list
|
|
var petList = myChar.GetPetList();
|
|
for( var i = 0; i < petList.length; i++ )
|
|
{
|
|
if( ValidateObject( petList[i] ))
|
|
{
|
|
myChar.TextMessage( petList[i].name + " is my pet and/or follower!" );
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_getTimerSetTimer"/>
|
|
<label for="spoiler_method_char_getTimerSetTimer">GetTimer/SetTimer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetTimer( timerID )</em></p>
|
|
<p><em>int SetTimer( timerID, numMilliSeconds )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get a timestamp for when timer will run out, or set the time in milliseconds until specified timer expires for a Character object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported timerIDs for Characters
|
|
<pre><code class="language-javascript">Timer.TIMEOUT // Time until next attack can be done in combat
|
|
Timer.INVIS // Time until invisible character becomes visible
|
|
Timer.HUNGER // Time until character grows more hungry
|
|
Timer.THIRST // Time until character grows more thirsty
|
|
Timer.POISONTIME // Time until next tick of poison damage
|
|
Timer.POISONTEXT // Time until next message about suffering from poison
|
|
Timer.POISONWEAROFF // Time until poison wears off
|
|
Timer.SPELLTIME // Time until spell cast is completed. Can be set to 0 to interrupt
|
|
Timer.SPELLRECOVERYTIME // Time until player has recovered from casting a spell
|
|
Timer.ANTISPAM // Time until next speech message can be sent (for anti spam purposes)
|
|
Timer.CRIMFLAG // Time until criminal flag runs out (should be set after criminal flag itself)
|
|
Timer.MURDERRATE // Time until next murder count decay
|
|
Timer.PEACETIMER // Time until character can re-enter combat after being affected by peacemaking
|
|
Timer.FLYINGTOGGLE // Time until next time flying ability can be toggled for gargoyles
|
|
Timer.FIREFIELDTICK // Time until next fire field tick
|
|
Timer.POISONFIELDTICK // Time until next poison field tick
|
|
Timer.PARAFIELDTICK // Time until next paralyze field tick
|
|
Timer.MOVETIME // Time until NPC can move again
|
|
Timer.SPATIMER // Time until next time NPC can cast a spell
|
|
Timer.SUMMONTIME // Time until a summoned NPC will vanish
|
|
Timer.EVADETIME // Time until an NPC will exit evade state
|
|
Timer.LOYALTYTIME // Time until next time pet loyalty drops
|
|
Timer.IDLEANIMTIME // Time until next time character plays idle animation
|
|
Timer.LOGOUT // Time it takes for a player char to vanish after logout
|
|
Timer.YOUNGHEAL // Time until next time Young player can be healed by NPC healer
|
|
Timer.YOUNGMESSAGE // Time until next time Young player is warned about dangerous looking monsters in overworld</code></pre></p>
|
|
<p>See also: GetTimer()/SetTimer() Socket Methods.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get a timestamp for when criminal flag expires, and spit out milliseconds left
|
|
var criminalTimestamp = myChar.GetTimer( Timer.CRIMFLAG );
|
|
myChar.TextMessage(( myTarget.GetTimer( Timer.CRIMFLAG ) - GetCurrentClock() ).toString() );
|
|
|
|
// Set time from now in milliseconds that criminal flag will last, after making character a criminal
|
|
myChar.criminal = true;
|
|
myChar.SetTimer( Timer.CRIMFLAG, 3000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_HasBeenOwner"/>
|
|
<label for="spoiler_method_char_HasBeenOwner">HasBeenOwner <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool HasBeenOwner( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns whether character pChar has previously owned the pet (is on pet's owner list)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get myChar's pet/follower list
|
|
if( myPet.HasBeenOwner( pChar ))
|
|
{
|
|
myPet.TextMessage( "Hey, you owned me earlier, I'll let you tame me easier this time around!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_heal"/>
|
|
<label for="spoiler_method_char_heal">Heal <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Heal( amount );
|
|
void Heal( amount, pHealer );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Heals a character for specified amount, with optional argument to provide character who healed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Heal( 15 );
|
|
myChar.Heal( 15, healerChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_InitiateCombat"/>
|
|
<label for="spoiler_method_char_InitiateCombat">InitiateCombat <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool InitiateCombat( targetChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Attempts to initiate combat with target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( myNPC.InitiateCombat( otherChar ))
|
|
{
|
|
myNPC.TextMessage( "Yes! I managed to initiate combat with " + otherChar.name + "!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_InvalidateAttacker"/>
|
|
<label for="spoiler_method_char_InvalidateAttacker">InvalidateAttacker <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void InvalidateAttacker();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Resets the attacker attack so that it cancels attack setup.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.InvalidateAttacker();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_initWanderArea"/>
|
|
<label for="spoiler_method_char_initWanderArea">InitWanderArea <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void InitWanderArea()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Initialize a WanderArea (10x10 box, or 10 radius circle) for the specified NPC. Will only work if their wander-mode is already set to box or circle.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.InitWanderArea();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_IsAggressor"/>
|
|
<label for="spoiler_method_char_IsAggressor">IsAggressor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void IsAggressor()</em></p>
|
|
<p><em>void IsAggressor( [bool]checkForPlayerOnly)</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true/false depending on whether character has any active aggressor flags</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If checkForPlayerOnly flag is true, any aggressor flags towards NPCs are ignored</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var isAggressor = pUser.IsAggressor();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_IsPermaGrey"/>
|
|
<label for="spoiler_method_char_IsPermaGrey">IsPermaGrey <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void IsPermaGrey( otherChar )</em></p>
|
|
<p><em>void IsPermaGrey( [bool]checkForPlayerOnly)</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true/false depending on whether character has any active permagrey flags</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If checkForPlayerOnly flag is true, any permagrey flags towards NPCs are ignored</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var isPermaGrey = pUser.IsPermaGrey();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_jail"/>
|
|
<label for="spoiler_method_char_jail">Jail <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Jail()<br>
|
|
void Jail( numSecsToJail )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Jails character for n seconds if specified. If no duration is specified, defaults to 24 hours.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Jail( 1000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_kill"/>
|
|
<label for="spoiler_method_char_kill">Kill <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Kill()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Kills the character. If onDeathBlow JS event is present for character's script, it triggers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Kill();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_magicEffect"/>
|
|
<label for="spoiler_method_char_magicEffect">MagicEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void MagicEffect( spellID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Applies spell effects of specified spell to character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.MagicEffect( 43 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_makeMenu"/>
|
|
<label for="spoiler_method_char_makeMenu">MakeMenu <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void MakeMenu( menu )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens up make menu menu and sends it to character's socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Can be used with a character
|
|
myChar.MakeMenu( 1 );
|
|
|
|
// Or with a socket
|
|
mySocket.MakeMenu( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_mark"/>
|
|
<label for="spoiler_method_char_mark">Mark <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Mark( item )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Marks an item with the characters current location to be used later for recall or gate</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Mark( targItem );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_openBank"/>
|
|
<label for="spoiler_method_char_openBank">OpenBank <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenBank( trgSock )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens character's bank, sending it to trgSock</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myPlayer.OpenBank( trgSock );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_openLayer"/>
|
|
<label for="spoiler_method_char_openLayer">OpenLayer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenLayer( socket, layerToOpen )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens the specified layer of the character for the specified socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.OpenLayer( socket, 0x15 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_popupTarget"/>
|
|
<label for="spoiler_method_char_popupTarget">PopupTarget <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PopUpTarget( tNum, toSay )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Provides a call to hard-coded targeting cursors.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>tNum must be between 0 and 255 inclusive. Says toSay, and shows a cursor. Note that some of these might depend on factors in code to actually work, and might not have much effect when ran through a script - or could grant access to functionality that a player would normally not have access to.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Can be used with a character object
|
|
myChar.PopUpTarget( 1, "Where do you wish to teleport to?" );</code></pre>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_popuptarget_list"/>
|
|
<label for="spoiler_popuptarget_list">List of Popup Target IDs <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p><span class="hl">1</span> - TELEPORT (teleports character to target location)<br>
|
|
<span class="hl">2</span> - DYE (will reset targeted item to default colour)<br>
|
|
<span class="hl">4</span> - REPAIRMETAL (Targeted metal item will be repaired. Checks Blacksmithing skill)<br>
|
|
<span class="hl">5</span> - DYEALL (used to give color to dyetubs)<br>
|
|
<span class="hl">6</span> - DVAT (Used for dying objects with the colour of the used dye tub)<br>
|
|
<span class="hl">9</span> - ITEMID (Select item to identify. Checks Item Identification skill)<br>
|
|
<span class="hl">10</span> - FISH (Select fishing location. Checks Fishing skill)<br>
|
|
<span class="hl">11</span> - INFO (Get info on targeted tile)<br>
|
|
<span class="hl">13</span> - SMITH (Blacksmithing skill usage via tools)<br>
|
|
<span class="hl">14</span> - MINE (Mining skill usage via tools)<br>
|
|
<span class="hl">15</span> - SMELTORE (Ore smelting targeting cursor)<br>
|
|
<span class="hl">16</span> - WSTATS (Show wander/movement details for targeted NPC)<br>
|
|
<span class="hl">17</span> - NPCRESURRECT (Used by NPC healers to resurrect dead players. In this context only works if target is identical to popuptarget user. Self-resurrection item?)<br>
|
|
<strong>(To be continued)</strong>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_reactOnDamage"/>
|
|
<label for="spoiler_method_char_reactOnDamage">ReactOnDamage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ReactOnDamage( damageType, attackerChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Lets a character react to damage by an attacker</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>In practical terms, this is what happens when a character reacts to damage:
|
|
<ul>
|
|
<li>attackerChar's attackFirst property is set to true</li>
|
|
<li>Character's attacker property is set to attackerChar</li>
|
|
<li>Character's attackFirst property is set to false</li>
|
|
<li>If character is an NPC, and was hidden upon taking damage, they're exposed to view</li>
|
|
<li>If character is an NPC, and was not already in combat mode, they enter combat mode with attackerChar as target</li>
|
|
<li>If character is a Player, their concentration is broken (i.e. any active Meditation effect is cancelled)</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.ReactOnDamage( 2, attackerChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Recall"/>
|
|
<label for="spoiler_method_char_Recall">Recall <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Recall( item )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Recalls character to the location marked on specified item (if any).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Recall( targItem );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Release"/>
|
|
<label for="spoiler_method_char_Release">Release <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Release()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Releases character from jail.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Release();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_RemoveAggressorFlag"/>
|
|
<label for="spoiler_method_char_RemoveAggressorFlag">RemoveAggressorFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveAggressorFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes character's aggressor flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.RemoveAggressorFlag( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_RemoveFriend"/>
|
|
<label for="spoiler_method_char_RemoveFriend">RemoveFriend <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveFriend( pChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes a player from an NPC pet/follower's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myPet.RemoveFriend( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_RemovePermaGreyFlag"/>
|
|
<label for="spoiler_method_char_RemovePermaGreyFlag">RemovePermaGreyFlag <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemovePermaGreyFlag( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes character's permagrey flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.RemovePermaGreyFlag( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Resist"/>
|
|
<label for="spoiler_method_char_Resist">Resist <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Resist( resistanceType );</em></p>
|
|
<p><em>void Resist( resistanceType, amount );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Used to get/set the resistance type and amount of a character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported resistanceTypes:<br>
|
|
<ul>
|
|
<li>1 - Armor</li>
|
|
<li>2 - Light</li>
|
|
<li>3 - Water</li>
|
|
<li>4 - Cold</li>
|
|
<li>5 - Heat</li>
|
|
<li>6 - Energy</li>
|
|
<li>7 - Poison</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.Resist( 1, 20 );
|
|
//or...
|
|
var coldResist = pUser.Resist( 4 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Resurrect"/>
|
|
<label for="spoiler_method_char_Resurrect">Resurrect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Resurrect()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Resurrects the deceased character.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.Resurrect();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_RunTo"/>
|
|
<label for="spoiler_method_char_RunTo">RunTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RunTo( object, maxSteps[, allowPartial, ignoreDoors] );</em></p>
|
|
<p><em>void RunTo( x, y, maxSteps[, allowPartial, ignoreDoors] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Makes the (NPC only) character run to a specific object/location, if a successful path can be calculated by pathfinding code.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported parameters:</p>
|
|
<ul>
|
|
<li><strong>object</strong> - Dynamic object to pathfind to</li>
|
|
<li><strong>x, y</strong> - Alternative to object, location to pathfind to</li>
|
|
<li><strong>maxSteps</strong> - Max steps to use in pathfinding calculation to find a valid path</li>
|
|
<li><strong>allowPartial</strong> - Optional, if true will allow partial pathfinding that will calculate a path near to desired location, if actual location is blocked</li>
|
|
<li><strong>ignoreDoors</strong> - Pathfinding will calculate a path as if doors are not there. Up to script/custom NPC AIs to open the doors to get them through and continue on their way (using onPathFindEnd, for instance)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.RunTo( pUser, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SellTo"/>
|
|
<label for="spoiler_method_char_SellTo">SellTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SellTo( myNPC );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Brings up the shopkeeper gump for selling to vendor myNPC.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.SellTo( myNPC );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SetInvisible"/>
|
|
<label for="spoiler_method_char_SetInvisible">SetInvisible <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetInvisible( visibility, timeLength );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sets character to the specified visibility level for the specified amount of time (in milliseconds).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported visibility levels:
|
|
<ul>
|
|
<li>0 - Visible to all</li>
|
|
<li>1 - Temporarily hidden (Hiding skill)</li>
|
|
<li>2 - Magically hidden</li>
|
|
<li>3 - Permanently hidden (GM hidden)</li>
|
|
<li>4 - Ghost hidden (normal state of ghost players)</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.SetInvisible( 1, 1000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SetPoisoned"/>
|
|
<label for="spoiler_method_char_SetPoisoned">SetPoisoned <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetPoisoned( poisonLevel, duration[, poisonSourceChar] )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Applies a specified level of poison to a character for a specified amount of time (in milliseconds). Optional third parameter can supply source character who applied the poison</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Gives myChar a level 2 poison for 10 seconds.
|
|
myChar.SetPoisoned( 2, 10000 );
|
|
|
|
// Applies level 2 poison to myChar with myNPC as source character
|
|
myChar.SetPoisoned( 2, 10000, myNPC ); </code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SetRandomName"/>
|
|
<label for="spoiler_method_char_SetRandomName">SetRandomName <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetRandomName( nameListID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Applies a random name from a specified namelist to character/item.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Trivia: Int values were originally used for namelist IDs in dfndata/npc/namelists.dfn or dfndata/items/namelists.dfn, and those still persist, but they are actually strings, and any string can be used as a namelist ID. Doesn't have to be a number!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar/myItem.SetRandomName( "19" ); // Apply random name from Savage Warriors namelist or can get random name from items namelist depending on how its used.</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SetRandomColor"/>
|
|
<label for="spoiler_method_char_SetRandomColor">SetRandomColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetRandomColor( colorListID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Applies a random color from a specified colorlist to character/item.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar/myItem.SetRandomColor( "1" ); // Apply random color from Savage Warriors skin or can get random color from items colorlist depending on how its used.</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SetSkillByName"/>
|
|
<label for="spoiler_method_char_SetSkillByName">SetSkillByName <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetSkillByName( "skillName", value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sets the skill specified by name to the specified value.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Name must be the same as in skills.dfn, or "ALLSKILLS" to set all skills at once.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.SetSkillByName( "alchemy", 1000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SpeechInput"/>
|
|
<label for="spoiler_method_char_SpeechInput">SpeechInput <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SpeechInput( speechID [, speechItem] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Calls up the onSpeechInput event using specified ID, with the text the user types. Also supports an optional speechItem parameter, which allows passing along an object to the onSPeechInput event.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example 1, in some function, we call upon user to enter some text:
|
|
myChar.SpeechInput( 1 );
|
|
|
|
// When user enters their text, the onSpeechInput() event gets triggered
|
|
function onSpeechInput( pUser, iUsed, pSpeech, pSpeechID )
|
|
{
|
|
// In this case, iUsed is null, because no item was passed along with SpeechInput
|
|
}
|
|
|
|
// Example 2, this time we pass along an item object called iUsed
|
|
myChar.SpeechInput( 1, iUsed );
|
|
|
|
function onSpeechInput( pUser, iUsed, pSpeech, pSpeechID )
|
|
{
|
|
// After checking to make sure iUsed is valid, we assign the text the user entered as the new name of iUsed
|
|
if( ValidateObject( iUsed ))
|
|
{
|
|
iUsed.name = pSpeech;
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SpellFail"/>
|
|
<label for="spoiler_method_char_SpellFail">SpellFail <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SpellFail();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Does the actions associated in code with spell failure. Use after character fails to cast a spell, will play fail-effect, sound and give player default fail-message</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>SoundID is the ID of the sound to play. If bAllHear is true, then everyone nearby hears it. If it's false, then only the Character hears it.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.SpellFail();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SpellMoveEffect"/>
|
|
<label for="spoiler_method_char_SpellMoveEffect">SpellMoveEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SpellMoveEffect( targetChar, mSpell );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays the MOVEFX effect of the specified spell in SPELLS.DFN, going from the character to the target</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get ID of spell being cast
|
|
var spellNum = mChar.spellCast;
|
|
|
|
// Get Spell object based on ID
|
|
var mSpell = Spells[spellNum];
|
|
|
|
// Play mSpell's MOVEFX from mChar to targetChar
|
|
mChar.SpellMoveEffect( targetChar, mSpell );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SpellStaticEffect"/>
|
|
<label for="spoiler_method_char_SpellStaticEffect">SpellStaticEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SpellStaticEffect( mSpell );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Play the STATFX effect specified for the specified spell in SPELLS.DFN, on the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get ID of spell being cast
|
|
var spellNum = mChar.spellCast;
|
|
|
|
// Get Spell object based on ID
|
|
var mSpell = Spells[spellNum];
|
|
|
|
// Play mSpell's MOVEFX from mChar to targetChar
|
|
targetChar.SpellStaticEffect( mSpell );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_SysMessage"/>
|
|
<label for="spoiler_method_char_SysMessage">SysMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SysMessage( [msgColor,] string message, ... );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends a string as a system message. Accepts up to 10 additional arguments which can be injected into the string as needed. Text colour can also be provided as an optional parameter prior to the string itself</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.SysMessage( "Isn't the world great?" );
|
|
myChar.SysMessage( GetDictionaryEntry(388), myNPC.name ); // Hello sir! My name is %s and I will be working for you.
|
|
myChar.SysMessage( 0x42, "This message has a different color!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_TurnToward"/>
|
|
<label for="spoiler_method_char_TurnToward">TurnToward <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnToward( trgObj );</em></p>
|
|
<p><em>void TurnToward( x, y );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Turn Character towards trgObj/specified location</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.TurnToward( myObject );
|
|
myNPC.TurnToward( myObject.x, myObject.y );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_UpdateAggressorFlagTimestamp"/>
|
|
<label for="spoiler_method_char_UpdateAggressorFlagTimestamp">UpdateAggressorFlagTimestamp <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void UpdateAggressorFlagTimestamp( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Updates the expiry timestamp of character's aggressor flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.UpdateAggressorFlagTimestamp( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_UpdatePermaGreyFlagTimestamp"/>
|
|
<label for="spoiler_method_char_UpdatePermaGreyFlagTimestamp">UpdatePermaGreyFlagTimestamp <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void UpdatePermaGreyFlagTimestamp( otherChar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Updates the expiry timestamp of character's permagrey flag towards target character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">pUser.UpdatePermaGreyFlagTimestamp( otherChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_WalkTo"/>
|
|
<label for="spoiler_method_char_WalkTo">WalkTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WalkTo( object, maxSteps[, allowPartial, ignoreDoors] );</em></p>
|
|
<p><em>void WalkTo( x, y, maxSteps[, allowPartial, ignoreDoors] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Makes the (NPC only) character walk to a specific object/location, if a successful path can be calculated by pathfinding code.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported parameters:</p>
|
|
<ul>
|
|
<li><strong>object</strong> - Dynamic object to pathfind to</li>
|
|
<li><strong>x, y</strong> - Alternative to object, location to pathfind to</li>
|
|
<li><strong>maxSteps</strong> - Max steps to use in pathfinding calculation to find a valid path</li>
|
|
<li><strong>allowPartial</strong> - Optional, if true will allow partial pathfinding that will calculate a path near to desired location, if actual location is blocked</li>
|
|
<li><strong>ignoreDoors</strong> - Pathfinding will calculate a path as if doors are not there. Up to script/custom NPC AIs to open the doors to get them through and continue on their way (using onPathFindEnd, for instance)</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myNPC.WalkTo( pUser, 20 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_Wander"/>
|
|
<label for="spoiler_method_char_Wander">Wander <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Wander( x1, y1, x2, y2 );</em></p>
|
|
<p><em>void Wander( x1, y1, radius );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Specifies a wander area for an NPC, as either a box or a circle</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>NPCs will return to their wander area if they reset after combat, or if they wander too far off</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Specify a box set of coordinates as the NPC's wander area
|
|
myNPC.Wander( 5593, 1203, 5608, 1206 );
|
|
|
|
// Specify a circle with radius of 10 as the NPC's wander area
|
|
myNPC.Wander( 5600, 1204, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_WhisperMessage"/>
|
|
<label for="spoiler_method_char_WhisperMessage">WhisperMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WhisperMessage( message );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the Character to whisper a message that can be seen only by nearby players (within 1 tile)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.WhisperMessage( "Shhhhh, we're hunting wabbits!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_char_YellMessage"/>
|
|
<label for="spoiler_method_char_YellMessage">YellMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void YellMessage( message );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the Character to yell a message to all players within range (36 tiles)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myChar.YellMessage( "YARGH!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsConsole" id="methodsConsole"><span>Console Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_BeginShutdown"/>
|
|
<label for="spoiler_method_console_BeginShutdown">BeginShutdown <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BeginShutdown();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Starts the UOX3 shutdown sequence</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.BeginShutdown();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_ClearScreen"/>
|
|
<label for="spoiler_method_console_ClearScreen">ClearScreen <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ClearScreen();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears the console screen</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.ClearScreen();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_Error"/>
|
|
<label for="spoiler_method_console_Error">Error <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Error( errorMsg );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Logs an error-message in default error log file, and prints it in the UOX3 console in bright red</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.Error( "I found an error, and I'm logging it!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_Log"/>
|
|
<label for="spoiler_method_console_Log">Log <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Log( logMsg [, filename] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Logs a message either in default log file or in specified file</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Note: Include \n at the end of the string to force a line break. Always do this unless you're printing multiple messages to the same line!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.Log( "Logging a custom message to default logfile!" );
|
|
Console.Log( "Logging a custom message to a specific logfile!", "myCustomLogFile.log" );
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_MoveTo"/>
|
|
<label for="spoiler_method_console_MoveTo">MoveTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void MoveTo( x, y );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Moves console cursor position to specified x, y location.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If you want the same line, y == -1</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.MoveTo( 100, 100 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_Print"/>
|
|
<label for="spoiler_method_console_Print">Print <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Print( string );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints a string to the UOX3 console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Note: Include \n at the end of the string to force a line break. Always do this unless you're printing multiple messages to the same line!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.Print( "Hello World!\n" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintDone"/>
|
|
<label for="spoiler_method_console_PrintDone">PrintDone <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintDone();</em></p>
|
|
<p><em>void PrintDone( bool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints colored [done] message in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintDone();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintFailed"/>
|
|
<label for="spoiler_method_console_PrintFailed">PrintFailed <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintFailed();</em></p>
|
|
<p><em>void PrintFailed( bool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints colored [failed] message in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintFailed();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintPassed"/>
|
|
<label for="spoiler_method_console_PrintPassed">PrintPassed <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintPassed();</em></p>
|
|
<p><em>void PrintPassed( bool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints colored [skipped] message in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintPassed();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintBasedOnVal"/>
|
|
<label for="spoiler_method_console_PrintBasedOnVal">PrintBasedOnVal <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintBasedOnVal( bool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints [done] or [failed] based on provided boolean (true/false)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintBasedOnVal( true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintSectionBegin"/>
|
|
<label for="spoiler_method_console_PrintSectionBegin">PrintSectionBegin <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintSectionBegin();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints a section separator in the console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintSectionBegin();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_PrintSpecial"/>
|
|
<label for="spoiler_method_console_PrintSpecial">PrintSpecial <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PrintSpecial( textColour, string );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prints a special tag in console similar to [done] and [failed], but with custom text and colour</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Available colours: 0 - Normal 1 - Blue 2 - Red 3 - Green 4 - Yellow 5 - Bright White</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.PrintSpecial( 3, "Success" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_Reload"/>
|
|
<label for="spoiler_method_console_Reload">Reload <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Reload( reloadType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Reloads server data from console.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Available reload types:
|
|
<ul>
|
|
<li>0 Reload INI</li>
|
|
<li>1 Reload Accounts</li>
|
|
<li>2 Reload Regions</li>
|
|
<li>3 Reload Spawn Regions</li>
|
|
<li>4 Reload Spells</li>
|
|
<li>5 Reload Commands</li>
|
|
<li>6 Reload Definition Files</li>
|
|
<li>7 Reload JS</li>
|
|
<li>8 Reload HTML</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.Reload( 4 ); //Reloads spells</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnBlue"/>
|
|
<label for="spoiler_method_console_TurnBlue">TurnBlue <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnBlue();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates blue text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnBlue();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnBrightWhite"/>
|
|
<label for="spoiler_method_console_TurnBrightWhite">TurnBrightWhite <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnBrightWhite();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates bright white text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnBrightWhite();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnGreen();"/>
|
|
<label for="spoiler_method_console_TurnGreen();">TurnGreen(); <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnGreen();();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates green text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnGreen();();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnNormal"/>
|
|
<label for="spoiler_method_console_TurnNormal">TurnNormal <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnNormal();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates normal text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnNormal();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnRed"/>
|
|
<label for="spoiler_method_console_TurnRed">TurnRed <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnRed();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates red text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnRed();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_TurnYellow"/>
|
|
<label for="spoiler_method_console_TurnYellow">TurnYellow <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void TurnYellow();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Activates yellow text in console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.TurnYellow();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_console_Warning"/>
|
|
<label for="spoiler_method_console_Warning">Warning <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Warning( warningMsg );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Logs an warning-message in default warning log file, and prints it in the UOX3 console</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">Console.Warning( "Logging a warning message!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsFileIO" id="methodsFileIO"><span>File I/O Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Close"/>
|
|
<label for="spoiler_method_fileio_Close">Close <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Close();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Closes a File that is currently open.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Closing an unopened file is undefined behaviour.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mFile.Close();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_DeleteFile"/>
|
|
<label for="spoiler_method_fileio_DeleteFile">DeleteFile <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool DeleteFile( fileName[, subFolderName[, useScriptDataDir]] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes a specified file, either in root of shared folder, inside a subfolder, or in JS data folder</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>File and subfolder names cannot contain some characters such as forward or backwards slashes, double dots, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Define filename and subfolder where to find it
|
|
var fileName = "myFile.jsdata";
|
|
var folderName = "mySubFolder";
|
|
|
|
// Deletes UOX3/js/jsdata/mySubFolder/myFile.jsdata
|
|
DeleteFile( fileName, folderName, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_EoF"/>
|
|
<label for="spoiler_method_fileio_EoF">EoF <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool EOF();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>A boolean value returning true if the file pointer is at the end of the file.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">while( !mFileRead.EOF() ) { ... }</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Free"/>
|
|
<label for="spoiler_method_fileio_Free">Free <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool Free();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deallocates the memory associated with creating the file variable.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>This must be called otherwise a slow memory leak will occur.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mFile.Free();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Length"/>
|
|
<label for="spoiler_method_fileio_Length">Length <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Length();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the length of the file</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var fileLength = mFile.Length();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Open"/>
|
|
<label for="spoiler_method_fileio_Open">Open <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>UOXCFile Open( fileName, accessMethod[, subFolder, useScriptDataDir] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens a File for reading, writing (write file from scratch) or appending (add to file).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>AccessMethod is a one byte string, which contains either "a" (append), "r" (read) or "w" (write). Subfolder is an optional parameter indicating which subfolder of UOX3/shared/ to open the file in, while useScriptDir is a boolean flag to indicate whether to open the file in the script-data folder (js/jsdata) instead.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a new UOXCFile object
|
|
var mFile = new UOXCFile;
|
|
|
|
// Open a file called "test.dat" (in UOX3/shared/mySubFolder/) for appending
|
|
mFile.Open( "test.dat", "a", "mySubFolder" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Pos"/>
|
|
<label for="spoiler_method_fileio_Pos">Pos <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int Pos();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns or sets the position we are at in the file</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>The current position that you are at in the file. This can be read and set, where setting it moves relative to the start of file (i.e. if you set it to 5, it would be 5 bytes from the start, not 5 bytes from it's current location). You cannot seek a location if you have opened the file for append.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var filePos = mFile.Pos();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_Read"/>
|
|
<label for="spoiler_method_fileio_Read">Read <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string Read( int numBytes );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a string of length numBytes, reading numBytes from the opened file.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>numBytes must be at least 1 and less than or equal to 512.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var mLine = mFile.Read( 80 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_fileio_ReadUntil"/>
|
|
<label for="spoiler_method_fileio_ReadUntil">ReadUntil <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string Read( string delimeter );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Reads a string until it encounters a newline or the string specified by delimeter.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>delimiter is at most a 2 character string (for C style character escapes, where \n is a newline, \' is a quote and so on). Will not read more than 512 bytes.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Read a line of open file mFile until it hits the letter t, a newline, or 512 bytes in length.
|
|
var untilT = mFile.ReadUntil( "t" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsGuild" id="methodsGuild"><span>Guild Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_AcceptRecruit"/>
|
|
<label for="spoiler_method_guild_AcceptRecruit">AcceptRecruit <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AcceptRecruit( [trgChar] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Accepts specified character as a recruit in the guild</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If no character parameter is provided, UOX3 will attempt to accept into the guild... the character the Guild object was retrieved from? Not clear.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to Guild object from character
|
|
var myGuild = myChar.guild;
|
|
|
|
// Accept a specified recruit pChar into the guild
|
|
myGuild.AcceptRecruit( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_IsAtPeace"/>
|
|
<label for="spoiler_method_guild_IsAtPeace">IsAtPeace <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void IsAtPeace();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Check if guild is at peace, i.e. not at war with any other guilds</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if guild player is in is at peace
|
|
var myGuild = myChar.guild;
|
|
if( myGuild.IsAtPeace() )
|
|
{
|
|
myChar.TextMessage( "My guild is not at war with anyone! Peace be praised! ");
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_AddMember"/>
|
|
<label for="spoiler_method_guild_AddMember">AddMember <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddMember( trgChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a character to the guild as a full member (removes from recruits if needed)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>N/A</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
// Add pChar as a member in myChar's guild
|
|
myGuild.AddMember( pChar );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_AddRecruit"/>
|
|
<label for="spoiler_method_guild_AddRecruit">AddRecruit <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddRecruit( trgChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a character to the guild as a recruit (removes from member list if needed)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>N/A</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
// Add pChar as recruit in myChar's guild
|
|
myGuild.AddRecruit( pChar );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_RemoveRecruit"/>
|
|
<label for="spoiler_method_guild_RemoveRecruit">RemoveRecruit <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveRecruit( trgChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes a character from the guild's recruit list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>N/A</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
// Remove myChar as recruit of guild
|
|
myGuild.RemoveRecruit( myChar );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- RemoveMember -->
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_RemoveMember"/>
|
|
<label for="spoiler_method_guild_RemoveMember">RemoveMember <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveMember( trgChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes a character from the guild's member list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>N?A</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
// Remove myChar as member of guild
|
|
myGuild.RemoveMember( myChar );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_RecruitToMember"/>
|
|
<label for="spoiler_method_guild_RecruitToMember">RecruitToMember <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RecruitToMember( trgChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Moves a character from recruit list to member list in the guild</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>N/A</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
// Promote myChar from recruit to member
|
|
myGuild.RecruitToMember( myChar );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_IsAtWar"/>
|
|
<label for="spoiler_method_guild_IsAtWar">IsAtWar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsAtWar( targetGuild );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if this guild considers the target guild to be an enemy (at war)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Returns true if the relation to the target guild is set to WAR.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
if( myGuild.IsAtWar( targetGuild ))
|
|
{
|
|
myChar.SysMessage( "Your guilds are at war!" );
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_IsAlly"/>
|
|
<label for="spoiler_method_guild_IsAlly">IsAlly <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsAlly( targetGuild );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if this guild considers the target guild an ally</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Returns true if the relation to the target guild is set to ALLY.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
if( myGuild.IsAlly( targetGuild ))
|
|
{
|
|
myChar.SysMessage( "Your guilds are allies!" );
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_guild_IsNeutral"/>
|
|
<label for="spoiler_method_guild_IsNeutral">IsNeutral <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsNeutral( targetGuild );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if this guild considers the target guild neutral</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Returns true if the relation to the target guild is set to NEUTRAL.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch myChar's guild
|
|
var myGuild = myChar.guild;
|
|
if( myGuild != null )
|
|
{
|
|
if( myGuild.IsNeutral( targetGuild ))
|
|
{
|
|
myChar.SysMessage( "Your guilds have a neutral standing." );
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsGump" id="methodsGump"><span>Gump Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Before any gump methods can be used, you need to instantiate a new Gump object:</p>
|
|
<pre><code class="language-javascript">var myGump = new Gump;</code></pre>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addbackground"/>
|
|
<label for="spoiler_method_gump_addbackground">AddBackground <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddBackground( topHeight, topLeft, bottomHeight, bottomRight, backImage )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a background (should come REALLY early in gump) of height (bottomHeight - topHeight) and width (bottomRight - topLeft) as image backImage (gump image like via AddGump).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddBackground( 0, 0, 320, 340, 2600 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addButton"/>
|
|
<label for="spoiler_method_gump_addButton">AddButton <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddButton( topHeight, topLeft, buttonImage, (buttonPressedImage), unk1, unk2, unk3 )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a button to the gump.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Having an unk1 of 1 indicates the gump will close. unk2 should be the button's unique ID, and unk3 is the page the button will call. buttonPressedImage is optional, and without it a value of buttonImage + 1 is assumed.</p>
|
|
<p><br>When the button is pressed, <a href="#onGumpPress">onGumpPress event</a> is called. If gump is closed without pressing a button, onGumpPress event's iButton parameter will be 0.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddButton( 13, 290, 5050, 1, 1, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addButtonTileArt"/>
|
|
<label for="spoiler_method_gump_addButtonTileArt">AddButtonTileArt <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddButtonTileArt( topHeight, topLeft, buttonImage, buttonPressedImage, unk1, unk2, unk3, tileID, hue, tileX, tileY )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a button to the gump, with tileArt as part of the button</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Having an unk1 of 1 indicates the gump will close. unk2 is the page it will call, while unk3 is the button's unique ID. tileID is tileArt added as part of the button, hue is the tileArt hue, and tileX and tileY is the tileArt's offset compared to the topHeight, topLeft coordinates</p>
|
|
<p>When the button is pressed, onGumpPress event is called, iButton is 0 if the gump has been closed without pressing a button: function onGumpPress( Sock, iButton ) { ... }</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddButtonTileArt( 13, 290, 5050, 5050, 1, 1, 1, 1193, 0, 10, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addCheckbox"/>
|
|
<label for="spoiler_method_gump_addCheckbox">AddCheckbox <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddCheckbox( topHeight, topLeft, checkImage, defaultStatus, unk2 )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a checkbox to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>DefaultStatus is true/false to determine the starting status of the checkbox, either checked or not. unk2 is the checkbox's ID. Uses same IDs as radiobuttons</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddCheckbox( 10, 10, 2706, 0, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addCroppedText"/>
|
|
<label for="spoiler_method_gump_addCroppedText">AddCroppedText <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddCroppedText( left, top, hue, width, height, text )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Crops the text if it's too long to display properly</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddCroppedText( 10, 10, 2706, 50, 20, "Hello world, this text is cut off somewhere!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addCheckerTrans"/>
|
|
<label for="spoiler_method_gump_addCheckerTrans">AddCheckerTrans <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddCheckerTrans( left, top, width, height )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Turns everything underneath the specified area transparent</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddCheckerTrans( 0, 0, 300, 220 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addGroup"/>
|
|
<label for="spoiler_method_gump_addGroup">AddGroup <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddGroup( groupNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>For grouping sets of radio buttons</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddGroup( 1 );
|
|
// .. add radio button elements here, then end the group with EndGroup() method</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addGump"/>
|
|
<label for="spoiler_method_gump_addGump">AddGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddGump( topHeight, topLeft, gumpImage, hue(optional) )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a gump on the current gump (ie any image in the Gumps-tab of a tool like <a href="https://github.com/polserver/UOFiddler" target="_blank" title="UOFiddler on GitHub">UOFiddler</a>). A fourth parameter - hue - is optional, and can be used to set the color of the gump.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddGump( 5, 260, 1141 );
|
|
|
|
myGump.AddGump( 5, 260, 1141, 1154 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addGumpColor"/>
|
|
<label for="spoiler_method_gump_addGumpColor">AddGumpColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddGumpColor( topHeight, topLeft, gumpImage, hue )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a gump on the current gump (ie any image in the Gumps-tab of a tool like <a href="https://github.com/polserver/UOFiddler" target="_blank" title="UOFiddler on GitHub">UOFiddler</a>). Same as AddGump, but with an additional parameter for hue/color.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddGumpColor( 5, 260, 1141, 1154 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_AddHTMLGump"/>
|
|
<label for="spoiler_method_gump_AddHTMLGump">AddHTMLGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddHTMLGump( topHeight, topLeft, width, height, background, scrollbar, HTMLText )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a gump element with HTML text support to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>background and scrollbar either <strong>false</strong> or <strong>true</strong>, for respectively off/on. HTMLText is the text in the gump, can use HTML here. Supported tags: <BODYBGCOLOR=[color name]|[#colorid]></BODYBGCOLOR> <B></B> <BIG></BIG> <SMALL></SMALL> <EM></EM> <I></I> <U></U>
|
|
<H1></H1> <H2></H2> <H3></H3> <H4></H4> <H5></H5> <H6></H6> <a href=\"\"></a>
|
|
<div align=\"right\"><div align=\"left\"></DIV> <left></left> <P> <CENTER></CENTER> <BR></BR> <BASEFONT color=#ffffff size=1-7></BASEFONT></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddHTMLGump( 15, 40, 110, 20, false, false, "<B>This is a text with HTML</B>" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_AddItemProperty"/>
|
|
<label for="spoiler_method_gump_AddItemProperty">AddItemProperty <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddItemProperty( myItem )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Attaches an item property element to previous element in a gump, which will cause client to display the properties of that object as a regular tooltip on cursor when hovering over the gump element</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Could be used to show item stats for items in a custom paperdoll</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Add item properties of myItem as a tooltip to the previous gump element
|
|
myGump.AddItemProperty( myItem );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addPage"/>
|
|
<label for="spoiler_method_gump_addPage">AddPage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPage( pageNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a new page to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Other Notes</span></p>
|
|
<p>Anything on page 0 is shown on ALL pages</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddPage( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addPageButton"/>
|
|
<label for="spoiler_method_gump_addPageButton">AddPageButton <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPageButton( topHeight, topLeft, buttonImage, (buttonPressedImage), pageNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a button to the gump allowing you to navigate pages without an onGumpPress event. buttonPressedImage is optional, and without it a value of buttonImage + 1 is assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddPageButton( 13, 290, 5050, 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_AddPicInPic"/>
|
|
<label for="spoiler_method_gump_AddPicInPic">AddPicInPic <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPicInPic( topLeft, topHeight, gumpImage, spriteX, spriteY, width, height )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a "picture in a picture" (picinpic) gump element to the gump, allowing one to display only a select area of a given piece of gump art</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>spriteX and spriteY are the starting point within the gump art, while width and height control how large area to display from that starting point. Only works in regular UO clients v7.0.80.0 or higher (not yet supported by ClassicUO)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Display first sprite in a gump sprite sheet, starting from 0, 0 in the gump art
|
|
myGump.AddPicInPic( 10, 10, 0x9d3b, 0, 0, 30, 30 );
|
|
|
|
// Display only Lord British' head from a gump that displays the Lord British paperdoll art
|
|
myGump.AddPicInPic( 10, 10, 0x03de, 0, 0, 30, 30 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addPicture"/>
|
|
<label for="spoiler_method_gump_addPicture">AddPicture <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPicture( topHeight, topLeft, tilePic )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the image tilePic to the gump at topHeight/topLeft. tilePic is an ITEM ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddPicture( 5, 111, 0x0EED );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addPictureColor"/>
|
|
<label for="spoiler_method_gump_addPictureColor">AddPictureColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddPictureColor( topHeight, topLeft, tilePic, hue )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the image tilePic to the gump at topHeight/topLeft, with color hue. tilePic is an ITEM ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddPictureColor( 5, 111, 0x0EED, 1154 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addRadio"/>
|
|
<label for="spoiler_method_gump_addRadio">AddRadio <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddRadio( topHeight, topLeft, radioImage, pressed, id )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a radio button to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>pressed (0/1) determines the default state of the radiobutton, id is the radiobutton's buttonID. Uses same IDs as CheckBoxes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddRadio( 13, 40, 2151, 0, 2966 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addText"/>
|
|
<label for="spoiler_method_gump_addText">AddText <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddText( topHeight, topLeft, textColour, text )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the text text to the gump represented by gumpHandle at topHeight/topLeft in textColour</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Note that each AddText line automatically gets assigned a "TextID", starting with 0 and counting upwards for each new AddText line. When using both AddText and AddTextEntry in the same gump, be sure to put all the AddText lines FIRST, then the AddTextEntry lines - since they both use TextIDs and otherwise the automatic assignment will get messed up (or some such)..</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddText( 30, 30, 0, "Test text" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addTextEntry"/>
|
|
<label for="spoiler_method_gump_addTextEntry">AddTextEntry <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddTextEntry( topHeight, topLeft, width, height, hue, unk4, textID, defaultText )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>It adds a text entry with default text to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>unk4 is..? seems to work when set to 1. textID uses an ID which is also automatically assigned to any AddText line, so be sure to place all AddTextEntry lines after any AddText lines, then assign these with the proper textIDs starting with the next free ID that hasn't been assigned as an ID for an AddText line..</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddTextEntry( 20, 62, 200, 20, 10, 1, 1, "Default text" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addTextEntryLimited"/>
|
|
<label for="spoiler_method_gump_addTextEntryLimited">AddTextEntryLimited <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddTextEntryLimited( topHeight, topLeft, width, height, hue, unk4, textID, defaultText, maxLength )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>It adds a text entry with default text to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>unk4 is..? seems to work when set to 1. textID uses an ID which is also automatically assigned to any AddText line, so be sure to place all AddTextEntry lines after any AddText lines, then assign these with the proper textIDs starting with the next free ID that hasn't been assigned as an ID for an AddText line.. maxLength specifies max amount of text that can be entered</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddTextEntryLimited( 20, 62, 200, 20, 10, 1, 1, "Default text", 20 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addTiledGump"/>
|
|
<label for="spoiler_method_gump_addTiledGump">AddTiledGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddTiledGump( left, top, width, height, gumpID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Tiles specified gump within specified area</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddTiledGump( left, top, width, height, gumpID );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addToolTip"/>
|
|
<label for="spoiler_method_gump_addToolTip">AddToolTip <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddToolTip( clilocNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a cliloc-based tooltip to the gump-element added prior to AddToolTip</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddPicture( 175, 50, 3644 );
|
|
myGump.AddToolTip( 1015094 ); //adds tooltip with cliloc 1015094 to the gump-picture added on the previous line</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addXMFHTMLGump"/>
|
|
<label for="spoiler_method_gump_addXMFHTMLGump">AddXMFHTMLGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddXMFHTMLGump( left, top, width, height, number, hasBorder, hasScrollbar )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>The purpose of this is to load a HTML like gump using the cliloc "number". Its to do with Localisation settings etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddXMFHTMLGump( 10, 10, 200, 300, 1, true, true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addXMFHTMLGumpColor"/>
|
|
<label for="spoiler_method_gump_addXMFHTMLGumpColor">AddXMFHTMLGumpColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddXMFHTMLGumpColor( left, top, width, height, number, hasBorder, hasScrollbar, rgbColour )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>The purpose of this is to load a HTML like gump using the cliloc "number". Its to do with Localisation settings etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddXMFHTMLGumpColor( 10, 10, 200, 300, 1, true, true, ?? );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_addXMFHTMLTok"/>
|
|
<label for="spoiler_method_gump_addXMFHTMLTok">AddXMFHTMLTok <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddXMFHTMLTok( left, top, width, height, hasBorder, hasScrollbar, rgbColour, clilocNum, clilocArg1, clilocArg2, clilocArg3 )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>The purpose of this is to load a HTML like gump using the cliloc "number". Its to do with Localisation settings etc. (Any of) the three cliloc-arguments are optional, but there must minimum be however many the cliloc requires.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.AddXMFHTMLTok( 10, 10, 200, 300, true, true, 1, 1060656, 99 );
|
|
myGump.AddXMFHTMLTok( 10, 10, 200, 300, true, true, 1, 1060658, 99, "BottlesOfBeer" );
|
|
myGump.AddXMFHTMLTok( 10, 10, 200, 300, true, true, 1, 1041522, 99, "BottlesOfBeer", "onTheWall" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_EndGroup"/>
|
|
<label for="spoiler_method_gump_EndGroup">EndGroup <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void EndGroup()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Ends a previously started group element</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.EndGroup();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_free"/>
|
|
<label for="spoiler_method_gump_free">Free <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Free()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes all the memory allocated to the gump</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.Free();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_MasterGump"/>
|
|
<label for="spoiler_method_gump_MasterGump">MasterGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void MasterGump( gumpID )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Unknown, more information needed. Overrides GumpID sent with gump packet?</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Introduced somewhere in UO client versions 4.0.4d to 5.0.5b</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.MasterGump( gumpID );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_noClose"/>
|
|
<label for="spoiler_method_gump_noClose">NoClose <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void NoClose()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds noclose element to gump stream; specifies that gump cannot be closed by clicking the right mouse button</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.NoClose();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_noDispose"/>
|
|
<label for="spoiler_method_gump_noDispose">NoDispose <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void NoClose()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds nodispose element to gump stream; specifies that gump cannot be disposed of/closed using the Escape button</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>It's also possible it is used to prevent gumps from being closed using the "Close Dialogs" client macro. No response is sent to server upon closing the Gump in this manner.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.NoDispose();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_noMove"/>
|
|
<label for="spoiler_method_gump_noMove">NoMove <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void NoMove()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds nomove element to gump stream; specifies that gump cannot be moved</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.NoMove();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_noResize"/>
|
|
<label for="spoiler_method_gump_noResize">NoResize <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void NoResize()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds noresize element to gump stream; specifies that gump cannot be resized</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.NoResize();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_send"/>
|
|
<label for="spoiler_method_gump_send">Send <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Send( targSocket )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends the gump to targSocket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myGump.Send( mySock );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gump_example"/>
|
|
<label for="spoiler_method_gump_example">Full Gump Example <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Displays a test gump with handling of button presses when item with script attached is double-clicked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example</span></p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var myGump = new Gump; // create a new gump
|
|
myGump.AddBackground( 0, 0, 300, 300, 2600 ); // add an automic scaled background
|
|
myGump.AddCheckerTrans( 0, 0, 100, 100 ); // Let's make part of the gump transparent! Whee!
|
|
myGump.AddButton( 300, 5, 0xa50, 1, 0, 0); // Add a close-gump button
|
|
myGump.AddGump( 120, 40, 0x157E ); // add some gump art
|
|
myGump.AddPicture( 20, 40, 0x12D8 ); // add tile art
|
|
myGump.AddText( 100, 20, 5, "My first gump!" ); // add text, gets assigned TextID 0
|
|
myGump.AddText( 100, 95, 7, "Some more text!" ); // add text, gets assigned TextID 1
|
|
myGump.AddText( 20, 200, 7, "TextEntry 1[ ]" ); // add text, gets assigned TextID 2
|
|
myGump.AddText( 20, 220, 7, "TextEntry 2[ ]" ); // add text, gets assigned TextID 3
|
|
myGump.AddTextEntry( 100, 200, 120, 25, 10, 0, 4, "First Entry" ); //TextID 4
|
|
myGump.AddTextEntry( 100, 220, 120, 25, 10, 0, 5, "Second Entry" ); //TextID 5
|
|
myGump.AddRadio( 20, 130, 2152, 0, 0 ); //RadioButton with ID 0
|
|
myGump.AddRadio( 20, 150, 2152, 0, 1 ); //RadioButton with ID 1
|
|
myGump.AddCheckbox( 20, 175, 2706, 0, 2 ); //CheckBox with ID 2
|
|
myGump.AddButton( 160, 265, 0xF7, 1, 0, 1 ); // add the "okay" button
|
|
myGump.Send( pUser.socket ); // send this gump to client now
|
|
myGump.Free(); // clear this gump from uox-memory
|
|
return false;
|
|
}
|
|
|
|
function onGumpPress( pSock, pButton, gumpData )
|
|
{
|
|
var pUser = pSock.currentChar;
|
|
switch(pButton)
|
|
{
|
|
case 0:
|
|
// abort and do nothing
|
|
break;
|
|
case 1:
|
|
var Text1 = gumpData.getEdit(0);
|
|
pUser.SysMessage( "The first TextEntry was: "+Text1 );
|
|
var Text2 = gumpData.getEdit(1);
|
|
pUser.SysMessage( "The second TextEntry was: "+Text2 )
|
|
var OtherButton = gumpData.getButton(0);
|
|
switch( OtherButton )
|
|
{
|
|
case 0:
|
|
pUser.SysMessage( "You selected RadioButton number: "+OtherButton );
|
|
pUser.DoAction( 15 );
|
|
break;
|
|
case 1:
|
|
pUser.SysMessage( "You selected RadioButton number: "+OtherButton );
|
|
pUser.DoAction( 11 );
|
|
break;
|
|
case 2:
|
|
pUser.SysMessage( "The Checkbox with ID "+OtherButton+" was checked." );
|
|
pUser.DoAction( 18 );
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsGumpData" id="methodsGumpData"><span>GumpData Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>GumpData objects are retrieved via one of the function parameters in the onGumpPress() event</p>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gumpData_Free"/>
|
|
<label for="spoiler_method_gumpData_Free">Free <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Free();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes JS Gump Data object and frees up associated memory</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.ApplyRank( 5, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gumpData_getButton"/>
|
|
<label for="spoiler_method_gumpData_getButton">getButton <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int getButton( gumpDataIndex );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets value of button at specified index in Gump Data</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example from Admin Welcome gump in UOX3/js/server/misc/admin_welcome.js
|
|
for( var i = 0; i < numCheckedBoxes; i++ )
|
|
{
|
|
buttonID = tempGumpData.getButton(i);
|
|
if( buttonID >= 0 && buttonID <= 7 )
|
|
{
|
|
facetName = "felucca";
|
|
}
|
|
...
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gumpData_getEdit"/>
|
|
<label for="spoiler_method_gumpData_getEdit">getEdit <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string getEdit( editIndex );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets data input from TextEntr(y/ies) in JS Gump. First input will have editIndex 0, second will have editIndex 1, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example from onGumpPress() event in UOX3/js/server/house/housesign.js
|
|
var newName = gumpData.getEdit(0);
|
|
if( newName.length <= 60 ) // Estimated longest name that fits inside sign gump
|
|
{
|
|
iSign.name = newName;
|
|
pSocket.SysMessage( GetDictionaryEntry( 1943, pSocket.language ), newName ); // House name changed to %s.
|
|
}
|
|
else
|
|
pSocket.SysMessage( GetDictionaryEntry( 1944, pSocket.language )); // That name is too long.</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_gumpData_getID"/>
|
|
<label for="spoiler_method_gumpData_getID">getID <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int getID( gumpDataIndex );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets nID at specified index in Gump Data</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// To be added</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsItem" id="methodsItem"><span>Item Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_ApplyRank"/>
|
|
<label for="spoiler_method_item_ApplyRank">ApplyRank <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ApplyRank( rank, maxRank );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Modifies item properties based on item's rank (could be calculated based on player's crafting skill, but is always 10 if rank system not enabled. Higher values will increase base properties of item, lower will decrease base properties). maxRank is the maximum amount of ranks in the rank system (10 by default).</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.ApplyRank( 5, 10 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_Carve"/>
|
|
<label for="spoiler_method_item_Carve">Carve <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Carve( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Makes the character belonging to socket carve up a corpse</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myCorpse.Carve( socket );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_Dupe"/>
|
|
<label for="spoiler_method_item_Dupe">Dupe <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Dupe( [socket] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Creates a duplicate of the item, and optionally changes its container to a player character's backpack, via their socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If socket parameter is provided, item is placed in associated player character's backpack. If no parameter is provided, item is duped, using same container as the original item. It's up to the script what happens to the duped item after that.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Dupe myItem and place is it the backpack of player character associated with mySock
|
|
myItem.Dupe( mySock );
|
|
|
|
// Dupe myItem and place it somewhere in the world
|
|
var newItem = myItem.Dupe( null );
|
|
newItem.container = null;
|
|
newItem.Teleport( 1000, 1000, 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_GetMoreVarSetMoreVar"/>
|
|
<label for="spoiler_method_item_GetMoreVarSetMoreVar">GetMoreVar/SetMoreVar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetMoreVar( moreVarName, moreVarPart );</em></p>
|
|
<p><em>void SetMoreVar( moreVarName, moreVarPart, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/set the value (0x00 to 0xFF) for a specific part (1-4) of temp variables ("more", "morex", "morey", "morez") associated with an item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Set all 4 parts of item's "morex" property in one go:
|
|
myItem.morex = 0x01223452; // The four values are 0x01 0x22 0x34 0x52
|
|
|
|
// Set each part of item's "morex" property individually
|
|
myItem.SetMoreVar( "morex", 1, 0x01 );
|
|
myItem.SetMoreVar( "morex", 2, 0x22 );
|
|
myItem.SetMoreVar( "morex", 3, 0x34 );
|
|
myItem.SetMoreVar( "morex", 4, 0x52 );
|
|
|
|
// Fetch the values stored in different parts of item's "morex" property
|
|
var moreXPart1 = myItem.GetMoreVar( "morex", 1 ); // value is 0x01
|
|
var moreXPart2 = myItem.GetMoreVar( "morex", 2 ); // value is 0x22
|
|
var moreXPart3 = myItem.GetMoreVar( "morex", 3 ); // value is 0x34
|
|
var moreXPart4 = myItem.GetMoreVar( "morex", 4 ); // value is 0x52
|
|
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_GetTileName"/>
|
|
<label for="spoiler_method_item_GetTileName">GetTileName <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void GetTileName();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Fetches item name, and looks in tiledata for name if no name is specified for object (or name is "#")</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var itemName = myItem.GetTileName();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_Glow"/>
|
|
<label for="spoiler_method_item_Glow">Glow <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Glow( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the object to begin glowing, by attaching an invisible light</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Can only be applied to players, and only to player whose socket is also provided as an argument to the Glow() function.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.Glow( pSock );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_IsOnFoodList"/>
|
|
<label for="spoiler_method_item_IsOnFoodList">IsOnFoodList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOnFoodList( foodListName );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if item is on a specified food list from UOX3/dfndata/items/itemlists/foodlists.dfn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Check if myItem is a vegetable
|
|
if( myItem.IsOnFoodList( "VEGETABLES" ))
|
|
{
|
|
pUser.TextMessage( "Yeah, my item is definitely a vegetable!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_LockDown"/>
|
|
<label for="spoiler_method_item_LockDown">LockDown <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void LockDown();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Locks item down (sets movable value to 3)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.LockDown();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_OpenPlank"/>
|
|
<label for="spoiler_method_item_OpenPlank">OpenPlank <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenPlank()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens the plank of a boat.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Step 1, find plank by iterating through all objects in a boat - or perhaps the plank is the item being used in an onUseChecked event?
|
|
// ...
|
|
|
|
// Step 2, open plank once found
|
|
myPlank.OpenPlank();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_PlaceInPack"/>
|
|
<label for="spoiler_method_item_PlaceInPack">PlaceInPack <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PlaceInPack( autoStackBool );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Randomly sets the placement of an item inside the container it is in.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If autoStackBool is set to true, UOX3 will attempt to stack the item with existing similar items in its container before randomly placing it.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Randomly place item in container
|
|
myItem.PlaceInPack();
|
|
|
|
// Attempt to autostack item with similar items
|
|
myItem.PlaceInPack( true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_SetCont"/>
|
|
<label for="spoiler_method_item_SetCont">SetCont <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SetCont( object );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sets the container of the item to the specified object.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.SetCont( mChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_UnGlow"/>
|
|
<label for="spoiler_method_item_UnGlow">UnGlow <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void UnGlow( socket );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Causes the object to stop glowing, by removing the invisible light</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myItem.UnGlow( pSock );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsMulti" id="methodsMulti"><span>Multi Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_AddToBanList"/>
|
|
<label for="spoiler_method_multi_AddToBanList">AddToBanList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool AddToBanList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the character pChar to the multi's ban list. Returns true if the parameters are valid.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Oh no! I'm getting banned from this house!" );
|
|
iMulti.AddToBanList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_AddToFriendList"/>
|
|
<label for="spoiler_method_multi_AddToFriendList">AddToFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool AddToFriendList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the character pChar to the multi's friend list. Won't duplicate if already on the list.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Yay, I'm being added as a friend of this house!" );
|
|
iMulti.AddToFriendList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_AddToGuestList"/>
|
|
<label for="spoiler_method_multi_AddToGuestList">AddToGuestList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool AddToGuestList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the character pChar to the multi's guest list. Won't duplicate if already on the list.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Yay, I'm being added as a guest of this house!" );
|
|
iMulti.AddToGuestList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_AddToOwnerList"/>
|
|
<label for="spoiler_method_multi_AddToOwnerList">AddToOwnerList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool AddToOwnerList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds the character pChar to the multi's owner list. Doesn't remove existing owners at all. Won't duplicate if already on the list.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Yay, I'm being added as an owner of this house!" );
|
|
iMulti.AddToOwnerList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_AddTrashCont"/>
|
|
<label for="spoiler_method_multi_AddTrashCont">AddTrashCont <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool AddTrashCont( trashContObj );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Add trash container to multi's list of trash containers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( trashContObj.x, trashContObj.y, trashContObj.z, trashContObj.worldnumber );
|
|
iMulti.AddTrashCont( trashContObj );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_ClearBanList"/>
|
|
<label for="spoiler_method_multi_ClearBanList">ClearBanList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ClearBanList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all players from multi's ban list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
iMulti.ClearBanList();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_ClearFriendList"/>
|
|
<label for="spoiler_method_multi_ClearFriendList">ClearFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ClearFriendList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all players from multi's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
iMulti.ClearFriendList();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_ClearGuestList"/>
|
|
<label for="spoiler_method_multi_ClearGuestList">ClearGuestList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ClearGuestList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all players from multi's guest list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
iMulti.ClearGuestList();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_ClearOwnerList"/>
|
|
<label for="spoiler_method_multi_ClearOwnerList">ClearOwnerList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ClearOwnerList();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Clears all players from multi's co-owner list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
iMulti.ClearOwnerList();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_FinishedChar"/>
|
|
<label for="spoiler_method_multi_FinishedChar">FinishedChar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool FinishedChar( [charType] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if there are no more items left to look through in the container (or multi)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<p><strong>See FirstChar() Method</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_FirstChar"/>
|
|
<label for="spoiler_method_multi_FirstChar">FirstChar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER FirstChar( [charType] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns a handle to the first character in the multi.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>If it's null, then there are no characters inside. An optional parameter is supported by both FirstChar(), NextChar() and FinishedChar() to specify the type of characters to look for... options are none (find all chars), "owner", "friend", "guest" or "banned".</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example 1 - Iterate through all characters in Multi
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var iMulti = pUser.multi;
|
|
var mChar;
|
|
for( mChar = iMulti.FirstChar(); !iMulti.FinishedChar(); mChar = iMulti.NextChar() )
|
|
{
|
|
if( mChar != null )
|
|
{
|
|
mChar.TextMessage( "I'm a character in this multi!" );
|
|
}
|
|
}
|
|
}
|
|
|
|
// Example 2 - Iterate through only characters on ownerlist of multi
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
var iMulti = pUser.multi;
|
|
var mChar;
|
|
for( mChar = iMulti.FirstChar( "owner" ); !iMulti.FinishedChar( "owner" ); mChar = iMulti.NextChar( "owner" ) )
|
|
{
|
|
if( mChar != null )
|
|
{
|
|
mChar.TextMessage( "I'm one of the owners of this multi!" );
|
|
}
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_GetMultiCorner"/>
|
|
<label for="spoiler_method_multi_GetMultiCorner">GetMultiCorner <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string GetMultiCorner( cornerID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets coordinates for specified corner of multi ( 0 = NW corner, 1 = NE corner, 2 = SW corner, 3 = SE corner)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var multiCornerCoords = (iMulti.GetMultiCorner( 3 )).split( "," );
|
|
var cornerX = parseInt(multiCornerCoords[0]);
|
|
var cornerY = parseInt(multiCornerCoords[1]);</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_GetTiller"/>
|
|
<label for="spoiler_method_multi_GetTiller">GetTiller <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>item GetTiller();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Fetches reference to boat's Tillerman</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iTiller = myBoat.GetTiller();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsInMulti"/>
|
|
<label for="spoiler_method_multi_IsInMulti">IsInMulti <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsInMulti( ourObj );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the object is in the multi. See also: <strong>FindMulti()</strong> Function</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Grab a reference to any potential Multi at object's location
|
|
var iMulti = FindMulti( ourObj.x, ourObj.y, ourObj.z, ourObj.worldnumber );
|
|
|
|
// If a Multi was found, check if object is considered inside
|
|
if( ValidateObject( iMulti ))
|
|
{
|
|
if( iMulti.IsInMulti( ourObj ) )
|
|
{
|
|
ourObj.TextMessage( "I am in a multi!" );
|
|
}
|
|
{</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsBoat"/>
|
|
<label for="spoiler_method_multi_IsBoat">IsBoat <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsBoat();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if an Item is actually a Boat. Note that a Boat is also a Multi!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( iToCheck.IsBoat() )
|
|
{
|
|
pUser.TextMessage( "Yep, it's definitely a boat." );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsMulti"/>
|
|
<label for="spoiler_method_multi_IsMulti">IsMulti <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsMulti();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if an Item is actually a Multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( iToCheck.IsMulti() )
|
|
{
|
|
pUser.TextMessage( "Yep, it's definitely a multi." );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsOnBanList"/>
|
|
<label for="spoiler_method_multi_IsOnBanList">IsOnBanList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOnBanList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the character pChar is on the multi's ban list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( ourObj.x, ourObj.y, ourObj.z, pChar.worldnumber );
|
|
if( iMulti.IsOnBanList( pChar ))
|
|
{
|
|
pChar.TextMessage( "Oops, I appear to be on the banlist of this house!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsOnFriendList"/>
|
|
<label for="spoiler_method_multi_IsOnFriendList">IsOnFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOnFriendList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the character pChar is on the list of friends of the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
if( iMulti.IsOnFriendList( pChar ))
|
|
{
|
|
pChar.TextMessage( "Ahh, I appear to be on the friend-list of this house!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsOnGuestList"/>
|
|
<label for="spoiler_method_multi_IsOnGuestList">IsOnGuestList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOnGuestList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the character pChar is on the list of guests of the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
if( iMulti.IsOnGuestList( pChar ))
|
|
{
|
|
pChar.TextMessage( "Ahh, I appear to be on the guest-list of this house!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsOnOwnerList"/>
|
|
<label for="spoiler_method_multi_IsOnOwnerList">IsOnOwnerList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOnOwnerList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the character pChar is on the list of owners of the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
if( iMulti.IsOnOwnerList( pChar ))
|
|
{
|
|
pChar.TextMessage( "Ahh, I appear to be on the owner-list of this house!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsOwner"/>
|
|
<label for="spoiler_method_multi_IsOwner">IsOwner <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsOwner( pUser );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if specified character is the (true) owner of the Multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
if( iMulti.IsOwner( pUser ) )
|
|
{
|
|
pUser.TextMessage( "Yep, I'm the owner of this multi!." );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_IsSecureContainer"/>
|
|
<label for="spoiler_method_multi_IsSecureContainer">IsSecureContainer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsSecureContainer( myTarget );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if specified item is a secure container in the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
|
|
var isSecure = iMulti.IsSecureContainer( myTarget );
|
|
if( iSecure )
|
|
{
|
|
pChar.TextMessage( "Container is secure!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_TurnBoat"/>
|
|
<label for="spoiler_method_multi_TurnBoat">TurnBoat <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool TurnBoat( turnDirection );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Turns boat in specified direction, relative to it's current direction</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>turnDirection can be 0 (go straight), 1 (turn left 90 degrees), 2 (turn right 90 degrees) or 3 (flip boat 180 degrees)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myBoat.TurnBoat( 0 ); // Do nothing
|
|
|
|
myBoat.TurnBoat( 1 ); // Turn 90 degrees left
|
|
|
|
myBoat.TurnBoat( 2 ); // Turn 90 degrees right
|
|
|
|
myBoat.TurnBoat( 3 ); // Flip boat around 180 degrees
|
|
</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_KillKeys"/>
|
|
<label for="spoiler_method_multi_KillKeys">KillKeys <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool KillKeys( [characterSerial] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Deletes ALL keys associated with a multi, or all keys owned by a specific character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pUser.x, pUser.y, pUser.z, pUser.worldnumber );
|
|
// Kill all keys that match house
|
|
iMulti.KillKeys();
|
|
|
|
// Kill all keys for this house owned by pUser
|
|
iMulti.KillKeys( pUser );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_LockDownItem"/>
|
|
<label for="spoiler_method_multi_LockDownItem">LockDownItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool LockDownItem( myTarget );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Locks down targeted item in multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
|
|
iMulti.LockDownItem( myTarget );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_NextChar"/>
|
|
<label for="spoiler_method_multi_NextChar">NextChar <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>CHARACTER NextChar( [charType] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns the next character found in the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<p><strong>See FirstChar() Method</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_ReleaseItem"/>
|
|
<label for="spoiler_method_multi_ReleaseItem">ReleaseItem <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool ReleaseItem( myTarget );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Releases targeted item in multi from lockdown</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
|
|
iMulti.ReleaseItem( myTarget );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_RemoveFromBanList"/>
|
|
<label for="spoiler_method_multi_RemoveFromBanList">RemoveFromBanList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool RemoveFromBanList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes pChar from the multi's ban list. Returns true on correct parameters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Yay! I've been removed from the ban-list of this house!" );
|
|
iMulti.RemoveFromBanList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_RemoveFromFriendList"/>
|
|
<label for="spoiler_method_multi_RemoveFromFriendList">RemoveFromFriendList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool RemoveFromFriendList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes pChar from the multi's friend list. Returns true on correct parameters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Zoinks! I am being removed as a friend of this house!" );
|
|
iMulti.RemoveFromFriendList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_RemoveFromGuestList"/>
|
|
<label for="spoiler_method_multi_RemoveFromGuestList">RemoveFromGuestList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool RemoveFromGuestList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p> Removes pChar from the multi's guest list. Returns true on correct parameters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Oops! I am being removed as a guest of this house!" );
|
|
iMulti.RemoveFromGuestList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_RemoveFromOwnerList"/>
|
|
<label for="spoiler_method_multi_RemoveFromOwnerList">RemoveFromOwnerList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool RemoveFromOwnerList( pChar );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes pChar from the multi's owner list. Returns true on correct parameters.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( pChar.x, pChar.y, pChar.z, pChar.worldnumber );
|
|
pChar.TextMessage( "Oops! I am being removed as owner of this house!" );
|
|
iMulti.RemoveFromOwnerList( pChar );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_RemoveTrashCont"/>
|
|
<label for="spoiler_method_multi_RemoveTrashCont">RemoveTrashCont <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool RemoveTrashCont( trashContObj );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Remove trash container from multi's list of trash containers</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( trashContObj.x, trashContObj.y, trashContObj.z, trashContObj.worldnumber );
|
|
iMulti.RemoveTrashCont( trashContObj );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_SecureContainer"/>
|
|
<label for="spoiler_method_multi_SecureContainer">SecureContainer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool SecureContainer( myTarget );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Turns specified container into a secure container in the Multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
|
|
}
|
|
iMulti.SecureContainer( myTarget );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_multi_UnsecureContainer"/>
|
|
<label for="spoiler_method_multi_UnsecureContainer">UnsecureContainer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool UnsecureContainer( myTarget );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Turns specified secure container into a regular container in the Multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var iMulti = FindMulti( myTarget.x, myTarget.y, myTarget.z, myTarget.worldnumber );
|
|
iMulti.UnsecureContainer( myTarget );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsPacket" id="methodsPacket"><span>Packet Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Before any Packet methods can be used, you need to instantiate a new Packet object:</p>
|
|
<pre><code class="language-javascript">var myPacket = new Packet();</code></pre>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_Packet"/>
|
|
<label for="spoiler_method_packet_Packet">Packet <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>PacketStream Packet();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Prepares a new packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Prepare a new packet stream
|
|
var myPacket = new Packet();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_ReserveSize"/>
|
|
<label for="spoiler_method_packet_ReserveSize">ReserveSize <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void ReserveSize( packetSize );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Reserves a specific size for the packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Prepare a new packet stream
|
|
var myPacket = new Packet();
|
|
|
|
// Reserve a size of 7 bytes for myPacket
|
|
myPacket.ReserveSize( 7 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_WriteByte"/>
|
|
<label for="spoiler_method_packet_WriteByte">WriteByte <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WriteByte( position, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Writes a single byte at the specified position in the packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// In byte-position 0 of a myPacket, write the value 0x73 as a Byte
|
|
myPacket.WriteByte( 0, 0x73 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_WriteShort"/>
|
|
<label for="spoiler_method_packet_WriteShort">WriteShort <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WriteShort( position, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Writes two bytes at the specified position in the packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// In byte-position 1 of myPacket, write the value 0x02 as a Short
|
|
myPacket.WriteShort( 1, 0x02 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_WriteLong"/>
|
|
<label for="spoiler_method_packet_WriteLong">WriteLong <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WriteLong( position, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Writes four bytes at the specified position in the packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// In byte-position 3 of myPacket, write the serial of mChar as a Long
|
|
myPacket.WriteLong( 3, mChar.serial );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_packet_WriteString"/>
|
|
<label for="spoiler_method_packet_WriteString">WriteString <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WriteString( position, string );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Writes four bytes at the specified position in the packet stream</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// In byte-position 7 of myPacket, write the specified text as a String, 4 bytes long
|
|
myPacket.WriteString( 7, "Text", 4 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_Send"/>
|
|
<label for="spoiler_method_item_Send">Send <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Send( packet );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Send the specified network-packet to a socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Send myPacket to pSock
|
|
pSock.Send( myPacket );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_item_Free"/>
|
|
<label for="spoiler_method_item_Free">Free <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Free();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Free up the memory used for the packet?</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myPacket.Free();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsParty" id="methodsParty"><span>Party Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_party_Add"/>
|
|
<label for="spoiler_method_party_Add">Add <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Add( playerToAdd );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Add a player to a party</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Create a new Party with leaderChar as party leader
|
|
var myParty = CreateParty( leaderChar );
|
|
|
|
// Add player playerToAdd to the newly created Party
|
|
myParty.Add( playerToAdd );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_party_Remove"/>
|
|
<label for="spoiler_method_party_Remove">Remove <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Remove( playerToRemove );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes player from party</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">myParty.Remove( playerToRemove );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_party_GetMember"/>
|
|
<label for="spoiler_method_party_GetMember">GetMember <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void GetMember( indexPos );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets party member at specified index in list of party members</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch party member at party index slot 3
|
|
var partyMember3 = myParty.GetMember( 3 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsRace" id="methodsRace"><span>Race Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_race_CanWearArmor"/>
|
|
<label for="spoiler_method_race_CanWearArmor">CanWearArmor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool CanWearArmor( armorClass );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Checks if members of race can equip items of specified armorClass</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( pUser.race.CanWearArmor( 1 ))
|
|
{
|
|
pUser.TextMessage( "Woho! My race can wear items of armor class 1!" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_race_IsValidBeardColor"/>
|
|
<label for="spoiler_method_race_IsValidBeardColor">IsValidBeardColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsValidBeardColor( colour );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the beard colour is valid for raceID.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !pTalking.race.IsValidBeardColour( 1 ))
|
|
{
|
|
pTalking.TextMessage( "awww, my beard can't be this colour?" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_race_IsValidHairColor"/>
|
|
<label for="spoiler_method_race_IsValidHairColor">IsValidHairColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsValidHairColor( colour );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the hair colour is valid for raceID.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !pTalking.race.IsValidHairColour( 1 ))
|
|
{
|
|
pTalking.TextMessage( "awww, my hair can't be this colour?" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_race_IsValidSkinColor"/>
|
|
<label for="spoiler_method_race_IsValidSkinColor">IsValidSkinColor <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool IsValidSkinColor( colour );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if the skin colour is valid for raceID.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">if( !pTalking.race.IsValidSkinColour( 1 ))
|
|
{
|
|
pTalking.TextMessage( "awww, my skin can't be this colour?" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsRegion" id="methodsRegion"><span>Region Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_region_AddScriptTrigger"/>
|
|
<label for="spoiler_method_region_AddScriptTrigger">AddScriptTrigger <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void AddScriptTrigger( scriptID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Adds a scriptTrigger to a (town-)region's list of scriptTriggers.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>See also: <strong>onEnterRegion()/onLeaveRegion()</strong> events.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to region pUser is in
|
|
var myRegion = pUser.region;
|
|
|
|
// Adds hypothetical script with ID 16003 to region
|
|
myRegion.AddScriptTrigger( 16003 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_region_GetOrePref"/>
|
|
<label for="spoiler_method_region_GetOrePref">GetOrePref <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>array GetOrePref( oreType );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Gets ore preference data for ore type from town region..</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Returned as array containing the following data:</p>
|
|
<ul>
|
|
<li>orePrefData
|
|
<ul>
|
|
<li>oreName // name of ore</li>
|
|
<li>color // color of ore</li>
|
|
<li>minskill // min skill to mine ore</li>
|
|
<li>ingotName // name of ingot created from ore</li>
|
|
<li>makemenu // makemenu entry for crafting something from ingot</li>
|
|
<li>oreChance // default global chance of finding this ore type</li>
|
|
<li>scriptID // script attached to mined ore, if any</li>
|
|
</ul>
|
|
</li>
|
|
<li>orePrefChance // chance of finding this ore type in given town region</li>
|
|
</ul>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">See MakeOre() function of js/skill/mining.js for an example of how this is used in practice.</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_region_RemoveScriptTrigger"/>
|
|
<label for="spoiler_method_region_RemoveScriptTrigger">RemoveScriptTrigger <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void RemoveScriptTrigger( scriptID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Removes a scriptTrigger from a (town-)region's list of scriptTriggers.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>See also: <strong>onEnterRegion()/onLeaveRegion()</strong> events.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Fetch reference to region pUser is in
|
|
var myRegion = pUser.region;
|
|
|
|
// Removes hypothetical script with ID 16003 to region
|
|
myRegion.RemoveScriptTrigger( 16003 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsSocket" id="methodsSocket"><span>Socket Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_BuyFrom"/>
|
|
<label for="spoiler_method_socket_BuyFrom">BuyFrom <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void BuyFrom( targNPC );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Brings up the shopkeeper gump or PV backpack for buying for vendor targNPC.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.BuyFrom( myNPC );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_CloseGump"/>
|
|
<label for="spoiler_method_socket_CloseGump">CloseGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CloseGump( gumpID, buttonID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Closes specified gump based on its ID, and provides a button ID response</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">
|
|
// Store a reference to this script's scriptID
|
|
var scriptID = 8000;
|
|
|
|
// Close gump opened via this script (by default, gumps are assigned a gumpID based on script ID + 0xffff)
|
|
mySocket.CloseGump( scriptID + 0xffff, 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_customTarget"/>
|
|
<label for="spoiler_method_socket_customTarget">CustomTarget <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void CustomTarget( targetNum, toSay )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Very similar to PopUpTarget. It's a callback situation instead. targetNum must be between 0 and 255. Character associated with Socket says toSay, and is shown a cursor. Re-enters the script associated with the socket's player (i.e. player who gets the cursor). Enters function name based on the value of tNum. if tNum is 0, then the function would be onCallback0. Prototype of callback is:<br>
|
|
function onCallback0( pSock, myTarget )</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// User double-clicks an item, which brings up a custom target cursor
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
pUser.socket.CustomTarget( 0, "Select your custom target:" );
|
|
}
|
|
|
|
// After player targets something, onCallback0 is called
|
|
function onCallback0( pSock, myTarget )
|
|
{
|
|
// ... do something with target here
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_Disconnect"/>
|
|
<label for="spoiler_method_socket_Disconnect">Disconnect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Disconnect();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Disconnects specified client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.Disconnect();</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_DisplayDamage"/>
|
|
<label for="spoiler_method_socket_DisplayDamage">DisplayDamage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void DisplayDamage( pUser, damage );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Displays specified damage value over character's head</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">socket.DisplayDamage( pUser, 15 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_FinishedTriggerWords"/>
|
|
<label for="spoiler_method_socket_FinishedTriggerWords">FinishedTriggerWords <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>bool FinishedTriggerWords();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns true if finished all trigger words in the socket's list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<p><strong>See FirstTriggerWord() Method</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_FirstTriggerWord"/>
|
|
<label for="spoiler_method_socket_FirstTriggerWord">FirstTriggerWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int FirstTriggerWord();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns first trigger word in the socket's list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Example from Banker NPC AI script in UOX3/js/npc/ai/banker.js
|
|
// ...
|
|
var trigWordHandled = false;
|
|
|
|
// Iterate through all trigger words currently active on socket
|
|
for( var trigWord = pSock.FirstTriggerWord(); !pSock.FinishedTriggerWords(); trigWord = pSock.NextTriggerWord() )
|
|
{
|
|
if( trigWordHandled )
|
|
break;
|
|
|
|
switch( trigWord )
|
|
{
|
|
case 0: // Withdraw
|
|
WithdrawFromBank( pSock, pTalking, pTalkingTo, bankBox, strSaid );
|
|
trigWordHandled = true;
|
|
break;
|
|
case 1: // Balance, Statement
|
|
CheckBalance( pSock, pTalking, pTalkingTo, bankBox );
|
|
trigWordHandled = true;
|
|
break;
|
|
case 2: // Bank
|
|
OpenBank( pSock, pTalking, pTalkingTo, bankBox );
|
|
trigWordHandled = true;
|
|
break;
|
|
case 3: // Check
|
|
CreateCheck( pSock, pTalking, pTalkingTo, bankBox, strSaid );
|
|
trigWordHandled = true;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetByteSetByte"/>
|
|
<label for="spoiler_method_socket_GetByteSetByte">GetByte/SetByte <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetByte( offset );</em></p>
|
|
<p><em>void SetByte( offset, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set a byte from a socket at offset, positive value assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get value of byte 0
|
|
var byte0 = sock.GetByte( 0 );
|
|
|
|
// Set byte 1 to value 64
|
|
sock.SetByte( 1, 64 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetSByte"/>
|
|
<label for="spoiler_method_socket_GetSByte">GetSByte <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSByte( offset );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Return a byte from a socket at offset, negative value accepted</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var byte0 = sock.GetSByte( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetWordSetWord"/>
|
|
<label for="spoiler_method_socket_GetWordSetWord">GetWord/SetWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetWord( offset );</em></p>
|
|
<p><em>void SetWord( offset, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set 2 bytes of data from socket at offset, positive value assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var word0 = sock.GetWord( 0 );
|
|
sock.SetWord( 1, 0x0164 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetSWord"/>
|
|
<label for="spoiler_method_socket_GetSWord">GetSWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSWord( offset );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Return 2 bytes of data from socket at offset, negative value assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var sWord0 = sock.GetSWord( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetDWordSetDWord"/>
|
|
<label for="spoiler_method_socket_GetDWordSetDWord">GetDWord/SetDWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetDWord( offset );</em></p>
|
|
<p><em>void SetDWord( offset, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set 4 bytes of data from socket at offset, positive value assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var dWord0 = sock.GetDWord( 0 );
|
|
sock.SetDWord( 1, 0x01640164 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetSDWord"/>
|
|
<label for="spoiler_method_socket_GetSDWord">GetSDWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetSDWord( offset );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Return 4 bytes of data from socket at offset, negative value assumed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var dWord0 = sock.GetSDWord( 0 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_GetStringSetString"/>
|
|
<label for="spoiler_method_socket_GetStringSetString">GetString/SetString <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>string GetString( offset[, len] );</em></p>
|
|
<p><em>void SetString( offset, value );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Return a string from a socket at offset with optional length len. If length is not provided, reads until next null terminator</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">var sName = sock.GetString( 0 );
|
|
sock.SetString( 0, "myText!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_getTimerSetTimer"/>
|
|
<label for="spoiler_method_socket_getTimerSetTimer">GetTimer/SetTimer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int GetTimer( timerID )</em></p>
|
|
<p><em>int SetTimer( timerID, numMilliSeconds )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Get/Set the time in milliseconds until specified timer expires for a Socket object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>Supported timerIDs for Sockets
|
|
<pre><code class="language-javascript">Timer.SOCK_SKILLDELAY // Time until player can use another skill
|
|
Timer.SOCK_OBJDELAY // Time until player can use another item
|
|
Timer.SOCK_SPIRITSPEAK // Time until Spirit Speak effect wears off
|
|
Timer.SOCK_TRACKING // Time until next time player can track
|
|
Timer.SOCK_FISHING // Time until next time player can fish
|
|
Timer.SOCK_MUTETIME // Time until character is no longer muted
|
|
Timer.SOCK_TRACKINGDISPLAY // Time until next time tracking arrow updates
|
|
Timer.SOCK_TRAFFICWARDEN // Time until next time traffic warden resets</code></pre></p>
|
|
<p>Also see <strong>GetTimer()/SetTimer()</strong> Character Methods.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get timestamp for when player can next use an object, and spit out remaining time in milliseconds
|
|
var objectDelayTimestamp = mySock.GetTimer( Timer.SOCK_OBJDELAY );
|
|
myChar.TextMessage(( objectDelayTimestamp - GetCurrentClock() ).toString() );
|
|
|
|
// Set time from now in milliseconds until next time player can use another item
|
|
mySock.SetTimer( timer.SOCK_OBJDELAY, 3000 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_Music"/>
|
|
<label for="spoiler_method_socket_Music">Music <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void Music( musicNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays the specified music for socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.Music( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_NextTriggerWord"/>
|
|
<label for="spoiler_method_socket_NextTriggerWord">NextTriggerWord <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int NextTriggerWord();</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns next trigger word in the socket's list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<p><strong>See FirstTriggerWord() Method</strong></p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_OpenContainer"/>
|
|
<label for="spoiler_method_socket_OpenContainer">OpenContainer <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenContainer( iCont );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens specified container (iCont) for socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.OpenContainer( myNPC.pack );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_OpenGump"/>
|
|
<label for="spoiler_method_socket_OpenGump">OpenGump <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenGump( gumpMenuID );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens specified gumpmenu from dfndata\misc\gumps.dfn for socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.OpenGump( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_OpenURL"/>
|
|
<label for="spoiler_method_socket_OpenURL">OpenURL <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void OpenURL( UrlString );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Opens a specified URL in player's default browser</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.OpenURL( "https://www.uox3.org" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_popupTarget"/>
|
|
<label for="spoiler_method_socket_popupTarget">PopupTarget <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void PopUpTarget( tNum, toSay )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Provides a call to hard-coded targeting cursors.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>tNum must be between 0 and 255 inclusive. Says toSay, and shows a cursor. Note that some of these might depend on factors in code to actually work, and might not have much effect when ran through a script - or could grant access to functionality that a player would normally not have access to.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Can be used with a socket object
|
|
myChar.socket.PopUpTarget( 1, "Where do you wish to teleport to?" );</code></pre>
|
|
</div>
|
|
<input type="checkbox" id="spoiler_socket_popuptarget_list"/>
|
|
<label for="spoiler_socket_popuptarget_list">List of Popup Target IDs <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p><span class="hl">1</span> - TELEPORT (teleports character to target location)<br>
|
|
<span class="hl">2</span> - DYE (will reset targeted item to default colour)<br>
|
|
<span class="hl">4</span> - REPAIRMETAL (Targeted metal item will be repaired. Checks Blacksmithing skill)<br>
|
|
<span class="hl">5</span> - DYEALL (used to give color to dyetubs)<br>
|
|
<span class="hl">6</span> - DVAT (Used for dying objects with the colour of the used dye tub)<br>
|
|
<span class="hl">9</span> - ITEMID (Select item to identify. Checks Item Identification skill)<br>
|
|
<span class="hl">10</span> - FISH (Select fishing location. Checks Fishing skill)<br>
|
|
<span class="hl">11</span> - INFO (Get info on targeted tile)<br>
|
|
<span class="hl">13</span> - SMITH (Blacksmithing skill usage via tools)<br>
|
|
<span class="hl">14</span> - MINE (Mining skill usage via tools)<br>
|
|
<span class="hl">15</span> - SMELTORE (Ore smelting targeting cursor)<br>
|
|
<span class="hl">16</span> - WSTATS (Show wander/movement details for targeted NPC)<br>
|
|
<span class="hl">17</span> - NPCRESURRECT (Used by NPC healers to resurrect dead players. In this context only works if target is identical to popuptarget user. Self-resurrection item?)<br>
|
|
<strong>(To be continued)</strong>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_ReadBytes"/>
|
|
<label for="spoiler_method_socket_ReadBytes">ReadBytes <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>int ReadBytes( byteCount );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Reads byteCount bytes from socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">sock.ReadBytes( 12 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_SellTo"/>
|
|
<label for="spoiler_method_socket_SellTo">SellTo <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SellTo( targNPC );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Brings up the shopkeeper gump for selling to a vendor targNPC.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.SellTo( myNPC );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_SendAddMenu"/>
|
|
<label for="spoiler_method_socket_SendAddMenu">SendAddMenu <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SendAddMenu( menuNum );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Send the Add-menu to the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">socket.SendAddMenu( 1 );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_SoundEffect"/>
|
|
<label for="spoiler_method_socket_SoundEffect">SoundEffect <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SoundEffect( soundID, bAllHear );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Plays a sound originating from character associated with Socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>SoundID is the ID of the sound to play. If bAllHear is true, then everyone nearby hears it. If it's false, then only the Character associated with the Socket hears it.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Play sound effect originating from character associated with the socket, which only that character can hear
|
|
socket.SoundEffect( 568, false );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_SysMessage"/>
|
|
<label for="spoiler_method_socket_SysMessage">SysMessage <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void SysMessage( [msgColor,] string message, ... );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends a string as a system message. Accepts up to 10 additional arguments which can be injected into the string as needed. Text colour can also be provided as an optional parameter prior to the string itself</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">socket.SysMessage( "Isn't the world great?" );
|
|
socket.SysMessage( GetDictionaryEntry(388), myNPC.name ); // Hello sir! My name is %s and I will be working for you.
|
|
socket.SysMessage( 0x42, "This message has a different color!" );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_socket_WhoList"/>
|
|
<label for="spoiler_method_socket_WhoList">WhoList <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void WhoList( [bSendOnList] );</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Sends a list to client with all players currently online (if true parameter is provided) or offline (if no parameter or false is provided)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">mySock.WhoList( true );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#methodsSpawnRegion" id="methodsSpawnRegion"><span>SpawnRegion Methods</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_spawnregion_getspawnregion"/>
|
|
<label for="spoiler_method_spawnregion_getspawnregion">GetSpawnRegion <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void GetSpawnRegion( spawnRegionNum )</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns SpawnRegion object for specified spawnRegionNum</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Return SpawnRegion object for spawn region #1 from spawns.dfn
|
|
var spawnRegion = GetSpawnRegion( i );
|
|
|
|
// Have character object pUser say the name of the spawnRegion
|
|
pUser.TextMessage( "The name of this SpawnRegion is: " + spawnRegion.name );</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_spawnregion_getspawnregioncount"/>
|
|
<label for="spoiler_method_spawnregion_getspawnregioncount">GetSpawnRegionCount <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void GetSpawnRegionCount()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Returns amount of SpawnRegions that exist</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Get total number of spawn regions
|
|
var spawnRegionCount = GetSpawnRegionCount();
|
|
pUser.TextMessage( "There are " + spawnRegionCount + " SpawnRegions on this server!" );
|
|
|
|
// Loop through all the spawn regions and print name of each one in UOX3 console
|
|
var spawnRegion;
|
|
for( var i = 0; i < spawnRegionCount; i++ )
|
|
{
|
|
spawnRegion = GetSpawnRegion( i );
|
|
Console.Print( "SpawnRegion Name: " + spawnRegion.name + "\n" );
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="spoilerWrapper">
|
|
<input type="checkbox" id="spoiler_method_spawnregion_iterateoverspawnregions"/>
|
|
<label for="spoiler_method_spawnregion_iterateoverspawnregions">IterateOverSpawnRegions <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Prototype</span></p>
|
|
<p><em>void IterateOverSpawnRegions()</em></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Purpose</span></p>
|
|
<p>Iterates over all SpawnRegions on the server.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Notes</span></p>
|
|
<p>For every object it comes across, the iterator will call onIterateSpawnRegions( SpawnRegionObject ) in the calling script.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">Example of usage</span></p>
|
|
<pre><code class="language-javascript">// Iterate over all spawn regions and count how many times the iterate function returned true
|
|
var count = IterateOverSpawnRegions();
|
|
|
|
// This function runs once per spawn region
|
|
function onIterateSpawnRegions( toCheck )
|
|
{
|
|
Console.Print( "Spawn Region Number: " + toCheck.regionNum + "\n" );
|
|
Console.Print( "Spawn Region Name: " + toCheck.name + "\n" );
|
|
Console.Print( "Spawn Region World: " + toCheck.world + "\n" );
|
|
return true;
|
|
}</code></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
</ul> <!-- cd-faq__group -->
|
|
|
|
<ul id="properties" class="cd-faq__group">
|
|
<li id="propertiesHeader" class="cd-faq__title title-jsdoc"><h1>JS Object Properties</h1><div id="filterInputProperties" contenteditable="true" placeholder="(Filter)" style="float:right; margin-top: -40px; margin-right: 10px; background-color: #fff; padding: 5px; width: 200px"></div></li>
|
|
|
|
<li class="cd-faq__item" id="accountsDiv">
|
|
<a class="cd-faq__trigger" href="#propAccounts" id="propAccounts"><span>Account Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>References to Account objects can be gotten from a player Character's .account property (or a Socket .account property). Example
|
|
<pre><code class="language-javascript">// Fetch reference to a player's Account object
|
|
var myAccount = myChar.account;
|
|
|
|
// Fetch username of Account
|
|
var myAccountName = myAccount.username;
|
|
</code></pre></p>
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isBanned</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account is banned</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isCounselor</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account is marked as a Counselor account</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGM</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account is marked as a GM account</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isOnline</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether someone is logged in to the Account</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPublic</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account info (contact/comment) can be considered public info</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSeer</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account is marked as a Seer account</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot1Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 1 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot2Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 2 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot3Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 3 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot4Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 4 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot5Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 5 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot6Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 6 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSlot7Blocked</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether slot 7 on Account is blocked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSuspended</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Account is suspended</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isYoung</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player account is considered Young</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.unused10</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set the unused10 flag. Currently unused</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.flags</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get flags set on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.timeban</span> <strong>(int, <em>0 - 999999</em>)</strong><br>
|
|
Get/Set how long player is banned for, in minutes</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.firstLogin</span> <strong>(int, <em>0 - 999999</em>)</strong><br>
|
|
Get a timestamp for when the account receives its first login, in minutes (since epoch)</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(int)</strong><br>
|
|
Get ID for Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lastIP</span> <strong>(int)</strong><br>
|
|
Get last IP that was used to login with Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.totalPlayTime</span> <strong>(int, 0 - 4294967295)</strong><br>
|
|
Get total combined playtime across all characters on account (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character1</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 1 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character2</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 2 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character3</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 3 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character4</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 4 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character5</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 5 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character6</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 6 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.character7</span> <strong>(object)</strong><br>
|
|
Get JS Object for character in slot 7 on Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.currentChar</span> <strong>(object)</strong><br>
|
|
Get JS Object for character currently logged in on Account (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.comment</span> <strong>(text, <em>max 200 characters</em>)</strong><br>
|
|
Get/Set Contact info/comment for Account</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.username</span> <strong>(text, <em>max 200 characters</em>)</strong><br>
|
|
Get username for Account (Read-Only)</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propCharacters" id="propCharacters"><span>Character Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.allmove</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether this character can move items set as immovable</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.attackFirst</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character attacked first</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.atWar</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is in war mode</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canAttack</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character can attack other characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canBroadcast</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character can broadcast messages to other players by yelling</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canRun</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character (NPCs only) can run</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canSnoop</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character can snoop in backpacks of other characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.createdOn</span> <strong>(int, <em>0 - 999999</em>)</strong><br>
|
|
Get a timestamp for when a player character was created, in minutes (since epoch)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.criminal</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether the character is flagged as a criminal. If set to true, default criminal timer is applied, as defined in the uox.ini setting CRIMINALTIMER. Can override with .SetTimer( Timer.CRIMFLAG, timeInMilliseconds ) <em>after</em> flag has already been set to true.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.dead</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is dead (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.frozen</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is frozen on the spot, unable to move</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hideFameKarmaTitle</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether fame/karma titles should show for character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hireling</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether NPC can be hired as a hireling</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.houseIcons</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player should see house icons instead of multis</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.innocent</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is flagged as innocent. If set to false, default criminal timer is applied, as defined in the uox.ini setting CRIMINALTIMER.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isAwake</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether the character (NPC only) is marked as permanently awake or not. If true, NPC is always active regardless of the active status of the region it's in (which can be deactivated based on lack of player activity)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isAnimal</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is flagged as an animal via creatures.dfn tag ANIMAL(Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isCasting</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is casting a spell</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isChar</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is a character (always returns true for Characters) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isCounselor</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player has Counselor privileges</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDisguised</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set character is disguised</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDispellable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether (NPC) character can be dispelled by the Dispel spell</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isflying</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is flying (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGM</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player has GM privileges</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGMPageable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player can see and respond to GM pages</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGuarded</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is guarded</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isHuman</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is flagged as a human via creatures.dfn tag HUMAN (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isIncognito</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is incognito</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isItem</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is an item (always returns false for Characters) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isJailed</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether player is jailed (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isMeditating</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is meditating (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isonhorse</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is mounted (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPackAnimal</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is flagged as a pack-animal via creatures.dfn tag PACKANIMAL (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPolymorphed</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether player is polymorphed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isRunning</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is running (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isShop</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether (NPC) character is a shopkeeper</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSpawner</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is a spawner (always returns false for Characters) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isUsingPotion</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is using a potion</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.magicReflect</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether magic reflection is active for the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mounted</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is mounted</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.murderer</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is flagged as a murderer</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.neutral</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is flagged as neutral</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.noNeedMana</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character needs mana to cast spells</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.noNeedReags</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character needs magical reagents to cast spells</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.noSkillTitles</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether skill titles show for the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.npc</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether character is an NPC (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.online</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether (player) character is online (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.partyLootable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether (player) character is lootable by party members upon death</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.permanentMagicReflect</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether permanent magic reflection is active for the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.singClickSer</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether single-clicking objects show their serial above the name</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.squelch</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is muted</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.stabled</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether (NPC) creature is stabled</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tamed</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether (NPC) character is tame</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.trainer</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/set whether (NPC) character can train players in skills they know</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.vulnerable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character is vulnerable to damage/being attacked</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.willhunger</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character will grow more hungry over time</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.willthirst</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character will grow more thirsty over time</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.shouldSave</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether character should be saved in worldfiles. If false, character will not be saved and will be gone after the next server restart</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.colour</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the color/hue of the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.direction</span> <strong>(hex, <em>0x0 - 0x7</em>)</strong><br>
|
|
Get/Set the direction the character is facing</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.emoteColour</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set colour of the character's emote speech</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.flag</span> <strong>(hex, <em>0x1 - 0x8</em>)</strong><br>
|
|
Get/Set NPC flag (0x1 = murderer, 0x2 = criminal, 0x4 = innocent, 0x8 = neutral)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the character's current body ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.nextAct</span> <strong>(hex, <em>0x0 - 0xff</em>)</strong><br>
|
|
Get/Set the next spellcasting action character is going to do</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.orgID</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the character's original body ID</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.orgSkin</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the character's original skin (colour)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.priv</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the character's special privileges (if any) as a 16-bit bit-field. Combine values to set multiple privs. Supported privs:
|
|
<ul>
|
|
<li>0x1 - GM (Character is a GM)</li>
|
|
<li>0x2 - Broadcast (Character can broadcast globally on server)</li>
|
|
<li>0x4 - Invulnerable (Character is invulnerable to damage?)</li>
|
|
<li>0x8 - SingleClickSerial (Show character serials on single click/all-names)</li>
|
|
<li>0x10 - Show Skill Titles (Show skill titles in paperdoll)</li>
|
|
<li>0x20 - GM Pageable (Character can answer GM Pages from players)</li>
|
|
<li>0x40 - Snoop Freely (Character can snoop freely in backpacks independent of snooping skill)</li>
|
|
<li>0x80 - Counselor (Character is a Counselor)</li>
|
|
<li>0x100 - AllMove (Character can move any dynamic item)</li>
|
|
<li>0x200 - Frozen (Character is frozen and cannot move)</li>
|
|
<li>0x400 - ViewHouseAsIcon (Character views multis as item deeds instead of multis)</li>
|
|
<li>0x800 - NoNeedMana (Character doesn't need mana to cast spells)</li>
|
|
<li>0x1000 - Dispellable (Character can be dispelled by the Dispel spell)</li>
|
|
<li>0x2000 - TempReflected (Character has a temporary magic reflection spell active)</li>
|
|
<li>0x4000 - NoNeedReags (Character doesn't need reagents to cast spells)</li>
|
|
<li>0x8000 - PermReflected (Character has a permanent magic reflection spell active)</li>
|
|
<li>0x10000 - HideFameKarmaTitle (No fame/karma titles shown for character)</li>
|
|
<li>0x20000 - Seer (Character is a Seer)</li>
|
|
</ul></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sayColour</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the colour/hue of the character's regular speech</p>
|
|
</div>
|
|
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.accountNum</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get the account number the character belongs to</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.actualDexterity</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get the base dexterity stat for character, excluding any mods, bonuses etc. (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.actualIntelligence</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get the base intelligence stat for character, excluding any mods, bonuses etc. (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.actualStrength</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get the base strength stat for character, excluding any mods, bonuses etc. (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.aitype</span> <strong>(int, <em>0 - 666</em>)</strong><br>
|
|
Get/Set the AI Type for NPCs<br>
|
|
See <a href="index.html#uox3NPCAI" title="UOX3 Docs - NPC AI" target="_blank">UOX3 Documentation section on NPC AI</a> for details on available AIs and what they do.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.attack</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get a randomized attack value for the character based on their skills, stats and equipment (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.attacker</span> <strong>(object)</strong><br>
|
|
Get/Set the character currently attacking this character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.brkPeaceChance</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Chance of character affected by peacemaking will break out of peace state</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.cell</span> <strong>(int, <em>0 - 127</em>)</strong><br>
|
|
Get/Set the jail cell number of the character (if any)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.commandlevel</span> <strong>(int)</strong><br>
|
|
Get/Set the command-level of the character. Default command-levels, as setup in dfndata/commands/commands.dfn: 0 = Player, 1 = Counselor, 2 = GM, 5 = Admin</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.controlSlots</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the total number of pet control slots available to the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.controlSlotsUsed</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the number of pet control slots currently in use by the character's pets</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.deaths</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the total number of deaths of a player character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.dexterity</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set the character's dexterity stat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fame</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set the character's fame level</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fleeAt</span> <strong>(int, <em>0 - 100</em>)</strong><br>
|
|
Get/Set percentage health threshold the NPC will flee at in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fontType</span> <strong>(int, <em>0 - 12</em>)</strong><br>
|
|
Get/Set font type used by character's speech (0-9 ASCII, 0-12 Unicode)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fx1</span> <strong>(int)</strong><br>
|
|
Get/Set FX1 coordinate of a character's wander area. See <a href="index.html#npcMovement" title="UOX3 Docs - NPC Movement and Pathfinding">NPC Movement and Pathfinding</a> in UOX3 Docs for details on how these are setup for different NPC wander types.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fy1</span> <strong>(int)</strong><br>
|
|
Get/Set FY1 coordinate of a character's wander area. See <a href="index.html#npcMovement" title="UOX3 Docs - NPC Movement and Pathfinding">NPC Movement and Pathfinding</a> in UOX3 Docs for details on how these are setup for different NPC wander types.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fx2</span> <strong>(int)</strong><br>
|
|
Get/Set FX2 coordinate of a character's wander area. See <a href="index.html#npcMovement" title="UOX3 Docs - NPC Movement and Pathfinding">NPC Movement and Pathfinding</a> in UOX3 Docs for details on how these are setup for different NPC wander types.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fy2</span> <strong>(int)</strong><br>
|
|
Get/Set FY2 coordinate of a character's wander area. See <a href="index.html#npcMovement" title="UOX3 Docs - NPC Movement and Pathfinding">NPC Movement and Pathfinding</a> in UOX3 Docs for details on how these are setup for different NPC wander types.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fz</span> <strong>(int)</strong><br>
|
|
Get/Set FZ coordinate of a character's wander area. See <a href="index.html#npcMovement" title="UOX3 Docs - NPC Movement and Pathfinding">NPC Movement and Pathfinding</a> in UOX3 Docs for details on how these are setup for different NPC wander types.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.gender</span> <strong>(int, <em>0 - 1</em>)</strong><br>
|
|
Get/Set gender of character. 0 = male, 1 = female</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.health</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set character's current health/hitpoints (cannot exceed value of maxhp property)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.healthRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set character's inherent health regeneration bonus, which affects passive health regeneration. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hidamage</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set highest damage character can deal in combat with wrestling/unarmed attacks (randomized between lodamage and hidamage)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.housesCoOwned</span> <strong>(int, <em>0 - 999</em>)</strong><br>
|
|
Get number of houses co-owned by character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.housesOwned</span> <strong>(int, <em>0 - 999</em>)</strong><br>
|
|
Get number of houses owned by character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hunger</span> <strong>(int, <em>0 - 6</em>)</strong><br>
|
|
Get/Set character's hunger status (0 - 6, where 0 is max hungry and 6 is max full. At 0, characters may start take hunger damage depending on server settings)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hungerRate</span> <strong>(int)</strong><br>
|
|
Get character's hunger rate, which determines how quickly (in seconds) they grow more hungry. This is either defined by the hunger DFN tag (<span class="hl">hunger=hungerRate,hungerDamage</span>) specified for the character's Race, or if that is not set (or set to 0), by the global hunger rate specified in uox.ini under the <span class="hl">HUNGERRATE</span> setting (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hungerWildChance</span> <strong>(int, <em>0 - 100</em>)</strong><br>
|
|
Get/Set chance for an extremely hungry pet to go wild with every NPC AI loop</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.instanceID</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set ID of instance of world that item exists in. Objects in different instances will not be able to interact with one another</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.intelligence</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set intelligence attribute of character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.karma</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set character's current karma level</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lastOnSecs</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Gets timestamp (in seconds since Unix epoch) for when player was last online (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lightlevel</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Get/Set character's fixed light level. Use value of 255 to disable fixed light level and start using global lightlevel again.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lodamage</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set lowest damage character can deal in combat with wrestling/unarmed attacks (randomized between lodamage and hidamage)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.loyalty</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the current loyalty of the NPC</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.loyaltyRate</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get the global royalty rate from UOX.INI. This is the amount of seconds between each time an NPC loses 1 loyalty (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mana</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set character's current mana</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.manaRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set character's inherent mana regeneration bonus, which affects passive mana regeneration. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxhp</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set character's maximum health</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxLoyalty</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the maximum loyalty of an NPC</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxmana</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set character's maximum mana</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxstamina</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set character's maximum stamina</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.murdercount</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set number of players character has killed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.npcFlag</span> <strong>(int, <em>0 - 2</em>)</strong><br>
|
|
Get/Set (NPC) character's flag (0 = neutral (grey), 1 = innocent (blue), 2 = evil (red))</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldWandertype</span> <strong>(int, <em>0 - 7</em>)</strong><br>
|
|
Get/Set character's old wandertype, usually set by code</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldX</span> <strong>(int, <em>0 - 7</em>)</strong><br>
|
|
Get/Set the previous X coordinate of character (usually set by code when character moves)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldY</span> <strong>(int, <em>0 - 7</em>)</strong><br>
|
|
Get/Set the previous Y coordinate of character (usually set by code when character moves)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldZ</span> <strong>(int, <em>0 - 7</em>)</strong><br>
|
|
Get/Set the previous Z coordinate of character (usually set by code when character moves)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.orneriness</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set a pet's orneriness level - i.e. the difficulty of controlling the pet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ownedItemsCount</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get number of items player owns (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ownerCount</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Get the total number of owners a pet/follower has had (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pathTargX</span> <strong>(int, <em>0 - 7168</em>)</strong><br>
|
|
Current NPC pathfinding target, X coordinate</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pathTargY</span> <strong>(int, <em>0 - 4096</em>)</strong><br>
|
|
Current NPC pathfinding target, Y coordinate</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.petCount</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get number of pets owned by character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.playTime</span> <strong>(int, <em>0 - 4294967295</em>)</strong><br>
|
|
Get total playtime on given character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poison</span> <strong>(int, <em>0 - 5</em>)</strong><br>
|
|
Get/Set character's current poisoned state</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poisonedBy</span> <strong>(int)</strong><br>
|
|
Get/Set serial of character who applied poison to character. Set to 0xFFFFFFFF/SE_INVALIDSERIAL() to clear.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poisonStrength</span> <strong>(int, <em>0 - 5</em>)</strong><br>
|
|
Get/Set the poison strength of the character, used to poison other characters in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.raceGate</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set ID of Race for which character has used a Race Gate, if any</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.reAttackAt</span> <strong>(int, <em>0 - 100</em>)</strong><br>
|
|
Get/Set percentage health threshold the NPC will re-attack current target in combat at</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.serial</span> <strong>(int, <em>0 - 4294967295</em>)</strong><br>
|
|
Get/Set unique serial for the character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.setPeace</span> <strong>(int, <em>0 - 4294967295</em>)</strong><br>
|
|
Set number of seconds that character will be forced into "peace" mode, unable to attack anyone in combat (Write-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scripttrigger</span> <strong>(int)</strong><br>
|
|
(Legacy property for backwards compatibility) Get/Set a scriptID associated with the character. When using this to set a new scriptID, all other scriptIDs are cleared from the character. When getting the scriptID, the last scriptID in the character's list of scriptIDs are returned. To get/set multiple scriptIDs for a character, see .scriptTriggers property and/or AddScriptTrigger() Method.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillToPeace</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set peacemaking skill required to successfully pacify this NPC (1000 = 100.0 skillpoints)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillToProv</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set provocation skill required to successfully provoke this NPC (1000 = 100.0 skillpoints)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillToTame</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set animal taming skill required to successfully tame this NPC (1000 = 100.0 skillpoints)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.spattack</span> <strong>(int, <em>1 - 8</em>)</strong><br>
|
|
Get/Set maximum spell circle from which (NPC) character will cast spells in combat. See <a href="index.html#spellcastingNPCs" target="_blank" title="UOX3 Documentation - Spellcasting NPCs">Spellcasting NPCs in UOX3 Documentation</a> for more details</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.spdelay</span> <strong>(int, <em>0 - 127</em>)</strong><br>
|
|
Get/Set the minimum delay in seconds between each time the (NPC) character will cast spells in combat. See <a href="index.html#spellcastingNPCs" target="_blank" title="UOX3 Documentation - Spellcasting NPCs">Spellcasting NPCs in UOX3 Documentation</a> for more details</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.spellCast</span> <strong>(int)</strong><br>
|
|
Get spell currently being cast by character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.split</span> <strong>(int, <em>0 - 127</em>)</strong><br>
|
|
Get/Set the amount of NPCs a character will split into when hit in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.splitchance</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Get/Set the chance of an NPC splitting into more characters when hit in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.stamina</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set the character's current stamina</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.staminaRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set character's inherent stamina regeneration bonus, which affects passive stamina regeneration. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.stealth</span> <strong>(int, <em>0 - 127</em>)</strong><br>
|
|
Get the number of steps character has taken in stealth (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.strength</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set the character's current strength</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tamedHungerRate</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set rate (in seconds) at which a tamed NPC pet grows hungry, as defined by the NPC DFN tag <span class="hl">tamedhungerrate</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tamedThirstRate</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set rate (in seconds) at which a tamed NPC pet grows thirsty, as defined by the NPC DFN tag <span class="hl">tamedthirstrate</span></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempdex</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set a character's secondary dexterity stat, as set by stuff like bonuses from equipment, spells, via <span class="hl">dexadd</span> Item DFN tag, etc.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempint</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set a character's secondary intelligence stat, as set by stuff like bonuses from equipment, spells, via <span class="hl">intadd</span> Item DFN tag, etc</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempstr</span> <strong>(int, <em>0 - 32737</em>)</strong><br>
|
|
Get/Set a character's secondary strength stat, as set by stuff like bonuses from equipment, spells, via <span class="hl">stradd</span> Item DFN tag, etc</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.thirst</span> <strong>(int, <em>0 - 6</em>)</strong><br>
|
|
Get/Set character's thirst status (0 - 6, where 0 is max thirsty and 6 is max thirst quenched. At 0, characters may start take thirst stamina damage depending on server settings)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.thirstRate</span> <strong>(int)</strong><br>
|
|
Get character's thirst rate, which determines how quickly (in seconds) they grow more thirsty. This is either defined by the thirst DFN tag (<span class="hl">thirst=thirstRate,thirstDamage</span>) specified for the character's Race, or if that is not set (or set to 0), by the global thirst rate specified in uox.ini under the <span class="hl">THIRSTRATE</span> setting (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.thirstWildChance</span> <strong>(int, <em>0 - 100</em>)</strong><br>
|
|
Get/Set chance for an extremely thirsty pet to go wild with every NPC AI loop</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.townPriv</span> <strong>(int, <em>0 - 2</em>)</strong><br>
|
|
Get/Set the privilege a character has with their town (0 = Doesn't belong to a town, 1 = Resident, 2 = Mayor)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.visible</span> <strong>(int, <em>0 - 3</em>)</strong><br>
|
|
Get/Set visibility of character to other players (0 = Visible, 1 = Hidden, 2 = Magically Invisible, 3 = Visible to GMs only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.wandertype</span> <strong>(int, <em>0 - 3</em>)</strong><br>
|
|
Get/Set wandertype for NPC (0 = None, [1 = Follow], 2 = Free, 3 = Box, 4 = Circle, 5 = Frozen, [6 = Flee, 7 = Pathfind]. Types 1, 6 and 7 are set primarily by code)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.weight</span> <strong>(int, <em>0 - 2147483647</em>)</strong><br>
|
|
Get/Set total weight of character (100 = 1.0 stone)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.worldnumber</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Get/Set current world character is in</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.x</span> <strong>(int, <em>0 - 7144</em>)</strong><br>
|
|
Get/Set X coordinate of character in the world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.y</span> <strong>(int, <em>0 - 4095</em>)</strong><br>
|
|
Get/Set Y coordinate of character in the world</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.z</span> <strong>(int, <em>-128 - 127</em>)</strong><br>
|
|
Get/Set Z coordinate of character in the world</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.account</span> <strong>(object)</strong><br>
|
|
Get JS Object reference to Account character belongs to (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.baseskills</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for baseskills (skill without modifiers) that can be used to get/set the value of individual skills using a syntax like .baseskills.alchemy = [0 - 1000] (1000 = 100.0 skillpoints) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.guarding</span> <strong>(object)</strong><br>
|
|
Get/Set the object (item/character) being guarded by this character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.guild</span> <strong>(object)</strong><br>
|
|
Get/Set guild object that character belongs to</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.multi</span> <strong>(object)</strong><br>
|
|
Get/Set multi character is inside (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.owner</span> <strong>(object)</strong><br>
|
|
Get/Set owner of character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pack</span> <strong>(object)</strong><br>
|
|
Get/Set character's root backpack object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.party</span> <strong>(object)</strong><br>
|
|
Get/Set party character is a member of</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.race</span> <strong>(object)</strong><br>
|
|
Get/Set race (player) character belongs to. Currently simulates character going through a race gate - which only works for players!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.region</span> <strong>(object)</strong><br>
|
|
Get/Set region character is in (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scriptTriggers</span> <strong>(object)</strong><br>
|
|
Get a list of scriptIDs associated with the character in the form of a JS object/comma-separated string, or set (add) a scriptID to the character's existing list of scriptIDs. If property sets a NULL value, all scriptIDs are cleared from character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillLock</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for skills that can be used to get/set the skill-lock value of individual skills using a syntax like .skillLock.alchemy = [0/1/2] (0 = increase, 1 = decrease, 2 = locked) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skills</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for skills that can be used to get/set the value of individual skills using a syntax like .skills.alchemy = [0 - 1000] (1000 = 100.0 skillpoints) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillsused</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for skills that can be used to get/set whether individual skills are in use (???) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skillCaps</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for skills Cap that can be used to get/set the value of individual skills Cap using a syntax like .skillCaps.alchemy = [0 - 1000] (1000 = 100.0 skillpoints) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.socket</span> <strong>(object)</strong><br>
|
|
Get JS Object reference for socket associated with player character (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.target</span> <strong>(object)</strong><br>
|
|
Get/Set character's current target</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.town</span> <strong>(object)</strong><br>
|
|
Get/Set town character is a citizen of</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.foodList</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set sectionID for list of food that creature will accept as food, from UOX3/dfndata/items/itemlists/foodlist.dfn</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.guildTitle</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set guild title of character that belongs to a guild</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lastOn</span> <strong>(text)</strong><br>
|
|
Gets text-formatted timestamp for when player was last online (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set name of character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.origin</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set origin (expansion, era) of character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.origName</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set character's original name before being changed by disguise kit</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sectionID</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Section ID from DFNs that object originated from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.title</span> <strong>(text, <em>max 60 characters</em>)</strong><br>
|
|
Get/Set character's title, displayed in paperdoll</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propConsole" id="propConsole"><span>Console Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<h4>Flag/Boolean Types</h4>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.logEcho</span> <strong>(int, <em>0 - 1</em>)</strong><br>
|
|
Get/Set whether log calls get echo'd to screen</p>
|
|
</div>
|
|
|
|
<h4>Integer Types</h4>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mode</span> <strong>(int, <em>0 - 127</em>)</strong><br>
|
|
Get/Set current filter mode of the Console</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propCreate" id="propCreate"><span>Create/Crafting Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>References to Create entries can be gotten from the global CreateEntries object. Example:
|
|
<pre><code class="language-javascript">// Fetch reference to Create entry 7 from Create DFNs
|
|
var createEntry = CreateEntries[7];
|
|
|
|
// Fetch name of Create entry
|
|
var createEntryName = createEntry.name;
|
|
</code></pre></p>
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.colour</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get the colour associated with this Create entry (unused by code, but could be used by scripts) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sound</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get the sound effect to be played when item associated with Create entry is crafted (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(int)</strong><br>
|
|
Get the artwork ID used to display the item in crafting menus (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.minRank</span> <strong>(int)</strong><br>
|
|
Get the minimum item rank that can be randomly applied to the crafted item based on the rank system, which can cause items to become weaker or stronger than average (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxRank</span> <strong>(int)</strong><br>
|
|
Get the maximum item rank that can be randomly applied to the crafted item based on the rank system, which can cause items to become weaker or stronger than average. If rank system is off, the default rank value is 10 (max) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.delay</span> <strong>(int)</strong><br>
|
|
Get the delay in milliseconds before the crafting process completes and the item has been crafted (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.spell</span> <strong>(int)</strong><br>
|
|
Get the spell ID of a spell required to be in the player's possession (in a spellbook) in order to craft the item. Primarily used by the Inscription skill (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.avgMinSkill</span> <strong>(int)</strong><br>
|
|
Get the average minimum skill required to craft the item, based on all skills required to craft item (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.avgMaxSkill</span> <strong>(int)</strong><br>
|
|
Get average skill required to craft the item with 100% success, based on all skills required to craft item (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resources</span> <strong>(object)</strong><br>
|
|
Get a JS object containing details for all the resources required to craft the item from this Create entry. Each resource reference comes with a few properties: amountNeeded, colour (Read-Only). Example:
|
|
<pre><code class="language-javascript">// Fetch reference to Create entry 7 from Create DFNs
|
|
var createEntry = CreateEntries[7];
|
|
|
|
// Fetch list of resource requirements from Create entry
|
|
var resources = createEntry.resources;
|
|
|
|
// List out resource requirements
|
|
for( var i = 0; i < resources.length; i++ )
|
|
{
|
|
var resource = resources[i];
|
|
var amountNeeded = resource[0];
|
|
var resourceColour = resource[1];
|
|
var resourceIDs = resource[2];
|
|
var resourcesNeeded = "Amount: " + amountNeeded.toString() + ", Colour: " + resourceColour.toString() + ", resource IDs:";
|
|
for( var j = 0; j < resourceIDs.length; j++ )
|
|
{
|
|
resourcesNeeded += (" " + resourceIDs[j] );
|
|
}
|
|
pUser.TextMessage( resourcesNeeded );
|
|
}</code></pre></p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.skills</span> <strong>(object)</strong><br>
|
|
Get a JS object containing details for the skills required to craft the item from this Create entry. Each skill reference comes with a few properties: skillNumber, minSkill and maxSkill (Read-Only). Example:
|
|
<pre><code class="language-javascript">// Fetch reference to Create entry 7 from Create DFNs
|
|
var createEntry = CreateEntries[7];
|
|
|
|
// Fetch list of skill requirements from Create entry
|
|
var skills = createEntry.skills;
|
|
|
|
// List out the skill requirements
|
|
for( var i = 0; i < skills.length; i++ )
|
|
{
|
|
var skillReq = skills[i];
|
|
var skillNumber = skillReq[0];
|
|
var minSkill = skillReq[1];
|
|
var maxSkill = skillReq[2];
|
|
var skillRequirements = "SkillNumber: " + skillNumber.toString() + ", minSkill: " + minSkill.toString() + ", maxSkill: " + maxSkill.toString();
|
|
pUser.TextMessage( skillRequirements );
|
|
}</code></pre></p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text)</strong><br>
|
|
Get the label applied to the item when shown in the crafting menu, which is not necessarily a reflection of the name of the actual item that will be crafted in the end (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.addItem</span> <strong>(text)</strong><br>
|
|
Get the Item section ID of the item actually being crafted in the end, from Item DFNs (Read-Only)</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propGuilds" id="propGuilds"><span>Guild Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.numMembers</span> <strong>(int)</strong><br>
|
|
Get last IP that was used to login with Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.numRecruits</span> <strong>(int)</strong><br>
|
|
Get last IP that was used to login with Account (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.type</span> <strong>(int)</strong><br>
|
|
Get/Set type of guild (0 - Standard, 1 - Order, 2 - Chaos, 3 - Unknown)</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.master</span> <strong>(object)</strong><br>
|
|
Get/Set Character JS Object for character that is considered Guild Master of the guild</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.stone</span> <strong>(object)</strong><br>
|
|
Get/Set Item JS Object for Guildstone</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.abbreviation</span> <strong>(text, <em>max 3 characters</em>)</strong><br>
|
|
Get/Set guild abbreviation</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.charter</span> <strong>(text, <em>max ??? characters</em>)</strong><br>
|
|
Get/Set guild charter</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set name of guild</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.webPage</span> <strong>(text, <em>max ??? characters</em>)</strong><br>
|
|
Get/Set guild webpage URL</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propItems" id="propItems"><span>Item Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canBeLockedDown</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can be locked down. Doors, field-spells, signs or already locked down items cannot be locked down.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.corpse</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is considered a corpse</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageHeat</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Heat damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageCold</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Cold damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageLight</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Light damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageLightning</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Lightning damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damagePoison</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Poison damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageRain</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Rain damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageSnow</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can deal Snow damage (currently does nothing, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.decayable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item will decay</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.divinelock</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item was locked by a GM (i.e. cannot be unlocked with lockpicking/magic unlock)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isChar</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns false for items (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isContType</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Gets whether item is a container; returns true if item is on layer 21 (backpack) or 29 (bankbox) on a Character, or if item has types 1, 8, 63, 64, 65 or 87 (Read-Only</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDamageable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can be damaged by attacks from Characters</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDispellable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is considered dispellable by the Dispel spell (mostly used by field-spell effects)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDyeable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can be dyed using normal dye tubs</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDoorOpen</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether an object of type 12/13 (door/locked door) is open</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isFieldSpell</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is considered part of a field spell</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGuarded</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is guarded by someone</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isItem</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns true for items (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isItemHeld</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is being "held" on a player's cursor</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isLeatherType</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns true if item ID is between 0x13C6 and 0x13E2 (leather/studded leather armor), or between 0x144E and 0x1457 (bone armor) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isLockedDown</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is locked down, i.e. has a movable value of 3 (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isMetalType</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns true if item is made of metal based on a comparison to various item ID ranges (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isNewbie</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is marked as newbie/blessed. If true, item won't drop from a character upon death</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPileable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item can be stacked with other items of same type. Note that not all items support being stacked in client</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isShieldType</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns true if item is a shield, based on comparison to various item ID ranges (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSpawner</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Returns true if item is a spawner (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isWipeable/.wipable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item is marked as wipeable, i.e. can be deleted using the 'wipe command</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.shouldSave</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether item should be saved in worldfiles. If false, item will not be saved and will be gone after the next server restart</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ammoID</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set ID for ammo used by ranged weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ammoHue</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set hue of ammo used by ranged weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ammoFX</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set ID for ammo used by ranged weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ammoFXHue</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set ID of projectile FX shown when firing ranged weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ammoFXRender</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set hue of projectiles fired by ranged weapons</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.colour</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set colour of item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.dir</span> <strong>(hex, <em>0x0 - 0xff</em>)</strong><br>
|
|
Get/Set direction in which this item is facing. For lightsources, this determines the light radius instead.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set the ID of item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.layer</span> <strong>(hex, <em>0x0 - 0xff</em>)</strong><br>
|
|
Get/Set the layer this item is on when equipped. See <a href="https://www.uox3.org/docs/index.html#itemLayers" target="_blank" title="UOX3 Documentation - Item Layers">full list of item layers</a> in UOX3 Docs!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.more</span> <strong>(hex, <em>0x0 - 0xffffffff</em>)</strong><br>
|
|
Get/Set temporary more value for this item. See <a href="https://www.uox3.org/docs/index.html#dfnTagSystem">list of DFN tags for items</a> in UOX3 Docs for more details!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.morex</span> <strong>(hex, <em>0x0 - 0xffffffff</em>)</strong><br>
|
|
Get/Set temporary morex value for this item. See <a href="https://www.uox3.org/docs/index.html#dfnTagSystem">list of DFN tags for items</a> in UOX3 Docs for more details!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.morey</span> <strong>(hex, <em>0x0 - 0xffffffff</em>)</strong><br>
|
|
Get/Set temporary morey value for this item. See <a href="https://www.uox3.org/docs/index.html#dfnTagSystem">list of DFN tags for items</a> in UOX3 Docs for more details!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.morez</span> <strong>(hex, <em>0x0 - 0xffffffff</em>)</strong><br>
|
|
Get/Set temporary morez value for this item. See <a href="https://www.uox3.org/docs/index.html#dfnTagSystem">list of DFN tags for items</a> in UOX3 Docs for more details!</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ac</span> <strong>(int)</strong><br>
|
|
Get/Set armor class of item. If a weapon's armor class matches the armor class of the hit location during combat, it deals double damage - if ARMORCLASSDAMAGEBONUS is enabled in UOX.INI</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.amount</span> <strong>(int, <em>1 - 65535</em>)</strong><br>
|
|
Get/Set amount of items in pile</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.att</span> <strong>(int)</strong><br>
|
|
Get a randomized damage value between lodamage and hidamage properties. If used to set a value, will set both lodamage and hidamage properties to the same value (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.baseRange</span> <strong>(int)</strong><br>
|
|
Get/Set the base range of a throwing weapon, before being affected by a character's strength</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.baseWeight</span> <strong>(int)</strong><br>
|
|
Get/Set the base, unchanging weight of an item - primarily used for the weight of containers without consideration for any items inside</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.buyvalue</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of money it costs to buy this item from a vendor</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.carveSection</span> <strong>(int)</strong><br>
|
|
Get/Set the carve-section of a corpse item from carve.dfn. Determines which items to spawn when the corpse is carved</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.creator</span> <strong>(int)</strong><br>
|
|
Get/Set serial of item's creator - primarily used in crafting/for maker's marks</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.decaytime</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of time (in seconds) it takes the item to decay</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.def</span> <strong>(int)</strong><br>
|
|
Get/Set the item's defense value (Physical Resistance post-AoS, AR pre-AoS)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.dexterity</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of dexterity required to wield this item, if it can be equipped</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.entryMadeFrom</span> <strong>(int)</strong><br>
|
|
Get/Set entry ID from create DFNs from which the item was crafted</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.health</span> <strong>(int)</strong><br>
|
|
Get/Set the current amount of hitpoints of the item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.healthRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set amount of bonus health regen points character will gain while equipping item. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.hidamage</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of damage the item can deal, if it's a weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.instanceID</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the instanceID of the world instance the object exists in. Default is 0 for all objects. Objects in different instances cannot see/interact with one another.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.intelligence</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of intelligence required to wield this item, if it can be equipped</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.itemsinside</span> <strong>(int)</strong><br>
|
|
Get the amount of items inside a container (excluding sub-containers?) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lodamage</span> <strong>(int)</strong><br>
|
|
Get/Set the minimum amount of damage the item can deal, if it's a weapon</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.madeWith</span> <strong>(int)</strong><br>
|
|
Get/Set ID of primary skill used to craft item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.manaRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set amount of bonus mana regen points character will gain while equipping item. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxhp</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of hitpoints an item can have</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxItems</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of items a container can contain (including sub-containers)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxRange</span> <strong>(int)</strong><br>
|
|
Get/Set the max range of archery weapons, and the cap for how far baseRange can extend for throwing weapons based on modifiers like character strength</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxUses</span> <strong>(int)</strong><br>
|
|
Get/Set the max amount of remaining uses an item (like a tool) can have.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.movable</span> <strong>(int)</strong><br>
|
|
Get/Set the movable state of an item (0 - default according to client tiledata, 1 = movable, 2 = immovable, 3 = locked down)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldX</span> <strong>(int)</strong><br>
|
|
Get the old X coordinate for an item, which will differ from current X coordinate if the position of the item has changed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldY</span> <strong>(int)</strong><br>
|
|
Get the old Y coordinate for an item, which will differ from current Y coordinate if the position of the item has changed</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oldZ</span> <strong>(int)</strong><br>
|
|
Get the old Z coordinate for an item, which will differ from current Z coordinate if the position of the item has changed (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poison</span> <strong>(int)</strong><br>
|
|
Get/Set poison strength applied to item such as weapons and food (from 1 to 4, where 1 = Weak poison, 4 = Deadly poison)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poisonedBy</span> <strong>(int)</strong><br>
|
|
Get/Set serial of character who applied poison to item. Set to 0xFFFFFFFF/SE_INVALIDSERIAL() to clear.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poisonCharges</span> <strong>(int, <em>0 - 255</em>)</strong><br>
|
|
Get/Set amount of poison charges on a poisoned item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.rank</span> <strong>(int, <em>1-10</em>)</strong><br>
|
|
Get/Set the quality-rank of this item (used in item-creation, for instance)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistCold</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Cold Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistHeat</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Heat Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistLight</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Light Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistLightning</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Lightning Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistPoison</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Poison Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistRain</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Rain Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistSnow</span> <strong>(int, <em>0-1000</em>)</strong><br>
|
|
Get/Set the item's Snow Resistance (0-1000, where 1000 = 100.0%) - no effect implemented yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.restock</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of this item a vendor will restock in their shop, if they carry it</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scripttrigger</span> <strong>(int)</strong><br>
|
|
(Legacy property for backwards compatibility) Get/Set a scriptID associated with the item. When using this to set a new scriptID, all other scriptIDs are cleared from the item. When getting the scriptID, the last scriptID in the item's list of scriptIDs are returned. To get/set multiple scriptIDs for an item, see .scriptTriggers property and/or AddScriptTrigger() Method.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.serial</span> <strong>(int)</strong><br>
|
|
Get the unique serial assigned to this item (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sellvalue</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of gold one can receive by selling this item to a vendor that carries it in their stock</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.speed</span> <strong>(int)</strong><br>
|
|
Get/Set the speed of the item, primarily used for weapons to determine how fast/how often the character wielding the weapon can attack in combat</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.staminaRegenBonus</span> <strong>(int, <em>-32768 - 32767</em>)</strong><br>
|
|
Get/Set amount of bonus stamina regen points character will gain while equipping item. See <a href="index.html#statRegeneration" title="UOX3 Docs - Stat Regeneration">Stat Regeneration</a> in UOX3 Docs for more details.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.strength</span> <strong>(int)</strong><br>
|
|
Get/Set the amount of strength required to wield this item, if it can be equipped</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempTimer</span> <strong>(int)</strong><br>
|
|
Get/Set timer value used by container-spawners to determine when to spawn an item next (if maximum items spawned from container hasn't been reached yet)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.totalItemCount</span> <strong>(int)</strong><br>
|
|
Get the total amount of items contained within a container, including sub-containers (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.type</span> <strong>(int)</strong><br>
|
|
Get/Set the item type of the item. See <a href="index.html#itemtypes" target="_blank" title="UOX3 Documentation - Item Types">full list in UOX3 Docs</a>!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.usesLeft</span> <strong>(int)</strong><br>
|
|
Get/Set the current amount of remaining uses an item (like a tool) has. Cannot exceed value of .maxUses property</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.visible</span> <strong>(int)</strong><br>
|
|
Get/Set the visibility state of the item (0 = Visible, 1 = Temporarily hidden (visible to Owner), 2 = Invisible (Magic), 3 = Permanently hidden (GM hidden))</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.weight</span> <strong>(int)</strong><br>
|
|
Get/Set the total weight of an item. 1000 = 10.00 stones, 100 = 1.00 stones, 10 = 0.1 stones, 1 = 0.01 stones</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.weightMax</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum weight in stones a container can hold. 1000 = 10.00 stones, 100 = 1.00 stones, 10 = 0.1 stones, 1 = 0.01 stones</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.worldnumber</span> <strong>(int)</strong><br>
|
|
Get/Set the world in which the item currently exists (0 = Felucca, 1 = Trammel, 2 = Ilshenar, 3 = Malas, 4 = Ter-mur)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.x</span> <strong>(int)</strong><br>
|
|
Get/Set item's X coordinate in the world. Also used to set item's location within a container</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.y</span> <strong>(int)</strong><br>
|
|
Get/Set item's Y coordinate in the world. Also used to set item's location within a container</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.z</span> <strong>(int, <em>-128 to 127</em>)</strong><br>
|
|
Get/Set item's Z coordinate in the world</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.container</span> <strong>(object)</strong><br>
|
|
Get/Set object reference to the container the item is contained in. Can be an Item or a Character</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.multi</span> <strong>(object)</strong><br>
|
|
Get object reference to Multi an item is contained within (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.owner</span> <strong>(object)</strong><br>
|
|
Get/Set the owner (Character) of item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.race</span> <strong>(object)</strong><br>
|
|
Get object reference to Race associated with item. Race can be set by providing race ID of new race to set</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scriptTriggers</span> <strong>(object)</strong><br>
|
|
Get a list of scriptIDs associated with the item in the form of a JS object/comma-separated string, or set (add) a scriptID to the item's existing list of scriptIDs. If property sets a NULL value, all scriptIDs are cleared from item</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.desc</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set description of item. Primarily used to describe items in player vendors</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.event</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set custom event name to associate item with. Primarily used by world templates to allow loading/unloading event-specific decorations</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set name of item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name2</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set secondary name of item - used in relation to magical items whose names get revealed upon successful use of Item Identification</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.origin</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set origin (expansion, era) of item</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sectionID</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Section ID from DFNs that object originated from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.title</span> <strong>(text, <em>max 59 characters</em>)</strong><br>
|
|
Get/Set title of item. Currently not used for anything</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propMultis" id="propMultis"><span>Multi Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<p>Multis (items spawned as boats/houses) inherit <strong>all the properties of regular Items</strong>, but also have the following unique ones:</p>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPublic</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set the private/public state of a multi</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.bans</span> <strong>(int)</strong><br>
|
|
Get the number of banned players in a multi's ban list (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.banX</span> <strong>(int, <em>0 - 32767</em>)</strong><br>
|
|
Get/Set the ban location X offset for the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.banY</span> <strong>(int, <em>0 - 32767)</em></strong><br>
|
|
Get/Set the ban location Y offset for the multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.friends</span> <strong>(int)</strong><br>
|
|
Get the number of friends in a multi's friend list (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.guests</span> <strong>(int)</strong><br>
|
|
Get the number of guests in a multi's guest list (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lockdowns</span> <strong>(int)</strong><br>
|
|
Get the number of lockdowns in a multi (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxBans</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of banned players allowed in a multi's ban list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxFriends</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of friends allowed in a multi's friend list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxGuests</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of guests allowed in a multi's guest list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxLockdowns</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of lockdowns allowed in a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxOwners</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of owners allowed in a multi's owner list</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxSecureContainers</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of secure containers allowed in a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxTrashContainers</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of trash containers allowed in a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxVendors</span> <strong>(int, <em>0 - 65535</em>)</strong><br>
|
|
Get/Set the max number of player vendors allowed in a multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.moveType</span> <strong>(int, <em>-1 - 24</em>)</strong><br>
|
|
Get/Set the active movement type for Boats, which UOX3 will apply to said boat during each boat update until another movement type is set (or boat is forced to stop).</p>
|
|
<input type="checkbox" id="spoiler_multi_movetype"/>
|
|
<label for="spoiler_multi_movetype">Supported Move Types <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<ul>
|
|
<li><span class="hl">-1</span> // Anchored, unable to move</li>
|
|
<li><span class="hl">0</span> // Stop, don't move</li>
|
|
<li><span class="hl">1</span> // Move forward</li>
|
|
<li><span class="hl">2</span> // Move backward</li>
|
|
<li><span class="hl">3</span> // Move left</li>
|
|
<li><span class="hl">4</span> // Move right</li>
|
|
<li><span class="hl">5</span> // Move forward left</li>
|
|
<li><span class="hl">6</span> // Move forward right</li>
|
|
<li><span class="hl">7</span> // Move backward left</li>
|
|
<li><span class="hl">8</span> // Move backward right</li>
|
|
<li><span class="hl">9</span> // Move left slowly</li>
|
|
<li><span class="hl">10</span> // Move right slowly</li>
|
|
<li><span class="hl">11</span> // Move forward slowly</li>
|
|
<li><span class="hl">12</span> // Move backward slowly</li>
|
|
<li><span class="hl">13</span> // Move forward left slowly</li>
|
|
<li><span class="hl">14</span> // Move forward right slowly</li>
|
|
<li><span class="hl">15</span> // Move backward right slowly</li>
|
|
<li><span class="hl">16</span> // Move backward left slowly</li>
|
|
<li><span class="hl">17</span> // Move left once</li>
|
|
<li><span class="hl">18</span> // Move right once</li>
|
|
<li><span class="hl">19</span> // Move forward once</li>
|
|
<li><span class="hl">20</span> // Move backward once</li>
|
|
<li><span class="hl">21</span> // Move forward left once</li>
|
|
<li><span class="hl">22</span> // Move forward right once</li>
|
|
<li><span class="hl">23</span> // Move backward left once</li>
|
|
<li><span class="hl">24</span> // Move backward right once</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.owners</span> <strong>(int)</strong><br>
|
|
Get the number of owners in a multi's owner list (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.secureContainers</span> <strong>(int)</strong><br>
|
|
Get the number of secure containers in a multi (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.trashContainers</span> <strong>(int)</strong><br>
|
|
Get the number of trash containers in a multi (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.vendors</span> <strong>(int)</strong><br>
|
|
Get the number of player vendors in a multi (Read-Only)</p>
|
|
</div>
|
|
|
|
<h4>Text Types</h4>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.buildTimestamp</span> <strong>(text)</strong><br>
|
|
Get/Set the timestamp for when the house was originally placed. When getting, timestamp is returned as a string. When setting... it doesn't matter what you set, because server will generate a timestamp on its own!</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.deed</span> <strong>(text)</strong><br>
|
|
Get/Set the item sectionID for deed used to place multi</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tradeTimestamp</span> <strong>(text)</strong><br>
|
|
Get/Set the timestamp for when the house was last traded to another player. When getting, timestamp is returned as a string. When setting... it doesn't matter what you set, because server will generate a timestamp on its own!</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propRaces" id="propRaces"><span>Race Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Decimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.magicResistance</span> <strong>(int, <em>0.0-100.0</em>)</strong><br>
|
|
Get/Set magic resistance bonus for members of this race, between 0.0 and 100.0 % (currently not used in code, but can be used in scripts)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.poisonResistance</span> <strong>(int, <em>0.0-100.0</em>)</strong><br>
|
|
Get/Set poison resistance bonus for members of this race, between 0.0 and 100.0 % (currently not used in code, but can be used in scripts)</p>
|
|
</div>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isPlayerRace</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether race is marked as a player race, i.e. a race usable by players (via something like Race Gates)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requiresBeard</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether a beard is required for members of this race. If true, and a player without a beard steps through a Race Gate associated with this race, a random beard will be assigned to them</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requiresNoBeard</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether no beard is required for members of this race. If true, and a player with a beard steps through a Race Gate associated with this race, their beard will be removed</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.armourClass</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set the armor class restriction of the race. Race will be unable to equip any armor with the specified AC</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get the unique ID of the race (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.genderRestrict</span> <strong>(int, <em>1-2</em>)</strong><br>
|
|
Get/Set whether race is restricted to characters with male (1) or female (2) genders</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.languageSkillMin</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/Set minimum skillpoints in Spirit Speak skill required for non-members of this race to understand speech from members of the race</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.nightVision</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set light level at which night vision kicks in for members of the race. If world light level (or light level of weather system in a region, or dungeon light level) is brighter than this (i.e. lower value) nothing happens. If light level is darker (higher value) than this, the character's personal light level gets adjusted to raceLightLevel - worldLightLevel.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.visibleDistance</span> <strong>(int, <em>0-127</em>)</strong><br>
|
|
Get/Set default visibility range of race. Defaults to 18</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text, <em>max 3 characters</em>)</strong><br>
|
|
Get/Set name of race</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propRegions" id="propRegions"><span>Region Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canCastAggressive</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether aggressive spells can be cast in this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canGate</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Gate spell can be used in this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canMark</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Mark spell can be used in this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canPlaceHouse</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether players can place houses within this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canRecall</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Recall spell can be used in this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.canTeleport</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether Teleport spell can be used in this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDungeon</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether region is considered a dungeon. Primarily used for light level stuff, and to determine if houses can be placed in a region (houses cannot be placed in dungeons)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isDisabled</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether region is disabled. If disabled, UOX3 will ignore it.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isGuarded</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether region is under protection of NPC guards</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSafeZone</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether region is considered a safe zone. If true, no hostile actions can be taken towards other players in this region</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.taxResource</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get/Set item ID of resource being taxed in this region. Used by Townstone system.</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.appearance</span> <strong>(int, <em>0-4</em>)</strong><br>
|
|
Get/set appearance of region (0 = Spring, 1 = Summer, 2 = Autumn, 3 = Winter, 4 = Desolation)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.chanceBigOre</span> <strong>(int, <em>0-100</em>)</strong><br>
|
|
Get/Set chance to find big ore in the region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.health</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set the health of townstone in this region. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(int)</strong><br>
|
|
Get region number (from region DFNs) for the region (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.instanceID</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/Set the instanceID the region exists in</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mayor</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/Set serial of character who is considered town mayor of the region. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.music</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/set default music to play in this region, based on sections of music lists (MUSICLIST #) setup in regions.dfn based on entries from config.txt in UO client's music folder</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.numGuards</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get the number of guards supported by the region. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.numOrePrefs</span> <strong>(int)</strong><br>
|
|
Get the number of ore preferences present for the region (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.population</span> <strong>(int)</strong><br>
|
|
Get population of the region. Used by Townstone system (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.race</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/Set ID of the race this region belongs to</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.reserves</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/set collected resource reserves for region. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scripttrigger</span> <strong>(int)</strong><br>
|
|
(Legacy property for backwards compatibility) Get/Set a scriptID associated with the region. When using this to set a new scriptID, all other scriptIDs are cleared from the region. When getting the scriptID, the last scriptID in the region's list of scriptIDs are returned. To get/set multiple scriptIDs for a region, see .scriptTriggers property and/or AddScriptTrigger() Method.</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tax</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/Set the amount of gold taxed from region members. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.taxes</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/Set collected gold reserves for region. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.weather</span> <strong>(int, <em>0-65535</em>)</strong><br>
|
|
Get/Set ID of weather system from UOX3/dfndata/weather/weather.dfn applied to this region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.worldNumber</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set the worldnumber of the region</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scriptTriggers</span> <strong>(object)</strong><br>
|
|
Get a list of scriptIDs associated with the region in the form of a JS object/comma-separated string, or set (add) a scriptID to the region's existing list of scriptIDs. If property sets a NULL value, all scriptIDs are cleared from region</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.members</span> <strong>(text)</strong><br>
|
|
Get list of serials belonging to members of the region, in the form of a comma-separated string. Used by Townstone system</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set name of region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.owner</span> <strong>(text, <em>max 127 characters</em>)</strong><br>
|
|
Get/Set name of owner of the guards in the region</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propResources" id="propResources"><span>Resource Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.logAmount</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set amount of log resources available in given resource object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.logTime</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/Set the respawn timer of log resources in given resource object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oreAmount</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set amount of ore resources available in given resource object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.oreTime</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/Set the respawn timer of ore resources in given resource object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fishAmount</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set amount of fish resources available in given resource object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fishTime</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get/Set the respawn timer of fish resources in given resource object</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propSockets" id="propSockets"><span>Socket Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.cryptClient</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether socket is set to crypt mode</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.firstPacket</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether socket has received its first packet yet</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.logging</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether packet logging is enabled for socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.newClient</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set property used to determine if connection is new or old</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.wasIdleWarned</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether socket has been warned of idling. If true, will eventually lead to client being disconnected if player keeps idling</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.targetOK</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether socket is ready/waiting to receive a target selection from client</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.flags</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get flags set on Account (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.bytesSent</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get amount of bytes sent to socket from server (resets every 10 seconds) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.bytesReceived</span> <strong>(int, <em>0-4294967295</em>)</strong><br>
|
|
Get amount of bytes received from socket (resets every 10 seconds) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clickX</span> <strong>(int, <em>-32768 to 32767</em>)</strong><br>
|
|
Get/Set temporary integer value on socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clickY</span> <strong>(int, <em>-32768 to 32767</em>)</strong><br>
|
|
Get/Set temporary integer value on socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clickZ</span> <strong>(int, <em>-128 to 127</em>)</strong><br>
|
|
Get/Set temporary integer value on socket</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clientMajorVer</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set major client version value on socket. Normally sent by client and set by server during login</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clientMinorVer</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set minor client version value on socket. Normally sent by client and set by server during login</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clientSubVer</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set client sub version value on socket. Normally sent by client and set by server during login</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clientLetterVer</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set client letter version value on socket. Normally sent by client and set by server during login</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.clientType</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set client type on socket. Normally sent by client and set by server during login. Supported values:
|
|
<ul>
|
|
<li>1 - Unknown</li>
|
|
<li>2 - Krrios Client</li>
|
|
<li>3 - T2A (up to 4.0.11c)</li>
|
|
<li>4 - Third Dawn</li>
|
|
<li>5 - Mondain's Legacy (4.0.11f to 5.0.9.1)</li>
|
|
<li>6 - Kingdom Reborn 2D (6.0.0.0+ to 6.0.14.1)</li>
|
|
<li>7 - Kingdom Reborn 3D</li>
|
|
<li>8 - Stygian Abyss 2D (6.0.14.2 to 7.0.8.2)</li>
|
|
<li>9 - Stygian Abyss 3D</li>
|
|
<li>10 - High Seas 2D (7.0.9.0 and upwards)</li>
|
|
<li>11 - High Seas 3D</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.currentSpellType</span> <strong>(int, <em>0-255</em>)</strong><br>
|
|
Get/Set the current spell type of the socket (0 = Normal spellcast, 1 = Scroll, 2 = Wand)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.language</span> <strong>(int, <em>0-133</em>)</strong><br>
|
|
Get/Set ID representing the language code set in the client. Languages values supported by UOX3's Dictionary system (Czech, English, French, German, Italian, Portuguese, Spanish)</p>
|
|
<input type="checkbox" id="spoiler_socket_props_language"/>
|
|
<label for="spoiler_socket_props_language">Supported Language Codes <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<ul>
|
|
<li>24 (UT_CSY) - Czech (Czech Republic)</li>
|
|
<li>26 (UT_DEU) - German (Germany)</li>
|
|
<li>27 (UT_DES) - German (Switzerland)</li>
|
|
<li>28 (UT_DEA) - German (Austria)</li>
|
|
<li>29 (UT_DEL) - German (Luxembourg)</li>
|
|
<li>30 (UT_DEC) - German (Liechtenstein)</li>
|
|
<li>32 (UT_ENU) - English (United States)</li>
|
|
<li>33 (UT_ENG) - English (United Kingdom)</li>
|
|
<li>34 (UT_ENA) - English (Australia)</li>
|
|
<li>35 (UT_ENC) - English (Canada)</li>
|
|
<li>36 (UT_ENZ) - English (New Zealand)</li>
|
|
<li>37 (UT_ENI) - English (Ireland)</li>
|
|
<li>38 (UT_ENS) - English (South Africa)</li>
|
|
<li>39 (UT_ENJ) - English (Jamaica)</li>
|
|
<li>40 (UT_ENB) - English (Caribbean)</li>
|
|
<li>41 (UT_ENL) - English (Belize)</li>
|
|
<li>42 (UT_ENT) - English (Trinidad)</li>
|
|
<li>43 (UT_ENW) - English (Zimbabwe)</li>
|
|
<li>44 (UT_ENP) - English (Philippines)</li>
|
|
<li>45 (UT_ESP) - Spanish (Spain (Traditional Sort))</li>
|
|
<li>46 (UT_ESM) - Spanish (Mexico)</li>
|
|
<li>47 (UT_ESN) - Spanish (Spain (International Sort))</li>
|
|
<li>48 (UT_ESG) - Spanish (Guatemala)</li>
|
|
<li>49 (UT_ESC) - Spanish (Costa Rica)</li>
|
|
<li>50 (UT_ESA) - Spanish (Panama)</li>
|
|
<li>51 (UT_ESD) - Spanish (Dominican Republic)</li>
|
|
<li>52 (UT_ESV) - Spanish (Venezuela)</li>
|
|
<li>53 (UT_ESO) - Spanish (Colombia)</li>
|
|
<li>54 (UT_ESR) - Spanish (Peru)</li>
|
|
<li>55 (UT_ESS) - Spanish (Argentina)</li>
|
|
<li>56 (UT_ESF) - Spanish (Ecuador)</li>
|
|
<li>57 (UT_ESL) - Spanish (Chile)</li>
|
|
<li>58 (UT_ESY) - Spanish (Uruguay)</li>
|
|
<li>59 (UT_ESZ) - Spanish (Paraguay)</li>
|
|
<li>60 (UT_ESB) - Spanish (Bolivia)</li>
|
|
<li>61 (UT_ESE) - Spanish (El Salvador)</li>
|
|
<li>62 (UT_ESH) - Spanish (Honduras)</li>
|
|
<li>63 (UT_ESI) - Spanish (Nicaragua)</li>
|
|
<li>64 (UT_ESU) - Spanish (Puerto Rico)</li>
|
|
<li>66 (UT_FRA) - French (France)</li>
|
|
<li>67 (UT_FRB) - French (Belgium)</li>
|
|
<li>68 (UT_FRC) - French (Canada)</li>
|
|
<li>69 (UT_FRS) - French (Switzerland)</li>
|
|
<li>70 (UT_FRL) - French (Luxembourg)</li>
|
|
<li>71 (UT_FRM) - French (Monaco)</li>
|
|
<li>75 (UT_ITA) - Italian (Italy)</li>
|
|
<li>76 (UT_ITS) - Italian (Switzerland)</li>
|
|
<li>83 (UT_PLK) - Polish (Poland)</li>
|
|
<li>84 (UT_PTB) - Portuguese (Brazil)</li>
|
|
<li>85 (UT_PTG) - Portuguese (Portugal)</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pickupSpot</span> <strong>(int, <em>0-5</em>)</strong><br>
|
|
Get/Set the spot where an item held on socket/cursor was picked up from (0 = Nowhere, 1 = Ground, 2 = Own pack, 3 = Other pack, 4 = Paperdoll, 5 = Bank)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pickupX</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set the X world coordinate an item held on socket/cursor was picked up from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pickupY</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set the Y world coordinate an item held on socket/cursor was picked up from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pickupZ</span> <strong>(int, <em>-128 to 127</em>)</strong><br>
|
|
Get/Set the Z world coordinate an item held on socket/cursor was picked up from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempInt</span> <strong>(int, <em>-2147483648 to 2147483647</em>)</strong><br>
|
|
Get/Set temporary integer value on socket. Primarily used by code</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempInt2</span> <strong>(int, <em>-2147483648 to 2147483647</em>)</strong><br>
|
|
Get/Set temporary integer value on socket. Primarily used by JS scripts</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.walkSequence</span> <strong>(int, <em>0-32767</em>)</strong><br>
|
|
Get/Set walk sequence value of the socket. Set by server when client sends a movement request</p>
|
|
</div>
|
|
|
|
<h3>Object Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.account</span> <strong>(object)</strong><br>
|
|
Get JS object reference to account associated with socket (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.currentChar</span> <strong>(object)</strong><br>
|
|
Get/Set JS object reference to character currently associated with socket (character player is logged in with)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.target</span> <strong>(object)</strong><br>
|
|
Get JS object reference to last Item/Character targeted by client (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempObj</span> <strong>(object)</strong><br>
|
|
Get/Set temporary JS object (Character/Item) reference on socket. Primarily used by code</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.tempObj2</span> <strong>(object)</strong><br>
|
|
Get/Set temporary JS object (Character/Item) reference on socket. Primarily used by JS scripts</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.xText</span> <strong>(text)</strong><br>
|
|
Get/Set temporary text value on socket</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propSkill" id="propSkill"><span>Skill Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<h3>Character Skill Properties</h3>
|
|
<p>A Character's Skill Properties can be gotten/set via object references to either "baseskills" (base skill before modifiers) or "skills" (skill after modifiers) JS objects. Examples:
|
|
<pre><code class="language-javascript">// Get myChar's base Alchemy skill
|
|
var alchemy = myChar.baseskills.alchemy;
|
|
|
|
// Get myChar's Alchemy skill (after modifiers)
|
|
var alchemy = myChar.skills.alchemy;
|
|
|
|
// Set myChar's base Tinkering skill to 100.0
|
|
myChar.baseskills.tinkering = 1000; // 100.0 skillpoints
|
|
|
|
// Set myChar's Tinkering skill (after modifiers) to 73.5
|
|
myChar.skills.tinkering = 735; // 73.5 skillpoints</code></pre></p>
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">alchemy</span> <strong>(int)</strong><br>
|
|
Get/Set a character's skill points in alchemy</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">anatomy</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Anatomy skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">animallore</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Animal Lore skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">itemid</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Item Identification skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">armslore</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Arms Lore skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">parrying</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Parrying skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">begging</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Begging skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">blacksmithing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Blacksmithing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">bowcraft</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Bowcraft/Fletching skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">peacemaking</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Peacemaking skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">camping</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Camping skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">carpentry</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Carpentry skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">cartography</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Cartography skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">cooking</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Cooking skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">detectinghidden</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Detecting Hidden skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">enticement</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Enticement skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">evaluatingintel</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Evaluating Intelligence skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">healing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Healing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">fishing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Fishing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">forensics</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Forensics skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">herding</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Herding skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">hiding</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Hiding skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">provocation</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Provocation skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">inscription</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Inscription skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">lockpicking</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Lockpicking skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">magery</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Magery skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">magicresistance</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Resisting Spells skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">tactics</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Tactics skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">snooping</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Snooping skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">musicianship</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Musicianship skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">poisoning</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Poisoning skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">archery</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Archery skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">spiritspeak</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Spirit Speak skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">stealing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Stealing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">tailoring</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Tailoring skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">taming</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Animal Taming skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">tasteid</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Taste Identification skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">tinkering</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Tinkering skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">tracking</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Tracking skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">veterinary</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Veterinary skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">swordsmanship</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Swordsmanship skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">macefighting</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Mace Fighting skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">fencing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Fencing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">wrestling</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Wrestling skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">lumberjacking</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Lumberjacking skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">mining</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Mining skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">meditation</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Meditation skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">stealth</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Stealth skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">removetrap</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Remove Trap skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">necromancy</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Necromancy skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">focus</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Focus skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">chivalry</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Chivalry skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">bushido</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Bushido skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">ninjitsu</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Ninjitsu skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">spellweaving</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Spellweaving skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">imbuing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Imbuing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">mysticism</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Mysticism skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">throwing</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in the Throwing skill (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">allskills</span> <strong>(int)</strong><br>
|
|
Get/Set a Character's skillpoints in <em>ALL</em> skills (1000 = 100.0, 10 = 1.0)</p>
|
|
</div>
|
|
|
|
<h3>Skill Object Properties</h3>
|
|
<p>Skills also have some inherit properties unrelated to Characters. These can be accessed by getting a reference to the skill in question via the global Skills reference. Examples:
|
|
<pre><code class="language-javascript">// Fetch reference to Alchemy skill
|
|
var alchemySkill = Skills[0]; // 0 = ID of Alchemy skill in skills.dfn
|
|
var alchemySkillDelay = alchemySkill.skillDelay; // Get the skill-delay defined for Alchemy skill in skills.dfn</code></pre></p>
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">strength</span> <strong>(int)</strong><br>
|
|
Get the weighting value that determines how likely the Strength stat is to increase from using the skill in question</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">dexterity</span> <strong>(int)</strong><br>
|
|
Get the weighting value that determines how likely the Dexterity stat is to increase from using the skill in question</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">intelligence</span> <strong>(int)</strong><br>
|
|
Get the weighting value that determines how likely the Intelligence stat is to increase from using the skill in question</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">skillDelay</span> <strong>(int)</strong><br>
|
|
Get the amount of time in seconds from the skill in question is used, until it can be used again</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">scriptID</span> <strong>(int)</strong><br>
|
|
Get the scriptID associated with the skill, as registered by skill-scripts in jse_fileassociations.scp</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text)</strong><br>
|
|
Get name of skill (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.madeWord</span> <strong>(text)</strong><br>
|
|
Get skill's "made word" - i.e. verb used to describe how an item was crafted. Ex: "forged" for Blacksmithing, "mixed" for Alchemy (Read-Only)</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propSpawner" id="propSpawner"><span>Spawner Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<p>Spawners (items spawned as Spawner objects with item type 61-65 or 69) inherit <strong>all the properties of regular Items</strong>, but also have a few unique ones:</p>
|
|
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.sectionalist</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether spawner should be trying to spawn objects from a list of objects</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mininterval</span> <strong>(int)</strong><br>
|
|
Get/Set the minimum amount of time for this spawner to spawn another object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxinterval</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of time for this spawner to spawn another object</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.spawnsection</span> <strong>(text)</strong><br>
|
|
Get/Set the Item or NPC script section (or ITEMLIST/NPCLIST) to spawn from</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propSpawnRegions" id="propSpawnRegions"><span>Spawn Region Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.onlyOutside</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether NPCs should only spawn outside buildings</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.isSpawner</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get/Set whether items spawned from Spawn Region is of object type Spawner</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.call</span> <strong>(int)</strong><br>
|
|
Get/Set number of objects that should be spawned in each respawn call for Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.instanceID</span> <strong>(int)</strong><br>
|
|
Get/Set the instanceID of the instance in which the Spawn Region exists</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.itemCount</span> <strong>(int)</strong><br>
|
|
Get the current amount of items spawned in Spawn Region (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxItems</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of items to spawn in Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxTime</span> <strong>(int)</strong><br>
|
|
Get/Set maximum amount of time to pass before Spawn Region spawns a new object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.maxNpcs</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum amount of NPCs to spawn in Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.minTime</span> <strong>(int)</strong><br>
|
|
Get/Set minimum amount of time to pass before Spawn Region spawns a new object</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.npcCount</span> <strong>(int)</strong><br>
|
|
Get the current amount of NPCs spawned in Spawn Region (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.prefZ</span> <strong>(int)</strong><br>
|
|
Get/Set the maximum Z value a dynamic or static item can have on spawning. If dynamic/static item at a given location is higher up than this, a lower spawn point will be selected</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.regionNum</span> <strong>(int)</strong><br>
|
|
Get/Set unique Spawn Region ID/number</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.x1</span> <strong>(int)</strong><br>
|
|
Get/Set left/western boundary of Spawn Region. Along with .y1 this makes up the top-left/northwest corner of the Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.x2</span> <strong>(int)</strong><br>
|
|
Get/Set right/eastern boundary of Spawn Region. Along with .y2 this makes up the lower-right/southeast corner of the Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.y1</span> <strong>(int)</strong><br>
|
|
Get/Set top/northern boundary of Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.y2</span> <strong>(int)</strong><br>
|
|
Get/Set bottom/southern boundary of Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.world</span> <strong>(int)</strong><br>
|
|
Get/Set world number that spawn region should be spawning objects in</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.item</span> <strong>(text)</strong><br>
|
|
Get/Set Item section ID of item to spawn in Spawn Region</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.itemList</span> <strong>(text)</strong><br>
|
|
Get comma-separated list of Items to spawn in Spawn Region, or set ITEMLIST to spawn items from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text)</strong><br>
|
|
Get/Set name of Spawn Region, for internal tracking</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.npc</span> <strong>(text)</strong><br>
|
|
Get comma-separated list of NPCS to spawn in Spawn Region, or set NPCLIST to spawn NPCs from</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.npcList</span> <strong>(text)</strong><br>
|
|
Get/Set guild abbreviation</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#propSpells" id="propSpells"><span>Spell Properties</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Object properties are accessed like this:
|
|
<pre><code class="language-javascript">// Read an object property and store it in a variable
|
|
var myVar = myObject.propertyName;
|
|
|
|
// Modify a (modifiable) object property. Note that some properties are read-only
|
|
myObject.propertyName = newValue;
|
|
</code></pre></p>
|
|
<p>Spells have properties that can be accessed via references to the spells in question via the global Spells object. Examples:
|
|
<pre><code class="language-javascript">// Fetch reference to Create Food spell
|
|
var createFoodSpell = Spells[1]; // 1 = ID of Create Food spell in spells.dfn
|
|
var createFoodSpellSFX = createFoodSpell.soundEffect; // Get the sound effect defined for Create Food spell in spells.dfn</code></pre></p>
|
|
<h3>Flag/Boolean Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.aggressiveSpell</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell is flagged as an aggressive/hostile spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.enabled</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell is enabled (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.fieldSpell</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell is considered a field spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.reflectable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell can be reflected by the Magic Reflection spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requireChar</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the requires a Character target (Ex: Energy Bolt, Flamestrike) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requireItem</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell requires an Item target (Ex: Magic Lock/Unlock) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requireLocation</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell requires a location target (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.requireTarget</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell requires a target (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.resistable</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell can be resisted (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.travelSpell</span> <strong>(bool, <em>true/false</em>)</strong><br>
|
|
Get whether the spell is considered a travel spell (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Hexadecimal Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.action</span> <strong>(hex, <em>0x0 - 0xff</em>)</strong><br>
|
|
Get which Character action/animation should be played when casting the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.soundEffect</span> <strong>(hex, <em>0x0 - 0xffff</em>)</strong><br>
|
|
Get which sound FX should be played when casting the spell (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Integer Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ash</span> <strong>(int)</strong><br>
|
|
Get amount of Sulphurous Ash required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.baseDmg</span> <strong>(int)</strong><br>
|
|
Get amount of Sulphurous Ash required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.circle</span> <strong>(int)</strong><br>
|
|
Get the spell circle that spell belongs to (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.damageDelay</span> <strong>(int)</strong><br>
|
|
Get the delay (in seconds, using decimals) between targeting someone with the spell and the spell's damage being applied to the target (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.delay</span> <strong>(int)</strong><br>
|
|
Get the duration (in seconds, using decimals) it takes to finish casting the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.drake</span> <strong>(int)</strong><br>
|
|
Get amount of Mandrake Root required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.garlic</span> <strong>(int)</strong><br>
|
|
Get amount of Garlic required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.ginseng</span> <strong>(int)</strong><br>
|
|
Get amount of Ginseng required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.health</span> <strong>(int)</strong><br>
|
|
Get amount of hitpoints required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.highSkill</span> <strong>(int)</strong><br>
|
|
Get the amount of Magery skill points required to always cast this spell with 100% success (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.id</span> <strong>(int)</strong><br>
|
|
Get the unique ID of this spell (from spells.dfn) (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.lowSkill</span> <strong>(int)</strong><br>
|
|
Get the minimum amount of Magery skill points required to have a chance of successfully casting this spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mana</span> <strong>(int)</strong><br>
|
|
Get the amount of mana required to cast this spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.moss</span> <strong>(int)</strong><br>
|
|
Get amount of Bloodmoss required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.pearl</span> <strong>(int)</strong><br>
|
|
Get amount of Black Pearl required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.recoveryDelay</span> <strong>(int)</strong><br>
|
|
Get amount of time (in seconds, using decimals) it takes to recover from casting this spell before Character can cast another spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scrollHigh</span> <strong>(int)</strong><br>
|
|
Get the amount of Magery skill points required to always cast this spell with 100% success when cast from a magic scroll (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.scrollLow</span> <strong>(int)</strong><br>
|
|
Get the minimum amount of Magery skill points required to have a chance of successfully casting this spell when cast from a magic scroll (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.shade</span> <strong>(int)</strong><br>
|
|
Get amount of Nightshade required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.silk</span> <strong>(int)</strong><br>
|
|
Get amount of Silk required to cast the spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.stamina</span> <strong>(int)</strong><br>
|
|
Get the amount of stamina required to cast this spell (Read-Only)</p>
|
|
</div>
|
|
|
|
<h3>Text Types</h3>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.mantra</span> <strong>(text)</strong><br>
|
|
Get the spell mantra/words of power spoken by the Character when casting this spell (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.name</span> <strong>(text)</strong><br>
|
|
Get the name of the spell, as defined in spells.dfn (Read-Only)</p>
|
|
</div>
|
|
<div class="settingsDiv">
|
|
<p><span class="hl">.strToSay</span> <strong>(text)</strong><br>
|
|
Get the text string accompanying the target cursor (if any) as the spell finishes casting (Read-Only)</p>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
</ul> <!-- cd-faq__group -->
|
|
|
|
<ul id="tips" class="cd-faq__group">
|
|
<li class="cd-faq__title title-jsdoc"><h1>Tips and Tutorials</h1></li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#tipsJSFundamentals" id="tipsJSFundamentals"><span>UOX3 JSE Fundamentals</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>Pick up the fundamentals of scripting with UOX3's JS Engine here!</p>
|
|
<input type="checkbox" id="spoiler_js_fundamentals_intro"/>
|
|
<label for="spoiler_js_fundamentals_intro">Introduction <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>Scripting with UOX3's JS Engine is quite straight-forward, and easy to pick up even for non-programmers. Here's a very basic example of what a fully functional script in UOX3 looks like:</p>
|
|
<pre><code class="language-javascript">// Script event that triggers when an item is double-clicked
|
|
function onUseChecked( pUser, iUsed )
|
|
{
|
|
// Send an overhead text message to the player who double-clicked the item
|
|
pUser.TextMessage( "I double-clicked on an item called " + iUsed.name );
|
|
}</code></pre>
|
|
<p>In the above example, "pUser" represents the player, and "iUsed" represents the item that the player double-clicked. The names of these representations are not important, just that their use is consistent within a script or function. They could have been called "myChar" and "myItem" instead, and it would still have worked!</p>
|
|
<p>Such scripts are usually (but not always) attached to objects in the game, and are triggered by UOX3 when special pre-defined events in code run.</p>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_js_fundamentals_basic_components"/>
|
|
<label for="spoiler_js_fundamentals_basic_components">Events, Functions, Methods and Properties <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>The basic building blocks of a script in UOX3 consist of one or more of the following:</p>
|
|
<ul>
|
|
<li>JS Events</li>
|
|
<li>JS Functions</li>
|
|
<li>JS Object Methods</li>
|
|
<li>JS Object Properties</li>
|
|
</ul>
|
|
<h3>JS Events</h3>
|
|
<p>JS Events are script functions that are <span class="hl">triggered by pre-defined events in UOX3's source code</span>. For example, the onEquipAttempt JS event will be triggered for any character that has a script attached with that JS event present, if they attempt to equip an item on their paperdoll. Similarly, the onResurrect JS event would trigger for characters getting resurrected - if they have a script attached with that JS Event present.</p>
|
|
<p>Note that other than being special in the way that UOX3 will trigger them directly when special events take place, JS events can also be triggered manually by calling them from other functions in the same script, or from events/functions in other scripts using the TriggerEvent() function.</p>
|
|
<p>For full lists of JS Events, check the <a href="#events" title="JS Events">JS Events</a> section.</p>
|
|
<h3>JS Functions</h3>
|
|
<p>JS Functions are uniquely named script functions that can be called upon to <span class="hl">make UOX3 run hard-coded pieces of code</span> and potentially return some data to the script. This could be calculating the height of the map at a given set of coordinates, playing some visual effects at an object's location, broadcasting a message to all connected players, etc.</p>
|
|
<p>Here's an example of a function that simulates the rolling of a dice, and stores the result of that die roll in a variable named mDie for use later in the script:
|
|
<pre><code class="language-javascript">// Roll a DnD style dice of type 2d3+1 (2 dice with 3 faces, add 1 to result)
|
|
var mDie = RollDice( 2, 3, 1 );</code></pre>
|
|
<p>It's also possible to make custom JS functions and call upon those from other functions or scripts. This can be helpful for instance to avoid having to repeat some specific code in a script over and over in multiple locations; just call the custom function which contains the shared code to run!</p>
|
|
<p>For full lists of JS Functions, check the <a href="#functions" title="JS Functions">JS Functions</a> section.</p>
|
|
<h3>JS Object Methods</h3>
|
|
<p>JS Object Methods are similar to JS Functions in that they <strong>can run hard-coded pieces of code and even return data to the calling script</strong>, but unlike JS Functions they are <span class="hl">associated directly with specific types of objects</span>, and don't exist (or work differently) for other types of objects.</p>
|
|
<p>For instance, Character objects have a method that can be used to make NPCs follow a specific target:</p>
|
|
<pre><code class="language-javascript">myNPC.Follow( myTarget );</code></pre>
|
|
<p>When this runs, myNPC will attempt to follow myTarget. However, if you tried using that method with an Item object, you'd see an error instead, since the method doesn't exist for the Item object type!</p>
|
|
<p>For full lists of JS Object Methods per object type, check the <a href="#methods" title="JS Object Methods">JS Object Methods</a> section.</p>
|
|
<h3>JS Object Properties</h3>
|
|
<p>Any pre-defined JS Objects in UOX3 (like Characters, Items, Multis, Regions, etc) have <span class="hl">pre-defined sets of object properties</span> that can be accessed from a script. Some of those properties are read-only, but most can also be modified (permanently or temporarily).</p>
|
|
<p>A couple of examples of how to access/modify object properties:</p>
|
|
<pre><code class="language-javascript">// Store the name of myObject in a variable called objectName
|
|
var objectName = myObject.name;
|
|
|
|
// Modify the name of myObject to become "new object name"
|
|
myObject.name = "new object name";
|
|
|
|
// Check if myObject is a GM, and have them say something if that's true
|
|
if( myObject.isGM )
|
|
{
|
|
myObject.TextMessage( "I'm a GM! Endless power! Muhahaha!" );
|
|
}</code></pre>
|
|
<p>For full lists of pre-defined object properties per object type, check the <a href="#properties" title="JS Object Properties">JS Object Properties</a> section.</p>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_js_fundamentals_attach_scripts"/>
|
|
<label for="spoiler_js_fundamentals_attach_scripts">Attaching Scripts to Objects <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>Before a script can be triggered by UOX3, it generally needs to be <span class="hl">attached to an object</span> in the game - like a character or an item - via a <span class="hl">unique scriptID</span> assigned to each and every script in UOX3 via <strong>UOX3/js/jse_fileassociations.scp</strong>.</p>
|
|
<p>Several methods exist to attach scripts to objects:</p>
|
|
<ul>
|
|
<li>Add a <span class="hl">SCRIPT=#</span> tag to a character, item, house or region definition under <strong>UOX3/dfndata/</strong></li>
|
|
<li>Target the object in question (character or item) in-game via the GM command <span class="hl">'addscptrig #</span></li>
|
|
<li>Setup an association between an <span class="hl">object's ID</span> and a scriptID in <strong>UOX3/js/jse_objectassociations.scp</strong></li>
|
|
<li>Setup an association between an <span class="hl">object's type</span> property and a scriptID in <strong>UOX3/js/jse_typeassociations.scp</strong></li>
|
|
</ul>
|
|
<p>Example of a script attached to objects via DFN files:</p>
|
|
<p>Example of a script attached to objects via object ID:</p>
|
|
<p>Example of a script attached to objects via object type:</p>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_js_fundamentals_first_script"/>
|
|
<label for="spoiler_js_fundamentals_first_script">Creating Your First Script <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>If you've read the above <strong>Introduction</strong>, info about <strong>script building blocks</strong> and <strong>how to attach scripts to objects</strong>, you should be all set to start creating your own JS script for UOX3! Tools you'll need:</p>
|
|
<ul>
|
|
<li>A text editor with (recommended) support for syntax highlighting, to make it easier to spot errors and mistakes. Some suggested cross-platform editors: <a href="https://www.sublimetext.com/" target="_blank" title="Sublime Text" rel="noopener">Sublime Text</a> (paid, but endless trial available), <a href="https://code.visualstudio.com/" target="_blank" title="Visual Studio Code" rel="noopener">Visual Studio Code</a></li>
|
|
<li>This document, with references to the Events, Functions, Methods and Properties available to you</li>
|
|
<li>Willingness to try, fail and learn!</li>
|
|
</ul>
|
|
<h4>Create the Basic Script</h4>
|
|
<p>Let's start off by creating a simple script that <strong>will roll two dice</strong> when an item is double-clicked, and <strong>announce the results</strong> to all nearby players! So start your text editor of choice, and enter the following lines of text at the top of a fresh new document:</p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
pUser.TextMessage( "Hello, world!" );
|
|
}</code></pre>
|
|
<p>This is the declaration of a JS event called <a href="#eventOnUseChecked">onUseChecked()</a>, which can trigger for items when double-clicked by players. <span class="hl">pUser</span> will contain a reference to the character that double-clicked the item, while <span class="hl">iUsed</span> will refer to the item that was double-clicked. Inside the curly brackets we put a line that causes pUser to say some text ("Hello, world!") with the help of a <a href="#methodsCharacter">JS Object Method for Characters</a> called <span class="hl">TextMessage()</span>.</p>
|
|
<h4>Save the Script, and Reload the JS Engine</h4>
|
|
<p>Before we do anything else with our script, let's <strong>save it</strong> so UOX3 can read it, and <strong>assign it a unique scriptID</strong> - so we can assign the script to an object in-game! First, save the document in the <span class="hl">UOX3/js/custom/</span> folder with a name of your choosing, but with a <strong>.js file extension</strong> (suggestion: <span class="hl">myFirstScript.js</span>).</p>
|
|
<p>Next, open <span class="hl">UOX3/js/jse_fileassociations.scp</span> in your text-editor, and add a new line somewhere <strong>inside the curly brackets under the [SCRIPT_LIST]</strong> section, saying: <span class="hl">20000=custom/myFirstScript.js</span> (or whatever you named your script). <strong>Save the file!</strong></p>
|
|
<p>Now, to get UOX3 <strong>to load</strong> your newly added script, <strong>go to the UOX3 console</strong> and hit the '<span class="hl">*</span>' key to unlock the console, followed by '<span class="hl">8</span>' - which will reload all JS scripts (including your new script). This will take a few moments.</p>
|
|
<h4>Assign the Script</h4>
|
|
<p>To test out the script as it stands so far, login with your admin/GM character and use the command <span class="hl">'addscptrig 20000</span>, before <span class="hl">targeting an item in your inventory</span> (or on your character's paperdoll). Now double-click said item and observe some text appearing over the head of your character!</p>
|
|
<p>Once this is confirmed to be working, let's extend our script and change it up a little:</p>
|
|
<h4>Roll the Dice</h4>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var diceResult1 = RandomNumber( 1, 6 );
|
|
var diceResult2 = RandomNumber( 1, 6 );
|
|
|
|
return false;
|
|
}</code></pre>
|
|
<p>Above, we removed the dummy TextMessage line, and replaced it with some new lines that generate two random numbers between 1 yo 6, simulating the throw of two regular six-sided dices, and store the results in a couple of variables we call diceResult1 and diceResult2, which we will make use of soon!</p>
|
|
<p>At the bottom of the function, we threw in a line saying "return false;", which for the onUseChecked() event tells UOX3 to disregard any hard-coded functionality for double-clicking the item; we're handling it in our script. Next up, let's fetch the name of the character that's doing the virtual dice-rolling:</p>
|
|
<h4>Fetch Name of Player</h4>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var diceResult1 = RandomNumber( 1, 6 );
|
|
var diceResult2 = RandomNumber( 1, 6 );
|
|
var pName = pUser.name;
|
|
|
|
return false;
|
|
}</code></pre>
|
|
<p>Here, we've stored the .name property of pUser - the character who double-clicked on the item iUsed - in a variable we call pName. The name of this variable (and of diceResult1 and diceResult2) are up to us, but it helps to name them something that can help us identify what they're used for, if we come back to the script later!</p>
|
|
<p>Now we have the name of the high-roller, and the result of the two dice-rolls, so let's make the script announce the results:</p>
|
|
<h4>Announce Dice Results</h4>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var diceResult1 = RandomNumber( 1, 6 );
|
|
var diceResult2 = RandomNumber( 1, 6 );
|
|
var pName = pUser.name;
|
|
|
|
pUser.EmoteMessage( diceResult1 );
|
|
pUser.EmoteMessage( diceResult2 );
|
|
|
|
return false;
|
|
}</code></pre>
|
|
<p>With the above additions, the character pUser will emote the results of the two dice rolls in-game! However, all you see is a couple of numbers appearing above the character's head, as two separate messages. Let's improve the message displayed:</p>
|
|
<h4>Finalize Result Announcement</h4>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
var diceResult1 = RandomNumber( 1, 6 );
|
|
var diceResult2 = RandomNumber( 1, 6 );
|
|
var pName = pUser.name;
|
|
|
|
pUser.EmoteMessage( pName + " rolls the dice and gets a " + diceResult1 + " and " + diceResult2 + "." );
|
|
|
|
return false;
|
|
}</code></pre>
|
|
<p>Much better! Now both the player doing the clicking and others nearby get some context to the numbers they're seeing. We did this by combining the name, the dice results and some other text into one string of text with the help of some simple addition and some quotes around the extra pieces of text!</p>
|
|
<p>And that's it! Your first script is complete!</p>
|
|
</div>
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
|
|
<li class="cd-faq__item">
|
|
<a class="cd-faq__trigger" href="#tipsQuickReference" id="tipsQuickReference"><span>JS Quick Reference</span></a>
|
|
<div class="cd-faq__content">
|
|
<div class="text-component">
|
|
<p>This section acts as a quick-reference guide for doing specific things with JavaScript in UOX3.</p>
|
|
|
|
<input type="checkbox" id="spoiler_qr_match"/>
|
|
<label for="spoiler_qr_match">Perform a search in a string <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match" rel="noopener" title="JavaScript Reference - match" target="_blank">JavaScript Reference - match [mozilla.org]</a></p>
|
|
<p>Search a string for a match against a regular expression. Returns null if no match is found, otherwise returns an array with details about where the match was found. If the regular expression includes /g modifier, match will return an array with all matches found throughout the string, but without additional details. If an /i modifier is included, the search is case insensitive:</p>
|
|
<p>Example 1:</p>
|
|
<pre><code class="language-javascript">if( mySpeech.match( /hello/i ) )</code></pre>
|
|
<p>Example 2:</p>
|
|
<pre><code class="language-javascript">var matchResultArray = mySpeech.match( /follow/i/g );
|
|
Console.Print( "Matches found: " + matchResultArray.length + "\n" );</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_vartype"/>
|
|
<label for="spoiler_qr_vartype">Check the type of a variable <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof" rel="noopener" title="JavaScript Reference - typeof" target="_blank">JavaScript Reference - typeof [mozilla.org]</a></p>
|
|
<p>Using typeof, you can check the type of a variable based on the string returned. It can return types like "boolean", "number", "string" or "undefined" (a variable with no value).</p>
|
|
<p>Example 1:</p>
|
|
<pre><code class="language-javascript">pSock.SysMessage( "The variable myVar is a " + typeof( myVar ) + " variable." );</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_pausemove"/>
|
|
<label for="spoiler_qr_pausemove">Pausing a wandering NPC in his tracks for X seconds <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p><a href="#" title="UOX3 JS Reference - SetTimer Method">UOX3 JS Reference - SetTimer</a></p>
|
|
<p>Using the JS Character Method SetTimer, you can pause an NPC in their tracks for a specific amount of seconds. After this they will return to their previous wandering.</p>
|
|
<pre><code class="language-javascript">myNPC.SetTimer( Timer.MOVETIME, 10000 ); // 10000 = 10 seconds</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_resetdecay"/>
|
|
<label for="spoiler_qr_resetdecay">Reset the decay timer of an item <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>By manually setting the decay time of an item to 0, you can actually reset the decay time for said item to the default value (as defined in UOX.INI):</p>
|
|
<pre><code class="language-javascript">myItem.decaytime = 0;</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_removeitem"/>
|
|
<label for="spoiler_qr_removeitem">Move items in/out of containers <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>To remove an item from the container it's inside, you can set the container property of the item to null, and then move the item to the desired new location (or new container, in which case the step to set it to null can be skipped):</p>
|
|
<pre><code class="language-javascript">myItem.container = null;
|
|
// Next, teleport myItem to new location</code></pre>
|
|
<p>To move an item from the ground into a container, or from one container to another, you can set the .container property of the item to match the new container:</p>
|
|
<pre><code class="language-javascript">myItem.container = containerItem;</code></pre>
|
|
<p>To move an item directly into a character's backpack, you can set the .container property of the item to equal the .pack property of the character:</p>
|
|
<pre><code class="language-javascript">myItem.container = myChar.pack;</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_equipitem"/>
|
|
<label for="spoiler_qr_equipitem">Equip an item on a character <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>To equip an item on a character (after first checking for conflicting items on the layer in question), you set the character as the new container for the item, then set the layer to match the layer the item should be equipped on:</p>
|
|
<pre><code class="language-javascript">myItem.container = myChar;
|
|
myItem.layer = [layerID];)</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_tempObj"/>
|
|
<label for="spoiler_qr_tempObj">Storing objects or values temporarily on player sockets <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>If you need to bring an object reference from one function to another, and it's not possible to include the object in the function call, you can temporarily store the object reference in a player's socket's .tempObj (primarily used by code) or .tempObj2 (primarily used by scripts) property:</p>
|
|
<pre><code class="language-javascript">mySocket.tempObj = myObject;
|
|
// or
|
|
myChar.socket.tempObj = myObject;</code></pre>
|
|
<p>Other temporary storage variables available on sockets:</p>
|
|
<pre><code class="language-javascript">mySocket.tempInt // Temporary variable to store larger numbers (supports negatives).
|
|
mySocket.tempInt2 // Temporary variable to store larger numbers (supports negatives).
|
|
mySocket.xText // Temporary variable to store strings of text.
|
|
mySocket.clickX // Temporary variable to store small numbers (supports negatives).
|
|
mySocket.clickY // Temporary variable to store small numbers (supports negatives).
|
|
mySocket.clickZ // Temporary variables to store very small numbers (-128 to 128).</code></pre>
|
|
</div>
|
|
|
|
<input type="checkbox" id="spoiler_qr_findObjects"/>
|
|
<label for="spoiler_qr_findObjects">Finding characters or items near a character <i class="fas fa-angle-down"></i></label>
|
|
<div class="spoiler">
|
|
<p>To find characters or items near another object, you can make use of the AreaCharacterFunction() - for finding characters, AreaItemFunction() - for finding items, or AreaObjFunc() - for finding both characters and items.</p>
|
|
<pre><code class="language-javascript">function onUseChecked( pUser, iUsed )
|
|
{
|
|
// Finding items within a radius of 10 tiles from pUser
|
|
// Replace with AreaCharacterFunction to find characters.
|
|
// Socket can be a player socket or NULL (if script runs for item/npc)
|
|
// var numberOfCharsFound = AreaCharacterFunction( "findNearbyChars", pUser, 10, pUser.socket );
|
|
var numberOfItemsFound = AreaItemFunction( "findNearbyItems", pUser, 10, pUser.socket );
|
|
pUser.TextMessage( "I found "+numberOfItemsFound+" items nearby!" );
|
|
return false;
|
|
}
|
|
|
|
// function findNearbyChars( pUser, trgChar, pSock )
|
|
function findNearbyItems( pUser, trgItem, pSock )
|
|
{
|
|
if( trgItem && trgItem.isItem )
|
|
return true;
|
|
else
|
|
return false;
|
|
}</code></pre>
|
|
</div>
|
|
|
|
</div>
|
|
</div> <!-- cd-faq__content -->
|
|
</li>
|
|
</ul> <!-- cd-faq__group -->
|
|
</div> <!-- cd-faq__items -->
|
|
|
|
<a href="#0" class="cd-faq__close-panel text-replace">Close</a>
|
|
|
|
<div class="cd-faq__overlay" aria-hidden="true"></div>
|
|
</section> <!-- cd-faq -->
|
|
<div style="text-align: center; margin-top: 0; margin-bottom: 20px">
|
|
<p><small>UOX3 JSE Docs by Xuri @ Copyright 2022-2025</small></p>
|
|
<p><small>Built upon <a href="https://codyhouse.co/demo/faq-template" rel="noopener" target="_blank" title="FAQ Template framework by CodyHouse">FAQ Template framwork provided by CodyHouse</a>.</small></p>
|
|
</div>
|
|
<script defer>
|
|
// Handle filters
|
|
document.getElementById("filterInputEvents").addEventListener("keyup", filterInputHandler, false);
|
|
document.getElementById("filterInputFunctions").addEventListener("keyup", filterInputHandler, false);
|
|
document.getElementById("filterInputMethods").addEventListener("keyup", filterInputHandler, false);
|
|
document.getElementById("filterInputProperties").addEventListener("keyup", filterInputHandler, false);
|
|
|
|
function filterInputHandler( e ) {
|
|
var filterInput = this.textContent.toUpperCase();
|
|
var parentDivID = e.composedPath()[0].closest('ul').id;
|
|
var parentDiv = e.composedPath()[0].closest('ul');
|
|
var filterElements = null;
|
|
|
|
if( parentDivID == "events" )
|
|
filterElements = parentDiv.getElementsByClassName('text-component');
|
|
if( parentDivID == "properties" )
|
|
filterElements = parentDiv.getElementsByClassName('settingsDiv');
|
|
else if( parentDivID == "methods" || parentDivID == "functions" )
|
|
filterElements = parentDiv.getElementsByClassName('spoilerWrapper');
|
|
|
|
var filterCategories = parentDiv.getElementsByClassName('cd-faq__item');
|
|
|
|
if( filterInput == "" )
|
|
{
|
|
this.style.border = "none";
|
|
ResetFilter( filterElements, filterCategories, parentDiv );
|
|
}
|
|
else
|
|
{
|
|
this.style.border = "2px solid yellow";
|
|
ApplyFilter( filterElements, filterCategories, parentDiv, filterInput );
|
|
}
|
|
}
|
|
|
|
function ResetFilter( filterElements, filterCategories, parentDiv ) {
|
|
for( i = 0; i < filterElements.length; i++ ) {
|
|
filterElements[i].style.display = "";
|
|
filterElements[i].style.border = "none";
|
|
}
|
|
|
|
for( i = 0; i < filterCategories.length; i++ ) {
|
|
filterCategories[i].style.display = "";
|
|
if( filterCategories[i].classList.contains('cd-faq__item-visible') )
|
|
filterCategories[i].firstElementChild.click();
|
|
}
|
|
}
|
|
|
|
function ApplyFilter( filterElements, filterCategories, parentDiv, filterInput ) {
|
|
// Loop through all list items, and hide those who don't match the search query
|
|
for( i = 0; i < filterElements.length; i++ ) {
|
|
var txtValue = filterElements[i].textContent;
|
|
var filterElem = filterElements[i];
|
|
//var spoilerWrapper = filterElem.closest(".spoilerWrapper");
|
|
if (txtValue.toUpperCase().indexOf(filterInput) > -1) {
|
|
//if( spoilerWrapper != null )
|
|
//spoilerWrapper.style.display = "";
|
|
filterElements[i].style.display = "";
|
|
if( filterInput !== "" )
|
|
{
|
|
filterElements[i].style.border = "2px solid yellow";
|
|
if( !filterElements[i].closest('.cd-faq__item').classList.contains('cd-faq__item-visible') )
|
|
filterElements[i].closest('.cd-faq__item').firstElementChild.click();
|
|
}
|
|
|
|
} else {
|
|
//if( spoilerWrapper != null )
|
|
//spoilerWrapper.style.display = "none";
|
|
filterElements[i].style.display = "none";
|
|
filterElements[i].style.border = "none";
|
|
|
|
for( j = 0; j < filterCategories.length; j++ ) {
|
|
var filterChildren = null;
|
|
if( parentDiv.id == "events" )
|
|
filterChildren = filterCategories[j].getElementsByClassName("text-component");
|
|
if( parentDiv.id == "properties" )
|
|
filterChildren = filterCategories[j].getElementsByClassName("settingsDiv");
|
|
else if( parentDiv.id == "methods" || parentDiv.id == "functions" )
|
|
filterChildren = filterCategories[j].getElementsByClassName("spoilerWrapper");
|
|
|
|
var divsArray = [].slice.call(filterChildren);
|
|
var displayShow = divsArray.filter(function(el) {
|
|
return getComputedStyle(el).display !== "none";
|
|
});
|
|
|
|
if( displayShow.length == 0 )
|
|
filterCategories[j].style.display = "none";
|
|
else
|
|
filterCategories[j].style.display = "";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/*function ApplyFilterOrig( filterElements, filterCategories, filterInput ) {
|
|
// Loop through all list items, and hide those who don't match the search query
|
|
for( i = 0; i < filterElements.length; i++ ) {
|
|
var txtValue = filterElements[i].textContent;
|
|
if (txtValue.toUpperCase().indexOf(filterInput) > -1) {
|
|
filterElements[i].style.display = "";
|
|
} else {
|
|
filterElements[i].style.display = "none";
|
|
|
|
for( j = 0; j < filterCategories.length; j++ ) {
|
|
var filterChildren = filterCategories[j].getElementsByClassName('settingsDiv');
|
|
var divsArray = [].slice.call(filterChildren);
|
|
var displayShow = divsArray.filter(function(el) {
|
|
return getComputedStyle(el).display !== "none";
|
|
});
|
|
|
|
if( displayShow.length == 0 )
|
|
filterCategories[j].style.display = "none";
|
|
else
|
|
filterCategories[j].style.display = "";
|
|
}
|
|
}
|
|
}
|
|
}*/
|
|
</script>
|
|
<script src="assets/js/util.js"></script> <!-- util functions included in the CodyHouse framework -->
|
|
<script src="assets/js/main.js"></script>
|
|
<script src="assets/js/prism.js"></script>
|
|
</body>
|
|
</html> |