diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..69b2865a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI Pipeline + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Check out repository code + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.14' + cache: 'pip' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pip install pytest + + - name: Run Test Suite + run: | + pytest \ No newline at end of file diff --git a/.gitignore b/.gitignore index ff54e9ee..5126968e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,24 @@ *.prof *.html -.env \ No newline at end of file +.env +_md_export/ + +# Python bytecode cache +__pycache__/ +*.pyc +*.pyo +*.pyd + +# Pytest cache +.pytest_cache/ + +*/__pycache__/ +_tmp_md_export/ + +old_bot.py +old_refsplitter.py +entries/ +pages/ +pretty_soup.txt +ref_doc.txt +dm cache sample.txt \ No newline at end of file diff --git a/README.md b/README.md index 0ae05f62..c7d1cca2 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,42 @@ -# About open-ref -This is an open source project meant to allow the [DM Reference](https://www.byond.com/docs/ref/) to be edited by the community to allow us to make fixes, corrections and ammendments and expand upon it. +# OpenRef +OpenRef is an open-source project that makes the BYOND DM Reference easier to maintain, improve, and expand through community contributions. -This repo also contains the tool used for splitting the reference provided by BYOND.com: `ref_splitter.py`. At this time the documentation for the tool is contained in the script itself. +Originally started as a way to edit and version-control the reference, the project evolved into a document-processing pipeline featuring HTML parsing, structured document models, automated transformations, testing, CI/CD, and community tooling. -The discord bot is also available here as well, under the bot folder. +## Features +* HTML → structured document parsing +* Markdown generation and transformation +* Automated reference processing tools +* Test suite and CI/CD pipeline +* Discord bot integration -You can join the BYONDiscord server to discuss this project [here](https://discord.gg/pTFccGgnAr) +## Repository Contents +### Reference Data +A community-maintained version of the DM Reference derived from BYOND's published documentation. ## Contributing -Anyone is welcome to submit contributions to open-ref. -Contributions can be made either on Github.com or by cloning the repo and working locally. -All contributions require a PR and are subject to approval. -If you have any thoughts for changes or edits, feel free to open a discussion on the repo or discuss them on the discord server - -## BYOND Version -The reference is currently built with the documentation for BYOND version 516.1644 alpha. -BYOND release notes can be found [here](https://www.byond.com/docs/notes/515.html). +Contributions are welcome, including: +* Documentation corrections +* Additional explanations and examples +* Tooling improvements +* Bug fixes +* Test coverage improvements + +All changes should be submitted through a Pull Request and are subject to review before being merged. +Discussion is available through GitHub or the BYONDiscord community: +https://discord.gg/pTFccGgnAr + +## Supported BYOND Version +The current reference data is based on BYOND 516.1644 Alpha. + +Release notes: +https://www.byond.com/docs/notes/516.html + +## Technical Focus +This project demonstrates: +* Parser development +* Document transformation pipelines +* Python application architecture +* Automated testing +* CI/CD workflows +* Open-source collaboration diff --git a/conftest.py b/conftest.py new file mode 100644 index 00000000..77ab23eb --- /dev/null +++ b/conftest.py @@ -0,0 +1,25 @@ +from pathlib import Path +import pytest +from ref_splitter.ref_splitter import RefSplitter + +@pytest.fixture(scope="function") +def mouse_down_sample_path(): + """Returns the absolute path to the mouse_down_sample test file.""" + return Path(__file__).parent / "tests" / "test_data" / "mouse_down_input_sample.txt" + +@pytest.fixture(scope="function") +def client_sample_path(): + """Returns the absolute path to the reference client sample file.""" + return Path(__file__).parent / "tests" / "test_data" / "ref_client_input_sample.txt" + +@pytest.fixture(scope="function") +def splitter(mouse_down_sample_path): + '''creates a shared splitter instance for all the tests in this module''' + with open(mouse_down_sample_path, 'r', encoding='utf-8') as f: + content = f.read() + + splitter_instance = RefSplitter(content) + splitter_instance.prep_pages() + splitter_instance.build_ref_entries() + + return splitter_instance diff --git a/diary.txt b/diary.txt new file mode 100644 index 00000000..142ca91d --- /dev/null +++ b/diary.txt @@ -0,0 +1,514 @@ + +PROJECT GOALS: + Learn Github Actions CI pipeline + Update refsplitter.py from dom_open_ref to be more maintainable + Expand python knowledge beyond the basics that I learned before, + leaning into OOP design and project organization + +The problems: + BYOND's built-in documentation is often lacking in its descriptions and the organization can be difficult for newcomers to navigate. + My last attempt 2 years ago to rectify this was haphazard and not very maintainable, as well as very static in its implementation. It also no longer works. + The output of the last solution only formatted a mirrored reference for use with dm_open_ref, making its utility very limited. + +The Solution: + Rewrite the parser from the ground up with the goals of maintainability, clean design, and wider utility. + The final product should be extendible, and natively support outputs for BYOND's native format, and oref. + + +#-----------------------------------------------------------------------------------------------------------------------------# +This will be an updated version of the dmo_open_ref (oref) reference splitter. + +The splitter will take the DM Reference html file and split it into RefEntry classes. +The RefEntry class will take that content and split it into more modularly digestible content. +RefEntry should have methods to serve its content in different formats. +This way, its content can be served in formats across different use cases such as: + - rebuilding as the BYOND native prettyref document + - markdown output for the oref repository + - custom (or customizable) formatting for external use (ie dmoide) + +The RefEntry's will all be assigned to a RefNode which will live in the RefTree. + +The RefTree should mirror BYOND's object tree. + +I'm going to give myself one week to complete this module. +The goals are: + Phase 0: Set up pytests and CI pipeline (1/2 hours) + [completed 05-29] (1 hrs total) + + Phase 1: DMRef extraction (19/16 hours) + Digest and extract raw content from info.html\(use old_refsplitter.py for reference) + Build the RefEntrys using the raw content in a logical format that can be formatted easily. + + Phase 2: Building the tree (2/4 hours) + Create RefNode class from RefEntry, to handle tree placement + Build the RefTree using RefNodes for the hierarchy. + + Phase 3: Packaging (7/21 hours) + Serve the RefTree in different formats, such as + md file format for oref repository* + rebuilding prettyref.html from custom content + A custom reference format that makes more sense for BYOND itself + *md formatting is a must-have, the rest are stretch goals + + Phase 4: Release (0/6 hours) + Tidy up remaining files + Review .gitignore + Add missing documentation + Update and proof-read Readme file. + Add images and possibly video to the readme + (stretch goal: clean up commit history to make it portfolio ready) + Release the project under CC0 + + ┌────────────────────────┐ + | Data Flow Overview | + └────────────────────────┘ + [Raw Web/Local HTML] + │ + ▼ (BeautifulSoup) + ┌─────────────────┐ + │ RefSplitter │ ───► Standardizes and tokenizes legacy HTML blocks + └─────────────────┘ + │ + ▼ Extracts into + ┌─────────────────┐ + │ RefEntry │ ───► Pure Data Object (Raw text, lists, see_also dicts, tokens) + └─────────────────┘ + │ + ▼ Encapsulated by + ┌─────────────────┐ + │ RefNode │ ───► Tree wrapper (References a RefEntry, tracks parent/children) + └─────────────────┘ + │ + ▼ Composes into + ┌─────────────────┐ + │ RefTree │ ───► Resolves BYOND hierarchy (/client vs /mob/var/client) + └─────────────────┘ + │ + ▼ Passed to + ┌─────────────────┐ + │ Exporters │ ───► (MarkdownExporter, PrettyRefExporter, HTMLExporter) + └─────────────────┘ + +#-----------# +# DIARY # +#-----------# + +[05-29-2026] (3 hour session) + Tonight I started work on the project in earnest. + With the goal in mind of getting to know the Github Actions and CI workflow, I started by getting pytest installed and set up some basic unit tests for myself to play with + From there, I set up the Actions workflow on github and published the repo. + After that, I dug into working on fetching the reference. + At first I was going to check the users computer, but I decided against that since the user may be using an outdated version. + This way, the onus is on BYOND to be publishing to the ref more regularly, and honestly, it's just easier and cleaner this way. + A future feature may be to add a program argument on startup to fetch remote or local, but for now, remote is fine. + Once I had the ref being pulled properly, I implemented three unit tests to check the following: + the url is correct + the timeout isn't above 10 seconds + ensure the ref is available and fetched. + that last test is flagged as a network test, and omitted from the github action, but will run locally when pytest is ran. Pretty nifty. + + Did some minor reorganizing. Ended up splitting the unit tests and network test into separate files, and updated the CI flow to only run the unit test file for now. + I'm pretty happy with the work today. I'm about 25% of the way through Phase 1 now that the reference fetching and tests are in place. + I'll have to really grind out the next session. + + Next Session Todo: + Reorganize project file structure: move main files into src/ folder and ensure it still runs. This'll save me later. + Begin development on the ref_splitter class to isolate reference entries, extract information, and strip formatting + pass the data into RefEntry class + + unit tests for this section should be: + ensure all formatting has been stripped away + ensure no ref entries are empty + ensure the number of ref entrys is correct (this one will be tricky) + + end goal for Phase 1: + explore mock testing and look into implementing mock tests to ensure proper data flow + +[01-06-2026] (9:30 am) + Started today by removing the old ref splitter files from the repo, and reorganizing the file tree + Then I set forth on intalling beautifulsoup to begin parsing the dm reference file. + + So the first thing I'll have to do is identify how the reference files are organized. + I'll start my search in the old splitter script, as I imagine most of what I'm looking to do I already did back then. + + (1pm) + So, working on the ref splitter for the last few hours, I tried to start by just naievely parsing the info.html file + This was a total mess, because it was written using extremely legacy rules, so none of the tags are properly closed, for example. + I've realized that my best course of action will be to let bs4's parser apply standard rules to the source file before extracting the useful info. + Once I've got the document parsed into a standard format, I can then use that with bs4 to extract the proper information and begin to populate RefEntry's. + So, my plan of attack is to, instead of try to "fix" the source html file, I'm going to extract the relevant information and use that to build o_refs markdown files. + + Once I've got the RefEntry class standardized, I can then use that to rebuild a "clean ref" html files, + using some of the rules I've uncovered with info.html to make sure that it conforms to the expected format, but is just a bit cleaner. + I also found that I can test this myself by just swapping out the local html file, so assuming that the web ref displays it following the same ruleset, + then if I can get this working locally, it should work with the webref as well. + + This will all, of course, be second to the main goal, of populating the md files that oref will end up using. + Alternatively, I may also look into using Github to host orefs open reference. + This could be either html that can be used by both the bot and byond for a simpler source of truth, or it could host the md, and then have a script + to consolidate the oref into the dmref format. Either or. + + But for now, we move on to the RefEntry extraction. + + I've got the entries extracting information correctly. Now to set out for parsing the "See also" lists. + Once I get this done I'll take a break, I've been at this for almost 6 hours already. + It looks like what I need to do is find the
tags and their grandchild tag that says "See Also:". + Probably not a perfect solution, but c'est la vie. We only need to get it with the first pass, and then we can fix it up later, once the source ref is cleaner. + + (3pm) + Alright, got the relative paths populating correctly. + Time for a break. Next sprint will be to formalize the RefEntry objects, and then populating the RefNodes and RefTree + + (6pm) + alright, I'm back at it after a bit of a break. + So far, I've gotten the "See Also" section pulled out of the reference entries. + + Next, I'll set my sights on other important information found in these entries: + - format + - arguments + - code blocks + + (8pm) + The parsing of the file content is giving me a bunch of little tiny problems here and there, so I'm going to take another break. + Currently, I've got the formatted lists appearing, so next I need to find a way to insert them into the content manually by dict lookup. + But we'll take care of that later. + + (12:30 AM, technically next day, but not) + I'm going to pull the lists out of the text now, and devise a token system for the RefEntry content. + + I do find myself wondering why I'm doing this with python instead of cpp, since that's what I've been working in more. + I guess it's not bad to get my fingers wet with another language, even if it's a hellspawn of unsafe practices. + Who cares if "we're all consenting adults". + + While going through and cleaning up, it was tempting to merge the related entries dict with the desc_lists list. + But, they're fundamentally different, where the related entries needs to encode both the link to the entry, and the name of the link + Whereas the desc_lists is essentially just a list of strings to be formatted. + + Going down this line a little bit more, I think I can get away with creating a dict of links for the pages. + I'd love to be able to do this for the whole document, but I think that's outside the realm of possibility. + I just don't trust the source ref to not reuse the same name with different link paths. + I could I guess use the paths as the keys, but then I don't have a reliable way of determining which text value to use. + I do think, however, that using the path for the key would work. This way, I can have just ONE text string to link to a specific page. + I can go through and clean this up a little bit later if some of the text doesn't make sense in a given context. + + A good example is that of the /client object, and the mob.client var. both are probably referenced as 'client' as the text for the links. + So using 'client' as a key is a no go. + But {'/client' : "client", '/mob/var/client' : 'client'} does seem like it would make sense. + + I'm feeling pretty good about this now, but I do have a small concern with the refsplitter holding the links. + That /might/ be fine for now, but I will probably end up passing that off on to the RefTree at some point, so that the source of truth + isn't kept on an ephemeral object. + Like, it's not a huge deal, since the whole thing is meant to just run and finish, but. meh. Thoughts to be had at least. + + Alright. Finished the night off by getting the test framework cleaned up, and learned about paramterization and fixturing with pytest. + nifty little features that let me test multiple inputs, and scope data for related tests within a single module, respectively. + + I'm pretty happy with how today went. + + Tomorrow, I'm going to take a break from the parsing itself, since I know from last time that there are a dozen dozen edge cases with byonds bs + So I'll work on getting the RefTree and RefNodes setup properly, and then look at exporting it into the two different formats. + That's all for now, signing off at 3:30 AM. + +[06-2-2026] + Ok. starting up at noon today. + The goal today is to get the RefNode and RefTree populating, and then if I have time, look into getting the markdown files set up as a github site. + I spent a bit of time today looking at options for hosting the github pages for oref. + I'll do some more work with it later, but for now, we're going to get into the thick of things with the nodes. + + Progress is carrying on quite well. took a 30 min break to grab coffee and a vape. + I'm making a note here that I need to handle p class attributes like "compatability" + This will give hints for the xmp parsing back into the byond documentation, as well as + hinting for markdown formats. Shouldn't be too rough. + + I've gotten the parsing more or less wrapped up for now. Setting up the unit test to test the failure state for + the page parsing is proving to be a bit difficult because of bs4, but I just need to figure out how to either Create + custom tags, or possibly reformat the data flow to accept something other than a bs4 tag. + + Took another hour break. Getting back into this now, I need to replace the tokens with their markdown equivalents. + + alright. So I spent the last half hour cleaning up the old oref repo to remove both the bot and the old parser. + I'll need to make sure to backup the bot somewhere, but I can do that another time. + + for now, we'll commit the new ref markdown and examine the diffs. + + first, we'll wire this up to export into the oref folder, then we'll wire up the commit + + Success. I managed to get the ref parsed out into the reference tree. There are a few issues that I need to address, but all in all looking pretty good. + Issues: + file paths are not being respected when they are a folder, they're being added to the parent folder as siblings of their own folder + I haven't properly plugged in the nodes yet, which means that the file tree is being built entirely off of the page path. + That's not terrible, but it's also not at all flexible. This will be my next project. + + I've also learned that github pages serves front-end web formats, so I'll need to be reformatting these to html anyways. + After thnking on this a bit further, this is what I've come up with. + + First off, take the reference, and parse it into pages of raw information. + Second, format those pages into markdown and export them into the openref repo. This is read by a discord bot to serve information on the byond discord channel. + Third, we think in terms of the pages deployment pipeline. + - The markdown files are pulled from the open ref repo (so that community changes are combined with the byond docs) + - those markdown files formatting is converted into standard html, that conforms with byonds javascript + - the html formatted pages are combined and served on the github pages site, using the byond reference javascript to navigate them. + - stretch goal, have some custom css + + I can feel myself getting pretty tired. It's been a busy last couple of days, with some fantastic progress. + I do need to update and confirm my testing framework. + +[06-03-2026] + It's a late night session for me. I'm going to work myself into a sprint to get the markdown export pipeline done tonight. + I'd like to wrap this project up today and get it back out into the wild so that I can begin to focus back on dmoide. + + Tonights todo is: + Finalize the RefEntry structure + Build the RefTree class + Build the filetree export + Complete the markdown formatting + Complete file export + + I might not even need the tree, but it's good to have for ease of use down the line. + Actually, having the tree is good, since it's main purpose is to manage the refnodes themselves, and provide things like + searching and reorganizing. Although those concepts aren't a part of the design spec. So I guess I should scrap it? + But no, I need a container for the refnodes themselves. without the reftree they end up contained in a list, referencing each other. + So yes, the reftree is necessary. + I'll keep the tree, but I'll implement it currently as a simple container class. This way it's easy to extend down the line + and provides explicit context for the refnodes + + I got the common fields implemented, and then ended up really arguing with python to get the tests forit configured correctly. + + I did learn about pytest dependency, so that I can branch my tests and only execute some if others have passed, which solvs a problem I have with + a boatload of fails if certain things don't end up passing. + + I definitely need to work on my discipline with organizing these tests, but this is my first time working with these, and I can already notice that + there's been a change in how I write code, where my implementations are cleaner just as a result of having tests at all, + so while the testing implementations might be a bit lackluster and disorganized, the actual code itself is much better off just as a result. + I've sort of pushed the hot mess back a layer. + + So, one of the issues I've got is that BYOND's ref only ever has one term in their description lists. + While this isn't a big problem, I have a bit ofa crossroads. I should technically allow the dl parser to extract all dt tags and their dd counterparts + however, that's beyond the scope of what the program needs to expect. + But if I only accept one dt tag now, I'll have to rewrite it later. + In the interest of time, I will simply leave a note on both the test and the parsing function, and move on. + + I'm going to add commit messages to the diary now, as part of the CI setup. + + [COMMIT [2026-06-04 02:24:36]: testing automated commit messages in diary entry + + Success! + + Previously, I ended up in an infinite loop, so the file got bloated. I nearly lost all of my work from the night, but using + git reflog I was able to save it, even though I had to sift through about a thousand commit ammendments to find it. + + [COMMIT [2026-06-04 02:26:27]: confirmed commit messages are added to diary + [COMMIT [2026-06-04 02:27:39]: test commit message format + + Excellent. This will help me keep track of exactly where I am in my workflow. + + Time for a break. I might not make the sprint tonight happen, but I'm happy with where the work took me so far. + + Next thing to do is confirm the full parse on a single test file (main.py has been updated to swap build states easily) + After that, I can set up the tree, which should only take a couple of hours. + + Then just build the new file, iterate the formatting, and bobs your uncle. + Should be able to ship before work, if I have the energy to contnue my all nighter. + + Once I have correct output, I need to create an E2E test for the sample, so that future tests can be confirmed working. + But rather than write the test first and build to conform to it, given the size and complexity, it'll be faster for me to create the test file dynamically, from the parser. + I could technically pull a properly formatted file from the live oref, since it's in the correct md format already. + I might actually do that when I get back from my break. + +[06-06-2026] (4 hours) + I spent tonight working on getting the new export method wired up. I'm pretty satisfied with how this turned out and came together. + + I separated the export functionality to its own ExportMD class in its own little file. This will help to keep things organized + as more export types are added in, at the very least just the markdown and the updated html. + + I still have to get tests setup for the new export functionality, but I also now have a snapshot of the markdown file, so I can + at least confirm that any changes I make from here on don't muck up the output of the file. I'm not sure there's much utility in that + outside of if I go through and refactor, which I don't see being a thing at this point, but that's not the test driven mindset. + + I've also definitely learned that writing the unit and integration tests definitely helps me keep the code nice and clean, so regardless of how I feel + about the tests at this particular moment, it's important that I get them setup. Besides, testing is half the reason for this project to begin with. + + So, the tests will be the todo for tomorrows work. + + Cheers. + [COMMIT [2026-06-07 00:08:38]: implements export as its own class. minor code reorganization + adds in client_mouse_snapshot.md file for future e2e tests + + It's almost there. I do have some little things I want to do within the realm of CI, but tomorrows task is to button up this version to make sure it's + on par with the last version of oref. + + Once that's done, before I ship, I'll do another pass for documentation and making it folio ready. + I won't be adding tests for the sake of tests though, so there won't be complete coverage, but I'll still do proper unit test passes to make sure that + future changes don't break the program down the line. + But the v2 project is getting github pages setup for the project, and then implementing the HTML export, so that I can live view orefs changes in + the native byond reference format on a legacy branch of the pages site. It'll be a fun way to spend the weekend, but I need the infra in place before + I can go down that route. + + This version is about 95% to finished I think + +[06-07-2026] (1 hour) + Today I'm working on handling the edge cases for the html parsing and markdown formatting to ensure relatively seamless parsing + in preparation for setting up the new oref repo and github pages repo. + + [COMMIT [2026-06-07 17:52:47]: implements p class tokens and adds markdown checks to token unit tests + [COMMIT [2026-06-07 18:00:35]: implements data-driven approach to p class tokenization + fixes typo in token_table for 'compatibility' tag + +[06-08-2026] + Took a good solid break last night to get some much needed rest and I'm back at it today. + Just finishing up the last of the markdown formatting for paragraph tags. + + I still need to handle the last few cases for paragraph parsing, and then set up the test suite for the exporter. + Once that's done, I'm ready to run a full export, but need to make sure that the export aborts in the event of a failed parse and a failed file write. + + + [COMMIT [2026-06-08 06:14:37]: implements p_class token parsing + [COMMIT [2026-06-08 06:28:20]: formatting cleanup pass + [COMMIT [2026-06-08 15:35:18]: implements test suite for export.py implementation + + I've been pretty quiet on the diary, as it's been mostly grunt work, setting up things like + the test suite for the export script and refactoring a few things. Details for that are in the commit logs. + + However, the last task on the todo is to set up the Ref Tree, and I'm at a bit of an impasse so I'm going to rubber ducky it here. + + DM's reference organizes itself into a tree, where each node on the tree is an entry in the reference. + This works great with the js implementation, because the custom tree on the left lets users click on the elements. + However, for an md repository on github, this doesn't work, as in the case of something like the canonical atoms + they are all organized into a folder structure that places the files for example for "mob" and "obj" are placed into the "atom/movable" dir + where they should logically be found in their respective folders. + + So what I need to do is to make the RefTree build the file tree first, then as I parse the pages, I can lookup the directories and if the page name + matches a directory name (ie: /atom/movable/mob dir would match the /atom/movable/mob page, by nature of the way I'm populating entry paths) + + HOWEVER! I need to look into the options for deploying github pages, because the frontend might handle the display system the same as the byond ref does. + If that's the case, then I don't need to do any extra work, as the backend md directories would be displayed correctly. + + I'll just run this as-is for now and worry about the filesystem foo awhile later. I'm more interested in + A: getting the open ref repo up and running on a fresh repository. + B: pushing the exported markdown to said repository, using github actions + C: setup the github pages site to render. im not settled on the actual front-end framework at the moment. I need to handle B and C first. + * The above was scrapped in favour of the workflow below + + The flow I need to implement for the completed project is as follows: + + ┌────────────────────────────────────────────────────────────┐ + | [ Local Machine ] | + | ┌────────────────┐ 1. Triggers ┌───────────────┐ | + | │ Bot Script │ ────────────────────> │ Parser Script │ | + | └────────────────┘ └───────────────┘ | + | │ │ | + | │ 3. Pushes Updates │ 2. Outputs Fresh + | ▼ ▼ Markdown Files + | ┌────────────────┐ ┌───────────────┐ | + | │ Local Git Repo │ <──────────────────── │ Output Folder │ | + | └────────────────┘ Copies files into └───────────────┘ | + | │ | + └────────────────────────────────────────────────────────────┘ + │ 4. git push + ▼ + ┌─────────────────────────────────────────────────────────┐ + │ GitHub.com │ + │ ┌───────────────────────────┐ 5. Auto-renders │ + │ │ dm_open_ref (new branch) │ ─────────────────> Pages │ + │ └───────────────────────────┘ │ + └─────────────────────────────────────────────────────────┘ + + This is entirely new to me, with this many moving parts from different infrastructures, so it might actually take me a few days to get it up and running. + I think the first move is to get the repo updated to the freshly parsed files. that's going to be a diff and a half, so I'll start by branching the live ref + and then work on my changes separately. Once I'm happy with it, then I can merge into main. + + So to simplify this into actionable steps: + [✓] 0) Branch open-ref for the new version of the parser + [✓] 1) Create a new repo for the bot to live on (laptop) + [ ] 2) Have the bot ping BYOND to check for new versions (will have to figure this part out) + [ ] 3) if a change is detected, have the bot spin up the parser + [ ] 4) parser should write to the local open_ref repo + [ ] 5) commit and push the local open_ref repo (halt if merge conflicts or errors) + [ ] 6) calculate some flashy metrics for the process on the bot side + [ ] 7) send telemetry to GitHub from the bot to display runtimes and other fancy metrics + [ ] 9) let this system run in the background for a week or two, implementing more tests as issues arise and updating discord features on bot + [ ] 10) merge to main open_ref repo + [ ] 11) implement github pages for the new repo content + + Alright. Step 1 is done. Time to take a break. + + I'm back from my break, and I've had a good think. I feel a little flustered because I feel like this is a lot of back and forth right now. + I'm leaning towards a simpler single-repo approach, like I had before. I guess I liked the idea of a multi-repo solution so that someone pulling + or contributing didn't have to grab the bot and everything else if they wanted to contribute or test things, but I'm learning that one of the benefits + of python is that the "programs" it makes are all super modular. You just run the script you want to run, and those dependencies run + when they're told to, or they don't. so for this setup, there's no need to completely lock everything behind its own repository. + It just adds unecessary complexity to the whole project. KISS baby. + + I will say, I'm learning an awful lot of CLI commands. + + Ok. We've got the old repo merged into the main oref repo now, git history preserved! hallelujiah, or whatever it is. + Time to dig in with reconfiguring the output stream, and then I can take a look at setting up this front-end + + [COMMIT [2026-06-09 02:06:47]: moves diary to open_ref root folder and adds commit message back into it + + That's better! Now it's time for bed. + +[06-09-2026] + Alright, back at it for another day off. The goal today is to get the program wrapped. + + The first order of business is to finish sorting the tree structure for the refnodes. We'll add a recursive function to build the path from the parents up to root, and then check if the current directory has + a folder with the same name as a node when we go to write the file, and if so, place it into that folder. I guess if I use MkDocs I also need to rename this file as well, depending on the rendering setup. + But let's get this working first, and then we can direct our attention to the front-end + + Alright. We've got the file mapping done now. The 'RefTree' is now more a collection of nodes, since there's no parenting or association going on there, so it's technically not a tree any more. + The next item will be implementing some tests for the pages to confirm: + - file structure: not sure how to confirm this. + - index file population: make sure that the index files were properly moved to their directories, renamed and don't exist as siblings to their dir + - link validity: since the tmp folder contains the /ref folder that will be moved, then links should yield a 1:1 match in tests + Once those tests are implemented, then write a CD script to move the temp folder over to the main ref folder and push it to git. + post-move tests will need to include: + - temp folder has been removed: check that it doesn't exist + - links still hold up: scan all of the files and make sure they aren't broken (adding this pass allows more formatting tests down the line as well) + - file structure is identical (will need to cache it and compare) + assuming these pass, we can push to remote + [COMMIT [2026-06-09 16:02:50]: fixes test suite + + Alright. Had to fix up the broken test suite. That was an adventure through stale caches, relative pathing and an admittedly bad config file. + I ended up moving the test suite out from ref_splitter into the root folder, so I had to point the ini to the correct dir and lock it in properly. + The directory is now looking much cleaner. I only have an old local test file that's now gone that I either need to add back in, or learn the pytesty way to populate test data like this. + + Alright. So I put the test file into a new test_data folder and point to it now from the conftest.py file. I also moved over the splitter fixture. At some point soon I'll do a pass of all of my tests + to make sure they're consistent and conform to proper standards. + + For now, I'm just glad that I've got them all working properly again. I did also remove a stale test that was testing for fields in the splitter that are no longer relevant. + + Time for some dinner and a few episodes of a show before I continue on by writing the test suite for the new export flow. + [COMMIT [2026-06-09 16:24:16]: configures test file for ref_splitter tests and moves refsplitter fixture to conftest and removes module scope + [COMMIT [2026-06-09 22:02:57]: implements e2e test happypath using test file + Ended up writing out a new end to end test to follow through the happy path. + The only thing left to do now is to automate the move over to the /ref folder, and then write some e2e tests on + + Fantastic! The program works! What a happy day! + + There are undoubtedly going to be some issues that have cropped up, and I will plan to automate deployment in the future, but for now, this works swimmingly! + + Excellent day! I'm satisfied with this, and am comfortable pushing this to the repo. After all, it's for a small community of devs. If there are any small issues + with any of the pages, then they'll understand and let me know. + [COMMIT [2026-06-09 22:45:20]: replaces remote ref with ref parsed with v2 parser program + + + [COMMIT [2026-06-09 22:53:39]: updates ci.yml to run all unit tests + + + [COMMIT [2026-06-09 23:09:06]: updates readme and addresses tests failing on runner + + + [COMMIT [2026-06-09 23:12:31]: testing fix on the runner + + + [COMMIT [2026-06-09 23:19:40]: attempts to correct runner errors _again_ + + + [COMMIT [2026-06-09 23:20:58]: fixes oopsie typo on ci.yml + + + [COMMIT [2026-06-09 23:24:21]: testing runner again + + + [COMMIT [2026-06-09 23:27:18]: Removing linux simulation and info test from suite (it has served its purpose!) + diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..eb239ed1 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,7 @@ +[pytest] +pythonpath = . +markers = + unit: small unit tests + integration: larger tests to test feature integration + e2e: full system end to end test + network: marks tests that require network/internet access \ No newline at end of file diff --git a/ref/DM/DM.md b/ref/DM/DM.md deleted file mode 100644 index def5ddcb..00000000 --- a/ref/DM/DM.md +++ /dev/null @@ -1,33 +0,0 @@ -# DM language details - -The DM (Dream Maker) language uses a syntax similar to C/C++ to -build networked multi-user worlds. This reference and the accompanying -guide discuss the structure and function of DM. - -This reference -is arranged in sections: -- **The DM language:** The majority of the reference; items in this - section can have top-level entries. -- **Special notes:** Articles describing advanced features or concepts - in more depth. -- **User interface skins:** Anything related to creating custom UIs - for your world. -- **Appendix:** Additional reference informtation that might apply to - multiple topics, e.g. regarding colors or HTML. - -You can filter the reference content by subject, which helps -narrow down anything you might be looking for. - -In various -articles you may see notes or sidebar content: - ---- -------------------- - ⚠️ Important note\ - 🔒️ Security concerns\ - 🏃️ Performance tip\ - 👍️ Rule of thumb\ - 🏛️ Compatibility\ - 💡️ Did you know?\ - 🔧️ Under the hood\ - 🦕️ Deprecated feature\ - 🎳️ Play area - ---- -------------------- \ No newline at end of file diff --git a/ref/DM/cache.md b/ref/DM/cache.md index 486dd5b5..20f1c176 100644 --- a/ref/DM/cache.md +++ b/ref/DM/cache.md @@ -1,28 +1,16 @@ -## cache -Files specified in single quotes are loaded (at compile time) -into the world cache file (ending in `.rsc`). These are referred to as -resource files. At runtime these files are downloaded by players into -their `byond.rsc` file for future use. With the appropriate verbs or -through savefiles, players may also upload files into the world cache. +## cache (info) +*** +Files specified in single quotes are loaded (at compile time) into the world cache file (ending in .rsc). These are referred to as resource files. At runtime these files are downloaded by players into their byond.rsc file for future use. With the appropriate verbs or through savefiles, players may also upload files into the world cache. -If a resource file is not used for a long time, it will be -automatically removed from the cache file to save space. If a cache file -gets too bulky, however, you may manually delete it and start from -scratch. +If a resource file is not used for a long time, it will be automatically removed from the cache file to save space. If a cache file gets too bulky, however, you may manually delete it and start from scratch. -To make compilation faster and to make it easier to -distribute code, the compiler will use an existing cache file if -possible. That means you could compile up a world, and send people the -`.dm` and `.rsc` files without any need to package all the individual -resource files. It is also possible to include additional supplementary -`.rsc` files by using the `#include` statement. - -> [!TIP] -> **See also:** -> + [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR.md) -> + [cache_lifespan var (world)](/ref/world/var/cache_lifespan.md) -> + [fcopy_rsc proc](/ref/proc/fcopy_rsc.md) -> + [file proc](/ref/proc/file.md) -> + [icons](/ref/DM/icon.md) -> + [sounds](/ref/DM/sound.md) \ No newline at end of file +To make compilation faster and to make it easier to distribute code, the compiler will use an existing cache file if possible. That means you could compile up a world, and send people the .dm and .rsc files without any need to package all the individual resource files. It is also possible to include additional supplementary .rsc files by using the #include statement. +*** +**Related Pages:** ++ [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR) ++ [cache_lifespan](/ref/world/var/cache_lifespan) ++ [fcopy_rsc proc](/ref/proc/fcopy_rsc) ++ [file proc](/ref/proc/file) ++ [icons](/ref/DM/icon) ++ [sounds](/ref/DM/sound) diff --git a/ref/DM/comment.md b/ref/DM/comment.md index 1aed4185..2ec9453a 100644 --- a/ref/DM/comment.md +++ b/ref/DM/comment.md @@ -1,23 +1,22 @@ -# comment +## comment (info) +*** +Comments may be used to explain code. They can also be used to turn off a line or block of code. All text inside a comment is ignored by the compiler. -Comments may be used to explain code. They can also be used to -turn off a line or block of code. All text inside a comment is ignored -by the compiler. +The single line comment begins with // and runs to the end of the line. -The single line comment begins with `//` and -runs to the end of the line. - -The multi-line comment begins with -`/*` and runs until `*/`. +The multi-line comment begins with /* and runs until */. Multi-line comments may be nested. -### Example: + ```dm + // single line comment /* multi-line comment */ ``` + +*** \ No newline at end of file diff --git a/ref/DM/garbage.md b/ref/DM/garbage.md index a118d739..5d493cb5 100644 --- a/ref/DM/garbage.md +++ b/ref/DM/garbage.md @@ -1,101 +1,29 @@ -## garbage collection +## garbage (info) +*** +At runtime, data objects are garbage collected. That means data which is no longer in use gets automatically deleted to free up system memory. This applies to text strings, lists, savefiles, datum objects, and so on. +The garbage collector works by using an efficient reference counting system. Once an item is no longer referenced by any variable, it gets deleted. For the most part, that frees you from having to think about memory allocation, which is wonderful, especially in the case of text strings, which tend to be allocated on the fly all over the place. -At runtime, data objects are garbage collected. That means data -which is no longer in use gets automatically deleted to free up system -memory. This applies to text strings, lists, savefiles, datum objects, -and so on. +There are a couple provisos that you should note. One is that circular references will never be deleted by the garbage collector. By circular reference, I mean a pair of objects with variables that point to each other, or even an object with a variable that points to itself. In rare cases, you may even depend on this behavior. When you are done with such objects, you should either null out the circular reference, or you should forcibly destroy each object with the del instruction. -The garbage collector works by using an efficient -reference counting system. Once an item is no longer referenced by any -variable, it gets deleted. For the most part, that frees you from having -to think about memory allocation, which is wonderful, especially in the -case of text strings, which tend to be allocated on the fly all over the -place. +This is a quick list of things that count as references to an object: -There are a couple provisos that you should note. One is -that circular references will never be deleted by the garbage collector. -By *circular reference*, I mean a pair of objects with variables that -point to each other, or even an object with a variable that points to -itself. In rare cases, you may even depend on this behavior. When you -are done with such objects, you should either null out the circular -reference, or you should forcibly destroy each object with the `del` -instruction. +`del()` will try to clear out the most obvious possible references first, and bail out when it's done, but if there are still references it will search everywhere for any references that remain. -> [!IMPORTANT] -> This is a quick list of things that count as references to an -> object: -> - Stored in a var -> - An item in a [list](/ref/list.md) , or [associated](/ref/list/associations.md) -> with a list item -> - Has a [tag](/ref/datum/var/tag.md) -> - Is on the map (always true for [turfs](/ref/turf.md) ) -> - Inside another atom\'s [contents](/ref/atom/var/contents.md) -> - Inside an atom\'s [vis_contents](/ref/atom/var/vis_contents.md) -> - A temporary value in a still-running proc -> - Is a [mob](/ref/mob.md) with a [key](/ref/mob/var/key.md) -> - Is an [image object](/ref/image.md) attached to an atom -> -> -> `del()` will try to clear out the most obvious possible -> references first, and bail out when it\'s done, but if there are still -> references it will search everywhere for any references that remain. +An object with running or sleeping procs is referenced by the src variable of those procs and will therefore not be thrown out. -An object with running or sleeping procs is referenced by the -`src` variable of those procs and will therefore not be thrown out. +Another note is that the world.contents list does not count as a reference. Otherwise, `/mob` and `/obj` objects would never be deleted, which is not the case. Note that objects which are contained by another object or which contain objects themselves are referenced and will not be deleted. That means an object must be at loc=null with no contents and, of course, no other references anywhere in order to get deleted by the garbage collector. -Another note is that the `world.contents` list does not count -as a reference. Otherwise, `/mob` and `/obj` objects would never be -deleted, which is not the case. Note that objects which are contained by -another object or which contain objects themselves *are* referenced and -will not be deleted. That means an object must be at `loc=null` with no -contents and, of course, no other references anywhere in order to get -deleted by the garbage collector. +Mobs with a non-empty `key` and all objects with non-empty `tag` are also immortal. -Mobs with a non-empty `key` -and all objects with non-empty `tag` are also immortal. +Turfs and areas do not currently get garbage collected. -Turfs and areas do not currently get garbage collected. +When the world shuts down, all objects are destroyed, whether they are referenced or not. You don't have to worry about system memory getting consumed by persistent objects. That doesn't happen. -When the world shuts down, all objects are destroyed, whether they are referenced -or not. You don\'t have to worry about system memory getting consumed by -persistent objects. That doesn\'t happen. - -In general, people who do not like reference counting garbage collection should be happy -that DM provides a `del` instruction, allowing you to take charge and -delete things whether they are referenced or not. Another nicety is that -this automatically nulls out any existing references to the object, so -you don\'t end up with dangling references to a deleted object, which -can otherwise be a great source of instability and mysterious bugs. - -> [!IMPORTANT] -> When the `del` instruction is used on an object, the engine will instantly delete the object -> should its reference count only include the reference passed to the del instruction. If the object's -> reference count does not satisfy this requirement, the garbage collector will scan through the -> following in this order, eliminating any references that are found until the passed reference is -> the last one remaining: -> + Currently running procs -> + Several internal global structures -> + Every client and their vars -> + DM pointers -> + Temporary objects awaiting SendMaps -> + The internal last animate() placeholder (this is cleared every tick) -> + BYONDapi (clears the refcount based on how many references BYONDapi says it holds) -> + Queued procs (spawned / slept calls) -> + Background procs (procs waiting on blocking calls) -> + Global vars -> + Tags -> + datum vars (including atoms and other types derived from datum, except for turfs) -> + user-defined lists -> + Mouse pointers in appearances -> + If the object is an appearance, scan global appearances -> + Internal Move() caches -> + Filter references -> + turf vars - -> [!TIP] -> **See also:** -> + [del proc](/ref/proc/del.md) -> + [world](/ref/world.md) -> + [refcount proc](/ref/proc/refcount.md) +In general, people who do not like reference counting garbage collection should be happy that DM provides a del instruction, allowing you to take charge and delete things whether they are referenced or not. Another nicety is that this automatically nulls out any existing references to the object, so you don't end up with dangling references to a deleted object, which can otherwise be a great source of instability and mysterious bugs. +*** +**Related Pages:** ++ [del proc](/ref/proc/del) ++ [world](/ref/world) ++ [refcount proc](/ref/proc/refcount) diff --git a/ref/DM/icon.md b/ref/DM/icon.md deleted file mode 100644 index 838e6ce8..00000000 --- a/ref/DM/icon.md +++ /dev/null @@ -1,28 +0,0 @@ -## icons - -An icon file may be referenced by putting single quotes around -the filename. The file extension determines the type of icon. Currently -supported icon types are `.dmi`, `.bmp`, `.png`, `.jpg`, and `.gif`. To -create dmi icons, use the Dream Maker icon editor. This allows you to -make animations, 4 or 8 directional icons, and icons with different -states (such as "live" and "dead"). -### Example: - -```dm - mob - icon = 'monster.dmi' -``` - -You can also load icons into memory at run-time and manipulate the graphical -data to produce new icons dynamically. This is done by creating an -[/icon](/ref/icon/icon.md) object. - -> [!TIP] -> **See also:** -> + [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR.md) -> + [cache](/ref/DM/cache.md) -> + [flick proc](/ref/proc/flick.md) -> + [icon](/ref/icon/icon.md) -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [icon_state var (atom)](/ref/atom/var/icon_state.md) -> + [image objects](/ref/image/image.md) diff --git a/ref/DM/icon/arithmetic.md b/ref/DM/icon/arithmetic.md index 98846497..63b72f1d 100644 --- a/ref/DM/icon/arithmetic.md +++ b/ref/DM/icon/arithmetic.md @@ -1,73 +1,51 @@ -## icon arithmetic + +## arithmetic (info) +*** > [!TIP] -> The following "arithmetical" methods of icon manipulation are -being phased out in favor of the [/icon](/ref/icon.md) object, which -can be directly manipulated and which provides a wider variety of -operations. Many of those in turn have been obviated by the -[color](/ref/atom/var/color.md) and -[transform](/ref/atom/var/transform.md) vars. - -There are -several ways in which icons can be manipulated at runtime. They can be -rotated, added together, and the colors components may be altered. - - -One purpose for such operations is to make players look -different. Other interesting uses (and abuses) will undoubtedly follow. -### Addition and Subtraction - -The result of adding two icons is an arithmetic combination of -the color components of each individual pixel. At positions where either -icon is transparent, the result is also transparent. Subtraction, -instead of increasing the intensity, decreases it by the amount in each -pixel of the icon being subtracted. - -Suppose you wanted to add -together different bodies and heads. You could do that by making a few -of each type with black backgrounds. When these add together, the black -contributes nothing but prevents pixels in the other icon from getting -clipped. -### Example: +> Note: The following "arithmetical" methods of icon manipulation are being phased out in favor of the /icon object, which can be directly manipulated and which provides a wider variety of operations. Many of those in turn have been obviated by the color and transform vars. + +There are several ways in which icons can be manipulated at runtime. They can be rotated, added together, and the colors components may be altered. + +One purpose for such operations is to make players look different. Other interesting uses (and abuses) will undoubtedly follow. + +The result of adding two icons is an arithmetic combination of the color components of each individual pixel. At positions where either icon is transparent, the result is also transparent. Subtraction, instead of increasing the intensity, decreases it by the amount in each pixel of the icon being subtracted. + +Suppose you wanted to add together different bodies and heads. You could do that by making a few of each type with black backgrounds. When these add together, the black contributes nothing but prevents pixels in the other icon from getting clipped. + ```dm + mob/verb addicon(I as icon) icon += I subicon(I as icon) icon -= I + ``` - -If you need to add the same color to every -pixel, you can do so using a color value. Color values have the same -format as in HTML: "#RRGGBB" with two hexadecimal digits for each -color component. That gives you a range in color from 0 to FF (which is -255 in decimal). - -You can also specify a color value as -"#RGB". The single digit is automatically repeated, so "#F00" is the -same as "#FF0000", which is bright red. For certain pre-defined color -values, you can also specify a name, such as "red". See [HTML -colors](/ref/appendix/html-colors.md) for a list of color names. - -If you prefer base 10, you can create color values with the -rgb(R,G,B) instruction. Each parameter is in the range 0 to 255. -### Multiplication - -To increase (or decrease) the intensity of an icon -multiplicatively, you can use the \'`*`\' operator. -### Example: + + +If you need to add the same color to every pixel, you can do so using a color value. Color values have the same format as in HTML: "#RRGGBB" with two hexadecimal digits for each color component. That gives you a range in color from 0 to FF (which is 255 in decimal). + +You can also specify a color value as "#RGB". The single digit is automatically repeated, so "#F00" is the same as "#FF0000", which is bright red. For certain pre-defined color values, you can also specify a name, such as "red". See HTML colors for a list of color names. + +If you prefer base 10, you can create color values with the rgb(R,G,B) instruction. Each parameter is in the range 0 to 255. + +To increase (or decrease) the intensity of an icon multiplicatively, you can use the '*' operator. + ```dm + mob/verb/multicon(factor as num) icon *= factor + ``` -> [!TIP] -> **See also:** -> + [icon proc](/ref/proc/icon.md) -> + [icon_states proc](/ref/proc/icon_states.md) -> + [icons](/ref/DM/icon.md) -> + [rgb proc](/ref/proc/rgb.md) -> + [turn proc (applied to an icon)](/ref/proc/turn/icon.md) -> + [icon object](/ref/icon.md) \ No newline at end of file +*** +**Related Pages:** ++ [icon proc](/ref/proc/icon) ++ [icon_states proc](/ref/proc/icon_states) ++ [icons](/ref/DM/icon) ++ [rgb proc](/ref/proc/rgb) ++ [turn proc (applied to an icon)](/ref/proc/turn/icon) ++ [icon](/ref/icon) diff --git a/ref/DM/icon/index.md b/ref/DM/icon/index.md new file mode 100644 index 00000000..dabaa126 --- /dev/null +++ b/ref/DM/icon/index.md @@ -0,0 +1,24 @@ + +## icon (info) +*** +An icon file may be referenced by putting single quotes around the filename. The file extension determines the type of icon. Currently supported icon types are .dmi, .bmp, .png, .jpg, and .gif. To create dmi icons, use the Dream Maker icon editor. This allows you to make animations, 4 or 8 directional icons, and icons with different states (such as "live" and "dead"). + + +```dm + + mob + icon = 'monster.dmi' + +``` + + +You can also load icons into memory at run-time and manipulate the graphical data to produce new icons dynamically. This is done by creating an /icon object. +*** +**Related Pages:** ++ [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR) ++ [cache](/ref/DM/cache) ++ [flick proc](/ref/proc/flick) ++ [icon](/ref/icon) ++ [icon var (atom)](/ref/atom/var/icon) ++ [icon_state](/ref/atom/var/icon_state) ++ [image objects](/ref/image) diff --git a/ref/DM/index.md b/ref/DM/index.md new file mode 100644 index 00000000..0c6b6d9d --- /dev/null +++ b/ref/DM/index.md @@ -0,0 +1,11 @@ + +## DM (info) +*** +The DM (Dream Maker) language uses a syntax similar to C/C++ to build networked multi-user worlds. This reference and the accompanying guide discuss the structure and function of DM. + +This reference is arranged in sections: + +You can filter the reference content by subject, which helps narrow down anything you might be looking for. + +In various articles you may see notes or sidebar content: +*** \ No newline at end of file diff --git a/ref/DM/mouse.md b/ref/DM/mouse.md deleted file mode 100644 index cdcfbf0e..00000000 --- a/ref/DM/mouse.md +++ /dev/null @@ -1,109 +0,0 @@ -## mouse handling - - -Various mouse actions may be handled by defining procedures -either on the client object or on the atomic object being manipulated. -Any of the following procedures may be defined: -- [MouseDown()](/ref/client/proc/MouseDown.md) -- [MouseUp()](/ref/client/proc/MouseUp.md) -- [MouseDrag()](/ref/client/proc/MouseDrag.md) -- [MouseDrop()](/ref/client/proc/MouseDrop.md) -- [MouseEntered()](/ref/client/proc/MouseEntered.md) -- [MouseExited()](/ref/client/proc/MouseExited.md) -- [MouseMove](/ref/client/proc/MouseMove.md) -- [MouseWheel](/ref/client/proc/MouseWheel.md) -- [Click()](/ref/client/proc/Click.md) -- [DblClick()](/ref/client/proc/DblClick.md) - - -In general, define only the procedures you need, because extra -communication overhead may be avoided when the compiler detects that you -do not care about certain events. - -The arguments used in mouse -procs generally follow one of these forms: -For Click(), DblClick(), MouseDown(), MouseUp(), MouseEntered(), MouseExited(), and MouseMove(): -+ client/Click(object, location, control, params)\ - atom/Click(location, control, params) -For MouseDrag() and MouseDrop(): -+ client/MouseDrag(src_object, over_object, src_location, - over_location, src_control, over_control, params)\ - atom/MouseDrag(over_object, src_location, over_location, - src_control, over_control, params) -For MouseWheel(): -+ client/MouseWheel(object, delta_x, delta_y, location, control, - params)\ - atom/MouseWheel(delta_x, delta_y, location, control, params) - - -The `location` argument varies with the type of control. For -the map, it will be the turf where the mouse action happened. For info -controls (statpanels), it will be the name of the statpanel where the -action happened. For grid controls, it will be the cell where the action -happened. For others controls it may vary, but most will leave this -blank. - -The `control` argument is the ID of the skin control -where the action happened, such as `"mappane.map"` or -`"mainwindow.banner"`. - -The `params` argument is text, and can -be converted to a list using [params2list()](/ref/proc/params2list.md) . -It may contain any of the following properties, which will only be set -if they are used: -- icon-x, icon-y: Pixel coordinates within the icon, in the icon\'s - coordinate space -- screen-loc: Pixel coordinates in screen_loc format - ("[tile_x]:[pixel_x],[tile_y]:[pixel_y]") -- left, middle, right: Mouse buttons pressed, held, or released in - this action (see compatibility note below) -- button: Mouse button pressed or released in this action (see - compatibility note below) -- ctrl, shift, alt: Keys held down during the mouse action -- drag-cell, drop-cell: Cells involved if using a Grid control -- drag: The button used for dragging (only sent for unrelated mouse - up/down messages during a drag) -- link: If the mouse is over a link in maptext, or this event is - related to clicking such a link -- vis-x, vis-y: Pixel coordinates relative to the icon\'s position on - screen - -The icon-x/y coordinates are integers, and try to point to the -actual pixel in the icon before any atom transforms are done; i.e. if -the icon were scaled up to 3 times its size using the transform var, -then a 3×3 region of pixels would all have the same icon-x/y values. The -lower left pixel of the icon is 1,1. The vis-x/y parameters are -screen-based, and their origin (1,1) is wherever the lower left corner -of the icon is rendered. - -> [!NOTE] -> vis-x/y will not be included in -the parameters if they are the same as icon-x/y. - -If the mouse -is over an overlay, icon-x/y and vis-x/y are relative to the parent -object, not the overlay icon itself, so it\'s possible to have value -outside of the normal range of 1,1 to [width],[height]. - -The mouse pointer may be customized as well. The following variables all -deal with the appearance of the pointer. They do not control what -actions may be taken by the user, but they provide hints to the user -about what actions may work. -- [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon.md) -- [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -- [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -- [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) -- [mouse_drop_zone](/ref/atom/var/mouse_drop_zone.md) -- [mouse_opacity](/ref/atom/var/mouse_opacity.md) - - -When selecting a mouse pointer, you may provide your own custom -icon or use one of the [built-in pointers](/ref/DM/mouse/pointers.md) -Note: Older games compiled prior to BYOND 4.0 had a different format for -the `MouseDown()` and `MouseUp()` procs. These used `icon_x` and -`icon_y` as arguments, but `control` and `params` have replaced them. -Note: Games compiled before version 514 did not have the `button` -parameter, so they handled the `left`, `middle`, and `right` parameters -differently. In old versions, only the button used in the action (left, -middle, right) was included as a parameter; now all buttons being held -or changed are included, and `button` is the mouse button that changed. \ No newline at end of file diff --git a/ref/DM/mouse/index.md b/ref/DM/mouse/index.md new file mode 100644 index 00000000..36209b88 --- /dev/null +++ b/ref/DM/mouse/index.md @@ -0,0 +1,33 @@ + +## mouse (info) +*** +Various mouse actions may be handled by defining procedures either on the client object or on the atomic object being manipulated. Any of the following procedures may be defined: + +In general, define only the procedures you need, because extra communication overhead may be avoided when the compiler detects that you do not care about certain events. + +The arguments used in mouse procs generally follow one of these forms: + +The `location` argument varies with the type of control. For the map, it will be the turf where the mouse action happened. For info controls (statpanels), it will be the name of the statpanel where the action happened. For grid controls, it will be the cell where the action happened. For others controls it may vary, but most will leave this blank. + +The `control` argument is the ID of the skin control where the action happened, such as `"mappane.map"` or `"mainwindow.banner"`. + +The `params` argument is text, and can be converted to a list using params2list(). It may contain any of the following properties, which will only be set if they are used: + +The icon-x/y coordinates are integers, and try to point to the actual pixel in the icon before any atom transforms are done; i.e. if the icon were scaled up to 3 times its size using the transform var, then a 3×3 region of pixels would all have the same icon-x/y values. The lower left pixel of the icon is 1,1. The vis-x/y parameters are screen-based, and their origin (1,1) is wherever the lower left corner of the icon is rendered. + +Note: vis-x/y will not be included in the parameters if they are the same as icon-x/y. + +If the mouse is over an overlay, icon-x/y and vis-x/y are relative to the parent object, not the overlay icon itself, so it's possible to have value outside of the normal range of 1,1 to [width],[height]. + +The mouse pointer may be customized as well. The following variables all deal with the appearance of the pointer. They do not control what actions may be taken by the user, but they provide hints to the user about what actions may work. + +When selecting a mouse pointer, you may provide your own custom icon or use one of the built-in pointers. + + +> [!TIP] +> Note: Older games compiled prior to BYOND 4.0 had a different format for the `MouseDown()` and `MouseUp()` procs. These used `icon_x` and `icon_y` as arguments, but `control` and `params` have replaced them. + + +> [!TIP] +> Note: Games compiled before version 514 did not have the `button` parameter, so they handled the `left`, `middle`, and `right` parameters differently. In old versions, only the button used in the action (left, middle, right) was included as a parameter; now all buttons being held or changed are included, and `button` is the mouse button that changed. +*** \ No newline at end of file diff --git a/ref/DM/mouse/pointers.md b/ref/DM/mouse/pointers.md index c52cb70d..da55ecb7 100644 --- a/ref/DM/mouse/pointers.md +++ b/ref/DM/mouse/pointers.md @@ -1,26 +1,13 @@ -## mouse pointers -The following mouse pointers are built-in and may be assigned -to any of the mouse pointer variables. Of course, you can also define -your own custom mouse pointers using an icon file. -MOUSE_INACTIVE_POINTER (0) -MOUSE_ACTIVE_POINTER (1) -MOUSE_DRAG_POINTER -Same as mouse_drag_pointer = MOUSE_ACTIVE_POINTER. -MOUSE_DROP_POINTER -Same as mouse_drop_pointer = MOUSE_ACTIVE_POINTER. -MOUSE_ARROW_POINTER -Same as mouse_over_pointer = MOUSE_INACTIVE_POINTER. -MOUSE_CROSSHAIRS_POINTER -Same as mouse_over_pointer = MOUSE_ACTIVE_POINTER. -MOUSE_HAND_POINTER - -> [!TIP] -> **See also:** -> + [mouse handling](/ref/DM/mouse.md) -> + [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) -> + [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) -> + [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +## pointers (info) +*** +The following mouse pointers are built-in and may be assigned to any of the mouse pointer variables. Of course, you can also define your own custom mouse pointers using an icon file. +*** +**Related Pages:** ++ [mouse handling](/ref/DM/mouse) ++ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer) ++ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer) ++ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/DM/null.md b/ref/DM/null.md index 4c01043d..3c2677e2 100644 --- a/ref/DM/null.md +++ b/ref/DM/null.md @@ -1,14 +1,7 @@ -# null +## null (info) +*** +Variables that are not initialized have the value null. This value is distinct from 0 and "". If you compare it to these, using the == operator, it is not equal. However, in a numeric context (like a mathematical operation), null evaluates to 0 and in a text context (like insertion into a text expression), null evaluates to "". In a logical expression, null, 0, and "" evaluate to false and all other values are true. -Variables that are not initialized have the value null. This -value is distinct from 0 and "". If you compare it to these, using the -`==` operator, it is not equal. However, in a numeric context (like a -mathematical operation), null evaluates to 0 and in a text context (like -insertion into a text expression), null evaluates to "". In a logical -expression, null, 0, and "" evaluate to false and all other values are -true. - -In an embedded text expression, null behaves like "". -That means, if you are expecting a variable to display a 0, you should -explicitly initialize it to 0 rather than leaving it as null. \ No newline at end of file +In an embedded text expression, null behaves like "". That means, if you are expecting a variable to display a 0, you should explicitly initialize it to 0 rather than leaving it as null. +*** \ No newline at end of file diff --git a/ref/DM/preprocessor.md b/ref/DM/preprocessor.md deleted file mode 100644 index ee7369cf..00000000 --- a/ref/DM/preprocessor.md +++ /dev/null @@ -1,24 +0,0 @@ -# preprocessor - - -The preprocessor performs various transformations on source -code as the DM compiler reads the file. It may be used to define -macros---that is words which are replaced by other fragments of code. It -is also possible to insert other source code files and to conditionally -compile or not compile sections of code. - -Preprocessor commands -are called directives. They are placed on a line by themselves and -always begin with a hash symbol `#`. The preprocessor directives -recognized by DM are the same as standard C compilers: - + #define - + #if - + #elif - + #ifdef - + #ifndef - + #else - + #endif - + #include - + #pragma - + #error - + #warn \ No newline at end of file diff --git a/ref/DM/preprocessor/DM_BUILD.md b/ref/DM/preprocessor/DM_BUILD.md index 405ddb29..0c96948a 100644 --- a/ref/DM/preprocessor/DM_BUILD.md +++ b/ref/DM/preprocessor/DM_BUILD.md @@ -1,12 +1,10 @@ -## DM_BUILD macro -This macro indicates the minor version of the compiler, which -is useful during BYOND beta testing. More often, you will want to use -the `DM_VERSION` macro instead, which is the major version. - -> [!TIP] -> **See also:** -> + [byond_build var (world)](/ref/world/var/byond_build.md) -> + [byond_build var (client)](/ref/client/var/byond_build.md) -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file +## DM_BUILD (info) +*** +This macro indicates the minor version of the compiler, which is useful during BYOND beta testing. More often, you will want to use the `DM_VERSION` macro instead, which is the major version. +*** +**Related Pages:** ++ [byond_build var (world)](/ref/world/var/byond_build) ++ [byond_build var (client)](/ref/client/var/byond_build) ++ [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION) ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/DM_VERSION.md b/ref/DM/preprocessor/DM_VERSION.md index a6100cc6..a1310415 100644 --- a/ref/DM/preprocessor/DM_VERSION.md +++ b/ref/DM/preprocessor/DM_VERSION.md @@ -1,25 +1,23 @@ -## DM_VERSION macro -This macro indicates the version of the compiler. This could be -useful when distributing code that uses new language features that would -not compile in older compilers. -### Example: +## DM_VERSION (info) +*** +This macro indicates the version of the compiler. This could be useful when distributing code that uses new language features that would not compile in older compilers. + ```dm + #if DM_VERSION < 230 #error This compiler is too far out of date! #endif + ``` - -If you use `#pragma compatibility`, -it will alter the value of this macro (but never higher than the actual -version being compiled). In this way you can alter your code\'s behavior -based on the pragma. -> [!TIP] -> **See also:** -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [byond_version var (client)](/ref/client/var/byond_version.md) -> + [DM_BUILD macro](/ref/DM/preprocessor/DM_BUILD.md) -> + [preprocessor](/ref/DM/preprocessor.md) -> + [#pragma compatibility \ No newline at end of file + +If you use `#pragma compatibility`, it will alter the value of this macro (but never higher than the actual version being compiled). In this way you can alter your code's behavior based on the pragma. +*** +**Related Pages:** ++ [byond_version var (world)](/ref/world/var/byond_version) ++ [byond_version var (client)](/ref/client/var/byond_version) ++ [DM_BUILD macro](/ref/DM/preprocessor/DM_BUILD) ++ [preprocessor](/ref/DM/preprocessor) ++ [#pragma compatibility directive](/ref/DM/preprocessor/pragma/compatibility) diff --git a/ref/DM/preprocessor/__FILE__.md b/ref/DM/preprocessor/__FILE__.md index 0a9bc48e..10de3002 100644 --- a/ref/DM/preprocessor/__FILE__.md +++ b/ref/DM/preprocessor/__FILE__.md @@ -1,16 +1,13 @@ -## \_\_FILE\_\_ macro - -The \_\_FILE\_\_ macro expands to a string containing the name -of the current source file. This may be useful when generating debugging -error messages. - -> [!TIP] -> **See also:** -> + [ASSERT proc](/ref/proc/ASSERT.md) -> + [DEBUG definition](/ref/DM/preprocessor/define/DEBUG.md) -> + [\_\_LINE\_\_ macro](/ref/DM/preprocessor/__LINE__.md) -> + [\_\_MAIN\_\_ macro](/ref/DM/preprocessor/__MAIN__.md) -> + [\_\_PROC\_\_ macro](/ref/DM/preprocessor/__PROC__.md) -> + [\_\_TYPE\_\_ macro](/ref/DM/preprocessor/__TYPE__.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +## __FILE__ (info) +*** +The __FILE__ macro expands to a string containing the name of the current source file. This may be useful when generating debugging error messages. +*** +**Related Pages:** ++ [ASSERT proc](/ref/proc/ASSERT) ++ [DEBUG definition](/ref/DM/preprocessor/define/DEBUG) ++ [__LINE__ macro](/ref/DM/preprocessor/__LINE__) ++ [__MAIN__ macro](/ref/DM/preprocessor/__MAIN__) ++ [__PROC__ macro](/ref/DM/preprocessor/__PROC__) ++ [__TYPE__ macro](/ref/DM/preprocessor/__TYPE__) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/DM/preprocessor/__IMPLIED_TYPE__.md b/ref/DM/preprocessor/__IMPLIED_TYPE__.md index 656c1829..bbce37d4 100644 --- a/ref/DM/preprocessor/__IMPLIED_TYPE__.md +++ b/ref/DM/preprocessor/__IMPLIED_TYPE__.md @@ -1,17 +1,11 @@ -## \_\_IMPLIED_TYPE\_\_ macro -###### BYOND Version 515 +## __IMPLIED_TYPE__ (info) +*** +The `__IMPLIED_TYPE__` macro is replaced by a reference to the type path implied at the current point in compilation. For instance, when using the `new` proc and assigning to a var, the type path for `new()` is implied by the var's type. Implied types are also automatically used in locate(), and are used by default for the second argument in istype() and astype(). -The `__IMPLIED_TYPE__` macro is replaced by a reference to the -type path implied at the current point in compilation. For instance, -when using the [`new` proc](/ref/proc/new.md) and assigning to a var, the type -path for `new()` is implied by the var\'s type. Implied types are also -automatically used in [locate()](/ref/proc/locate.md) , and are used by -default for the second argument in [istype()](/ref/proc/istype.md) . -### Example: - ```dm + proc/Factory(new_type) world.log << "Creating new [new_type]" return new new_type() @@ -19,24 +13,20 @@ proc/Factory(new_type) proc/CreateThing() // pass /thing to Factory var/thing/T = Factory(__IMPLIED_TYPE__) + ``` + `__IMPLIED_TYPE__` is valid in the following situations: -- In an expression on the right-hand side of an assignment operator - (this includes operators like `+=`), where the left-hand side is a - var that has a defined type path. -- Within the second argument of [istype()](/ref/proc/istype.md) and [astype proc](/ref/proc/astype.md). - -This is actually a pseudo-macro; the preprocessor doesn\'t -handle it directly. - -> [!TIP] -> **See also:** -> + [\_\_FILE\_\_ macro](/ref/DM/preprocessor/__FILE__.md) -> + [\_\_LINE\_\_ macro](/ref/DM/preprocessor/__LINE__.md) -> + [\_\_PROC\_\_ macro](/ref/DM/preprocessor/__PROC__.md) -> + [\_\_TYPE\_\_ macro](/ref/DM/preprocessor/__TYPE__.md) -> + [new proc](/ref/proc/new.md) -> + [locate proc](/ref/proc/locate.md) -> + [istype proc](/ref/proc/istype.md) -> + [astype proc](/ref/proc/astype.md) \ No newline at end of file + +This is actually a pseudo-macro; the preprocessor doesn't handle it directly. +*** +**Related Pages:** ++ [__FILE__ macro](/ref/DM/preprocessor/__FILE__) ++ [__LINE__ macro](/ref/DM/preprocessor/__LINE__) ++ [__PROC__ macro](/ref/DM/preprocessor/__PROC__) ++ [__TYPE__ macro](/ref/DM/preprocessor/__TYPE__) ++ [new proc](/ref/proc/new) ++ [locate proc](/ref/proc/locate) ++ [istype proc](/ref/proc/istype) ++ [astype proc](/ref/proc/astype) diff --git a/ref/DM/preprocessor/__LINE__.md b/ref/DM/preprocessor/__LINE__.md index ba6cb87e..9054bc53 100644 --- a/ref/DM/preprocessor/__LINE__.md +++ b/ref/DM/preprocessor/__LINE__.md @@ -1,14 +1,12 @@ -## \_\_LINE\_\_ macro -The \_\_LINE\_\_ macro is replaced by the line number in the -current source file. This may be useful when generating debugging error -messages. - -> [!TIP] -> **See also:** -> + [ASSERT proc](/ref/proc/ASSERT.md) -> + [DEBUG definition](/ref/DM/preprocessor/define/DEBUG.md) -> + [\_\_FILE\_\_ macro](/ref/DM/preprocessor/__FILE__.md) -> + [\_\_PROC\_\_ macro](/ref/DM/preprocessor/__PROC__.md) -> + [\_\_TYPE\_\_ macro](/ref/DM/preprocessor/__TYPE__.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +## __LINE__ (info) +*** +The __LINE__ macro is replaced by the line number in the current source file. This may be useful when generating debugging error messages. +*** +**Related Pages:** ++ [ASSERT proc](/ref/proc/ASSERT) ++ [DEBUG definition](/ref/DM/preprocessor/define/DEBUG) ++ [__FILE__ macro](/ref/DM/preprocessor/__FILE__) ++ [__PROC__ macro](/ref/DM/preprocessor/__PROC__) ++ [__TYPE__ macro](/ref/DM/preprocessor/__TYPE__) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/DM/preprocessor/__MAIN__.md b/ref/DM/preprocessor/__MAIN__.md index 75dfbdb9..1649f70c 100644 --- a/ref/DM/preprocessor/__MAIN__.md +++ b/ref/DM/preprocessor/__MAIN__.md @@ -1,30 +1,22 @@ -## \_\_MAIN\_\_ macro -The \_\_MAIN\_\_ macro is defined in the main `.dme` file being -compiled. In all other files included by this file, \_\_MAIN\_\_ is not -defined. +## __MAIN__ (info) +*** +The __MAIN__ macro is defined in the main .dme file being compiled. In all other files included by this file, __MAIN__ is not defined. + +The purpose of this is for library writers to package a small demo of their library directly in the library source code. When users compile the library directly, the library's own .dme is the main file and can include extra files that are not normally part of the library. -The purpose of this is for library writers to package -a small demo of their library directly in the library source code. When -users compile the library directly, the library\'s own `.dme` is the -main file and can include extra files that are not normally part of the -library. -### Example: ```dm + #ifdef __MAIN__ #include "demo.dm" #include "demo.dmm" #endif + ``` -If the demo requires a lot of -extra resources, it is probably better to package the demo as a separate -project. Small demos, however, are nice and convenient using this -"auto-demo" technique---especially since Dream Seeker automatically -launches Dream Maker after installing a library containing a `.dme` -file. -> [!TIP] -> **See also:** -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file +If the demo requires a lot of extra resources, it is probably better to package the demo as a separate project. Small demos, however, are nice and convenient using this "auto-demo" technique—especially since Dream Seeker automatically launches Dream Maker after installing a library containing a .dme file. +*** +**Related Pages:** ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/__PROC__.md b/ref/DM/preprocessor/__PROC__.md index 88286fce..35bb6513 100644 --- a/ref/DM/preprocessor/__PROC__.md +++ b/ref/DM/preprocessor/__PROC__.md @@ -1,16 +1,12 @@ -## \_\_PROC\_\_ macro -###### BYOND Version 515 -The `__PROC__` macro is replaced by a reference to the current -proc being compiled. This may be useful when generating debugging error -messages, especially when wrapped in `nameof`, e.g. `nameof(__PROC__)`. +## __PROC__ (info) +*** +The `__PROC__` macro is replaced by a reference to the current proc being compiled. This may be useful when generating debugging error messages, especially when wrapped in `nameof`, e.g. `nameof(__PROC__)`. -This is actually a pseudo-macro; the preprocessor doesn\'t -handle it directly. - -> [!TIP] -> **See also:** -> + [\_\_FILE\_\_ macro](/ref/DM/preprocessor/__FILE__.md) -> + [\_\_LINE\_\_ macro](/ref/DM/preprocessor/__LINE__.md) -> + [\_\_TYPE\_\_ macro](/ref/DM/preprocessor/__TYPE__.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +This is actually a pseudo-macro; the preprocessor doesn't handle it directly. +*** +**Related Pages:** ++ [__FILE__ macro](/ref/DM/preprocessor/__FILE__) ++ [__LINE__ macro](/ref/DM/preprocessor/__LINE__) ++ [__TYPE__ macro](/ref/DM/preprocessor/__TYPE__) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/DM/preprocessor/__TYPE__.md b/ref/DM/preprocessor/__TYPE__.md index c36a3ec6..d3dd110f 100644 --- a/ref/DM/preprocessor/__TYPE__.md +++ b/ref/DM/preprocessor/__TYPE__.md @@ -1,17 +1,12 @@ -## \_\_TYPE\_\_ macro -###### BYOND Version 515 -The `__TYPE__` macro is replaced by a reference to the type -path currently being compiled. This may be useful when generating -debugging error messages. If used in a global proc, the value will be -null. +## __TYPE__ (info) +*** +The `__TYPE__` macro is replaced by a reference to the type path currently being compiled. This may be useful when generating debugging error messages. If used in a global proc, the value will be null. -This is actually a pseudo-macro; the preprocessor -doesn\'t handle it directly. - -> [!TIP] -> **See also:** -> + [\_\_FILE\_\_ macro](/ref/DM/preprocessor/__FILE__.md) -> + [\_\_LINE\_\_ macro](/ref/DM/preprocessor/__LINE__.md) -> + [\_\_PROC\_\_ macro](/ref/DM/preprocessor/__PROC__.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +This is actually a pseudo-macro; the preprocessor doesn't handle it directly. +*** +**Related Pages:** ++ [__FILE__ macro](/ref/DM/preprocessor/__FILE__) ++ [__LINE__ macro](/ref/DM/preprocessor/__LINE__) ++ [__PROC__ macro](/ref/DM/preprocessor/__PROC__) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/DM/preprocessor/define.md b/ref/DM/preprocessor/define.md deleted file mode 100644 index 3a1cc983..00000000 --- a/ref/DM/preprocessor/define.md +++ /dev/null @@ -1,98 +0,0 @@ -## \#define directive - -**Format:** -+ #define Name Value -+ #define Name(Parameters) Value - -**Args:** -+ Name: A macro definition. -+ Value: The value to substitute for Name. -+ Parameters: Arguments to pass into the macro. - - -The #define statement creates a macro that is substituted for -Name. Substitution only applies to whole words. Text inside of double or -single quotes is not processed for substitution, so `"This is BIG."` -would not be modified even if a macro named BIG were defined. That is -different from `"This is [BIG]."`, where BIG is an embedded expression, -which does get processed for macro substitution. -### Example: - -```dm -#define DAY 0 -#define NIGHT 1 -var/daytime = NIGHT //daytime = 1 -``` - -### Example: - -```dm -#define SQR(X) ((X)*(X)) -var/x = SQR(2) //x = ((2)*(2)) = 4 -``` - -> [!NOTE] -> it\'s usually important to use -parentheses around any arguments you use in a macro. Otherwise strange -results may occur if you use an expression such as 2+3. In the SQR(X) -example, if there were no parentheses around each X then the expansion -of the macro would be (2+3*2+3). Since the * operator has a higher -precedence than + the result is 11, not 25 as expected. It\'s equally -important to put parentheses around the entire macro for the same -reason. -### Variadic macros -###### BYOND Version 511 - -The last parameter of a macro can end in `...` which means that -it and all other arguments following it count as a single argument. This -is called a variadic macro because it lets you use a variable number of -arguments. The last parameter will also become optional. -### Example: - -```dm - #define DEFAULT_LIST(n, items...) if(!n) n = list(items) -``` - -### `#var` to string - -In a macro\'s body, if you precede a parameter by `#`, the -replacement value will be turned into a string. For instance, 2 would -become "2". -### Example: - -```dm -#define DEBUG_VAR(v) world.log << "[#v] = [v]" -DEBUG_VAR(usr.x) // world.log << "usr.x = [usr.x]" -``` -### `##var` concatenation - -A parameter preceded by `##` in the macro body is substituted -directly, without any spaces. If you use this with the last argument in -a variadic macro, any preceding spaces and a comma (if found) will be -removed if the replacement is empty. -### Example: - -```dm -#define MACROVAR(k) var/macro_state_##k -// MACROVAR(right) becomes var/macro_state_right - -#define PREFIX_LIST(x, y...) list(x, src, ##y) -// PREFIX_LIST(1, 2, 3) becomes list(1, src, 2, 3) -// PREFIX_LIST(4) becomes list(4, src) -``` -### `n###var` repeat - - -Using `###` in the macro body, preceded by a number, will -repeat the replacement a certain number of times. -### Example: - -```dm -#define SAYTWICE(t) 2###t -#define TOTEXT(t) #t -world << "[TOTEXT(SAYTWICE(hi))]" // world << "hihi" -``` - -> [!TIP] -> **See also:** -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file diff --git a/ref/DM/preprocessor/define/DEBUG.md b/ref/DM/preprocessor/define/DEBUG.md index 4496f186..12775f41 100644 --- a/ref/DM/preprocessor/define/DEBUG.md +++ b/ref/DM/preprocessor/define/DEBUG.md @@ -1,24 +1,16 @@ -## DEBUG definition + +## DEBUG (info) **Format:** + #define DEBUG +*** +If DEBUG is defined, source file and line number information will be stored in the compiled .dmb file. If a proc crashes during execution and DEBUG information is present, the current source file name and line number will be indicated in the error output. -If `DEBUG` is defined, source file and line number information -will be stored in the compiled `.dmb` file. If a proc crashes during -execution and `DEBUG` information is present, the current source file -name and line number will be indicated in the error output. - -This option increases the size of the `.dmb`, typically by -about 10%. Execution of the code may also be a tiny bit slower. - -If you are distributing the `.dmb` to players and you do not -want them to have debug access at runtime, you should *not* compile in -debug mode. +This option increases the size of the .dmb, typically by about 10%. Execution of the code may also be a tiny bit slower. -If you want to use the run-time profiler (see the -debugging options in Dream Seeker), you must compile in debug mode. Then -you can get a report of CPU usage by your various procs. +If you are distributing the .dmb to players and you do not want them to have debug access at runtime, you should not compile in debug mode. -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) \ No newline at end of file +If you want to use the run-time profiler (see the debugging options in Dream Seeker), you must compile in debug mode. Then you can get a report of CPU usage by your various procs. +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) diff --git a/ref/DM/preprocessor/define/FILE_DIR.md b/ref/DM/preprocessor/define/FILE_DIR.md index a16d0d00..d0b13fd4 100644 --- a/ref/DM/preprocessor/define/FILE_DIR.md +++ b/ref/DM/preprocessor/define/FILE_DIR.md @@ -1,31 +1,28 @@ -## FILE_DIR definition + +## FILE_DIR (info) **Format:** + #define FILE_DIR Path -**Args:** +**Arguments:** + Path: A search path on the current filesystem. +*** +This macro defines a search path to be used in evaluating resource files (icons and sounds). First the current directory is searched, then the first FILE_DIR path, then the next, etc. -This macro defines a search path to be used in evaluating -resource files (icons and sounds). First the current directory is -searched, then the first `FILE_DIR` path, then the next, etc. -### Example: ```dm + #define FILE_DIR icons #define FILE_DIR icons/mobs mob/clown icon = 'clown.dmi' -``` +``` -This searches for the -file at the paths `"./clown.dmi"`, `"./icons/clown.dmi"`, and -`"./icons/sounds/clown.dmi"`, where `"."` is the directory of the -current source file. -> [!TIP] -> **See also:** -> + [cache](/ref/DM/cache.md) -> + [icons](/ref/DM/icon.md) \ No newline at end of file +This searches for the file at the paths "./clown.dmi", "./icons/clown.dmi", and "./icons/sounds/clown.dmi", where "." is the directory of the current source file. +*** +**Related Pages:** ++ [cache](/ref/DM/cache) ++ [icons](/ref/DM/icon) diff --git a/ref/DM/preprocessor/define/index.md b/ref/DM/preprocessor/define/index.md new file mode 100644 index 00000000..f42b90df --- /dev/null +++ b/ref/DM/preprocessor/define/index.md @@ -0,0 +1,85 @@ + +## define (info) + +**Format:** ++ #define Name Value ++ #define Name(Parameters) Value + +**Arguments:** ++ Name: A macro definition. ++ Value: The value to substitute for Name. ++ Parameters: Arguments to pass into the macro. +*** +The #define statement creates a macro that is substituted for Name. Substitution only applies to whole words. Text inside of double or single quotes is not processed for substitution, so "This is BIG." would not be modified even if a macro named BIG were defined. That is different from "This is [BIG].", where BIG is an embedded expression, which does get processed for macro substitution. + + +```dm + +#define DAY 0 +#define NIGHT 1 +var/daytime = NIGHT //daytime = 1 + +``` + + + +```dm + +#define SQR(X) ((X)*(X)) +var/x = SQR(2) //x = ((2)*(2)) = 4 + +``` + + +Note that it's usually important to use parentheses around any arguments you use in a macro. Otherwise strange results may occur if you use an expression such as 2+3. In the SQR(X) example, if there were no parentheses around each X then the expansion of the macro would be (2+3*2+3). Since the * operator has a higher precedence than + the result is 11, not 25 as expected. It's equally important to put parentheses around the entire macro for the same reason. + +The last parameter of a macro can end in `...` which means that it and all other arguments following it count as a single argument. This is called a variadic macro because it lets you use a variable number of arguments. The last parameter will also become optional. + + +```dm + +#define DEFAULT_LIST(n, items...) if(!n) n = list(items) + +``` + + +In a macro's body, if you precede a parameter by `#`, the replacement value will be turned into a string. For instance, 2 would become "2". + + +```dm + +#define DEBUG_VAR(v) world.log << "[#v] = [v]" +DEBUG_VAR(usr.x) // world.log << "usr.x = [usr.x]" + +``` + + +A parameter preceded by `##` in the macro body is substituted directly, without any spaces. If you use this with the last argument in a variadic macro, any preceding spaces and a comma (if found) will be removed if the replacement is empty. + + +```dm + +#define MACROVAR(k) var/macro_state_##k +// MACROVAR(right) becomes var/macro_state_right + +#define PREFIX_LIST(x, y...) list(x, src, ##y) +// PREFIX_LIST(1, 2, 3) becomes list(1, src, 2, 3) +// PREFIX_LIST(4) becomes list(4, src) + +``` + + +Using `###` in the macro body, preceded by a number, will repeat the replacement a certain number of times. + + +```dm + +#define SAYTWICE(t) 2###t +#define TOTEXT(t) #t +world << "[TOTEXT(SAYTWICE(hi))]" // world << "hihi" + +``` + +*** +**Related Pages:** ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/elif.md b/ref/DM/preprocessor/elif.md index a6c3e578..566113ab 100644 --- a/ref/DM/preprocessor/elif.md +++ b/ref/DM/preprocessor/elif.md @@ -1,3 +1,3 @@ -## \#elif directive -**See:** -+ [#if directive](/ref/DM/preprocessor/if.md) \ No newline at end of file + +## elif (info) +****** \ No newline at end of file diff --git a/ref/DM/preprocessor/else.md b/ref/DM/preprocessor/else.md index a435e857..9962b12e 100644 --- a/ref/DM/preprocessor/else.md +++ b/ref/DM/preprocessor/else.md @@ -1,3 +1,3 @@ -## \#else directive -**See:** -+ [#if directive](/ref/DM/preprocessor/if.md) \ No newline at end of file + +## else (info) +****** \ No newline at end of file diff --git a/ref/DM/preprocessor/endif.md b/ref/DM/preprocessor/endif.md index 5464ed09..919ac8aa 100644 --- a/ref/DM/preprocessor/endif.md +++ b/ref/DM/preprocessor/endif.md @@ -1,3 +1,3 @@ -## \#endif directive -**See:** -+ [#if directive](/ref/DM/preprocessor/if.md) \ No newline at end of file + +## endif (info) +****** \ No newline at end of file diff --git a/ref/DM/preprocessor/error.md b/ref/DM/preprocessor/error.md index 87eae13f..a153401e 100644 --- a/ref/DM/preprocessor/error.md +++ b/ref/DM/preprocessor/error.md @@ -1,22 +1,24 @@ -## \#error directive + +## error (info) **Format:** + #error Text -**Args:** +**Arguments:** + Text: an error message to display +*** +The #error directive halts compilation and displays the specified message. -The #error directive halts compilation and displays the -specified message. -### Example: ```dm + #if DM_VERSION < 4 #error This compiler is too far out of date! #endif + ``` -> [!TIP] -> **See also:** -> + [preprocessor](/ref/DM/preprocessor.md) -> + [#warn directive](/ref/DM/preprocessor/warn.md) +*** +**Related Pages:** ++ [preprocessor](/ref/DM/preprocessor) ++ [#warn directive](/ref/DM/preprocessor/warn) diff --git a/ref/DM/preprocessor/if.md b/ref/DM/preprocessor/if.md index ac54708c..88fc7007 100644 --- a/ref/DM/preprocessor/if.md +++ b/ref/DM/preprocessor/if.md @@ -1,4 +1,5 @@ -## \#if directive + +## if (info) **Format:** + #if Val @@ -9,20 +10,16 @@ + ... + #endif -**Args:** +**Arguments:** + Val: A logical expression. +*** +The #if statement is used to conditionally compile code. If Val is true (non-zero), the code following the #if statement will be compiled. Otherwise, compilation skips to the next #elif, #else, or #endif statement. -The `#if` statement is used to conditionally compile code. If -Val is true (non-zero), the code following the `#if` statement will be -compiled. Otherwise, compilation skips to the next `#elif`, `#else`, or -`#endif` statement. +The function defined() can be used in the conditional expression. It is true if its argument is a defined macro (with #define) and false otherwise. -The function `defined()` can be used in the -conditional expression. It is true if its argument is a defined macro -(with `#define`) and false otherwise. -### Example: ```dm + #if defined(DEBUG) // This code will be compiled if DEBUG is // defined @@ -30,12 +27,12 @@ conditional expression. It is true if its argument is a defined macro // This code will be compiled if DEBUG is // not defined #endif + ``` - -You can also use `fexists()` in a -conditional to check if a file exists. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [#ifdef directive](/ref/DM/preprocessor/ifdef.md) \ No newline at end of file + + +You can also use `fexists()` in a conditional to check if a file exists. +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [#ifdef directive](/ref/DM/preprocessor/ifdef) diff --git a/ref/DM/preprocessor/ifdef.md b/ref/DM/preprocessor/ifdef.md index de8ae841..e12eb58b 100644 --- a/ref/DM/preprocessor/ifdef.md +++ b/ref/DM/preprocessor/ifdef.md @@ -1,16 +1,15 @@ -## \#ifdef directive + +## ifdef (info) **Format:** + #ifdef Name -**Args:** +**Arguments:** + Name: A macro definition. - -The `#ifdef` statement is used to conditionally compile code. -It is equivalent to `#if defined(Name)`. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [#if directive](/ref/DM/preprocessor/if.md) -> + [#ifndef directive](/ref/DM/preprocessor/ifndef.md) \ No newline at end of file +*** +The #ifdef statement is used to conditionally compile code. It is equivalent to #if defined(Name). +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [#if directive](/ref/DM/preprocessor/if) ++ [#ifndef directive](/ref/DM/preprocessor/ifndef) diff --git a/ref/DM/preprocessor/ifndef.md b/ref/DM/preprocessor/ifndef.md index f7f1cc36..83ebf8e8 100644 --- a/ref/DM/preprocessor/ifndef.md +++ b/ref/DM/preprocessor/ifndef.md @@ -1,17 +1,16 @@ -## \#ifndef directive + +## ifndef (info) **Format:** + #ifndef Name -**Args:** +**Arguments:** + Name: A macro definition. - -The `#ifndef` statement is used to conditionally compile code. -It is equivalent to `#if !defined(Name)`. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [#if directive](/ref/DM/preprocessor/if.md) -> + [#ifdef directive](/ref/DM/preprocessor/ifdef.md) -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file +*** +The #ifndef statement is used to conditionally compile code. It is equivalent to #if !defined(Name). +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [#if directive](/ref/DM/preprocessor/if) ++ [#ifdef directive](/ref/DM/preprocessor/ifdef) ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/include.md b/ref/DM/preprocessor/include.md index 06c1e018..0c3240bb 100644 --- a/ref/DM/preprocessor/include.md +++ b/ref/DM/preprocessor/include.md @@ -1,60 +1,37 @@ -## \#include directive + +## include (info) **Format:** + #include "Filename" + #include -**Args:** +**Arguments:** + "Filename": The path to the filename to include, from the current directory. -+ \: The path inside the BYOND lib directory. - - -The `#include` statement causes the compiler to process another -file before continuing in the current source file. ++ : The path inside the BYOND lib directory. +*** +The #include statement causes the compiler to process another file before continuing in the current source file. -If a file is -included multiple times, only the first occurrence will be processed. -That is a convenient addition to the standard C preprocessor, which DM -otherwise emulates quite closely. If you want the file to be included -more than once, put the line `#pragma multiple` somewhere in the file. +If a file is included multiple times, only the first occurrence will be processed. That is a convenient addition to the standard C preprocessor, which DM otherwise emulates quite closely. If you want the file to be included more than once, put the line `#pragma multiple` somewhere in the file. +The file <stddef.dm> is automatically included before all other source code. You can view the contents of that file by creating a file with that name in Dream Maker. -The file `` is automatically included before all -other source code. You can view the contents of that file by creating a -file with that name in Dream Maker. -### Example: ```dm + #include "test.dm" // checks ./test.dm -#include // checks lib-path/test.dm +#include // checks lib-path/test.dm + ``` - - -The BYOND lib directory is -called `"lib"` and is located in the BYOND system directory (typically -`"\Program Files\Byond\lib"`). If the file is not found there, it also -looks in the user lib directory, which would typically be -`"...\Byond\user\`*`login-name`*`\lib"`. - -Note that the compiler -interface allows you to include files graphically by simply clicking the -checkbox next to the file. This creates an include statement for you in -the `.dme` project environment file. The only time you would still want -to manually include files is when you need to ensure a certain order of -processing. For example, if file `"MyCode.dm"` overrides procedure -definitions of an object defined in `"LibCode.dm"`, you should include -`"LibCode.dm"` at the top of `"MyCode.dm"`. Most other DM code is -independent of order, but overriding procedure definitions is not. The -compiler will warn you in such cases if you forget. - -Another case in which you should manually include files is if you are writing a -library to be used by other programmers. Since the `.dme` file is not -distributed with a library, all necessary inclusions must be made in the -`.dm` files. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file + + +The BYOND lib directory is called "lib" and is located in the BYOND system directory (typically "\Program Files\Byond\lib"). If the file is not found there, it also looks in the user lib directory, which would typically be "...\Byond\user\*login-name*\lib". + +Note that the compiler interface allows you to include files graphically by simply clicking the checkbox next to the file. This creates an include statement for you in the .dme project environment file. The only time you would still want to manually include files is when you need to ensure a certain order of processing. For example, if file "MyCode.dm" overrides procedure definitions of an object defined in "LibCode.dm", you should include "LibCode.dm" at the top of "MyCode.dm". Most other DM code is independent of order, but overriding procedure definitions is not. The compiler will warn you in such cases if you forget. + +Another case in which you should manually include files is if you are writing a library to be used by other programmers. Since the .dme file is not distributed with a library, all necessary inclusions must be made in the .dm files. +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/index.md b/ref/DM/preprocessor/index.md new file mode 100644 index 00000000..3576c76e --- /dev/null +++ b/ref/DM/preprocessor/index.md @@ -0,0 +1,7 @@ + +## preprocessor (info) +*** +The preprocessor performs various transformations on source code as the DM compiler reads the file. It may be used to define macros—that is words which are replaced by other fragments of code. It is also possible to insert other source code files and to conditionally compile or not compile sections of code. + +Preprocessor commands are called directives. They are placed on a line by themselves and always begin with a hash symbol #. The preprocessor directives recognized by DM are the same as standard C compilers:
 #define #if #elif #ifdef #ifndef #else #endif #include #pragma #error #warn 
+*** \ No newline at end of file diff --git a/ref/DM/preprocessor/pragma.md b/ref/DM/preprocessor/pragma.md deleted file mode 100644 index 5653d98f..00000000 --- a/ref/DM/preprocessor/pragma.md +++ /dev/null @@ -1,33 +0,0 @@ -## \#pragma directive -###### BYOND Version 515 - - - -The `#pragma` directive alters the compiler\'s behavior in -various ways. -[#pragma multiple](/ref/DM/preprocessor/pragma/multiple.md) -+ Include this file more than once. -[#pragma ignore *Warning*](/ref/DM/preprocessor/pragma/warn.md) \ -[#pragma warn *Warning*](/ref/DM/preprocessor/pragma/warn.md) \ -[#pragma error *Warning*](/ref/DM/preprocessor/pragma/warn.md) -+ Changes how the compiler handles certain warnings. -[#pragma push](/ref/DM/preprocessor/pragma/push.md) -+ Save the current pragma state. -[#pragma pop](/ref/DM/preprocessor/pragma/push.md) -+ Restore a previously saved warning state. -[#pragma syntax](/ref/DM/preprocessor/pragma/syntax.md) -+ Switch to a different syntax for parsing certain procs. -[#pragma compatibility](/ref/DM/preprocessor/pragma/compatibility.md) -+ Hint that the compiler should avoid using features higher than a - given version. -[#pragma math](/ref/DM/preprocessor/pragma/math.md) : Choose faster (old) or more accurate (new default) trigonometry. - - -Pragmas will *not* be inherited by libraries included in your -project. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [#include directive](/ref/DM/preprocessor/include.md) -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file diff --git a/ref/DM/preprocessor/pragma/compatibility.md b/ref/DM/preprocessor/pragma/compatibility.md index aa000334..480350d9 100644 --- a/ref/DM/preprocessor/pragma/compatibility.md +++ b/ref/DM/preprocessor/pragma/compatibility.md @@ -1,23 +1,24 @@ -## #pragma compatibility directive -###### BYOND Version 516 + +## compatibility (info) **Format:** -+ #pragma compatibility \ ++ #pragma compatibility version +*** +Hints that the compiler should avoid using features past a certain major BYOND version. If it encounters a situation where you explicitly or implicitly use a newer feature than requested, it will generate a warning. -Hints that the compiler should avoid using features past a -certain major BYOND version. If it encounters a situation where you -explicitly or implicitly use a newer feature than requested, it will -generate a warning. -### Example: ```dm - #pragma compatibility 515 + +#pragma compatibility 515 + ``` - A value of 0 or -anything negative will reset the compatibility version to the default. - -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [warn/ignore/error directive](/ref/DM/preprocessor/warn.md) -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) \ No newline at end of file + + +This directive also alters the DM_VERSION macro. + +A value of 0 or anything negative will reset the compatibility version to the default. +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [#warn directive](/ref/DM/preprocessor/warn) ++ [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION) diff --git a/ref/DM/preprocessor/pragma/index.md b/ref/DM/preprocessor/pragma/index.md new file mode 100644 index 00000000..4b225e58 --- /dev/null +++ b/ref/DM/preprocessor/pragma/index.md @@ -0,0 +1,11 @@ + +## pragma (info) +*** +The `#pragma` directive alters the compiler's behavior in various ways. + +Pragmas will *not* be inherited by libraries included in your project. +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [#include directive](/ref/DM/preprocessor/include) ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/pragma/math.md b/ref/DM/preprocessor/pragma/math.md index f5c4bb45..6c142f23 100644 --- a/ref/DM/preprocessor/pragma/math.md +++ b/ref/DM/preprocessor/pragma/math.md @@ -1,45 +1,33 @@ -## #pragma math directive -###### BYOND Version 516 + +## math (info) **Format:** -+ #pragma math \ - -Chooses old-style fast math procs, or newer more accurate ones -that sacrifice a small amount of speed. This appplies to -[`sin()`](/proc/sin), [`cos()`](/proc/cos), and -[`tan()`](/proc/tan). - -The reason this is necessary is -because BYOND uses degrees for its angles, but converting to radians -(for the underlying math libraries) can\'t be done with precision for -many angles such as 90°, which is π/2 in radians. When the result of the -trig function is small, the angle being slightly off from what the user -intended will produce a small error in the result as well. - -> [!NOTE] -> For consistency, built-in compiler -math for constant values uses the same calculations that would be used -for non-constant values runtime, so `cos(90)` compiles as 6.12323e-17 -with fast math and as 0 for accurate math. - -The more-accurate procs use trigonometric identities to reduce the angle to -a more manageable range of 0 to 45° (π/4 radians). -### Example: ++ #pragma math fastaccurate +*** +Chooses old-style fast math procs, or newer more accurate ones that sacrifice a small amount of speed. This appplies to sin(), cos(), and tan(). + +The reason this is necessary is because BYOND uses degrees for its angles, but converting to radians (for the underlying math libraries) can't be done with precision for many angles such as 90°, which is π/2 in radians. When the result of the trig function is small, the angle being slightly off from what the user intended will produce a small error in the result as well. + +The more-accurate procs use trigonometric identities to reduce the angle to a more manageable range of 0 to 45° (π/4 radians). + ```dm + var/angle = 90 #pragma math fast usr << cos(angle) // 6.12323e-17 #pragma math accurate usr << cos(angle) // 0 + ``` -Using [`#pragma compatibility 515`](/DM/preprocessor/pragma/compatibility) will also force the -fast math version. -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [sin proc](/ref/proc/sin.md) -> + [cos proc](/ref/proc/cos.md) -> + [tan proc](/ref/proc/tan.md) \ No newline at end of file +Using #pragma compatibility 515 will also force the fast math version. + +Note: For consistency, built-in compiler math for constant values uses the same calculations that would be used for non-constant values runtime, so `cos(90)` compiles as 6.12323e-17 with fast math and as 0 for accurate math. +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [sin proc](/ref/proc/sin) ++ [cos proc](/ref/proc/cos) ++ [tan proc](/ref/proc/tan) diff --git a/ref/DM/preprocessor/pragma/multiple.md b/ref/DM/preprocessor/pragma/multiple.md index 2e959d9a..9a38c7e7 100644 --- a/ref/DM/preprocessor/pragma/multiple.md +++ b/ref/DM/preprocessor/pragma/multiple.md @@ -1,10 +1,8 @@ -## #pragma multiple directive -###### BYOND Version 515 -Allows this file to be included more than once. Ordinarily the -`#include` directive only allows a file to be included once. - -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [#include directive](/ref/DM/preprocessor/include.md) \ No newline at end of file +## multiple (info) +*** +Allows this file to be included more than once. Ordinarily the `#include` directive only allows a file to be included once. +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [#include directive](/ref/DM/preprocessor/include) diff --git a/ref/DM/preprocessor/pragma/push.md b/ref/DM/preprocessor/pragma/push.md index 8e0d5316..d83a6ccc 100644 --- a/ref/DM/preprocessor/pragma/push.md +++ b/ref/DM/preprocessor/pragma/push.md @@ -1,15 +1,13 @@ -## #pragma push/pop directive -###### BYOND Version 515 -`#pragma push` saves the current state any pragma flags, so for -instance a warning\'s level can be temporarily changed to ignore, warn, -or error. +## push (info) +*** +`#pragma push` saves the current state any pragma flags, so for instance a warning's level can be temporarily changed to ignore, warn, or error. + +`#pragma pop` restores a previously saved pragma state. -`#pragma pop` restores a previously saved pragma -state. -### Example: ```dm + // temporarily ignore the unused_var warning #pragma push #pragma ignore unused_var @@ -18,9 +16,10 @@ proc/GNDN() var/nothing // var defined but not used #pragma pop + ``` -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [#pragma warn/ignore/error directive](/ref/DM/preprocessor/pragma/warn.md) \ No newline at end of file +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [#pragma warn/ignore/error directive](/ref/DM/preprocessor/pragma/warn) diff --git a/ref/DM/preprocessor/pragma/syntax.md b/ref/DM/preprocessor/pragma/syntax.md index 5496a7b3..b007047d 100644 --- a/ref/DM/preprocessor/pragma/syntax.md +++ b/ref/DM/preprocessor/pragma/syntax.md @@ -1,26 +1,18 @@ -## #pragma syntax directive -###### BYOND Version 516 +## syntax (info) **Format:** -+ #pragma syntax [for|switch] ++ #pragma syntax CDM forswitch +*** +Changes the syntax used to parse certain statements. This can be more natural for users who prefer non-DM style, and can sometimes do things that regular DM syntax can't do. -Changes the syntax used to parse certain statements. This can -be more natural for users who prefer non-DM style, and can sometimes do -things that regular DM syntax can\'t do. +Changing the `for()` loop syntax to C will use semicolons to separate the Init, Test, Inc sections instead of commas. That means commas can be used to chain multiple statements together instead. -Changing the [`for()` loop](/ref/proc/for/loop.md) syntax to C will use semicolons to separate the -Init, Test, Inc sections instead of commas. That means commas can be -used to chain multiple statements together instead. +In switch(), C syntax changes the if/else statements to use C's `case` and/or `default` keywords, followed by a colon, and the `break` statement is required to skip to the end of the switch unless you want to fall through to the next case. Fall-through behavior isn't possible in the default DM syntax. -In [switch()](/ref/proc/switch.md) , C syntax changes the if/else -statements to use C\'s `case` and/or `default` keywords, followed by a -colon, and the [`break` statement](/ref/proc/break.md) is required to skip to -the end of the switch unless you want to fall through to the next case. -Fall-through behavior isn\'t possible in the default DM syntax. -### Example: ```dm + #pragma push #pragma syntax C switch @@ -38,11 +30,11 @@ switch(thing) usr << "This is a different case. #pragma pop -``` +``` -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [for loop proc](/ref/proc/for/loop.md) -> + [switch proc](/ref/proc/switch.md) \ No newline at end of file +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [for loop proc](/ref/proc/for/loop) ++ [switch proc](/ref/proc/switch) diff --git a/ref/DM/preprocessor/pragma/warn.md b/ref/DM/preprocessor/pragma/warn.md index 316ce84c..bf6f86fc 100644 --- a/ref/DM/preprocessor/pragma/warn.md +++ b/ref/DM/preprocessor/pragma/warn.md @@ -1,21 +1,16 @@ -## #pragma warn/ignore/error directive -###### BYOND Version 515 +## warn (info) **Format:** -+ #pragma \ WarningName ++ #pragma warnignoreerror WarningName +*** +Changes the way the compiler responds to warnings (except those caused by the `#warn` directive). The warning name appears in the compiler output when the warning is generated. +Multiple warning names can be used in the same pragma, separated by commas. -Changes the way the compiler responds to warnings (except those -caused by the [`#warn` directive](/ref/DM/preprocessor/warn.md) ). The warning -name appears in the compiler output when the warning is generated. - - -Multiple warning names can be used in the same pragma, -separated by commas. -### Example: ```dm + // temporarily ignore the unused_var warning #pragma push #pragma ignore unused_var @@ -24,17 +19,13 @@ proc/GNDN() var/nothing // var defined but not used #pragma pop + ``` - + Here is a list of warnings that are disabled by default, but can be turned on for linting purposes: -| Name | Description | -| --- | --- | -| init_proc | A var in a very commonly used type, like `/turf` or `/atom` or `/datum`, is being initialized with an init proc. An example is `var/stuff[]` or `var/list/stuff = list(1,2,3)` which creates a list in a special internal proc because calling [New()](/ref/datum/proc/New.md) . Best practice is to not initialize the list until it\'s needed. | -| frequent_call | A very commonly called proc such as [New()](/ref/datum/proc/New.md) or [Del()](/ref/datum/proc/Del.md) has been overridden on a type that gets created or destroyed frequently, such as `/turf`, `/atom`, or `/datum`. | - -> [!TIP] -> **See also:** -> + [#pragma directive](/ref/DM/preprocessor/pragma.md) -> + [#warn directive](/ref/DM/preprocessor/warn.md) -> + [#error directive](/ref/DM/preprocessor/error.md) \ No newline at end of file +*** +**Related Pages:** ++ [#pragma directive](/ref/DM/preprocessor/pragma) ++ [#warn directive](/ref/DM/preprocessor/warn) ++ [#error directive](/ref/DM/preprocessor/error) diff --git a/ref/DM/preprocessor/undef.md b/ref/DM/preprocessor/undef.md index 70b825a8..6221e178 100644 --- a/ref/DM/preprocessor/undef.md +++ b/ref/DM/preprocessor/undef.md @@ -1,14 +1,14 @@ -## \#undef directive + +## undef (info) **Format:** + #undef Name -**Args:** +**Arguments:** + Name: A macro definition. - -The `#undef` statement removes a macro definition. - -> [!TIP] -> **See also:** -> + [#define directive](/ref/DM/preprocessor/define.md) -> + [preprocessor](/ref/DM/preprocessor.md) \ No newline at end of file +*** +The #undef statement removes a macro definition. +*** +**Related Pages:** ++ [#define directive](/ref/DM/preprocessor/define) ++ [preprocessor](/ref/DM/preprocessor) diff --git a/ref/DM/preprocessor/warn.md b/ref/DM/preprocessor/warn.md index 1516e821..7c78ac5e 100644 --- a/ref/DM/preprocessor/warn.md +++ b/ref/DM/preprocessor/warn.md @@ -1,22 +1,24 @@ -## \#warn directive + +## warn (info) **Format:** + #warn Text -**Args:** +**Arguments:** + Text: a warning message to display +*** +The #warn directive displays the specified message as a warning, but does not prevent the project from compiling. -The #warn directive displays the specified message as a -warning, but does not prevent the project from compiling. -### Example: ```dm + #ifdef USE_LIGHTING #warn The lighting feature in MyLibrary is experimental. #endif + ``` -> [!TIP] -> **See also:** -> + [preprocessor](/ref/DM/preprocessor.md) -> + [#error directive](/ref/DM/preprocessor/error.md) \ No newline at end of file +*** +**Related Pages:** ++ [preprocessor](/ref/DM/preprocessor) ++ [#error directive](/ref/DM/preprocessor/error) diff --git a/ref/DM/sound.md b/ref/DM/sound.md index 19c8c2e6..ad0a9e77 100644 --- a/ref/DM/sound.md +++ b/ref/DM/sound.md @@ -1,22 +1,21 @@ -## sounds -A sound stored in a file may be referenced by putting single -quotes around the filename. The file extension determines the type of -sound. Currently supported music types include MIDI (.mid or .midi), and -module formats .mod, .it, .s3m, .xm, and .oxm. Supported sound effect -formats include .wav, .ogg, .mp3, .raw, .wma, and .aiff. -### Example: +## sound (info) +*** +A sound stored in a file may be referenced by putting single quotes around the filename. The file extension determines the type of sound. Currently supported music types include MIDI (.mid or .midi), and module formats .mod, .it, .s3m, .xm, and .oxm. Supported sound effect formats include .wav, .ogg, .mp3, .raw, .wma, and .aiff. + ```dm + world << sound('fugue.midi') + ``` -This example plays the specified midi file to all players. -> [!TIP] -> **See also:** -> + [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR.md) -> + [cache](/ref/DM/cache.md) -> + [sound proc](/ref/proc/sound.md) -> + [/sound datum](/ref/sound.md) -> + [load_resource proc](/ref/proc/load_resource.md) \ No newline at end of file +This example plays the specified midi file to all players. +*** +**Related Pages:** ++ [FILE_DIR definition](/ref/DM/preprocessor/define/FILE_DIR) ++ [cache](/ref/DM/cache) ++ [sound proc](/ref/proc/sound) ++ [sound datum](/ref/sound) ++ [load_resource proc](/ref/proc/load_resource) diff --git a/ref/DM/text.md b/ref/DM/text.md deleted file mode 100644 index b8b4d5b6..00000000 --- a/ref/DM/text.md +++ /dev/null @@ -1,87 +0,0 @@ -# Text - -Text consists of a string of characters enclosed in double quotes. To place a quote inside a string, escape it with a backslash \\ character. You will also need to escape a backslash if you want to use one on purpose. - -## Example: -```dm -usr << "He said, \"Hi.\"" -``` -This example sends some text to the usr: `He said, "Hi."` - -Backslashes are also used for special macros and to escape other characters that would normally be hard to include in a string. A backslash at the end of a line will ignore the line break, and continue the string on the next line after ignoring any leading spaces. - -To insert a variable expression into a string, enclose it in brackets []. These are referred to as embedded text expressions. An object expression will display the object's name preceded by the text macro \the or \The if no other article has been specified. Capitalization of the article is inferred from context. - -## Example: -```dm -mob/verb/shout(T as text) - world << "[usr]: [T]" - ``` -If this example is called by a mob named "Bill" with the text "hi everybody!", it will display "Bill: hi everybody!". - -On the other hand, if it is called by a mob named "cat", it would display "The cat: hi everybody!". - -Via operator overloading you can define an operator"" proc for an object to return different text when it's embedded in a string. 515 - -## Document strings -For lengthy text strings, DM provides a special text document syntax. This begins with {" and ends with "}. It may include multiple lines and even un-escaped double quotes, but it still parses escape characters and embedded expressions. - -### Example: -```dm -mob/verb/end() - usr << {" -This is the way the world ends -This is the way the world ends -This is the way the world ends -Not with a bang but a whimper. - ---T.S. Eliot "Hollow Men" -"} - del world //the end! -``` - -## Raw strings 512 - -DM also has a format for raw strings, which do not allow escape characters or embedded expressions. This can be useful for many situations, especially regular expressions which tend to use characters that need escaping. There are three ways to specify a raw string. All of them begin with the @ character. - -Simple raw strings follow @ with a single-character delimiter, usually " but it can be almost anything, and end when that delimiter is seen again. Line breaks are not allowed in simple raw strings. - -### Examples: -```dm -world << @"I can say \ or [] without escaping anything!" -world << @#Here I can use "quotes" but not the pound sign.# - -var/regex/R = new(@/(\d+)/) - -// without raw strings -world << "I can say \\ or \[] without escaping anything!" // lying -world << "I have to escape \"quotes\" to use them." - -var/regex/R = new("(\\d+)") -``` -Complex raw strings use more complicated delimiters, but they let you include line breaks. There are two ways to do this: One starts with @{" and ends with "}, so it looks like the familiar document string format. The other way starts with @(XYZ), where XYZ is any arbitrary text you want it to be, and ends when that same text is encountered. - -With a complex raw string, a single leading and/or trailing line break will be ignored. - -### Examples: -```dm -world << @{" -Now I have absolute freedom to use "quotes" -or [brackets] or line breaks, as long as I -don't follow a quote with a closing brace. -"} - -world << @(~~~) -Until three tilde (~) characters are seen, this is a valid string. -~~~ // end of string - -world << @(!!)You don't need a line break if you don't want one.!! -``` - -See also: -<< output operator -entities (text) -macros (text) -tags (text) -text proc -Unicode \ No newline at end of file diff --git a/ref/DM/text/entities.md b/ref/DM/text/entities.md index 6dfec606..4e1323f1 100644 --- a/ref/DM/text/entities.md +++ b/ref/DM/text/entities.md @@ -1,30 +1,9 @@ -## entities (text) -Special characters may be inserted into text using HTML syntax. -Such characters are known as entities. They start with an ampersand and -end with a semicolon. The main reason for doing this is to insert -characters that otherwise have a special meaning. The most common -entities have names. The rest must be referred to by their Unicode -character number (e.g. `&` is the same as `&`). The common ones -are listed in the following table. Note that the same effect may be -achieved by simply escaping the special character (like `<`). The full -entity syntax is included for generality. - -| Entity | Character | -| -------- | ----------- | - \& | & - \< | < - \> | > - \" | " - \© | © - - -When using numbered entities, you can put an `x` in front of -the number to use hexadecimal. For instance `&`, `&`, and -`&` are all equivalent. - -> [!TIP] -> **See also:** -> + [macros (text)](/ref/DM/text/macros.md) -> + [tags (text)](/ref/DM/text/tags.md) -> + [text](/ref/DM/text.md) \ No newline at end of file +## entities (info) +*** +Special characters may be inserted into text using HTML syntax. Such characters are known as entities. They start with an ampersand and end with a semicolon. The main reason for doing this is to insert characters that otherwise have a special meaning. The most common entities have names. The rest must be referred to by their Unicode character number (e.g. `&#38;` is the same as `&amp;`). The common ones are listed in the following table. Note that the same effect may be achieved by simply escaping the special character (like \<). The full entity syntax is included for generality. +*** +**Related Pages:** ++ [macros (text)](/ref/DM/text/macros) ++ [tags (text)](/ref/DM/text/tags) ++ [text](/ref/DM/text) diff --git a/ref/DM/text/index.md b/ref/DM/text/index.md new file mode 100644 index 00000000..6e09c689 --- /dev/null +++ b/ref/DM/text/index.md @@ -0,0 +1,103 @@ + +## text (info) +*** +Text consists of a string of characters enclosed in double quotes. To place a quote inside a string, escape it with a backslash \ character. You will also need to escape a backslash if you want to use one on purpose. + + +```dm + +usr << "He said, \"Hi.\"" + +``` + + +This example sends some text to the usr: He said, "Hi." + +Backslashes are also used for special macros and to escape other characters that would normally be hard to include in a string. A backslash at the end of a line will ignore the line break, and continue the string on the next line after ignoring any leading spaces. + +To insert a variable expression into a string, enclose it in brackets []. These are referred to as embedded text expressions. An object expression will display the object's name preceded by the text macro \the or \The if no other article has been specified. Capitalization of the article is inferred from context. + + +```dm + +mob/verb/shout(T as text) + world << "[usr]: [T]" + +``` + + +If this example is called by a mob named "Bill" with the text "hi everybody!", it will display "Bill: hi everybody!". + +On the other hand, if it is called by a mob named "cat", it would display "The cat: hi everybody!". + +Via operator overloading you can define an `operator""` proc for an object to return different text when it's embedded in a string. + +For lengthy text strings, DM provides a special text document syntax. This begins with {" and ends with "}. It may include multiple lines and even un-escaped double quotes, but it still parses escape characters and embedded expressions. + + +```dm + +mob/verb/end() + usr << {" +This is the way the world ends +This is the way the world ends +This is the way the world ends +Not with a bang but a whimper. + +--T.S. Eliot "Hollow Men" +"} + del world //the end! + +``` + + +DM also has a format for raw strings, which do not allow escape characters or embedded expressions. This can be useful for many situations, especially regular expressions which tend to use characters that need escaping. There are three ways to specify a raw string. All of them begin with the @ character. + +Simple raw strings follow @ with a single-character delimiter, usually " but it can be almost anything, and end when that delimiter is seen again. Line breaks are not allowed in simple raw strings. + + +```dm + +world << @"I can say \ or [] without escaping anything!" +world << @#Here I can use "quotes" but not the pound sign.# + +var/regex/R = new(@/(\d+)/) + +// without raw strings +world << "I can say \\ or \[] without escaping anything!" // lying +world << "I have to escape \"quotes\" to use them." + +var/regex/R = new("(\\d+)") + +``` + + +Complex raw strings use more complicated delimiters, but they let you include line breaks. There are two ways to do this: One starts with @{" and ends with "}, so it looks like the familiar document string format. The other way starts with @(XYZ), where XYZ is any arbitrary text you want it to be, and ends when that same text is encountered. + +With a complex raw string, a single leading and/or trailing line break will be ignored. + + +```dm + +world << @{" +Now I have absolute freedom to use "quotes" +or [brackets] or line breaks, as long as I +don't follow a quote with a closing brace. +"} + +world << @(~~~) +Until three tilde (~) characters are seen, this is a valid string. +~~~ // end of string + +world << @(!!)You don't need a line break if you don't want one.!! + +``` + +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [entities (text)](/ref/DM/text/entities) ++ [macros (text)](/ref/DM/text/macros) ++ [tags (text)](/ref/DM/text/tags) ++ [text proc](/ref/proc/text) ++ [Unicode](/ref/{notes}/Unicode) diff --git a/ref/DM/text/macros/icon.md b/ref/DM/text/macros/icon.md index facc6bb8..30f5380e 100644 --- a/ref/DM/text/macros/icon.md +++ b/ref/DM/text/macros/icon.md @@ -1,75 +1,75 @@ -## icon text macro -The \\icon macro is used to treat the following embedded -expression (in []\'s) as an icon rather than as text. An object, for -example, would be replaced by its icon rather than by its name. -### Example: +## icon (info) +*** +The \icon macro is used to treat the following embedded expression (in []'s) as an icon rather than as text. An object, for example, would be replaced by its icon rather than by its name. + ```dm + usr << "You look like this: \icon[usr]!" + ``` -The `\icon` macro expands internally to the tag. The -above example, could be rewritten like this: + +The \icon macro expands internally to the <IMG> tag. The above example, could be rewritten like this: + + ```dm + usr << "You look like this: \ - !" + !" + ``` - -> [!NOTE] -> The current icon state of the object is automatically used. Also note that -the image belongs to a class called `icon`. That allows you to configure -the way icons are displayed by using a style sheet. The following -default style rule causes icons to be shrunk to 16 by 16 pixels so they -fit in better with surrounding text: + + +Note that the current icon state of the object is automatically used. Also note that the image belongs to a class called icon. That allows you to configure the way icons are displayed by using a style sheet. The following default style rule causes icons to be shrunk to 16 by 16 pixels so they fit in better with surrounding text: + + ```dm + IMG.icon {width: 16px; height: 16px} + ``` -You could override this setting -globally in your own style sheet. You could even define rules to allow -individual icons to be formatted differently from the rest. -### Example: + +You could override this setting globally in your own style sheet. You could even define rules to allow individual icons to be formatted differently from the rest. + + ```dm + BIG IMG.icon {width: 32px; height: 32px} SMALL IMG.icon {width: 16px; height: 16px} + ``` - -With those rules in -place, you could output a full sized icon by using the \ tag: + + +With those rules in place, you could output a full sized icon by using the <BIG> tag: + ```dm -usr << "You look like this: \icon[usr]!" + +usr << "You look like this: \icon[usr]!" + ``` -The one time that one might want to use the tag -directly is to specify the ALT text to be displayed on clients which -don\'t support graphical icons. -Specific states, directions, -and frames of an icon can be displayed in lieu of the default through -use of the following tags: -- ICONSTATE=\'[state]\' -- ICONDIR=[dir], where dir is one of NORTH, SOUTH, EAST, WEST, - NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST -- ICONFRAME=[frame], where frame is the animation frame, starting - with 1 -### Example: +The one time that one might want to use the <IMG> tag directly is to specify the ALT text to be displayed on clients which don't support graphical icons. + +Specific states, directions, and frames of an icon can be displayed in lieu of the default through use of the following tags: + ```dm + usr << "You look like this: \ - !" + !" + ``` - -> [!NOTE] -> The \\icon macro does not work in the mini-browser; it is only for text output. To make icons -appear in an HTML document, use [browse_rsc()](/ref/proc/browse_rsc.md) to -send an icon to the client before using [browse()](/ref/proc/browse.md) to -display it. - -> [!TIP] -> **See also:** -> + [icon_state var (atom)](/ref/atom/var/icon_state.md) -> + [macros (text)](/ref/DM/text/macros.md) -> + [style sheets](/ref/DM/text/style.md) -> + [tags (text)](/ref/DM/text/tags.md) + + +Note that the \icon macro does not work in the mini-browser; it is only for text output. To make icons appear in an HTML document, use browse_rsc() to send an icon to the client before using browse() to display it. +*** +**Related Pages:** ++ [icon_state](/ref/atom/var/icon_state) ++ [macros (text)](/ref/DM/text/macros) ++ [style sheets](/ref/DM/text/style) ++ [tags (text)](/ref/DM/text/tags) diff --git a/ref/DM/text/macros.md b/ref/DM/text/macros/index.md similarity index 79% rename from ref/DM/text/macros.md rename to ref/DM/text/macros/index.md index 74267969..6181b137 100644 --- a/ref/DM/text/macros.md +++ b/ref/DM/text/macros/index.md @@ -1,8 +1,11 @@ -## macros (text) -Text macros start with \'\\\' (a backslash) and end with a -space or other punctuation. +## macros (info) +*** +Text macros start with '\' (a backslash) and end with a space or other punctuation. + + ```dm + \the, \The // insert 'the' (if needed) \a, \an, // insert 'a(n)' or 'some' (if needed) \A, \An @@ -29,39 +32,49 @@ space or other punctuation. \n // insert new line \" // insert double quote \\ // insert backslash -\< // insert &lt; (less than) -\> // insert &gt; (greater than) +\< // insert < (less than) +\> // insert > (greater than) \(space) // skip a space \(newline) // skip a newline (and following space) \xNN // insert a character by its ASCII/Unicode value \uNNNN // " \UNNNNNN // " + ``` -### Example: + + ```dm + mob/verb/steal(M as mob,obj/O as obj in M) O.loc = usr view() << "[usr] finds \himself \an [O]." + ``` -### Example: + + ```dm + var/DayCount proc/NewDay() DayCount++ world << "The [DayCount]\th day dawns." + ``` -### Example: + + ```dm + obj/CPU name = "\improper CPU" //prevent capitalization from causing proper-noun behavior + ``` -> [!TIP] -> **See also:** -> + [icon text macro](/ref/DM/text/macros/icon.md) -> + [text](/ref/DM/text.md) -> + [text proc](/ref/proc/text.md) \ No newline at end of file +*** +**Related Pages:** ++ [icon text macro](/ref/DM/text/macros/icon) ++ [text](/ref/DM/text) ++ [text proc](/ref/proc/text) diff --git a/ref/DM/text/macros/ref.md b/ref/DM/text/macros/ref.md index 437d9a71..84508f8c 100644 --- a/ref/DM/text/macros/ref.md +++ b/ref/DM/text/macros/ref.md @@ -1,85 +1,53 @@ -## ref text macro -###### BYOND Version 513 - -The `\ref` text macro inserts a unique identification number or -text string for the following embedded object (inside []\'s). - -In older versions of BYOND, if an object had a tag, that was -used instead. However this has often proved to be problematic, so -anything compiled from version 512 onward should expect to output a -reference number. If you want to use the tag, which stands a better -chance of still being valid if the object is deleted and recreated (like -in a world reboot), you can output the object\'s tag explicitly. - -The primary use for object references embedded in text is in -topic links. This allows you to encode a reference to an object in the -href value of a hyperlink. (Just make sure the object does not get -deleted before the user executes the link. See [garbage -collection](/ref/DM/garbage.md) .) - -Topic links that contain a -parameter "src" assigned to an object reference are treated somewhat -specially. Unless you override client.Topic() to do otherwise, the -default behavior is to call the referenced object\'s own Topic() -procedure. -### Example: + +## ref (info) +*** +The \ref text macro inserts a unique identification number or text string for the following embedded object (inside []'s). + +In older versions of BYOND, if an object had a tag, that was used instead. However this has often proved to be problematic, so anything compiled from version 512 onward should expect to output a reference number. If you want to use the tag, which stands a better chance of still being valid if the object is deleted and recreated (like in a world reboot), you can output the object's tag explicitly. + +The primary use for object references embedded in text is in topic links. This allows you to encode a reference to an object in the href value of a hyperlink. (Just make sure the object does not get deleted before the user executes the link. See garbage collection.) + +Topic links that contain a parameter "src" assigned to an object reference are treated somewhat specially. Unless you override client.Topic() to do otherwise, the default behavior is to call the referenced object's own Topic() procedure. + ```dm + mob/verb/test() - usr << "Click here!" + usr << "Click here!" mob/Topic(href,href_list[]) switch(href_list["action"]) if("start") usr << "Starting the game..." else return ..() + ``` - -The above example uses -an embedded reference to the player\'s own mob to create a link to a -topic handled by that mob\'s Topic() proc. The `href_list` parameter is -simply the result of `params2list(href)`. - -In that example, the -embedded reference was automatically converted back into an object -(dereferenced) for you. If you embed references to additional objects in -the href data, you would have to dereference those yourself using the -locate() instruction. -### Browser images -###### BYOND Version 516 - -In output for browser controls, you can use `\ref[object]` as -the src parameter for an tag. The object can be an -[appearance](/ref/atom/var/appearance.md) , an icon, or an atom or image. - -If the ref string is for an icon, you can add an HTML query -string after the icon reference. -### Example: + + +The above example uses an embedded reference to the player's own mob to create a link to a topic handled by that mob's Topic() proc. The href_list parameter is simply the result of params2list(href). + +In that example, the embedded reference was automatically converted back into an object (dereferenced) for you. If you embed references to additional objects in the href data, you would have to dereference those yourself using the locate() instruction. + +In output for browser controls, you can use `\ref[object]` as the src parameter for an <img> tag. The object can be an appearance, an icon, or an atom or image. + +If the ref string is for an icon, you can add an HTML query string after the icon reference. + ```dm + player << browse({" - - - "}) + + + "}) + ``` -The query string can include any of the -following (separated by & characters): - -+ `sheet:` Display all matching frames as a sprite sheet; otherwise the first - matching frame is used -+ `state = ICON_STATE`: Use a specific icon state; be sure to - [url_encode](/ref/proc/url_encode.md) it) -+ `moving = M`: Specify whether to choose only moving (M=1) or non-moving (M=0) - states -+ `dir = DIR`: Choose only frames with a specific direction (this should be a - number, not text, so for instance `dir=[NORTH]`) -+ `frame = N`: Choose the Nth animation frame in an animated icon - -> [!TIP] -> **See also:** -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [icon text macro](/ref/DM/text/macros/icon.md) -> + [locate proc](/ref/proc/locate.md) -> + [macros (text)](/ref/DM/text/macros.md) -> + [tag var (datum)](/ref/datum/var/tag.md) \ No newline at end of file + +The query string can include any of the following (separated by & characters): +*** +**Related Pages:** ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [icon text macro](/ref/DM/text/macros/icon) ++ [locate proc](/ref/proc/locate) ++ [macros (text)](/ref/DM/text/macros) ++ [tag](/ref/datum/var/tag) diff --git a/ref/DM/text/style.md b/ref/DM/text/style.md index ecf9d6fb..df30eeaf 100644 --- a/ref/DM/text/style.md +++ b/ref/DM/text/style.md @@ -1,283 +1,68 @@ -## style sheets +## style (info) +*** +HTML tags, such as <font> may be used to directly format output text. Another approach, however, is to use HTML tags to specify purely structural information and use a style sheet to define how various elements within that structure should be treated. DM uses a subset of the Cascading Style Sheet (CSS) language, which was introduced for this purpose in HTML documents. +This section discusses the syntax of style sheets as an independent element. For information on how to include the style sheets in your DM code, see the section on client.script. -HTML tags, such as `` may be used to directly format -output text. Another approach, however, is to use HTML tags to specify -purely structural information and use a style sheet to define how -various elements within that structure should be treated. DM uses a -[subset of the Cascading Style Sheet (CSS) -language](/ref/appendix/css.md) , which was introduced for this -purpose in HTML documents. +As an example of a style sheet, one might want combat and conversational messages to appear differently—perhaps using different colors. Instead of using the <font> tag to color the text, you could use <span> to mark the beginning and ending of the text and to specify what kind of message it is. The result might be text such as the following: -This section discusses the syntax of -style sheets as an independent element. For information on how to -include the style sheets in your DM code, see the section on -[client.script](/ref/client/var/script.md) . -As an example of a -style sheet, one might want combat and conversational messages to appear -differently---perhaps using different colors. Instead of using the -`` tag to color the text, you could use `` to mark the -beginning and ending of the text and to specify what kind of message it -is. The result might be text such as the following: ```dm -"[usr] spanks [targ]!" -"[usr] says, '[msg]'" -``` - -The `class` attribute may be -used with any tag, but `span` and `div` are often convenient because -they have no other side-effect but defining the style class. `span` is -for text within a single paragraph and `div` is for whole paragraphs. -The way text belonging to a particular class is formatted may be -controlled in a style sheet such as the following: -```dm -.combat {color: red} -.chat {color: green} -``` - -This says that -text in the `combat` class should be colored red and text in the `chat` -class should be colored green. These classes are not pre-defined; you -can create whatever new style classes you need. (The color names are -predefined however. You can find a list of them in [HTML -colors](/ref/appendix/html-colors.md) . - -The advantage of -using style sheets instead of direct formatting tags is that you can -cleanly separate structural information (such as combat and -conversational messages) from formatting information (such as red and -green text). By separating the two, you or the player can easily plug in -different formatting schemes without changing any of the actual content. - -A style sheet is composed of a list of rules, such as the two -rules in the preceding example. Each rule contains one or more -*selectors* followed by a body of attribute assignments (in braces). The -selector specifies the context of the rule and the body specifies the -format. -A selector may specify a container tag (such as `span`, -`body`, or `p`) and a class. The above example could have been written -with a selector of `span.chat`. However, by leaving out the tag, it -applies to any tag with `class=chat`. It is also possible to only -specify the tag and not the class. In that case, the selector applies to -any matching tag, regardless of class. +"[usr] spanks [targ]!" +"[usr] says, '[msg]'" -To specify a *nested* -context, several simple selectors may be listed one after the other. For -example, emphasized text within a combat message could be enlarged with -the following rule: -```dm -.combat em {font-size: larger} -``` - -It is also possible to list several selectors -separated by commas in order to make them all apply to the same body. -For example, this next rule is equivalent to the two following ones: - -```dm -.combat em, .chat em {font-size: larger} -.combat em {font-size: larger} -.chat em {font-size: larger} ``` - -The style rule body contains a list of attribute assignments, delimited by -semicolons. Each assignment takes the form of an attribute name, -followed by a colon, followed by the value of the attribute. The -following table summarizes the recognized attributes and their possible -values. -| attribute |value | -| --- | --- | -| color |#F00, #FF0000, red, rgb(255,0,0), rgb(100%,0%,0%) -| background |#F00, #FF0000, red, rgb(255,0,0), rgb(100%,0%,0%) -| font-size| 10pt, 1.5em, 150% -| font-style| normal or italic -| font-weight| normal, bold, lighter, darker, or 100 to 900 -| font-family| monospace, sans-serif, serif, cursive, ... -| font| *style weight size family* -| text-decoration| none, underline -| text-align| right, left, or center -| vertical-align| top, middle, bottom -| text-indent| 0.25in, 3em, 20pt -| margin-left| 0.25in, 3em, 20pt -| margin-right| 0.25in, 3em, 20pt -| width| 16px, 32px, auto -| height| 16px, 32px, auto -| line-height| 1.2 -### fonts -The `font` attribute is a special short-hand for assigning -`font-size`, `font-style`, `font-weight`, and `font-family` in one -statement. Any properties that are not specified in the `font` statement -are assigned to their default values. +The class attribute may be used with any tag, but span and div are often convenient because they have no other side-effect but defining the style class. span is for text within a single paragraph and div is for whole paragraphs. The way text belonging to a particular class is formatted may be controlled in a style sheet such as the following: -The font family may be a -specific font name or a more general category such as monospace or -sans-serif. Since not all users necessarily have the same fonts -installed, it is a good idea to list alternate fonts. The desired font -is placed first, followed by other possible fall-backs, each separated -by a comma. Usually a general family such as monospace is listed last of -all. Any font names containing a space should have quotes around them. -The following example sets the font for the `` tag. Even -if you don\'t explicitly use `` in output text, it is applied -implicitly. ```dm -body {font: 12pt 'Times New Roman', sans-serif} -``` - -This sets the font to 12 point and -selects `Times New Roman` if it is available and otherwise falls back on -a system-determined sans-serif font. This command also implicitly -specifies not to use italics and to use a normal font weight (not bold). -Font sizes may be specified in points (1pt = 1/72 of an inch), -picas (1pc = 12pt), pixels (px), inches (in), centimeters (cm), and -millimeters (mm). There are also various levels corresponding to the old -1 to 7 HTML scale. These are `xx-small`, `x-small`, `small`, `medium`, -`large`, `x-large`, and `xx-large`. In addition to these absolute font -sizes, it is possible to use a relative size, such as 150% or -equivalently 1.5em (1em = 100% of the current font size). This scales -the font relative to the currently active font setting. - -In addition to regular classes, there are special pseudo-classes for -handling embedded hyperlinks. These are specified in the selector with -the class starting with a colon rather than a dot. They are `:link`, -`:visited`, and `:active`. These only apply to the `` tag. The -`:link` class applies to hyperlinks in their normal state. Once a link -has been clicked, it belongs instead to the `:visited` class. When the -user holds the mouse over a link, it temporarily belongs to the -`:active` class. The only attribute that may change in an active or -visited link is the text color. -### margins and indents +.combat {color: red} +.chat {color: green} -Paragraphs can be given different margins according to your -preferences. The `margin-left` attribute controls the left margin, and -`margin-right` is the right margin. You can use specific sizes like -inches or points, or a relative size unit like em or ex. (A percentage -is interpreted so that 100% is 1em, not the width of the window.) Using -the `text-indent` attribute will indent the first line of a paragraph -from the left margin. It is possible to create a hanging indent by using -a negative value for `text-indent`, like so: -```dm -body {text-indent: -0.5in; margin-left: 0.5in} ``` -### background colors -The background attribute is only relevant to the `body` -context. It causes the entire terminal background to change color. When -doing this, it is usually necessary to change the foreground colors of -text or it may become unreadable. The various standard classes of output -generated by DreamSeeker are in the following table. -|**system colors** | | -| --- | --- | -| system notice| general notices from the client -| system command echo| command echoing -| system command expansion| command-line expansion list -| system pager| pager messages -| system irc| IRC command prefix +This says that text in the `combat` class should be colored red and text in the `chat` class should be colored green. These classes are not pre-defined; you can create whatever new style classes you need. (The color names are predefined however. You can find a list of them in HTML colors. -The value of the CLASS attribute may contain a list of classes -separated by spaces. This permits client output to be in the \'system\' -class as well as more specific ones. That allows you to change all of -these colors in one shot if you are too lazy to change them each -individually. For example, if you define a style sheet that changes the -background color, you might need to redefine the various foreground -colors like this: -```dm -body {background: aqua; color: black} -.system {color: red; font-weight: bold} -.command {color: green} -``` +The advantage of using style sheets instead of direct formatting tags is that you can cleanly separate structural information (such as combat and conversational messages) from formatting information (such as red and green text). By separating the two, you or the player can easily plug in different formatting schemes without changing any of the actual content. -In this example, the background color of the -terminal will be aqua, normal text from the server will be black, and -all output from the client will be bold and red, except echoed commands -and expansion lists, which will be bold and green. The more specific -.command rule is placed after the general .system rule so that its color -takes precedence. This is how style sheets are composed---you write -general rules first followed by any exceptions. -### style rule precedence +A style sheet is composed of a list of rules, such as the two rules in the preceding example. Each rule contains one or more selectors followed by a body of attribute assignments (in braces). The selector specifies the context of the rule and the body specifies the format. -The order in which rules are specified is one of the factors -that determines precedence of style sheet commands. The language is -known as Cascading Style Sheets because of its ability to handle several -layers of stylistic rules, intermingling the configurations of the user -and the designer in an ordered fashion. +A selector may specify a container tag (such as span, body, or p) and a class. The above example could have been written with a selector of span.chat. However, by leaving out the tag, it applies to any tag with class=chat. It is also possible to only specify the tag and not the class. In that case, the selector applies to any matching tag, regardless of class. -Rules are selected by -first finding all matching candidates for a given attribute in the -current HTML tag being processed. If there is more than one, rules from -a higher level style sheet take precedence over lower level ones. That -means the basic user configurable settings in DreamSeeker are the lowest -priority, followed by a style sheet in the user\'s `.dms` script file, -followed by a style sheet from the designer\'s `client.script` setting, -because that is the order in which these are read by the style sheet -manager. +To specify a nested context, several simple selectors may be listed one after the other. For example, emphasized text within a combat message could be enlarged with the following rule: -Rules from the same style sheet are ordered by -specificity. The selector `span.chat` is more specific than `.chat` and -`.chat em` is more specific than `em`. In general, the more classes -referenced by a selector, the more specific it is. When that results in -a tie, the selector with the greater number of tags takes precedence. -If two rules about the same attribute come from the same sheet -and have the same specificity, the final one to be defined takes -precedence. +```dm -In the rare event that a rule needs to break out of -the normal order of precedence, it can be flagged as important. In this -case it will take precedence over all other "unimportant" rules. -However, if more than one rule is important, the normal rules of -precedence will be used to resolve the conflict. +.combat em {font-size: larger} -The important -flag is applied after the attribute assignment like this: -```dm -body {background: white ! important; font: serif} ``` -In the above example, only the background color is important, not the font -specification. -### `style` attribute -Style commands may also be inserted directly in an html tag to -control its appearance. This does not have the advantages of style -sheets, which separate content from presentation, but it does allow you -to use the style sheet syntax when formatting text. +It is also possible to list several selectors separated by commas in order to make them all apply to the same body. For example, this next rule is equivalent to the two following ones: -The following example uses the style attribute to color some text: ```dm -usr << "That HURT!" -``` -As you can see, the `style` attribute of any tag can be -assigned to a text string containing a list of attribute assignments. -Just the body of the style rule is given, since no selector is needed to -match the current context. -### Maptext options +.combat em, .chat em {font-size: larger} +.combat em {font-size: larger} +.chat em {font-size: larger} -The [atom.maptext](/ref/atom/var/maptext.md) var supports some -additional CSS attributes. -| attribute | value | -|----|---| -|vertical-align |top, middle, bottom -|text-shadow |*x-offset y-offset blur color* -|-dm-text-outline |*width color style* +``` -Additionally, you can use the `:hover` pseudo-class to change -the color of a link. As with other link pseudo-classes, only the text -color can currently be changed. -> [!TIP] -> **See also:** -> + [CSS attributes](/ref/appendix/css.md) -> + [entities (text)](/ref/DM/text/entities.md) -> + [macros (text)](/ref/DM/text/macros.md) -> + [script var (client)](/ref/client/var/script.md) -> + [tags (text)](/ref/DM/text/tags.md) -> + [text](/ref/DM/text.md) \ No newline at end of file +The style rule body contains a list of attribute assignments, delimited by semicolons. Each assignment takes the form of an attribute name, followed by a colon, followed by the value of the attribute. The following table summarizes the recognized attributes and their possible values. +*** +**Related Pages:** ++ [CSS attributes](/ref/{{appendix}}/css) ++ [entities (text)](/ref/DM/text/entities) ++ [macros (text)](/ref/DM/text/macros) ++ [script var (client)](/ref/client/var/script) ++ [tags (text)](/ref/DM/text/tags) ++ [text](/ref/DM/text) diff --git a/ref/DM/text/tags.md b/ref/DM/text/tags.md index ba1db2b4..0fc3e73c 100644 --- a/ref/DM/text/tags.md +++ b/ref/DM/text/tags.md @@ -1,81 +1,29 @@ -## tags (text) +## tags (info) +*** +Text tags (also known as elements by snooty HTML purists) control how the text is formatted. HTML syntax is used, so all tags start with < and end with >. The tags which are currently supported by Dream Seeker, are listed below: +In addition to these, the <BEEP> tag, which is not standard HTML, may be used to beep the terminal. -Text tags (also known as *elements* by snooty HTML purists) -control how the text is formatted. HTML syntax is used, so all tags -start with `<` and end with `>`. The tags which are currently supported -by Dream Seeker, are listed below: -``` - // anchor (hyperlink) - // acronym or abbreviation - // bold text - // one size bigger text - // body of html document -
// line break - // citation reference - // program source code - // definition -
// used in conjunction with style sheets - // emphasized text - // font face, color, and size -

// heading level -

-

-

-
-
- // document head section - // html document - // italic text - // display icons - // keyboard input -

// paragraph -
          // pre-formatted text
-                  // overstrike text
-            // sample output
-          // one size smaller text
-            // used in conjunction with style sheets
-        // strongly emphasized text
-          // contains a style sheet
-          // document title
-                // typewriter style
-                  // underline
-              // variable name
-              // preformatted (tags ignored)
-```
+Some tags take additional parameters, known as attributes. The most common ones are <FONT> and <A>. The syntax for these is illustrated by the following two examples:
 
-In addition to these, the `` tag, which is not standard
-HTML, may be used to beep the terminal. 
 
-Some tags take
-additional parameters, known as attributes. The most common ones are
-`` and ``. The syntax for these is illustrated by the following
-two examples: 
 ```dm
-"How about this!"
-"Click here!"
+
+"How about this!"
+"Click here!"
+
 ```
- 
-As many attributes may
-be specified as desired. The attribute value may have quotes around it,
-but this is only necessary if the value contains spaces. It is usually
-more convenient to use single quotes so you don\'t have to escape the
-double quotes, but you can also embed the HTML in a [text
-document](/ref/DM/text.md)  to avoid the need for escaping quotes.
 
-When applying color to text, you can use hexadecimal RGB or you
-can use one of the named [HTML
-colors](/ref/appendix/html-colors.md)  
 
-Text sizes range
-from 1 to 7, 1 being the smallest and 7 being the largest. In addition
-to absolute sizes, relative sizes may be specified (like +1 for one size
-bigger or -1 for one size smaller).
+As many attributes may be specified as desired. The attribute value may have quotes around it, but this is only necessary if the value contains spaces. It is usually more convenient to use single quotes so you don't have to escape the double quotes, but you can also embed the HTML in a text document to avoid the need for escaping quotes.
+
+When applying color to text, you can use hexadecimal RGB or you can use one of the named HTML colors.
 
-> [!TIP] 
-> **See also:**
-> +   [entities (text)](/ref/DM/text/entities.md) 
-> +   [macros (text)](/ref/DM/text/macros.md) 
-> +   [style sheets](/ref/DM/text/style.md) 
-> +   [text](/ref/DM/text.md) 
\ No newline at end of file
+Text sizes range from 1 to 7, 1 being the smallest and 7 being the largest. In addition to absolute sizes, relative sizes may be specified (like +1 for one size bigger or -1 for one size smaller).
+***
+**Related Pages:**
++    [entities (text)](/ref/DM/text/entities)
++    [macros (text)](/ref/DM/text/macros)
++    [style sheets](/ref/DM/text/style)
++    [text](/ref/DM/text)
diff --git a/ref/DM/vars.md b/ref/DM/vars.md
index 836ac7ab..59e93da6 100644
--- a/ref/DM/vars.md
+++ b/ref/DM/vars.md
@@ -1,21 +1,19 @@
-## vars list var (global) 
-###### BYOND Version 512
 
-This is a list of all global variables. The items in the list
-are the variable names. If the variable name is used as an index into
-the list, the value of that variable is accessed.
-### Example:
+## vars (info)
+***
+This is a list of all global variables. The items in the list are the variable names. If the variable name is used as an index into the list, the value of that variable is accessed.
+
 
 ```dm
+
 mob/verb/dumpglobal()
    for(var/V in global.vars)
       usr << "[V] = [global.vars[V]]"
+
 ```
 
-This example displays all global variables. The `global` keyword is used here to
-distinguish it from `src.vars`, which in this example would be the
-mob\'s vars.
 
-> [!TIP] 
-> **See also:**
-> +   [vars list var (datum)](/ref/datum/var/vars.md) 
\ No newline at end of file
+This example displays all global variables. The global keyword is used here to distinguish it from src.vars, which in this example would be the mob's vars.
+***
+**Related Pages:**
++    [vars](/ref/datum/var/vars)
diff --git a/ref/appendix/Byondapi.md b/ref/appendix/Byondapi.md
index b7e1bb4b..ca135cfa 100644
--- a/ref/appendix/Byondapi.md
+++ b/ref/appendix/Byondapi.md
@@ -1,110 +1,45 @@
-# Byondapi 
-###### BYOND Version 515
-
-Byondapi is a set of exported functions from BYOND\'s core
-library that can be used by external libraries that you call via the
-[`call_ext()` proc](/ref/proc/call_ext.md)  The purpose is to make interfacing
-with native code easier, and to allow external access to BYOND\'s
-functionality. Before this existed, all external calls had to use text
-strings to pass data back and forth, which was inefficient for many uses
-and very limited. 
-
-To build your external library with Byondapi,
-you have to include the `byondapi.h` header file that\'s included in
-BYOND\'s distribution. When compiling in Windows, you\'ll also need to
-link with `byondapi.lib`; in Linux, your makefile should link with
-`byondcore.so` from BYOND\'s own `bin` directory.
-### Simple BYOND types
-
-For simplicity, BYOND defines some basic types and macros in
-`byondapi.h`. The one most relevant to you is `u4c`, which is an
-unsigned 4-byte integer. There\'s also `s4c` which is a signed integer,
-as well as simple 1-byte and 2-byte ints that use `1c` and `2c`
-(respectively) insteaed of the `4c` suffix.
-### CByondValue struct
-
-
-The main structure used to pass data back and forth is
-`CByondValue`. This mimics an internal structure in BYOND that holds
-values of all sorts: numbers, null, references to strings, references to
-objects and lists, and so on. 
-
-The exact functions used for
-interfacing with this structure are documented in `byondapi.h`.
-
-
-The main tricky aspect of working with BYOND data is strings.
-If you need to get the contents of a string, you\'ll need to allocate
-memory for the character data and call `Byond_ToString()` to get a copy
-of the string. For converting character data to an internal string
-stored in CByondValue, you\'ll need to call `ByondValue_SetStr()`.
-### Other function calls
-
-
-There are many function calls available in Byondapi for
-interacting with the server. These include the ability to read and write
-vars, call procs, create lists, read and write from lists, and so on.
-
-
-Most of these procs return boolean values: true if they
-succeed, false if not. In the event of a failure, you can call
-`Byond_LastError()` to get the error message. 
-
-In any functions
-that read data from lists, or read string data, they require the caller
-to allocate the needed memory for a copy of the string or list items. In
-these cases, the functions also take a `u4c` pointer for the length. If
-the return value is false and the length is set to zero, an error
-occurred. If the return value is false and the length is non-zero, the
-new length value is the required length of the array; the memory should
-be allocated and the function called again. 
-
-BYOND servers
-handle proc executin and the management of data in a single thread. If
-your library tries to call any BYOND server functions in a different
-thread of its own, the call will block until the server thread can
-handle it.
-### C++ wrappers
-
-
-If you want to use the handy C++ wrappers and classes, you can
-include `byondapi_cpp_wrappers.cpp` and `byondapi_cpp_wrappers.h` in
-your library. 
-
-The `ByondValue` class is a wrapper around
-`CByondValue` that handles a number of operations for you. You can
-redefine the `argv` argument of any `call_ext()` functions as an array
-of `ByondValue` instead of `CByondValue`, but the return value should
-stay a `CByondValue`.
-### Example:
-``` cpp
-#include 
-#include 
-#include 
-#include 
-extern "C" BYOND_EXPORT CByondValue merge(int n, ByondValue v[])
-{
-    ByondValue result;
-    std::string merged, str;
-    for(int i=0; i [!TIP] 
-> **See also:**
-> +   [call_ext() proc](/ref/proc/call_ext.md) 
\ No newline at end of file
+
+## Byondapi (info)
+***
+Byondapi is a set of exported functions from BYOND's core library that can be used by external libraries that you call via the `call_ext()` proc. The purpose is to make interfacing with native code easier, and to allow external access to BYOND's functionality. Before this existed, all external calls had to use text strings to pass data back and forth, which was inefficient for many uses and very limited.
+
+To build your external library with Byondapi, you have to include the `byondapi.h` header file that's included in BYOND's distribution. When compiling in Windows, you'll also need to link with `byondapi.lib`; in Linux, your makefile should link with `byondcore.so` from BYOND's own `bin` directory.
+
+For simplicity, BYOND defines some basic types and macros in `byondapi.h`. The one most relevant to you is `u4c`, which is an unsigned 4-byte integer. There's also `s4c` which is a signed integer, as well as simple 1-byte and 2-byte ints that use `1c` and `2c` (respectively) insteaed of the `4c` suffix.
+
+The main structure used to pass data back and forth is `CByondValue`. This mimics an internal structure in BYOND that holds values of all sorts: numbers, null, references to strings, references to objects and lists, and so on.
+
+The exact functions used for interfacing with this structure are documented in `byondapi.h`.
+
+The main tricky aspect of working with BYOND data is strings. If you need to get the contents of a string, you'll need to allocate memory for the character data and call `Byond_ToString()` to get a copy of the string. For converting character data to an internal string stored in CByondValue, you'll need to call `ByondValue_SetStr()`.
+
+There are many function calls available in Byondapi for interacting with the server. These include the ability to read and write vars, call procs, create lists, read and write from lists, and so on.
+
+Most of these procs return boolean values: true if they succeed, false if not. In the event of a failure, you can call `Byond_LastError()` to get the error message.
+
+In any functions that read data from lists or read string data—including `Byond_LastError()`—you need to allocate the required memory for a copy of the string or list items. These functions take a pointer to the buffer that will be filled, and a `u4c` pointer for the buffer size (in items for lists, in bytes for strings). If the return value is false and the length is set to zero, an error occurred. If the return value is false and the length is non-zero, the new length value is the required length of the array; the memory should be allocated and the function called again.
+
+The C++ wrappers have a better way of calling `Byond_LastError()` and other functions like it, where you don't need to worry about allocations.
+
+Objects in BYOND are reference-counted; when an object's count reaches 0 it gets garbage-collected. In Byondapi you can call `ByondValue_IncRef()` and `ByondValue_DecRef()` to increment or decrement the reference count, respectively.
+
+Byondapi maintains its own internal reference count for any object, so you can't decref past the number of references Byondapi holds.
+
+The results you get from calls to Byondapi functions, such as reading a var or getting a return value from a proc call, have already had their reference count increased. That means when you're done using the value, you need to clean it up with `ByondValue_DecRef()` or else you'll have a memory leak.
+
+The value you return from a function called by `call_ext()` should have a reference.
+
+The C++ wrappers take care of most of the reference counting issues for you (see below).
+
+BYOND servers handle proc execution and the management of data in a single thread. If your library tries to call any BYOND server functions in a different thread of its own, the call will block until the server thread can handle it.
+
+The special function `Byond_ThreadSync()` will run a callback function on the main thread, avoiding the need to keep syncing over multiple Byondapi calls.
+
+If you want to use the handy C++ wrappers and classes, you can include `byondapi_cpp_wrappers.cpp` and `byondapi_cpp_wrappers.h` in your library.
+
+The `ByondValue` class is a wrapper around `CByondValue` that handles a number of operations for you. You can redefine the `argv` argument of any `call_ext()` functions as an array of `ByondValue` instead of `CByondValue`, but the return value should stay a `CByondValue`.
+
+The external function calls like `ByondValue_CallProc()` have C++ wrappers that use the C calls internally, but if an error happens they'll call an error handler. The default error handler does nothing, but you can change it to a a different handler that accepts an error string.
+
+If you define a `CatchingByondExceptions` variable inside of a `try` block, it will automatically change the error handler to one that throws a `ByondExtException`. This replaces the more cumbersome approach of checking if the return value is false and then calling `Byond_LastError()`.
+***
\ No newline at end of file
diff --git a/ref/appendix/appendix.md b/ref/appendix/appendix.md
deleted file mode 100644
index 9a143c77..00000000
--- a/ref/appendix/appendix.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# Appendix
-
-This section contains miscellaneous information that may apply
-to multiple vars or procs.
-
-+ [Byondapi](/ref/appendix/Byondapi.md)
-+ [CSS attributes](/ref/appendix/css.md)
-+ [HTML-colors](/ref/appendix/html-colors.md)
-+ [Color space](/ref/appendix/color-space.md)
-+ [stddef.dm file](/ref/appendix/stddef%2edm.md) 
\ No newline at end of file
diff --git a/ref/appendix/color-space.md b/ref/appendix/color-space.md
index 44ee6cd2..eb1229ec 100644
--- a/ref/appendix/color-space.md
+++ b/ref/appendix/color-space.md
@@ -1,71 +1,25 @@
-# Color space
 
-There are different ways of interpreting color besides RGB.
-Several parts of BYOND are capable of using other color spaces.
-### COLORSPACE_RGB
+## color-space (info)
+***
+There are different ways of interpreting color besides RGB. Several parts of BYOND are capable of using other color spaces.
 
-The default color space is RGB, where each color is split into
-red, green, and blue components, as well as an optional alpha. All of
-these components range from 0 to 255. 
+The default color space is RGB, where each color is split into red, green, and blue components, as well as an optional alpha. All of these components range from 0 to 255.
 
-The color yellow for
-instance is `rgb(255,255,0)` which is red and green mixed together at
-their maximum brightness, but no blue component.
-### COLORSPACE_HSV
+The color yellow for instance is `rgb(255,255,0)` which is red and green mixed together at their maximum brightness, but no blue component.
 
 HSV stands for hue, saturation, and value.
--   Hue ranges from 0 to 360 on a color wheel, where 0 is red, 60 is
-    yellow, 120 is green, and so on as seen in the image.
--   Saturation is how colorful this color is; it ranges from 0 which
-    means a shade of gray, to 100 which is fully colored.
--   Value is the brightness of the biggest red, green, or blue
-    component, and ranges from 0 to 100. A value of 0 is always black.
 
-All pure hues such as red (hue=0) have a saturation of 100 and
-a value of 100. As saturation decreases, the colors turns whiter. Lower
-values mean darker colors and darker shades of gray. 
+All pure hues such as red (hue=0) have a saturation of 100 and a value of 100. As saturation decreases, the colors turns whiter. Lower values mean darker colors and darker shades of gray.
 
-In HSV,
-saturation is less meaningful as value gets closer to 0. Black of course
-always has a value of 0. With 10 as the value, saturation=100 gives you
-a very dark color whereas saturation=0 is a 10% shade of gray.
-### COLORSPACE_HSL
+In HSV, saturation is less meaningful as value gets closer to 0. Black of course always has a value of 0. With 10 as the value, saturation=100 gives you a very dark color whereas saturation=0 is a 10% shade of gray.
 
-HSL is a little more intuitive than HSV. Here, the value is
-replaced by luminance, which again ranges from 0 to 100. Luminance is
-the average of the minimum and maximum values of the red, green, and
-blue components. 
+HSL is a little more intuitive than HSV. Here, value is replaced by luminance, which again ranges from 0 to 100. Luminance is the average of the minimum and maximum values of the red, green, and blue components.
 
-Black has a luminance of 0; white has a
-luminance of 100. Pure hues all have a saturation of 100 and luminance
-of 50. As saturation decreases, the color will approach a grayscale
-shade of L%. 
+Black has a luminance of 0; white has a luminance of 100. Pure hues all have a saturation of 100 and luminance of 50. As saturation decreases, the color will approach a grayscale shade of L%.
 
-Saturation is less meaningful the closer luminance
-is to 0 or 100. At a luminance of 100, the saturation is totally
-irrelevant. At 90, high saturation will get you a very light shade of
-the hue but that isn\'t very far off from a 90% shade of gray.
-### COLORSPACE_HCY
+Saturation is less meaningful the closer luminance is to 0 or 100. At a luminance of 100, the saturation is totally irrelevant. At 90, high saturation will get you a very light shade of the hue but that isn't very far off from a 90% shade of gray.
 
-HCY stands for **hue**, **chroma**, and the Y is for grayscale
-luminance. (Again chroma and Y range from 0 to 100.) This color space is
-based around the apparent brightness of each color according to a rough
-approximation of human vision. 
+HCY stands for **hue**, **chroma**, and the Y is for grayscale luminance. (Again chroma and Y range from 0 to 100.) This color space is based around the apparent brightness of each color according to a rough approximation of human vision.
 
-Chroma is similar to saturation
-in that it determines how far from grayscale the color is. As chroma
-decreases toward 0, the color approaches a grayscale shade of Y%.
-What\'s different about HCY color from HSV or HSL is that at chroma=0
-and chroma=100 the colors should appear equally bright. Pure red,
-therefore, has a hue of 0, a chroma of 100, and a Y luminance of only
-29.9---roughly what red would look like in black & white with all the
-color leached out.
-
-> [!TIP] 
-> **See also:**
-> +   [rgb proc](/ref/proc/rgb.md) 
-> +   [rgb2num proc](/ref/proc/rgb2num.md) 
-> +   [gradient proc](/ref/proc/gradient.md) 
-> +   [animate proc](/ref/proc/animate.md) 
-> +   [Color gradient](/ref/notes/color-gradient.md) 
-> +   [Color matrix filter](/ref/notes/filters/color.md) 
\ No newline at end of file
+Chroma is similar to saturation in that it determines how far from grayscale the color is. As chroma decreases toward 0, the color approaches a grayscale shade of Y%. What's different about HCY color from HSV or HSL is that at chroma=0 and chroma=100 the colors should appear equally bright. Pure red, therefore, has a hue of 0, a chroma of 100, and a Y luminance of only 29.9—roughly what red would look like in black & white with all of the color leached out.
+***
\ No newline at end of file
diff --git a/ref/appendix/css.md b/ref/appendix/css.md
index 4b28f192..1cdfbe2f 100644
--- a/ref/appendix/css.md
+++ b/ref/appendix/css.md
@@ -1,50 +1,7 @@
-# CSS attributes
 
-DM-CSS is a subset of CSS, and only supports some kinds of
-selectors and attributes. 
+## css (info)
+***
+DM-CSS is a subset of CSS, and only supports some kinds of selectors and attributes.
 
-The following table lists all
-supported attributes, and whether they are supported in text output,
-maptext, and in other controls (labels/etc.) Other controls will often
-allow only one style for an entire unit of text. A checkbox in "Other"
-only indicates that *some* support exists in other controls, but it may
-vary by the type of control.
-
-  | Attribute          | Output  | Maptext | Other | Notes |
-  | ------------------ | :-----: | :-----: | :---: | :---  |
-  | color              | ✔️     |  ✔️     |	✔️    | Alpha colors may not be supported in some controls. |
-  | background         | ✔️     |  ✔️     | 	✔️  | In most cases, only applies to the entire text body. |
-  | background-color   | ✔️     |  ✔️     |       |       |
-  | background-image   | ✔️     |         |        |       |
-  | font               | ✔️     | ✔️      | 	✔️  |       | 
-  | font-family        | ✔️     | ✔️      | 	✔️  |       |
-  | font-style         | ✔️     | ✔️      | 	✔️  |       |
-  | font-weight        | ✔️     | ✔️      | 	✔️  |       |
-  | font-size          | ✔️     | ✔️      |  	✔️  |       |
-  | text-decoration    | ✔️     | ✔️      | 	✔️  | Limited to underline, overline, line-through, blink, and none. Support for each of these may vary depending on where they are used. |
-  | text-align         | ✔️     | ✔️      | 	✔️  | justify is supported in output and maptext.|
-  | vertical-align     |        | ✔️      | 	✔️  | Limited to top, middle, and bottom. |
-  | text-indent        | ✔️     | ✔️513 |       |       |
-  | margin-left        | ✔️     |  ✔️513 |  ✔️   |       |
-  | margin-right       | ✔️     |  ✔️513 |  ✔️   |       |
-  | margin-top         |        |          |  ✔️   |       |
-  | margin-bottom      |        |          |  ✔️   |       |
-  | margin             | ✔️     |  ✔️     |  ✔️   |       |
-  | width              | ✔️     |  ✔️     |       | Applies only to some elements such as images. |
-  | height             | ✔️     |  ✔️     |       | Applies only to some elements such as images. |
-  | line-height 512       | ✔️     |  ✔️     |       | Support in output control is limited; line heights less than 1 are not respected.
-Only unitless numbers, percentages, or em units are allowed. |
-  | white-space        | ✔️     |  ✔️     |       | normal, nowrap, pre, pre-wrap, pre-line |
-  | text-shadow 512       |        | ✔️      |       |       |
-  | -dm-text-outline 512  |         | ✔️     |       | Custom attribute: Adds an outline to text. Values are in the form: width color style.
-The style is either blank, or any combination of the sharp and square keywords (see [Outline filter](/ref/notes/filters/outline.md)). |
-
-
-These pseudo-classes are allowed in some contexts, but they can
-only change the text color.
- |  Psuedo-class  |  Output  |  Maptext  | Other | Notes |
- |  --------------|  ------- | --------- | ----- | ----- |
- |  :link         |   ✔️     |✔️512|   ✔️  |       |
- |  :visited      |   ✔️     |           |       |       |
- |  :active       |          |           |       | Currently not used, but future support is planned. |
- |  :hover        |          |✔️ 512|       |       |
\ No newline at end of file
+The following table lists all supported attributes, and whether they are supported in text output, maptext, and in other controls (labels/etc.) Other controls will often allow only one style for an entire unit of text. A checkbox in "Other" only indicates that *some* support exists in other controls, but it may vary by the type of control.
+***
\ No newline at end of file
diff --git a/ref/appendix/html-colors.md b/ref/appendix/html-colors.md
index e3a2280d..0a91f7a6 100644
--- a/ref/appendix/html-colors.md
+++ b/ref/appendix/html-colors.md
@@ -1,39 +1,9 @@
-# HTML colors
 
-Text colors may be specified by name or RGB value. The RGB
-color format uses hexadecimal numbers, with 2 hex digits each for red,
-green, and blue. These range from 0 (00 in hex) to 255 (FF in hex). In
-certain situations BYOND will also honor a fourth pair of digits for
-alpha.
-  -  #rrggbb
-  -  #rrggbbaa
+## html-colors (info)
+***
+Text colors may be specified by name or RGB value. The RGB color format uses hexadecimal numbers, with 2 hex digits each for red, green, and blue. These range from 0 (00 in hex) to 255 (FF in hex). In certain situations BYOND will also honor a fourth pair of digits for alpha.
 
-It is also possible to use 4 bit values by using only one hex
-digit per color. The full 8 bit color is produced by repeating each
-digit. For example, `#F00` (red) is the same as `#FF0000`. 
+It is also possible to use 4 bit values by using only one hex digit per color. The full 8 bit color is produced by repeating each digit. For example, #F00 (red) is the same as #FF0000.
 
-The named colors supported by BYOND, and their corresponding RGB values,
-are listed in the following table:
-| Colour | Code | Example |
-| :------ | ------| ----- |
-| black                  | #000000   | Example Example Example|
-| silver                 | #C0C0C0   |  Example Example Example|
-| gray *or* grey         | #808080   |  Example Example Example|
-| white                  | #FFFFFF   |  Example Example Example|
-| maroon                 | #800000   |  Example Example Example|
-| red                    | #FF0000   |  Example Example Example|
-| purple                 | #800080   |  Example Example Example|
-| fuchsia *or* magenta   | #FF00FF   |  Example Example Example|
-| green                  | #00C000   |  Example Example Example|
-| lime                   | #00FF00   |  Example Example Example|
-| olive *or* gold        | #808000   |  Example Example Example|
-| yellow                 | #FFFF00   |  Example Example Example|
-| navy                   | #000080   |  Example Example Example|
-| blue                   | #0000FF   |  Example Example Example|
-| teal                   | #008080   |  Example Example Example|
-| aqua *or* cyan         | #00FFFF   |  Example Example Example|
----------------------- --------- --
-
-> [!TIP] 
-> **See also:**
-> +   [rgb proc](/ref/proc/rgb.md) 
\ No newline at end of file
+The named colors supported by BYOND, and their corresponding RGB values, are listed in the following table:
+***
\ No newline at end of file
diff --git a/ref/appendix/index.md b/ref/appendix/index.md
new file mode 100644
index 00000000..9026daf7
--- /dev/null
+++ b/ref/appendix/index.md
@@ -0,0 +1,5 @@
+
+## {{appendix}} (info)
+***
+This section contains miscellaneous information that may apply to multiple vars or procs.
+***
\ No newline at end of file
diff --git a/ref/appendix/stddef.dm.md b/ref/appendix/stddef.dm.md
index ca4e0ae0..6665c6a1 100644
--- a/ref/appendix/stddef.dm.md
+++ b/ref/appendix/stddef.dm.md
@@ -1,487 +1,9 @@
-# stddef.dm file
 
-This is a special file that\'s included in all projects when
-you compile. It contains various constants, definitions of some built-in
-datums, and so on. 
+## stddef%2edm (info)
+***
+This is a special file that's included in all projects when you compile. It contains various constants, definitions of some built-in datums, and so on.
 
-You can see the contents of this file by
-creating a new file in Dream Maker called `stddef.dm`. It will
-automatically be filled with the standard definitions. 
+You can see the contents of this file by creating a new file in Dream Maker called `stddef.dm`. It will automatically be filled with the standard definitions.
 
-The
-contents of `stddef.dm` may change with new BYOND versions. However an
-eye is always kept on backwards-compatibility.
-
-Below are the contents of the stddef.dm file
-
-```dm
-/*
-	Standard definitions for Dream Maker
-
-	Const vars below are for backwards-compatibility only. The compiler will
-	prefer the #define macros instead which are faster to use at runtime.
-*/
-
-// directions
-var/const
-	NORTH = 1
-	SOUTH = 2
-	EAST = 4
-	WEST = 8
-	NORTHEAST = 5
-	NORTHWEST = 9
-	SOUTHEAST = 6
-	SOUTHWEST = 10
-	UP = 16
-	DOWN = 32
-#define NORTH 1
-#define SOUTH 2
-#define EAST 4
-#define WEST 8
-#define NORTHEAST 5
-#define NORTHWEST 9
-#define SOUTHEAST 6
-#define SOUTHWEST  10
-#define UP 16
-#define DOWN 32
-// eye and sight
-var/const
-	BLIND = 1
-	SEE_MOBS = 4
-	SEE_OBJS = 8
-	SEE_TURFS = 16
-	SEE_SELF = 32
-	SEE_INFRA = 64
-	SEE_PIXELS = 256
-	SEE_THRU = 512
-	SEE_BLACKNESS = 1024
-#define SEEINVIS 2
-#define SEEMOBS 4
-#define SEEOBJS 8
-#define SEETURFS 16
-var/const
-	MOB_PERSPECTIVE = 0
-	EYE_PERSPECTIVE = 1
-	EDGE_PERSPECTIVE = 2
-#define BLIND 1
-#define SEE_MOBS 4
-#define SEE_OBJS 8
-#define SEE_TURFS 16
-#define SEE_SELF 32
-#define SEE_INFRA 64
-#define SEE_PIXELS 256
-#define SEE_THRU 512
-#define SEE_BLACKNESS 1024
-#define MOB_PERSPECTIVE 0
-#define EYE_PERSPECTIVE 1
-#define EDGE_PERSPECTIVE 2
-// layers
-var/const
-	FLOAT_LAYER = -1
-	AREA_LAYER = 1
-	TURF_LAYER = 2
-	OBJ_LAYER = 3
-	MOB_LAYER = 4
-	FLY_LAYER = 5
-	EFFECTS_LAYER = 5000
-	TOPDOWN_LAYER = 10000
-	BACKGROUND_LAYER = 20000
-	FLOAT_PLANE = -32767
-#define FLOAT_LAYER -1
-#define AREA_LAYER 1
-#define TURF_LAYER 2
-#define OBJ_LAYER 3
-#define MOB_LAYER 4
-#define FLY_LAYER 5
-#define EFFECTS_LAYER 5000
-#define TOPDOWN_LAYER 10000
-#define BACKGROUND_LAYER 20000
-#define FLOAT_PLANE -32767
-
-// map formats
-var/const
-	TOPDOWN_MAP = 0
-	ISOMETRIC_MAP = 1
-	SIDE_MAP = 2
-	TILED_ICON_MAP = 32768
-#define TOPDOWN_MAP 0
-#define ISOMETRIC_MAP 1
-#define SIDE_MAP 2
-#define TILED_ICON_MAP 32768
-
-// gliding
-#define NO_STEPS 0
-#define FORWARD_STEPS 1
-#define SLIDE_STEPS 2
-#define SYNC_STEPS 3
-
-// appearance_flags
-#define LONG_GLIDE 1 0
-#define RESET_COLOR 2 0
-#define RESET_ALPHA 4 0 
-#define RESET_TRANSFORM 8 0 
-#define NO_CLIENT_COLOR 16 0
-#define KEEP_TOGETHER 32 0
-#define KEEP_APART 64 0
-#define PLANE_MASTER 128 0
-#define TILE_BOUND 256 1
-#define PIXEL_SCALE 512 1
-#define PASS_MOUSE 1024
-
-var/const
-	TRUE = 1
-	FALSE = 0
-#define TRUE 1
-#define FALSE 0
-
-var/const
-	MALE = "male"
-	FEMALE = "female"
-	NEUTER = "neuter"
-	PLURAL = "plural"
-#define MALE "male"
-#define FEMALE "female"
-#define NEUTER "neuter"
-#define PLURAL "plural"
-
-// mouse
-var/const
-	MOUSE_INACTIVE_POINTER = 0
-	MOUSE_ACTIVE_POINTER = 1
-	MOUSE_DRAG_POINTER = 3
-	MOUSE_DROP_POINTER = 4
-	MOUSE_ARROW_POINTER = 5
-	MOUSE_CROSSHAIRS_POINTER = 6
-	MOUSE_HAND_POINTER = 7
-#define MOUSE_INACTIVE_POINTER 0
-#define MOUSE_ACTIVE_POINTER 1
-#define MOUSE_DRAG_POINTER 3
-#define MOUSE_DROP_POINTER 4
-#define MOUSE_ARROW_POINTER 5
-#define MOUSE_CROSSHAIRS_POINTER 6
-#define MOUSE_HAND_POINTER 7
-var/const
-	MOUSE_LEFT_BUTTON = 1
-	MOUSE_RIGHT_BUTTON = 2
-	MOUSE_MIDDLE_BUTTON = 4
-	MOUSE_CTRL_KEY = 8
-	MOUSE_SHIFT_KEY = 16
-	MOUSE_ALT_KEY = 32
-#define MOUSE_LEFT_BUTTON 1
-#define MOUSE_RIGHT_BUTTON 2
-#define MOUSE_MIDDLE_BUTTON 4
-#define MOUSE_CTRL_KEY 8
-#define MOUSE_SHIFT_KEY 16
-#define MOUSE_ALT_KEY 32
-
-#define CONTROL_FREAK_ALL 1
-#define CONTROL_FREAK_SKIN 2
-#define CONTROL_FREAK_MACROS 4
-
-var/const
-	MS_WINDOWS = "MS Windows"
-	UNIX = "UNIX"
-#define MS_WINDOWS "MS Windows"
-#define UNIX "UNIX"
-
-#define ASSERT(c) if(!(c)) {CRASH("[__FILE__]:[__LINE__]:Assertion Failed: [#c]"); }
-#define _DM_datum 0x001
-#define _DM_atom 0x002
-#define _DM_movable 0x004
-#define _DM_sound 0x020
-#define _DM_image 0x040
-#define _DM_Icon 0x100
-#define _DM_RscFile 0x200
-#define _DM_Matrix 0x400
-#define _DM_Database 0x1000
-#define _DM_Regex 0x2000
-#define _DM_Special 0x4000
-
-// sound
-var/const
-	SOUND_MUTE = 1
-	SOUND_PAUSED = 2
-	SOUND_STREAM = 4
-	SOUND_UPDATE = 16
-#define SOUND_MUTE 1
-#define SOUND_PAUSED 2
-#define SOUND_STREAM 4
-#define SOUND_UPDATE 16
-sound
-	var
-		file
-		repeat
-		wait
-		channel
-		frequency = 0
-		pan = 0
-		volume = 100
-		priority = 0
-		status = 0
-		environment = -1
-		echo
-		x = 0; y = 0; z = 0
-		falloff = 1
-		// only used by client.SoundQuery() for now:
-		offset = 0
-		len = 0
-	_dm_interface = _DM_datum|_DM_sound|_DM_RscFile
-	New(file,repeat,wait,channel,volume=100)
-		src.file = istype(file,/list) ? file : fcopy_rsc(file)
-		src.repeat = repeat
-		src.wait = wait
-		src.channel = channel
-		src.volume = volume
-		return ..()
-	proc
-		RscFile()
-			return file
-
-// icons
-#define ICON_ADD 0
-#define ICON_SUBTRACT 1
-#define ICON_MULTIPLY 2
-#define ICON_OVERLAY 3
-#define ICON_AND 4
-#define ICON_OR 5
-#define ICON_UNDERLAY 6
-icon
-	_dm_interface = _DM_datum|_DM_Icon|_DM_RscFile
-	var/icon
-	New(icon,icon_state,dir,frame,moving)
-		src.icon = _dm_new_icon(icon,icon_state,dir,frame,moving)
-	proc
-		Icon()
-			return icon
-		RscFile()
-			return fcopy_rsc(icon)
-		IconStates(mode=0)
-			return icon_states(icon,mode)
-		Turn(angle,antialias)
-			if(antialias) _dm_turn_icon(icon,angle,1)
-			else _dm_turn_icon(icon,angle)
-		Flip(dir)
-			_dm_flip_icon(icon,dir)
-		Shift(dir,offset,wrap)
-			_dm_shift_icon(icon,dir,offset,wrap)
-		SetIntensity(r,g=-1,b=-1)
-			_dm_icon_intensity(icon,r,g,b)
-		Blend(icon,f,x=1,y=1)
-			_dm_icon_blend(src.icon,icon,f,x,y)
-		SwapColor(o,n)
-			_dm_icon_swap_color(icon,o,n)
-		DrawBox(c,x1,y1,x2,y2)
-			_dm_icon_draw_box(icon,c,x1,y1,x2,y2)
-		Insert(new_icon,icon_state,dir,frame,moving,delay)
-			_dm_icon_insert(icon,new_icon,icon_state,dir,frame,moving,delay)
-		MapColors(a,b,c,d,e,f,g,h,i,j=0,k=0,l=0)
-			if(istext(a))
-				if(!e) _dm_icon_map_colors(icon,a,b,c,d)
-				else _dm_icon_map_colors(icon,a,b,c,d,e)
-			else if(args.len <= 12) _dm_icon_map_colors(icon,a,b,c,d,e,f,g,h,i,j,k,l)
-			else _dm_icon_map_colors(icon,a,b,c,d,e,f,g,h,i,j,k,l,args[13],args[14],args[15],args[16],args[17],args[18],args[19],args[20])
-		Scale(x,y)
-			_dm_icon_scale(icon,x,y)
-		Crop(x1,y1,x2,y2)
-			_dm_icon_crop(icon,x1,y1,x2,y2)
-		GetPixel(x,y,icon_state,dir,frame,moving)
-			return _dm_icon_getpixel(icon,x,y,icon_state,dir,frame,moving)
-		Width()
-			return _dm_icon_size(icon,1)
-		Height()
-			return _dm_icon_size(icon,2)
-
-// matrix
-#define MATRIX_COPY 0
-#define MATRIX_MULTIPLY 1
-#define MATRIX_ADD 2
-#define MATRIX_SUBTRACT 3
-#define MATRIX_INVERT 4
-#define MATRIX_ROTATE 5
-#define MATRIX_SCALE 6
-#define MATRIX_TRANSLATE 7
-#define MATRIX_INTERPOLATE 8
-#define MATRIX_MODIFY 128
-matrix
-	var/a=1,b=0,c=0,d=0,e=1,f=0
-	_dm_interface = _DM_datum|_DM_Matrix
-	New(m)
-		if(args.len == 6)
-			a = m; b = args[2]; c = args[3]; src.d = args[4]; src.e = args[5]; src.f = args[6]
-		else if(m) matrix(src,m,MATRIX_COPY|MATRIX_MODIFY)
-	proc
-		Multiply(m) return matrix(src,m,MATRIX_MULTIPLY|MATRIX_MODIFY)
-		Add(m) return matrix(src,m,MATRIX_ADD|MATRIX_MODIFY)
-		Subtract(m) return matrix(src,m,MATRIX_SUBTRACT|MATRIX_MODIFY)
-		Invert() return matrix(src,MATRIX_INVERT|MATRIX_MODIFY)
-		Turn(a) return matrix(src,a,MATRIX_ROTATE|MATRIX_MODIFY)
-		Scale(x,y)
-			if(isnull(y)) y = x
-			return matrix(src,x,y,MATRIX_SCALE|MATRIX_MODIFY)
-		Translate(x,y)
-			if(isnull(y)) y = x
-			return matrix(src,x,y,MATRIX_TRANSLATE|MATRIX_MODIFY)
-		Interpolate(m2,t)
-			return matrix(src,m2,t,MATRIX_INTERPOLATE)
-
-// animation easing
-#define LINEAR_EASING 0
-#define SINE_EASING 1
-#define CIRCULAR_EASING 2
-#define CUBIC_EASING 3
-#define BOUNCE_EASING 4
-#define ELASTIC_EASING 5
-#define BACK_EASING 6
-#define QUAD_EASING 7
-#define JUMP_EASING 7
-#define EASE_IN 64
-#define EASE_OUT 128
-
-// animation flags
-#define ANIMATION_END_NOW 1
-#define ANIMATION_LINEAR_TRANSFORM 2
-#define ANIMATION_PARALLEL 4
-#define ANIMATION_RELATIVE 256
-
-// blend_mode
-var/const
-	BLEND_DEFAULT = 0
-	BLEND_OVERLAY = 1
-	BLEND_ADD = 2
-	BLEND_SUBTRACT = 3
-	BLEND_MULTIPLY = 4
-	BLEND_INSET_OVERLAY = 5
-#define BLEND_DEFAULT 0
-#define BLEND_OVERLAY 1
-#define BLEND_ADD 2
-#define BLEND_SUBTRACT 3
-#define BLEND_MULTIPLY 4
-#define BLEND_INSET_OVERLAY 5
-
-// vis_flags
-#define VIS_INHERIT_ICON 1
-#define VIS_INHERIT_ICON_STATE 2
-#define VIS_INHERIT_DIR 4
-#define VIS_INHERIT_LAYER 8
-#define VIS_INHERIT_PLANE 16
-#define VIS_INHERIT_ID 32
-#define VIS_UNDERLAY 64
-#define VIS_HIDE 128
-
-// Database
-#define DATABASE_OPEN 0
-#define DATABASE_CLOSE 1
-#define DATABASE_ERROR_CODE 2
-#define DATABASE_ERROR 3
-#define DATABASE_QUERY_CLEAR 4
-#define DATABASE_QUERY_ADD 5
-#define DATABASE_QUERY_EXEC 8
-#define DATABASE_QUERY_NEXT 9
-#define DATABASE_QUERY_ABORT 10
-#define DATABASE_QUERY_RESET 11
-#define DATABASE_QUERY_ROWS_AFFECTED 12
-#define DATABASE_ROW_COLUMN_NAMES 16
-#define DATABASE_ROW_COLUMN_VALUE 17
-#define DATABASE_ROW_LIST 18
-database
-	_dm_interface = _DM_datum|_DM_Database
-	var/_binobj
-	New(filename)
-		if(filename) Open(filename)
-	proc/Open(filename)
-		_dm_database(src, DATABASE_OPEN, filename)
-	proc/Close()
-		_dm_database(src, DATABASE_CLOSE)
-	proc/Error()
-		return _dm_database(src, DATABASE_ERROR_CODE)
-	proc/ErrorMsg()
-		return _dm_database(src, DATABASE_ERROR)
-	query
-		var/database/database
-		New(query)
-			_dm_database(src, DATABASE_QUERY_ADD, (args.len>1 ? args : query))
-		Open()
-		proc/Clear()
-			_dm_database(src, DATABASE_QUERY_CLEAR)
-		proc/Add(query)
-			_dm_database(src, DATABASE_QUERY_ADD, (args.len>1 ? args : query))
-		proc/Execute(database/database)
-			if(database && !istype(database)) database = new(database)
-			src.database=(database||src.database)
-			return _dm_database(src, DATABASE_QUERY_EXEC, src.database)
-		proc/NextRow()
-			return _dm_database(src, DATABASE_QUERY_NEXT)
-		proc/RowsAffected()
-			return _dm_database(src, DATABASE_QUERY_ROWS_AFFECTED)
-		Close()
-			return _dm_database(src, DATABASE_QUERY_ABORT)
-		proc/Reset()
-			return _dm_database(src, DATABASE_QUERY_RESET)
-		proc/Columns(column)
-			return _dm_database(src, DATABASE_ROW_COLUMN_NAMES, (isnum(column) ? column-1 : column))
-		proc/GetColumn(column)
-			return _dm_database(src, DATABASE_ROW_COLUMN_VALUE, column-1)
-		proc/GetRowData()
-			return _dm_database(src, DATABASE_ROW_LIST)
-
-exception
-	var/name,desc,file,line
-	New(name,file,line)	// not called by regular crashes
-		src.name=name
-		src.file=file
-		src.line=line
-#define EXCEPTION(m) new/exception((m),__FILE__,__LINE__)
-
-#define REGEX_QUOTE(a) regex((a), 1)
-#define REGEX_QUOTE_REPLACEMENT(a) regex((a), 2)
-regex
-	_dm_interface = _DM_datum|_DM_Regex
-	var/name
-	var/flags
-	var/_binobj
-	var/text	// last text checked
-	var/match	// last match
-	var/list/group	// list of groups in last match
-	var/index	// index of last match
-	var/next	// index to search next
-	New(text, flags)
-		regex(src, text, flags)
-	proc/Find(text, start=1, end)
-		return findtext(text, src, start, end)
-	proc/Replace(text, rep, start=1, end)
-		return replacetext(text, src, rep, start, end)
-	proc/Find_char(text, start=1, end)
-		return findtext_char(text, src, start, end)
-	proc/Replace_char(text, rep, start=1, end)
-		return replacetext_char(text, src, rep, start, end)
-
-mutable_appearance
-	parent_type = /image
-	_dm_interface = _DM_datum|_DM_image|_DM_Special
-
-// filters
-dm_filter // dummy datum so the compiler knows these are allowable filter vars
-	var/x, y, size, offset, color, alpha, flags, repeat, falloff, radius, space, icon, render_source
-#define WAVE_SIDEWAYS 1
-#define WAVE_BOUNDED 2
-#define MASK_INVERSE 1
-#define MASK_SWAP 2
-#define OUTLINE_SHARP 1
-#define OUTLINE_SQUARE 2
-#define FILTER_OVERLAY 1
-#define FILTER_UNDERLAY 2
-#define FILTER_COLOR_RGB 0
-#define FILTER_COLOR_HSV 1
-#define FILTER_COLOR_HSL 2
-#define FILTER_COLOR_HCY 3
-
-
-#define PROFILE_STOP 1
-#define PROFILE_CLEAR 2
-#define PROFILE_AVERAGE 4
-#define PROFILE_START 0	// start but don't clear
-#define PROFILE_REFRESH 0
-#define PROFILE_RESTART 2	// start and clear
-
-
-```
\ No newline at end of file
+The contents of `stddef.dm` may change with new BYOND versions. However an eye is always kept on backwards-compatibility.
+***
\ No newline at end of file
diff --git a/ref/area/area.md b/ref/area/area.md
deleted file mode 100644
index fa8c29b9..00000000
--- a/ref/area/area.md
+++ /dev/null
@@ -1,40 +0,0 @@
-## area
-
-Areas are derived from `/area`, which derives from `/atom`.
-Regions on the map may be assigned to an area by painting it onto the
-map.  All turfs must have an area, and it defaults to [`world.area`](ref/world/var/area.md)
-unless otherwise specified.
-
-For each area type defined in code, one area object is created at
-runtime. By default, for all areas on the map, all squares with the same area type
-belong to the same instance of the area. However, new variants added in the map editor
-with unique variables (ie: `color = "red"`, `tag = "darkness"`) are considered unique 
-instances of the same type.
-
-The following example defines the area prototype `/area/outside`. It also
-defines an action to be taken when somebody enters an area, namely to
-display its description.
-### Example:
-
-```dm
-area
-	Entered(O)
-		if(desc)
-			O << desc
-			return ..()
-outside
-	desc = "Ah! A breath of fresh air!" 
-```
-
-## Rooms
-Areas off the map serve as rooms that objects may enter and exit.
-Additional instances of rooms may be created from the same type by explicitly creating them
-with null as the initial location. That is, the first argument to
-`new()` should either be `null` or left unspecified. 
-
-> [!TIP] 
-> **See also:**
-> +   [atom](/ref/atom.md) 
-> +   [procs (area)](/ref/area/proc.md) 
-> +   [rooms](/ref/area/room.md) 
-> +   [vars (area)](/ref/area/var.md) 
diff --git a/ref/area/index.md b/ref/area/index.md
new file mode 100644
index 00000000..edcc61ac
--- /dev/null
+++ b/ref/area/index.md
@@ -0,0 +1,30 @@
+
+## area (info)
+***
+Areas are derived from `/area`, which derives from `/atom`. Regions on the map may be assigned to an area by painting it onto the map. Areas off the map serve as rooms that objects may enter and exit.
+
+For each area type defined, one area object is created at runtime. So for areas on the map, all squares with the same area type belong to the same instance of the area.
+
+Additional instances of rooms may be created from the same type by explicitly creating them with null as the initial location. That is, the first argument to `new()` should either be `null` or left unspecified.
+
+The following example defines the area prototype `/area/outside`. It also defines an action to be taken when somebody enters an area, namely to display its description.
+
+
+```dm
+
+area
+  Entered(O)
+    if(desc) O << desc
+    return ..()
+
+  outside
+    desc = "Ah!  A breath of fresh air!"
+
+```
+
+***
+**Related Pages:**
++    [atom](/ref/atom)
++    [procs (area)](/ref/area/proc)
++    [rooms](/ref/area/room)
++    [vars (area)](/ref/area/var)
diff --git a/ref/area/proc.md b/ref/area/proc.md
index 93dd624d..4a73ea08 100644
--- a/ref/area/proc.md
+++ b/ref/area/proc.md
@@ -1,29 +1,5 @@
-## procs (area)
-
 
+## proc (proc)
+***
 Built-in area procs:
-area/proc
-+   [Click](/ref/atom/proc/Click.md) 
-+   [Cross proc](/ref/atom/proc/Cross.md) 
-+   [Crossed proc](/ref/atom/proc/Crossed.md) 
-+   [DblClick](/ref/atom/proc/DblClick.md) 
-+   [Del](/ref/datum/proc/Del.md) 
-+   [Enter](/ref/atom/proc/Enter.md) 
-+   [Entered](/ref/atom/proc/Entered.md) 
-+   [Exit](/ref/atom/proc/Exit.md) 
-+   [Exited](/ref/atom/proc/Exited.md) 
-+   [MouseDown](/ref/atom/proc/MouseDown.md) 
-+   [MouseDrag](/ref/atom/proc/MouseDrag.md) 
-+   [MouseDrop](/ref/atom/proc/MouseDrop.md) 
-+   [MouseEntered](/ref/atom/proc/MouseEntered.md) 
-+   [MouseExited](/ref/atom/proc/MouseExited.md) 
-+   [MouseMove](/ref/atom/proc/MouseMove.md) 
-+   [MouseUp](/ref/atom/proc/MouseUp.md) 
-+   [MouseWheel](/ref/atom/proc/MouseWheel.md) 
-+   [New](/ref/atom/proc/New.md) 
-+   [Read](/ref/datum/proc/Read.md) 
-+   [Stat](/ref/atom/proc/Stat.md) 
-+   [Topic](/ref/datum/proc/Topic.md) 
-+   [Uncross proc](/ref/atom/proc/Uncross.md) 
-+   [Uncrossed proc](/ref/atom/proc/Uncrossed.md) 
-+   [Write](/ref/datum/proc/Write.md) 
\ No newline at end of file
+***
\ No newline at end of file
diff --git a/ref/area/room.md b/ref/area/room.md
index 406a0a7b..22088a1b 100644
--- a/ref/area/room.md
+++ b/ref/area/room.md
@@ -1,32 +1,29 @@
-## rooms
 
+## room (info)
+***
+Areas that are not located on the map are referred to as rooms. When a player enters one, the map goes away and you have something like a text MUD. By default, there would be no way for players to move from one room to another, so you have to handle movement yourself.
 
-Areas that are not located on the map are referred to as
-*rooms*. When a player enters one, the map goes away and you have
-something like a text MUD. By default, there would be no way for players
-to move from one room to another, so you have to handle movement
-yourself. 
+You can check the variable area.x to see if a given area is on the map or not.
 
-You can check the variable [area.x](/ref/atom/var/x.md) to
-see if a given area is on the map or not. 
+The following example puts players in a room when they log in and provides a single exit.
 
-The following example
-puts players in a room when they log in and provides a single exit.
-### Example:
 
 ```dm
+
 mob/Login()
-	if(!loc)
-		Move(locate(/area/birthing_hut))
-		return ..()
+   if(!loc) Move(locate(/area/birthing_hut))
+   return ..()
 
 area/birthing_hut
-	Entered(O) O << "Waaaaah! You land in a pile of straw."
-	return ..()
-
-	verb/exit()
-		if(Move(locate(1,1,1))) //jump to the map or whatever
-		usr << "You crawl into the open air..."
-		else
-			usr << "The hut door is blocked. You cannot get out." 
+   Entered(O)
+      O << "Waaaaah!  You land in a pile of straw."
+      return ..()
+   verb/exit()
+      if(Move(locate(1,1,1))) //jump to the map or whatever
+         usr << "You crawl into the open air..."
+      else
+         usr << "The hut door is blocked.  You cannot get out."
+
 ```
+
+***
\ No newline at end of file
diff --git a/ref/area/var.md b/ref/area/var.md
deleted file mode 100644
index 449d95c2..00000000
--- a/ref/area/var.md
+++ /dev/null
@@ -1,48 +0,0 @@
-## vars (area)
-
-
-Built-in area vars:
-area/var
-+   [alpha](/ref/atom/var/alpha.md) 
-+   [appearance](/ref/atom/var/appearance.md) 
-+   [appearance_flags](/ref/atom/var/appearance_flags.md) 
-+   [blend_mode](/ref/atom/var/blend_mode.md) 
-+   [color](/ref/atom/var/color.md) 
-+   [contents](/ref/atom/var/contents.md) 
-+   [density](/ref/atom/var/density.md) 
-+   [desc](/ref/atom/var/desc.md) 
-+   [dir](/ref/atom/var/dir.md) 
-+   [filters](/ref/atom/var/filters.md) 
-+   [gender](/ref/atom/var/gender.md) 
-+   [icon](/ref/atom/var/icon.md) 
-+   [icon_state](/ref/atom/var/icon_state.md) 
-+   [icon_w](/ref/atom/var/icon_w.md) 
-+   [icon_z](/ref/atom/var/icon_z.md) 
-+   [invisibility](/ref/atom/var/invisibility.md) 
-+   [underlays](/ref/atom/var/underlays.md) 
-+   [overlays](/ref/atom/var/overlays.md) 
-+   [layer](/ref/atom/var/layer.md) 
-+   [luminosity](/ref/atom/var/luminosity.md) 
-+   [maptext](/ref/atom/var/maptext.md) 
-+   [maptext_width](/ref/atom/var/maptext_width.md) 
-+   [maptext_height](/ref/atom/var/maptext_height.md) 
-+   [maptext_x](/ref/atom/var/maptext_x.md) 
-+   [maptext_y](/ref/atom/var/maptext_y.md) 
-+   [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) 
-+   [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) 
-+   [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) 
-+   [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) 
-+   [mouse_opacity var](/ref/atom/var/mouse_opacity.md) 
-+   [name](/ref/atom/var/name.md) 
-+   [opacity](/ref/atom/var/opacity.md) 
-+   [parent_type](/ref/area/var/parent_type.md) 
-+   [plane](/ref/atom/var/plane.md) 
-+   [render_source](/ref/atom/var/render_source.md) 
-+   [render_target](/ref/atom/var/render_target.md) 
-+   [suffix](/ref/atom/var/suffix.md) 
-+   [tag](/ref/datum/var/tag.md) 
-+   [text](/ref/atom/var/text.md) 
-+   [transform](/ref/atom/var/transform.md) 
-+   [type](/ref/datum/var/type.md) 
-+   [vars](/ref/datum/var/vars.md) 
-+   [verbs](/ref/atom/var/verbs.md) 
\ No newline at end of file
diff --git a/ref/area/var/index.md b/ref/area/var/index.md
new file mode 100644
index 00000000..0e46dc9b
--- /dev/null
+++ b/ref/area/var/index.md
@@ -0,0 +1,5 @@
+
+## var (var)
+***
+Built-in area vars:
+***
\ No newline at end of file
diff --git a/ref/area/var/parent_type.md b/ref/area/var/parent_type.md
index 59823f48..baeca188 100644
--- a/ref/area/var/parent_type.md
+++ b/ref/area/var/parent_type.md
@@ -1,9 +1,7 @@
-## parent_type var (area)
 
-
-
-The default parent_type of [/area](/ref/area.md)  is [/atom](/ref/atom.md) 
-
-> [!TIP] 
-> **See also:**
-> +   [parent_type var](/ref/datum/var/parent_type.md) 
\ No newline at end of file
+## parent_type (var)
+***
+The default parent_type of /area is /atom.
+***
+**Related Pages:**
++    [parent_type](/ref/datum/var/parent_type)
diff --git a/ref/atom/atom.md b/ref/atom/atom.md
deleted file mode 100644
index 52b1140b..00000000
--- a/ref/atom/atom.md
+++ /dev/null
@@ -1,25 +0,0 @@
-## atom
-
-
-The /atom object type is the ancestor of all mappable objects
-in the game. The types /area, /turf, /obj, and /mob are all derived from
-/atom. You should not create instances of /atom directly but should use
-/area, /turf, /obj, and /mob for actual objects. The /atom object type
-exists for the purpose of defining variables or procedures that are
-shared by all of the other "physical" objects. These are also the only
-objects for which verbs may be accessible to the user. 
-
-/atom is
-derived from /datum, so it inherits the basic properties that are shared
-by all DM objects.
-
-> [!TIP] 
-> **See also:**
-> +   [area](/ref/area.md) 
-> +   [datum](/ref/datum.md) 
-> +   [mob](/ref/mob.md) 
-> +   [movable atoms](/ref/atom/movable.md) 
-> +   [obj](/ref/obj.md) 
-> +   [procs (atom)](/ref/atom/proc.md) 
-> +   [turf](/ref/turf.md) 
-> +   [vars (atom)](/ref/atom/var.md) 
\ No newline at end of file
diff --git a/ref/atom/index.md b/ref/atom/index.md
new file mode 100644
index 00000000..f2e2d58d
--- /dev/null
+++ b/ref/atom/index.md
@@ -0,0 +1,16 @@
+
+## atom (info)
+***
+The /atom object type is the ancestor of all mappable objects in the game. The types /area, /turf, /obj, and /mob are all derived from /atom. You should not create instances of /atom directly but should use /area, /turf, /obj, and /mob for actual objects. The /atom object type exists for the purpose of defining variables or procedures that are shared by all of the other "physical" objects. These are also the only objects for which verbs may be accessible to the user.
+
+/atom is derived from /datum, so it inherits the basic properties that are shared by all DM objects.
+***
+**Related Pages:**
++    [area](/ref/area)
++    [datum](/ref/datum)
++    [mob](/ref/mob)
++    [atom/movable](/ref/atom/movable)
++    [obj](/ref/obj)
++    [procs (atom)](/ref/atom/proc)
++    [turf](/ref/turf)
++    [vars (atom)](/ref/atom/var)
diff --git a/ref/atom/movable.md b/ref/atom/movable.md
deleted file mode 100644
index 385cf1ea..00000000
--- a/ref/atom/movable.md
+++ /dev/null
@@ -1,16 +0,0 @@
-## movable atoms
-
-
-The /atom/movable object type is the ancestor of all mappable
-objects that are capable of motion. The types /obj and /mob are derived
-from /atom/movable. You should not create instances of /atom/movable but
-should use /obj and /mob for actual objects. This object definition
-exists solely to define variables and procedures related to motion.
-
-> [!TIP] 
-> **See also:**
-> +   [atom](/ref/atom.md) 
-> +   [mob](/ref/mob.md) 
-> +   [obj](/ref/obj.md) 
-> +   [procs (movable atoms)](/ref/atom/movable/proc.md) 
-> +   [vars (movable atoms)](/ref/atom/movable/var.md) 
\ No newline at end of file
diff --git a/ref/atom/movable/index.md b/ref/atom/movable/index.md
new file mode 100644
index 00000000..03094259
--- /dev/null
+++ b/ref/atom/movable/index.md
@@ -0,0 +1,11 @@
+
+## movable (info)
+***
+The /atom/movable object type is the ancestor of all mappable objects that are capable of motion. The types /obj and /mob are derived from /atom/movable. You should not create instances of /atom/movable but should use /obj and /mob for actual objects. This object definition exists solely to define variables and procedures related to motion.
+***
+**Related Pages:**
++    [atom](/ref/atom)
++    [mob](/ref/mob)
++    [obj](/ref/obj)
++    [procs (movable atoms)](/ref/atom/movable/proc)
++    [vars (movable atoms)](/ref/atom/movable/var)
diff --git a/ref/atom/movable/proc.md b/ref/atom/movable/proc.md
deleted file mode 100644
index 16bef1e0..00000000
--- a/ref/atom/movable/proc.md
+++ /dev/null
@@ -1,7 +0,0 @@
-## procs (movable atoms)
-
-
-Built-in movement procs:
-atom/movable/proc
-+   [Bump](/ref/atom/movable/proc/Bump.md) 
-+   [Move](/ref/atom/movable/proc/Move.md) 
\ No newline at end of file
diff --git a/ref/atom/movable/proc/Bump.md b/ref/atom/movable/proc/Bump.md
index c0fd8195..3dfbb11f 100644
--- a/ref/atom/movable/proc/Bump.md
+++ b/ref/atom/movable/proc/Bump.md
@@ -1,20 +1,20 @@
-## Bump proc (movable atom)
+
+## Bump (proc)
 
 **Format:**
 +   Bump(atom/Obstacle)
 
-**When:**
-+   Called when a movement fails due to a dense blockage.
-
-**Args:**
+**Arguments:**
 +   Obstacle: The blocking object.
 
-**Default action:**
-+   If the obstacle is a mob and src is in its group, swap their
-    positions. This is only done if the mobs both move by full tiles and
-    do not use pixel movement, to preserve the behavior of older games.
+**Called When:**
++   Called when a movement fails due to a dense blockage.
 
-> [!TIP] 
-> **See also:**
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+**Default Action:**
++   If the obstacle is a mob and src is in its group, swap their positions.
+This is only done if the mobs both move by full tiles and do not use pixel
+movement, to preserve the behavior of older games.
+******
+**Related Pages:**
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/proc/Move.md b/ref/atom/movable/proc/Move.md
index c63d7c27..9e89247b 100644
--- a/ref/atom/movable/proc/Move.md
+++ b/ref/atom/movable/proc/Move.md
@@ -1,80 +1,52 @@
-## Move proc (movable atom)
+
+## Move (proc)
 
 **Format:**
-+   Move(NewLoc, Dir = 0, step_x = 0, step_y = 0)
++   Move(NewLoc,Dir=0,step_x=0,step_y=0)
+
+**Arguments:**
++   NewLoc: The new location.
++   Dir: The direction of movement (or 0).
++   : The new step_x value, relative to NewLoc
++   : The new step_y value, relative to NewLoc
 
 **Returns:**
 +   Success (jump): 1
 +   Success (slide): Number of pixels moved
 +   Failure: 0
 
-**When:**
-+   Called to move the object. By default, client.Move() calls this proc
-    when players use direction keys. The automated movement functions
-    (like walk()) also call this proc. Directly setting the loc variable
-    does **not** call this procedure.
-
-**Args:**
-+   NewLoc: The new location.
-+   Dir: The direction of movement (or 0).
-+   [step_x] 490 : The new step_x value, relative to NewLoc
-+   [step_y] 490 : The new step_y value, relative to NewLoc
-
-
-Any Move() is either a slide or a jump. Normal walking around
-is a slide; it can be stopped partway. A jump is pass/fail. See more
-information below. 
+**Called When:**
++   Called to move the object.  By default, client.Move() calls this proc when
+players use direction keys.  The automated movement functions (like walk())
+also call this proc.  Directly setting the loc variable does
+ call this procedure.
+***
+Any Move() is either a slide or a jump. Normal walking around is a slide; it can be stopped partway. A jump is pass/fail. See more information below.
 
 This is what happens by default:
-1.  
-
-oldloc.Exit(src) is called for any turfs or areas being
-    vacated, or the container if moving out of an obj or mob.
-    neighbor.Uncross(src) is called for any atoms that will no longer be
-    overlapping this object. If any of these return 0 (failure),
-    movement fails.
-2.  
-
-newloc.Enter(src) is called for any turfs or areas that may
-    be entered for the first time, or the container if moving into an
-    obj or mob. neighbor.Cross(src) is called for any atoms that may be
-    in collision with this object if the move fully succeeds. If any of
-    these return 0 (failure), then a slide can be cut short but a jump
-    will fail completely.
-3.  
-
-If any obstacles were encountered via Enter() or Cross()
-    failing, then src.Bump(obstacle) will be called for each of them.
-4.  
-
-If movement did not fail completely, then loc and step_x/y,
-    will be changed, and the following calls will be made:
-    oldloc.Exited() for any turfs, areas, or other containers vacated;
-    neighbor.Uncrossed() for any movable atoms no longer overlapping;
-    newloc.Entered() for any turfs, areas, or other containers being
-    entered for the first time; and neighbor.Crossed() for any movable
-    atoms now overlapping the object.
-
-
-A movement is considered a slide if src is moving from one turf
-to another on the same z level, and the total pixel distance is less
-than either src.step_size or a full tile size (whichever is largest).
-Any other movement is a jump. Movement to the same turf with no step_x/y
-change is also considered a jump.
 
-> [!TIP] 
-> **See also:**
-> +   [Bump proc (movable atom)](/ref/atom/movable/proc/Bump.md) 
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [loc var (atom)](/ref/atom/var/loc.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [walk proc](/ref/proc/walk.md) 
-> +   [Gliding](/ref/notes/gliding.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+oldloc.Exit(src) is called for any turfs or areas being vacated, or the container if moving out of an obj or mob. neighbor.Uncross(src) is called for any atoms that will no longer be overlapping this object. If any of these return 0 (failure), movement fails.
+
+newloc.Enter(src) is called for any turfs or areas that may be entered for the first time, or the container if moving into an obj or mob. neighbor.Cross(src) is called for any atoms that may be in collision with this object if the move fully succeeds. If any of these return 0 (failure), then a slide can be cut short but a jump will fail completely.
+
+If any obstacles were encountered via Enter() or Cross() failing, then src.Bump(obstacle) will be called for each of them.
+
+If movement did not fail completely, then loc and step_x/y, will be changed, and the following calls will be made: oldloc.Exited() for any turfs, areas, or other containers vacated; neighbor.Uncrossed() for any movable atoms no longer overlapping; newloc.Entered() for any turfs, areas, or other containers being entered for the first time; and neighbor.Crossed() for any movable atoms now overlapping the object.
+
+A movement is considered a slide if src is moving from one turf to another on the same z level, and the total pixel distance is less than either src.step_size or a full tile size (whichever is largest). Any other movement is a jump. Movement to the same turf with no step_x/y change is also considered a jump.
+***
+**Related Pages:**
++    [Bump](/ref/atom/movable/proc/Bump)
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [loc](/ref/atom/var/loc)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [walk proc](/ref/proc/walk)
++    [Gliding](/ref/{notes}/gliding)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/proc/index.md b/ref/atom/movable/proc/index.md
new file mode 100644
index 00000000..f0a4896c
--- /dev/null
+++ b/ref/atom/movable/proc/index.md
@@ -0,0 +1,5 @@
+
+## proc (proc)
+***
+Built-in movement procs:
+***
\ No newline at end of file
diff --git a/ref/atom/movable/var.md b/ref/atom/movable/var.md
deleted file mode 100644
index 79e2e13f..00000000
--- a/ref/atom/movable/var.md
+++ /dev/null
@@ -1,17 +0,0 @@
-## vars (movable atoms)
-
-
-Built-in movement vars:
-atom/movable/var
-+   [animate_movement](/ref/atom/movable/var/animate_movement.md) 
-+   [bound_x](/ref/atom/movable/var/bound_x.md) 
-+   [bound_y](/ref/atom/movable/var/bound_y.md) 
-+   [bound_width](/ref/atom/movable/var/bound_width.md) 
-+   [bound_height](/ref/atom/movable/var/bound_height.md) 
-+   [locs](/ref/atom/movable/var/locs.md) 
-+   [screen_loc](/ref/atom/movable/var/screen_loc.md) 
-+   [glide_size](/ref/atom/movable/var/glide_size.md) 
-+   [particles](/ref/atom/movable/var/particles.md) 
-+   [step_size](/ref/atom/movable/var/step_size.md) 
-+   [step_x](/ref/atom/movable/var/step_x.md) 
-+   [step_y](/ref/atom/movable/var/step_y.md) 
\ No newline at end of file
diff --git a/ref/atom/movable/var/animate_movement.md b/ref/atom/movable/var/animate_movement.md
index 1fe7bc53..bdb40171 100644
--- a/ref/atom/movable/var/animate_movement.md
+++ b/ref/atom/movable/var/animate_movement.md
@@ -1,44 +1,18 @@
-## animate_movement var (movable atoms)
 
+## animate_movement (var)
 
-**Default value:**
+**Default Value:**
 +   FORWARD_STEPS (1)
+***
+Setting this to 0 causes movement between two adjacent positions to be displayed as a single discrete jump. Otherwise, objects will be made to glide from one position to another, using the movement animation defined in the icon file if one is defined.
 
-**Possible values:**
-+   NO_STEPS (0)
-+   FORWARD_STEPS (1)
-+   SLIDE_STEPS (2)
-+   SYNC_STEPS (3)
-
-
-Setting this to 0 causes movement between two adjacent
-positions to be displayed as a single discrete jump. Otherwise, objects
-will be made to glide from one position to another, using the movement
-animation defined in the icon file if one is defined. 
-
-By
-default, movement animation avoids cutting corners, since this can look
-very bad in some games. If you want objects to take the shortest (and
-smoothest) visual path when moving around, use `SLIDE_STEPS` instead of
-the default `FORWARD_STEPS`. This also allows the object to be facing in
-a different direction than it is moving, so make sure this is what you
-want. 
-
-`SYNC_STEPS` is intended for objects that move in unison
-as part of a larger "conglomerate" object. You should set the movement
-animation to `SYNC_STEPS` on all but a single "head" object, which
-will serve as the leader when choosing pixel step sizes. If you do not
-use `SYNC_STEPS`, there are cases where the pixel offsets of objects may
-get out of sync during motion, causing the object to visually break up.
-Because of the advent of features like big icons, this value is no
-longer of much use. 
+By default, movement animation avoids cutting corners, since this can look very bad in some games. If you want objects to take the shortest (and smoothest) visual path when moving around, use `SLIDE_STEPS` instead of the default `FORWARD_STEPS`. This also allows the object to be facing in a different direction than it is moving, so make sure this is what you want.
 
-Note: This setting has no impact when used
-with pixel movement, except in special cases. See
-[Gliding](/ref/notes/gliding.md) for more details.
+`SYNC_STEPS` is intended for objects that move in unison as part of a larger "conglomerate" object. You should set the movement animation to `SYNC_STEPS` on all but a single "head" object, which will serve as the leader when choosing pixel step sizes. If you do not use `SYNC_STEPS`, there are cases where the pixel offsets of objects may get out of sync during motion, causing the object to visually break up. Because of the advent of features like big icons, this value is no longer of much use.
 
-> [!TIP] 
-> **See also:**
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) 
-> +   [Gliding](/ref/notes/gliding.md) 
\ No newline at end of file
+Note: This setting has no impact when used with pixel movement, except in special cases. See Gliding for more details.
+***
+**Related Pages:**
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [glide_size var (movable atom)](/ref/atom/movable/var/glide_size)
++    [Gliding](/ref/{notes}/gliding)
diff --git a/ref/atom/movable/var/bound_height.md b/ref/atom/movable/var/bound_height.md
index d9c11679..89271282 100644
--- a/ref/atom/movable/var/bound_height.md
+++ b/ref/atom/movable/var/bound_height.md
@@ -1,33 +1,24 @@
-## bound_height var (movable atom) 
-###### BYOND Version 490
-
-**Default value:**
-+   32 (depends on world.icon_size)
 
+## bound_height (var)
 
-This var defines the height of the physical atom\'s bounding
-box, in pixels. By default all atoms are assumed to be one tile in
-physical size. 
-
-Example: A 16×16 smiley face centered in a 32×32
-icon should have a bound_height value of 16. 
+**Default Value:**
++   32 (depends on world.icon_size)
+***
+This var defines the height of the physical atom's bounding box, in pixels. By default all atoms are assumed to be one tile in physical size.
 
-The default value
-depends on world.icon_size and world.map_format. In a topdown or tiled
-map_format, the icon height specified in world.icon_size is used. In
-other modes, height is irrelevant and tile "footprints" are square, so
-the icon width is used.
+Example: A 16×16 smiley face centered in a 32×32 icon should have a bound_height value of 16.
 
-> [!TIP] 
-> **See also:**
-> +   [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) 
-> +   [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) 
-> +   [icon_w var (atom)](/ref/atom/var/icon_w.md) 
-> +   [icon_z var (atom)](/ref/atom/var/icon_z.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [icon_size var (world)](/ref/world/var/icon_size.md) 
-> +   [map_format var (world)](/ref/world/var/map_format.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+The default value depends on world.icon_size and world.map_format. In a topdown or tiled map_format, the icon height specified in world.icon_size is used. In other modes, height is irrelevant and tile "footprints" are square, so the icon width is used.
+***
+**Related Pages:**
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [bound_y var (movable atom)](/ref/atom/movable/var/bound_y)
++    [bound_width var (movable atom)](/ref/atom/movable/var/bound_width)
++    [icon_w var (atom)](/ref/atom/var/icon_w)
++    [icon_z var (atom)](/ref/atom/var/icon_z)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [icon_size var (world)](/ref/world/var/icon_size)
++    [map_format var (world)](/ref/world/var/map_format)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/bound_width.md b/ref/atom/movable/var/bound_width.md
index 64c25508..0f981a3b 100644
--- a/ref/atom/movable/var/bound_width.md
+++ b/ref/atom/movable/var/bound_width.md
@@ -1,26 +1,21 @@
-## bound_width var (movable atom) 
-###### BYOND Version 490
-
-**Default value:**
-+   32 (width of default icon; depends on world.icon_size)
 
+## bound_width (var)
 
-This var defines the width of the physical atom\'s bounding
-box, in pixels. By default all atoms are assumed to be one tile in
-physical size. 
-
-Example: A 16×16 smiley face centered in a 32×32
-icon should have a bound_width value of 16.
+**Default Value:**
++   32 (width of default icon; depends on world.icon_size)
+***
+This var defines the width of the physical atom's bounding box, in pixels. By default all atoms are assumed to be one tile in physical size.
 
-> [!TIP] 
-> **See also:**
-> +   [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) 
-> +   [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) 
-> +   [icon_w var (atom)](/ref/atom/var/icon_w.md) 
-> +   [icon_z var (atom)](/ref/atom/var/icon_z.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [icon_size var (world)](/ref/world/var/icon_size.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+Example: A 16×16 smiley face centered in a 32×32 icon should have a bound_width value of 16.
+***
+**Related Pages:**
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [bound_y var (movable atom)](/ref/atom/movable/var/bound_y)
++    [bound_height var (movable atom)](/ref/atom/movable/var/bound_height)
++    [icon_w var (atom)](/ref/atom/var/icon_w)
++    [icon_z var (atom)](/ref/atom/var/icon_z)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [icon_size var (world)](/ref/world/var/icon_size)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/bound_x.md b/ref/atom/movable/var/bound_x.md
index 9d0b461b..d1532757 100644
--- a/ref/atom/movable/var/bound_x.md
+++ b/ref/atom/movable/var/bound_x.md
@@ -1,35 +1,25 @@
-## bound_x var (movable atom) 
-###### BYOND Version 490
 
-> [!NOTE]
-> The bound_x/y vars have been deprecated in favor of icon_w/z and
-pixel_w/z. It\'s now preferred to use bound_width/height alone to define
-a bounding box. New behavior simply subtracts bound_x/y from pixel_w/z
-to mimic the old usage. 
+## bound_x (var)
 
-**Default value:**
-+ 0
+**Default Value:**
++   0
+***
 
-This var defines the left side of the
-physical atom\'s bounding box, in pixels. By default all atoms are
-assumed to be one tile in physical size. 
+> [!WARNING]
+> Note: The bound_x/y vars aren't exactly deprecated, but it's preferable to use icon_w/z or pixel_w/z instead. Best practice is to avoid bound_x/y altogether, and use bound_width/height alone to define a bounding box. New behavior simply subtracts bound_x/y from pixel_w/z to mimic the old usage.
 
-The left edge of the
-bounding box starts bound_x pixels inward from the left edge of the
-atom\'s icon (as affected by step_x). A bound_x value of 4 means the
-atom has 4 pixels of empty space to its left. 
+This var defines the left side of the physical atom's bounding box, in pixels. By default all atoms are assumed to be one tile in physical size.
 
-Example: A 16×16
-smiley face centered in a 32×32 icon should have a bound_x value of 8,
-since there are 8 pixels of empty space to the left.
+The left edge of the bounding box starts bound_x pixels inward from the left edge of the atom's icon (as affected by step_x). A bound_x value of 4 means the atom has 4 pixels of empty space to its left.
 
-> [!TIP] 
-> **See also:**
-> +   [icon_w var (atom)](/ref/atom/var/icon_w.md) 
-> +   [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) 
-> +   [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) 
-> +   [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+Example: A 16×16 smiley face centered in a 32×32 icon should have a bound_x value of 8, since there are 8 pixels of empty space to the left.
+***
+**Related Pages:**
++    [icon_w var (atom)](/ref/atom/var/icon_w)
++    [bound_y var (movable atom)](/ref/atom/movable/var/bound_y)
++    [bound_width var (movable atom)](/ref/atom/movable/var/bound_width)
++    [bound_height var (movable atom)](/ref/atom/movable/var/bound_height)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/bound_y.md b/ref/atom/movable/var/bound_y.md
index 2b5ba0f8..d9f32d02 100644
--- a/ref/atom/movable/var/bound_y.md
+++ b/ref/atom/movable/var/bound_y.md
@@ -1,34 +1,25 @@
-## bound_y var (movable atom) 
-###### BYOND Version 490
-> [!NOTE]
-> The bound_x/y vars have been deprecated in favor of icon_w/z and
-pixel_w/z. It\'s now preferred to use bound_width/height alone to define
-a bounding box. New behavior simply subtracts bound_x/y from pixel_w/z
-to mimic the old usage. 
 
-**Default value:**
+## bound_y (var)
+
+**Default Value:**
 +   0
+***
 
-This var defines the bottom side of the
-physical atom\'s bounding box, in pixels. By default all atoms are
-assumed to be one tile in physical size. 
+> [!WARNING]
+> Note: The bound_x/y vars aren't exactly deprecated, but it's preferable to use icon_w/z or pixel_w/z instead. Best practice is to avoid bound_x/y altogether, and use bound_width/height alone to define a bounding box. New behavior simply subtracts bound_x/y from pixel_w/z to mimic the old usage.
 
-The bottom edge of the
-bounding box starts bound_y pixels inward from the bottom edge of the
-atom\'s icon (as affected by step_y). A bound_y value of 4 means the
-atom has 4 pixels of empty space below it. 
+This var defines the bottom side of the physical atom's bounding box, in pixels. By default all atoms are assumed to be one tile in physical size.
 
-Example: A 16×16
-smiley face centered in a 32×32 icon should have a bound_y value of 8,
-since there are 8 pixels of empty space below.
+The bottom edge of the bounding box starts bound_y pixels inward from the bottom edge of the atom's icon (as affected by step_y). A bound_y value of 4 means the atom has 4 pixels of empty space below it.
 
-> [!TIP] 
-> **See also:**
-> +   [icon_z var (atom)](/ref/atom/var/icon_z.md) 
-> +   [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) 
-> +   [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+Example: A 16×16 smiley face centered in a 32×32 icon should have a bound_y value of 8, since there are 8 pixels of empty space below.
+***
+**Related Pages:**
++    [icon_z var (atom)](/ref/atom/var/icon_z)
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [bound_width var (movable atom)](/ref/atom/movable/var/bound_width)
++    [bound_height var (movable atom)](/ref/atom/movable/var/bound_height)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/glide_size.md b/ref/atom/movable/var/glide_size.md
index 71ef5e8f..269169e4 100644
--- a/ref/atom/movable/var/glide_size.md
+++ b/ref/atom/movable/var/glide_size.md
@@ -1,44 +1,27 @@
-## glide_size var (movable atoms) 
-###### BYOND Version 490
 
+## glide_size (var)
 
-**Default value:**
+**Default Value:**
 +   0
+***
+Note: The way this setting is used depends on world.movement_mode. See Gliding for more details.
 
+This controls the number of pixels an object is moved in each footstep during animated movement. The default value of 0 chooses automated control over this value, which generally results in a minimum footstep of 4 pixels that is increased when necessary to keep up with motion on the turf grid.
 
-Note: The way this setting is used depends on
-[world.movement_mode](/ref/world/var/movement_mode.md) . See
-[Gliding](/ref/notes/gliding.md) for more details. 
+Decimal values are allowed.
 
-This
-controls the number of pixels an object is moved in each footstep during
-animated movement. The default value of 0 chooses automated control over
-this value, which generally results in a minimum footstep of 4 pixels
-that is increased when necessary to keep up with motion on the turf
-grid. 
+Be careful about using small glide sizes. Icons with high contrast pixel-level detail can look pretty ugly when displaced by short distances.
 
-Decimal values are allowed. 
-
-Be careful about
-using small glide sizes. Icons with high contrast pixel-level detail can
-look pretty ugly when displaced by short distances. 
-
-The glide
-size is measured in server ticks. If you use a different client tick
-rate by altering `client.fps` or `client.tick_lag`, the actual glide
-used will be scaled appropriately. E.g., if your `client.fps` is 4 times
-greater than `world.fps`, the actual glide amount each client tick will
-be `glide_size/4`. 
+The glide size is measured in server ticks. If you use a different client tick rate by altering client.fps or client.tick_lag, the actual glide used will be scaled appropriately. E.g., if your client.fps is 4 times greater than world.fps, the actual glide amount each client tick will be glide_size/4.
 
 This was renamed from `pixel_step_size`.
-
-> [!TIP] 
-> **See also:**
-> +   [animate_movement var (movable atoms)](/ref/atom/movable/var/animate_movement.md) 
-> +   [glide_size var (client)](/ref/client/var/glide_size.md) 
-> +   [pixel_x var (atom)](/ref/atom/var/pixel_x.md) 
-> +   [pixel_y var (atom)](/ref/atom/var/pixel_y.md) 
-> +   [icon_size var (world)](/ref/world/var/icon_size.md) 
-> +   [movement_mode var (world)](/ref/world/var/movement_mode.md) 
-> +   [fps var (client)](/ref/client/var/fps.md) 
-> +   [Gliding](/ref/notes/gliding.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [animate_movement var (movable atom)](/ref/atom/movable/var/animate_movement)
++    [glide_size var (client)](/ref/client/var/glide_size)
++    [pixel_x](/ref/atom/var/pixel_x)
++    [pixel_y](/ref/atom/var/pixel_y)
++    [icon_size var (world)](/ref/world/var/icon_size)
++    [movement_mode var (world)](/ref/world/var/movement_mode)
++    [fps var (client)](/ref/client/var/fps)
++    [Gliding](/ref/{notes}/gliding)
diff --git a/ref/atom/movable/var/index.md b/ref/atom/movable/var/index.md
new file mode 100644
index 00000000..a1ad3a70
--- /dev/null
+++ b/ref/atom/movable/var/index.md
@@ -0,0 +1,5 @@
+
+## var (var)
+***
+Built-in movement vars:
+***
\ No newline at end of file
diff --git a/ref/atom/movable/var/locs.md b/ref/atom/movable/var/locs.md
index 4b9f666e..b220402e 100644
--- a/ref/atom/movable/var/locs.md
+++ b/ref/atom/movable/var/locs.md
@@ -1,35 +1,23 @@
-## locs list var (movable atom) 
-###### BYOND Version 490
-
-**Default value:**
-+   list(src.loc)
 
+## locs (var)
 
-This read-only var tells which turfs are being physically
-covered by the atom\'s bounding box. The purpose of this is for cases
-where you set the atom\'s bounds to change its physical size so that it
-ends up covering more than one turf. 
-
-This is different from the
-loc var in that every atom still has only one "true" location. A
-movable atom may cover multiple turfs, but only one turf is its loc. The
-loc var can be thought of as an anchor point, while the actual physical
-footprint is in locs. 
+**Default Value:**
++   list(src.loc)
+***
+This read-only var tells which turfs are being physically covered by the atom's bounding box. The purpose of this is for cases where you set the atom's bounds to change its physical size so that it ends up covering more than one turf.
 
-For every turf in locs, this atom will
-also be in that turf\'s contents list. 
+This is different from the loc var in that every atom still has only one "true" location. A movable atom may cover multiple turfs, but only one turf is its loc. The loc var can be thought of as an anchor point, while the actual physical footprint is in locs.
 
-If loc is not a turf, it
-will be the only item in the locs list. If loc is null, locs will be
-empty.
+For every turf in locs, this atom will also be in that turf's contents list.
 
-> [!TIP] 
-> **See also:**
-> +   [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) 
-> +   [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) 
-> +   [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [loc var (atom)](/ref/atom/var/loc.md) 
-> +   [contents list var (atom)](/ref/atom/var/contents.md) 
\ No newline at end of file
+If loc is not a turf, it will be the only item in the locs list. If loc is null, locs will be empty.
+***
+**Related Pages:**
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [bound_y var (movable atom)](/ref/atom/movable/var/bound_y)
++    [bound_width var (movable atom)](/ref/atom/movable/var/bound_width)
++    [bound_height var (movable atom)](/ref/atom/movable/var/bound_height)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [loc](/ref/atom/var/loc)
++    [contents list var (atom)](/ref/atom/var/contents)
diff --git a/ref/atom/movable/var/particles.md b/ref/atom/movable/var/particles.md
index 14ce17d9..d8aa4889 100644
--- a/ref/atom/movable/var/particles.md
+++ b/ref/atom/movable/var/particles.md
@@ -1,20 +1,12 @@
-## particles var (movable atom) 
-###### BYOND Version 514
 
+## particles (var)
 
-**Default value:**
+**Default Value:**
 +   null
+***
+A datum (not derived from /atom) containing information about a particle set attached to this atom. See Particle effects for more information.
 
-
-A datum (not derived from /atom) containing information about a
-particle set attached to this atom. See [Particle
-effects](/ref/notes/particles.md) for more information.
-
-
-Resetting this var to null after it has contained a particle
-set will cause any existing particles on this object to immiediately
-disappear.
-
-> [!TIP] 
-> **See also:**
-> +   [Particle effects](/ref/notes/particles.md) 
\ No newline at end of file
+Resetting this var to null after it has contained a particle set will cause any existing particles on this object to immiediately disappear.
+***
+**Related Pages:**
++    [Particle effects](/ref/{notes}/particles)
diff --git a/ref/atom/movable/var/pixel_step_size.md b/ref/atom/movable/var/pixel_step_size.md
index 669469d0..3c2889d4 100644
--- a/ref/atom/movable/var/pixel_step_size.md
+++ b/ref/atom/movable/var/pixel_step_size.md
@@ -1,4 +1,5 @@
-## pixel_step_size var (movable atoms)
 
-
-Renamed to [glide_size](/ref/atom/movable/var/glide_size.md) 
\ No newline at end of file
+## pixel_step_size (var)
+***
+Renamed to glide_size.
+***
\ No newline at end of file
diff --git a/ref/atom/movable/var/screen_loc.md b/ref/atom/movable/var/screen_loc.md
index 39686a84..a9e09ed4 100644
--- a/ref/atom/movable/var/screen_loc.md
+++ b/ref/atom/movable/var/screen_loc.md
@@ -1,125 +1,59 @@
-## screen_loc var (movable atoms)
 
+## screen_loc (var)
+***
+This is a text string that controls where an object that is listed in `client.screen` will appear on the user's screen. The format is:
 
 
-This is a text string that controls where an object that is
-listed in `client.screen` will appear on the user\'s screen.
-The format is: 
 ```dm
- "x,y"
- "x:px,y:py"
- "x1,y1 to x2,y2"
+
+"x,y"
+"x:px,y:py"
+"x1,y1 to x2,y2"
+
 ```
- 
-
-The bottom left corner of the map viewport
-(southwest) is `"1,1"`. If the view is 11x11, then the top-right corner
-(northeast) is `"11,11"`. (Changing
-[world.map_format](/ref/world/var/map_format.md)  may change the range for
-screen_loc.) 
-
-A range of coordinates (the second format above)
-causes a square region to be filled with the object at each position.
-The southwest and northeast corners of the box are indicated in the
-screen_loc value.
-### Special keywords
-
-
-The edges of the map may also be referenced by using
-directions, such as `"3,NORTH"`. For convenience, the order of
-coordinates is arbitrary when using directions, so one may specify
-`y` before `x` as in `"NORTH,WEST"`. In
-expressions such as the latter, you may also leave out the comma. Icon
-size is not taken into account, so a big icon with a screen_loc of
-`"SOUTHEAST"` will extend further to the right and may create a border
-(see "Outside the map" below).
-The `CENTER` keyword can also be used. This can be used alone to
-completely center the object, or as either the x or y component. If the
-map covers an even number of tiles in either direction, pixel offsets
-will be applied automatically. Centering is relative to the regular map
-edges, and it does not take the icon\'s size into account.
-The `LEFT`, `RIGHT`, `TOP`, and `BOTTOM` keywords (also `TOPLEFT`,
-`TOPRIGHT`, `BOTTOMLEFT`, `BOTTOMRIGHT`) can be used to anchor a screen
-object to the edge of the map control if the map is zoomed in so that
-some pixels are cut off. When you use these edge-alignment keywords, the
-icon size *is* taken into account, and the alignment of the icon changes
-to fit whichever edge you use. Because these keywords do not conform to
-the normal tile-based structure of the HUD, they can\'t be used for a
-range of tiles with the `"to"` format. 
-
-> [!NOTE]
-> [Letterboxing](/ref/skin/param/letterbox.md) , the blank space to either
-side of the map if it doesn\'t take up the whole map control, is not
-considered usable space. HUD objects aligned to the control edge appear
-inside any letterboxing, not on top of it.
-### Outside the map
-
-
-In addition to objects inside of the map view, one may create
-border objects. Borders are automatically created when screen objects
-are placed at coordinates outside of the inner map view. For example,
-objects placed at y=0 fall on a border directly below the map and y=-1
-is one tile below that. (The `CENTER` keyword is based on normal
-viewport bounds and not any extra borders.) 
-
-A big icon placed
-towards the northeast end of the map, if it spills over the edge, will
-create a border big enough for the whole icon to be shown. You can avoid
-this by using the [`TILE_BOUND` appearance
-flag](/ref/atom/var/appearance_flags.md) . Transforms on this atom are not
-taken into account when determining whether to add a border.
-
-### Offsets
-Offsets may be applied to screen_loc coordinates. For example,
-`"NORTH+1,WEST"` is in a border above the map. `"CENTER+2,CENTER-1"`
-will appear 2 units right, 1 unit down from the center of the map.
-Non-integer offsets like 1.5 are allowed; the fractional part will be
-counted towards a pixel offset.
-Offsets may be specified in percentages as well. These effectively
-always count as pixel offsets and will never be used to determine if a
-border should be added. `"WEST+100%"` and `"100%"` are basically
-identical to `"EAST"` in most respects, and `"WEST+50%"` is basically
-the same as `"CENTER"`. If you\'re using the edge keywords (`LEFT`,
-`TOP`, etc.), this percentage is relative to the control edge and also
-factors in the icon size, so `"LEFT+100%"` is equivalent to `"RIGHT"`.
-
-
-It is also possible to specify a pixel offset. Screen objects
-do not use `pixel_x` and `pixel_y` for this purpose, because it is
-intended that an object could exist on the map and in the screen object
-list simultaneously, so positioning must be independent. Pixel offsets
-are specified after a colon like this: `"1:16,1:16"`. In this case the
-object is shifted to the northeast by 16 pixels.
-
-### Layering
-Screen objects on a plane will appear above non-screen objects
-on the same plane regardless of layer, except that `BACKGROUND_LAYER` or
-`EFFECTS_LAYER` may be used to move the objects forward or back.
-
-### Secondary map controls
-You can use HUD objects in any additional [map
-controls](/ref/skin/control/map.md)  that might appear in game\'s skin
-file. If you have a second map named `map2` for instance, then you can
-use `"map2:1,1"` or something similar as a `screen_loc`. If the map
-control is set to automatically scale to fit its contents, it will try
-to show every object you put there. 
-
-Note: For secondary-map HUD
-items, you should not use the full `window.control` ID, just the
-[id](/ref/skin/param/id.md) of the control itself. Map controls
-should always have a unique `id`.
-
-### Invalid screen locs
-Attempting to add an object to the client's screen with an invalid
-screen loc string will produce a runtime error. However, an empty,
-or null screen loc will produce no such error. A screen object can be
-prevented from drawing on the screen by temporarily emptying its screen_loc,
-but will retain its precedence in the screen list.
-
-> [!TIP] 
-> **See also:**
-> +   [HUD / screen objects](/ref/notes/HUD.md) 
-> +   [layer var (atom)](/ref/atom/var/layer.md) 
-> +   [screen var (client)](/ref/client/var/screen.md) 
-> +   [view var (client)](/ref/client/var/view.md) 
-> +   [map_format var (world)](/ref/world/var/map_format.md) 
+
+
+The bottom left corner of the map viewport (southwest) is `"1,1"`. If the view is 11x11, then the top-right corner (northeast) is `"11,11"`. (Changing world.map_format may change the range for screen_loc.)
+
+A range of coordinates (the second format above) causes a square region to be filled with the object at each position. The southwest and northeast corners of the box are indicated in the screen_loc value.
+
+If you use a `screen_loc` outside of the normal map view, extra tiles will be added to that side and the map will be clipped. For example, a value of `"0,1"` adds an extra column of tiles to the left, but that column will be blank except for any screen objects you show there. This is used if you want screen objects to provide a border around the map.
+
+The edges of the map may also be referenced by using directions, such as "3,NORTH". For convenience, the order of coordinates is arbitrary when using directions, so one may specify `y` before `x` as in "NORTH,WEST". In expressions such as the latter, you may also leave out the comma. Icon size is not taken into account, so a big icon with a screen_loc of "SOUTHEAST" will extend further to the right and may create a border (see "Outside the map" below).
+
+The `CENTER` keyword can also be used. This can be used alone to completely center the object, or as either the x or y component. If the map covers an even number of tiles in either direction, pixel offsets will be applied automatically. Centering is relative to the regular map edges, and it does not take the icon's size into account.
+
+The `LEFT`, `RIGHT`, `TOP`, and `BOTTOM` keywords (also `TOPLEFT`, `TOPRIGHT`, `BOTTOMLEFT`, `BOTTOMRIGHT`) can be used to anchor a screen object to the edge of the map control if the map is zoomed in so that some pixels are cut off. When you use these edge-alignment keywords, the icon size *is* taken into account, and the alignment of the icon changes to fit whichever edge you use. Because these keywords do not conform to the normal tile-based structure of the HUD, they can't be used for a range of tiles with the "to" format.
+
+The equivalent to `CENTER` for the `LEFT`/`RIGHT`/`TOP`/`BOTTOM` keywords is `MIDDLE`. It acts the same as `LEFT+50%`, `BOTTOM+50%`, or both.
+
+Note: Letterboxing, the blank space to either side of the map if it doesn't take up the whole map control, is not considered usable space. HUD objects aligned to the control edge appear inside any letterboxing, not on top of it.
+
+`SCREEN_SOUTHWEST`, `SCREEN_EAST`, and other directions with `SCREEN_` in front will anchor a screen object relative to the extent of all other screen objects. That is, if you extend the screen beyond the map with another object that uses `0,0`, then `SCREEN_SOUTHWEST` will refer to `0,0` instead of the normal `1,1` that `SOUTHWEST` would do.
+
+This is especially useful if you're using a render_source to copy a plane master. The object using `render_source` should be anchored at `SCREEN_SOUTHWEST`, which is the corner of the plane.
+
+In addition to objects inside of the map view, one may create border objects. Borders are automatically created when screen objects are placed at coordinates outside of the inner map view. For example, objects placed at y=0 fall on a border directly below the map and y=-1 is one tile below that. (The `CENTER` keyword is based on normal viewport bounds and not any extra borders.)
+
+A big icon placed towards the northeast end of the map, if it spills over the edge, will create a border big enough for the whole icon to be shown. You can avoid this by using the `TILE_BOUND` appearance flag. Transforms on this atom are not taken into account when determining whether to add a border.
+
+Offsets may be applied to screen_loc coordinates. For example, "NORTH+1,WEST" is in a border above the map. "CENTER+2,CENTER-1" will appear 2 units right, 1 unit down from the center of the map.
+
+Non-integer offsets like 1.5 are allowed; the fractional part will be counted towards a pixel offset.
+
+Offsets may be specified in percentages as well. These effectively always count as pixel offsets and will never be used to determine if a border should be added. "WEST+100%" and "100%" are basically identical to "EAST" in most respects, and "WEST+50%" is basically the same as "CENTER". If you're using the edge keywords (`LEFT`, `TOP`, etc.), this percentage is relative to the control edge and also factors in the icon size, so "LEFT+100%" is equivalent to "RIGHT".
+
+It is also possible to specify a pixel offset. Screen objects do not use `pixel_x` and `pixel_y` for this purpose, because it is intended that an object could exist on the map and in the screen object list simultaneously, so positioning must be independent. Pixel offsets are specified after a colon like this: `"1:16,1:16"`. In this case the object is shifted to the northeast by 16 pixels.
+
+Screen objects on a plane will appear above non-screen objects on the same plane regardless of layer, except that `BACKGROUND_LAYER` or `EFFECTS_LAYER` may be used to move the objects forward or back.
+
+You can use HUD objects in any additional map controls that might appear in game's skin file. If you have a second map named `map2` for instance, then you can use `"map2:1,1"` or something similar as a `screen_loc`. If the map control is set to automatically scale to fit its contents, it will try to show every object you put there.
+
+Note: For secondary-map HUD items, you should not use the full `window.control` ID, just the id of the control itself. Map controls should always have a unique `id`.
+***
+**Related Pages:**
++    [HUD / screen objects](/ref/{notes}/HUD)
++    [layer var (atom)](/ref/atom/var/layer)
++    [screen var (client)](/ref/client/var/screen)
++    [view var (client)](/ref/client/var/view)
++    [map_format var (world)](/ref/world/var/map_format)
diff --git a/ref/atom/movable/var/step_size.md b/ref/atom/movable/var/step_size.md
index 63120d38..3fd11400 100644
--- a/ref/atom/movable/var/step_size.md
+++ b/ref/atom/movable/var/step_size.md
@@ -1,29 +1,19 @@
-## step_size var (movable atom) 
-###### BYOND Version 490
-
-**Default value:**
-+   32 (width of default icon; depends on world.icon_size)
 
+## step_size (var)
 
-This var defines how fast, in pixels, an atom will move by
-default. If you use lower values of `step_size` for most items in your
-world, you may want to consider raising `world.fps` (at higher
-performance cost). 
-
-When `Move()` is called by a step or walk,
-or by the built-in client movement verbs, a change of `step_size` is
-applied to `step_x` and/or `step_y`. Any movement within the speed of
-`step_size`, or up to one tile in distance (whichever is greater), is
-considered a slide and may partially succeed if an obstacle is bumped
-before reaching the final position.
+**Default Value:**
++   32 (width of default icon; depends on world.icon_size)
+***
+This var defines how fast, in pixels, an atom will move by default. If you use lower values of `step_size` for most items in your world, you may want to consider raising `world.fps` (at higher performance cost).
 
-> [!TIP] 
-> **See also:**
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [fps var (world)](/ref/world/var/fps.md) 
-> +   [icon_size var (world)](/ref/world/var/icon_size.md) 
-> +   [Gliding](/ref/notes/gliding.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+When `Move()` is called by a step or walk, or by the built-in client movement verbs, a change of `step_size` is applied to `step_x` and/or `step_y`. Any movement within the speed of `step_size`, or up to one tile in distance (whichever is greater), is considered a slide and may partially succeed if an obstacle is bumped before reaching the final position.
+***
+**Related Pages:**
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [fps var (world)](/ref/world/var/fps)
++    [icon_size var (world)](/ref/world/var/icon_size)
++    [Gliding](/ref/{notes}/gliding)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/step_x.md b/ref/atom/movable/var/step_x.md
index a13bb03e..3161abdd 100644
--- a/ref/atom/movable/var/step_x.md
+++ b/ref/atom/movable/var/step_x.md
@@ -1,36 +1,21 @@
-## step_x var (movable atom) 
-###### BYOND Version 490
 
-**Default value:**
-+   0
-
-
-This var defines the position of the atom (in pixels) relative
-to its tile, on the x axis. A step_x of 5 means the atom actually is
-shown 5 pixels east of the tile\'s western edge. 
-
-The atom\'s
-actual bounding box may not begin at step_x, but can be set even further
-in via bound_x. 
+## step_x (var)
 
-Example: A 16×16 smiley face centered in a
-32×32 icon should have the following bounds:
--   bound_x = 8
--   bound_y = 8
--   bound_width = 16
--   bound_height = 16
-
-
-For the smiley to appear at the left edge of the tile it is
-standing on, it would need a step_x value of -8. A step_x value of 8
-takes it all the way to the rightmost edge of the tile. Anything outside
-of the range -8 to 8 will have the atom straddling multiple turfs.
-
-> [!TIP] 
-> **See also:**
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
-> +   [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) 
-> +   [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+**Default Value:**
++   0
+***
+This var defines the position of the atom (in pixels) relative to its tile, on the x axis. A step_x of 5 means the atom actually is shown 5 pixels east of the tile's western edge.
+
+The atom's actual bounding box may not begin at step_x, but can be set even further in via bound_x.
+
+Example: A 16×16 smiley face centered in a 32×32 icon should have the following bounds:
+
+For the smiley to appear at the left edge of the tile it is standing on, it would need a step_x value of -8. A step_x value of 8 takes it all the way to the rightmost edge of the tile. Anything outside of the range -8 to 8 will have the atom straddling multiple turfs.
+***
+**Related Pages:**
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
++    [step_size var (movable atom)](/ref/atom/movable/var/step_size)
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/movable/var/step_y.md b/ref/atom/movable/var/step_y.md
index f5f00db2..55787fd9 100644
--- a/ref/atom/movable/var/step_y.md
+++ b/ref/atom/movable/var/step_y.md
@@ -1,36 +1,21 @@
-## step_y var (movable atom) 
-###### BYOND Version 490
 
-**Default value:**
-+   0
-
-
-This var defines the position of the atom (in pixels) relative
-to its tile, on the y axis. A step_y of 5 means the atom actually is
-shown 5 pixels north of the tile\'s southern edge. 
-
-The atom\'s
-actual bounding box may not begin at step_y, but can be set even further
-in via bound_y. 
+## step_y (var)
 
-Example: A 16×16 smiley face centered in a
-32×32 icon should have the following bounds:
--   bound_x = 8
--   bound_y = 8
--   bound_width = 16
--   bound_height = 16
-
-
-For the smiley to appear at the bottom edge of the tile it is
-standing on, it would need a step_y value of -8. A step_y value of 8
-takes it all the way to the top edge of the tile. Anything outside of
-the range -8 to 8 will have the atom straddling multiple turfs.
-
-> [!TIP] 
-> **See also:**
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) 
-> +   [bound_y var (movable atom)](/ref/atom/movable/var/bound_x.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [locs list var (movable atom)](/ref/atom/movable/var/locs.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+**Default Value:**
++   0
+***
+This var defines the position of the atom (in pixels) relative to its tile, on the y axis. A step_y of 5 means the atom actually is shown 5 pixels north of the tile's southern edge.
+
+The atom's actual bounding box may not begin at step_y, but can be set even further in via bound_y.
+
+Example: A 16×16 smiley face centered in a 32×32 icon should have the following bounds:
+
+For the smiley to appear at the bottom edge of the tile it is standing on, it would need a step_y value of -8. A step_y value of 8 takes it all the way to the top edge of the tile. Anything outside of the range -8 to 8 will have the atom straddling multiple turfs.
+***
+**Related Pages:**
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_size var (movable atom)](/ref/atom/movable/var/step_size)
++    [bound_x var (movable atom)](/ref/atom/movable/var/bound_x)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [locs list var (movable atom)](/ref/atom/movable/var/locs)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc.md b/ref/atom/proc.md
deleted file mode 100644
index 36dc777f..00000000
--- a/ref/atom/proc.md
+++ /dev/null
@@ -1,29 +0,0 @@
-## procs (atom)
-
-
-Built-in atom procs:
-atom/proc
-+   [Click](/ref/atom/proc/Click.md) 
-+   [Cross proc](/ref/atom/proc/Cross.md) 
-+   [Crossed proc](/ref/atom/proc/Crossed.md) 
-+   [DblClick](/ref/atom/proc/DblClick.md) 
-+   [Del](/ref/datum/proc/Del.md) 
-+   [Enter](/ref/atom/proc/Enter.md) 
-+   [Entered](/ref/atom/proc/Entered.md) 
-+   [Exit](/ref/atom/proc/Exit.md) 
-+   [Exited](/ref/atom/proc/Exited.md) 
-+   [MouseDown](/ref/atom/proc/MouseDown.md) 
-+   [MouseDrag](/ref/atom/proc/MouseDrag.md) 
-+   [MouseDrop](/ref/atom/proc/MouseDrop.md) 
-+   [MouseEntered](/ref/atom/proc/MouseEntered.md) 
-+   [MouseExited](/ref/atom/proc/MouseExited.md) 
-+   [MouseMove](/ref/atom/proc/MouseMove.md) 
-+   [MouseUp](/ref/atom/proc/MouseUp.md) 
-+   [MouseWheel](/ref/atom/proc/MouseWheel.md) 
-+   [New](/ref/atom/proc/New.md) 
-+   [Read](/ref/datum/proc/Read.md) 
-+   [Stat](/ref/atom/proc/Stat.md) 
-+   [Topic](/ref/datum/proc/Topic.md) 
-+   [Uncross proc](/ref/atom/proc/Uncross.md) 
-+   [Uncrossed proc](/ref/atom/proc/Uncrossed.md) 
-+   [Write](/ref/datum/proc/Write.md) 
\ No newline at end of file
diff --git a/ref/atom/proc/Click.md b/ref/atom/proc/Click.md
index 9fb2b7bb..6d3f0c11 100644
--- a/ref/atom/proc/Click.md
+++ b/ref/atom/proc/Click.md
@@ -1,42 +1,39 @@
-## Click proc (atom)
 
+## Click (proc)
 
 **Format:**
 +   Click(location,control,params)
 
-**When:**
-+   Called when the object is clicked.
-
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. in which the object
-    was clicked
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. in which the object was clicked
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
 
+**Called When:**
++   Called when the object is clicked.
+***
 This proc is called by the default client.Click() procedure.
 
+The following example allows the player to walk to a position by clicking it.
 
-The following example allows the player to walk to a position
-by clicking it.
-### Example:
 
 ```dm
- turf/Click()
-    walk_to(usr,src) 
-```
 
+turf/Click()
+  walk_to(usr,src)
+
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Click proc (client)](/ref/client/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Click proc (client)](/ref/client/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/Cross.md b/ref/atom/proc/Cross.md
index 3c5eefb3..1ebe82c1 100644
--- a/ref/atom/proc/Cross.md
+++ b/ref/atom/proc/Cross.md
@@ -1,52 +1,39 @@
-## Cross proc (atom) 
-###### BYOND Version 490
 
+## Cross (proc)
 
 **Format:**
 +   Cross(atom/movable/O)
 
+**Arguments:**
++   O: the object attempting to overlap.
+
 **Returns:**
 +   1 to permit; 0 to deny.
 
-**When:**
+**Called When:**
 +   Called when another object attempts to overlap this one.
 
-**Args:**
-+   O: the object attempting to overlap.
-
-**Default action:**
-+   Allow overlap unless both atoms are dense. If both atoms are mobs,
-    the behavior depends partly on whether they are in the same group.
+**Default Action:**
++   Allow overlap unless both atoms are dense. If both atoms are mobs, the
+behavior depends partly on whether they are in the same group.
+***
 
 > [!NOTE]
-> The following behavior only applies to
-[LEGACY_MOVEMENT_MODE](/ref/world/var/movement_mode.md). In other
-movement modes, src.Cross(O) returns 0 by default if src and O are both
-mobs in the same group. 
-
-If src completely covers the turf it is
-standing on, Cross() is called as part of turf.Enter(). This is to
-preserve the behavior of older games, which expect turf.Enter() to care
-about its contents. 
-
-If src and O are both mobs, and O is in
-src\'s group, overlap is allowed *unless* neither of them use pixel
-movement. Older games that do not use pixel movement expect that Bump()
-will be called, and by default Bump() will swap the mobs\' positions.
-Swapping obviously only works in situations where a mob takes up a whole
-tile and only moves by tiles; for all other situations, allowing an
-overlap makes more sense.
-
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [group var (mob)](/ref/mob/var/group.md) 
-> +   [movement_mode var (world)](/ref/world/var/movement_mode.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+> The following behavior only applies to LEGACY_MOVEMENT_MODE. In other movement modes, src.Cross(O) returns 0 by default if src and O are both mobs in the same group.
+
+If src completely covers the turf it is standing on, Cross() is called as part of turf.Enter(). This is to preserve the behavior of older games, which expect turf.Enter() to care about its contents.
+
+If src and O are both mobs, and O is in src's group, overlap is allowed *unless* neither of them use pixel movement. Older games that do not use pixel movement expect that Bump() will be called, and by default Bump() will swap the mobs' positions. Swapping obviously only works in situations where a mob takes up a whole tile and only moves by tiles; for all other situations, allowing an overlap makes more sense.
+***
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [group](/ref/mob/var/group)
++    [movement_mode var (world)](/ref/world/var/movement_mode)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc/Crossed.md b/ref/atom/proc/Crossed.md
index 73c8d1a0..9bd1846e 100644
--- a/ref/atom/proc/Crossed.md
+++ b/ref/atom/proc/Crossed.md
@@ -1,39 +1,40 @@
-## Crossed proc (atom) 
-###### BYOND Version 490
+
+## Crossed (proc)
 
 **Format:**
 +   Crossed(atom/movable/O)
 
-**When:**
-+   Called when an object has overlapped this one through Move().
-    Directly setting the object\'s loc or step_x/y vars does not result
-    in a call to Crossed() or any other movement side-effects. The same
-    goes for creation or deletion of an object at a location.
-
-**Args:**
+**Arguments:**
 +   O: the object that moved and is now overlapping.
 
-**Default action:**
+**Called When:**
++   Called when an object has overlapped this one through Move(). Directly
+setting the object's loc or step_x/y vars does not result in a call to
+Crossed() or any other movement side-effects.  The same goes for creation
+or deletion of an object at a location.
+
+**Default Action:**
 +   none
-### Example:
+***
 
 ```dm
+
 obj/landmine
-    Crossed(O)
-        O << "You stepped on a land mine!"
-        Explode() 
-```
+   Crossed(O)
+      O << "You stepped on a land mine!"
+      Explode()
 
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [group var (mob)](/ref/mob/var/group.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [group](/ref/mob/var/group)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc/DblClick.md b/ref/atom/proc/DblClick.md
index c1d3e9a0..976fe89a 100644
--- a/ref/atom/proc/DblClick.md
+++ b/ref/atom/proc/DblClick.md
@@ -1,42 +1,39 @@
-## DblClick proc (atom)
 
+## DblClick (proc)
 
 **Format:**
 +   DblClick(location,control,params)
 
-**When:**
-+   Called when the object is double-clicked.
-
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. in which the object
-    was double-clicked
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. in which the object was double-clicked
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
 
+**Called When:**
++   Called when the object is double-clicked.
+***
 This proc is called by the default client.DblClick() procedure.
 
+This example allows the player to teleport to a position by double clicking it.
 
-This example allows the player to teleport to a position by
-double clicking it.
-### Example:
 
 ```dm
- turf/DblClick()
-    usr.Move(src) 
-```
 
+turf/DblClick()
+  usr.Move(src)
+
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (client)](/ref/client/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick proc (client)](/ref/client/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/Enter.md b/ref/atom/proc/Enter.md
index 1f44ac0f..f2253d42 100644
--- a/ref/atom/proc/Enter.md
+++ b/ref/atom/proc/Enter.md
@@ -1,56 +1,42 @@
-## Enter proc (atom)
 
+## Enter (proc)
 
 **Format:**
 +   Enter(atom/movable/O, atom/oldloc)
 
+**Arguments:**
++   O: the object attempting to enter.
++   oldloc: the old (current) loc of the object attempting to enter.
+
 **Returns:**
 +   1 to permit; 0 to deny.
 
-**When:**
+**Called When:**
 +   Called when an object attempts to enter the contents list.
 
-**Args:**
-+   O: the object attempting to enter.
-+   oldloc: the old (current) loc of the object attempting to enter.
-
-**Default action:**
+**Default Action:**
 +   Explained below.
+***
+Areas, objs, and mobs will always permit anything to enter by default.
 
 
-Areas, objs, and mobs will always permit anything to enter by
-default. 
 > [!NOTE]
-> The following behavior only applies to
-[LEGACY_MOVEMENT_MODE](/ref/world/var/movement_mode.md). In all other
-movement modes, the turf\'s contents are not taken into account. Only
-the result of turf.Cross() matters. 
-
-Turfs will return 1
-(permit) or 0 (deny) based on density. In simple terms, if the atom that
-is entering is dense, then the turf will deny entry if the turf itself
-or its contents (any that take up the full tile) are dense.
-
-
-What actually happens in turf.Enter() is more detailed: Cross()
-is called for the turf, and if it succeeds (movement is permitted), then
-Cross() is called for any atoms in turf.contents that cover the entire
-tile. If any Cross() call fails, Enter() fails too and will return 0.
-
-
-If a mob is standing on a turf but its bounding box does not
-cover the whole tile, it is ignored by Enter(). Instead, its Cross()
-proc is called if there is a danger of the object overlapping it.
-
-> [!TIP] 
-> **See also:**
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [movement_mode var (world)](/ref/world/var/movement_mode.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+> The following behavior only applies to LEGACY_MOVEMENT_MODE. In all other movement modes, the turf's contents are not taken into account. Only the result of turf.Cross() matters.
+
+Turfs will return 1 (permit) or 0 (deny) based on density. In simple terms, if the atom that is entering is dense, then the turf will deny entry if the turf itself or its contents (any that take up the full tile) are dense.
+
+What actually happens in turf.Enter() is more detailed: Cross() is called for the turf, and if it succeeds (movement is permitted), then Cross() is called for any atoms in turf.contents that cover the entire tile. If any Cross() call fails, Enter() fails too and will return 0.
+
+If a mob is standing on a turf but its bounding box does not cover the whole tile, it is ignored by Enter(). Instead, its Cross() proc is called if there is a danger of the object overlapping it.
+***
+**Related Pages:**
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [movement_mode var (world)](/ref/world/var/movement_mode)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc/Entered.md b/ref/atom/proc/Entered.md
index 31067e78..688e489b 100644
--- a/ref/atom/proc/Entered.md
+++ b/ref/atom/proc/Entered.md
@@ -1,99 +1,92 @@
-## Entered proc (atom)
+
+## Entered (proc)
 
 **Format:**
 +   Entered(atom/movable/Obj,atom/OldLoc)
 
-**When:**
-+   Called when an object has entered the contents list through Move().
-    Directly setting the object\'s loc or step_x/y vars does not result
-    in a call to Entered() or any other movement side-effects. The same
-    goes for creation or deletion of an object at a location.
-
-**Args:**
+**Arguments:**
 +   Obj: the object that entered (a mob or obj).
 +   OldLoc: the previous location of the object.
 
-**Default action:**
+**Called When:**
++   Called when an object has entered the contents list through Move().
+Directly setting the object's loc or step_x/y vars does not result in a
+call to Entered() or any other movement side-effects.  The same goes for
+creation or deletion of an object at a location.
+
+**Default Action:**
 +   None for most atoms, but turfs will call Crossed().
-### Example:
+***
 
 ```dm
- turf/pit
-    Entered(O)
-        O << "OUCH. You fell in a pit!"
+
+turf/pit
+   Entered(O)
+      O << "OUCH.  You fell in a pit!"
 
 ```
- 
 
-The mob\'s Entered() and Exited() procs can be used
-to control what happens when objects are added or removed from the
-mob\'s inventory. Of course that could all be done within get() and
-drop() verbs, but the following code separates user interface from
-lower-level functions.
-### Example:
+
+The mob's Entered() and Exited() procs can be used to control what happens when objects are added or removed from the mob's inventory. Of course that could all be done within get() and drop() verbs, but the following code separates user interface from lower-level functions.
+
 
 ```dm
+
 obj
-    var
-        weight = 10
-
-    verb
-        get()
-            set src in oview(1)
-            if(Move(usr))
-                usr << "You pick up \a [src]."
-            else
-                usr << "You cannot pick up [src]."
-
-        drop()
-            set src in usr
-            if(Move(usr.loc))
-                usr << "You drop a [src]."
+   var
+      weight = 10
+   verb
+      get()
+         set src in oview(1)
+         if(Move(usr))
+            usr << "You pick up \a [src]."
+         else
+            usr << "You cannot pick up [src]."
+      drop()
+         set src in usr
+         if(Move(usr.loc))
+            usr << "You drop \a [src]."
 mob
-    var
-        weight
-        max_weight = 50
-
-    Entered(obj/O)
-        weight += O.weight
-
-    Exited(obj/O)
-        weight -= O.weight
-    
-    Enter(obj/O)
-        //only allow entrance if weight is within the limit
-        if(O.weight + weight <= max_weight)
-            return ..() 
+   var
+      weight
+      max_weight = 50
+
+   Entered(obj/O)
+      weight += O.weight
+   Exited(obj/O)
+      weight -= O.weight
+   Enter(obj/O)
+      //only allow entrance if weight is within the limit
+      if(O.weight + weight <= max_weight)
+         return ..()
+
 ```
- 
 
-To see the advantages of this arrangement, imagine that there are certain
-situations in which an object may be created directly within the mob\'s
-inventory without the mob picking it up. You can still run it through
-your normal movement rules without calling get().
-### Example:
+
+To see the advantages of this arrangement, imagine that there are certain situations in which an object may be created directly within the mob's inventory without the mob picking it up. You can still run it through your normal movement rules without calling get().
+
 
 ```dm
+
 mob/verb/wish()
-    var/obj/O = new() //create it with loc=null
-    if(O.Move(usr))
-        //and then move it into inventory
-        usr << "Your wish has been granted!"
-    else
-        usr << "You are too greedy!"
-        del O 
-```
+   var/obj/O = new() //create it with loc=null
+   if(O.Move(usr))   //and then move it into inventory
+      usr << "Your wish has been granted!"
+   else
+      usr << "You are too greedy!"
+      del O
 
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) 
-> +   [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [step_x var (movable atom)](/ref/atom/movable/var/step_x)
++    [step_y var (movable atom)](/ref/atom/movable/var/step_y)
diff --git a/ref/atom/proc/Exit.md b/ref/atom/proc/Exit.md
index 150bb310..65fc6cf7 100644
--- a/ref/atom/proc/Exit.md
+++ b/ref/atom/proc/Exit.md
@@ -1,51 +1,37 @@
-## Exit proc (atom)
 
+## Exit (proc)
 
 **Format:**
 +   Exit(atom/movable/O, atom/newloc)
 
+**Arguments:**
++   O: the object attempting to exit.
++   : the object's new location.
+
 **Returns:**
 +   1 to permit; 0 to deny.
 
-**When:**
+**Called When:**
 +   Called when an object attempts to exit the contents list.
 
-**Args:**
-+   O: the object attempting to exit.
-+   newloc 507 : the object\'s new location.
-
-**Default action:**
-+   Turfs will call Uncross() and return that value (1 by default). All
-    others allow the object to exit (returning 1).
+**Default Action:**
++   Turfs will call Uncross() and return that value (1 by default). All others allow the object to exit (returning 1).
+***
+By default, every atom returns 1 to allow exit, except for turfs which call Uncross() to handle it for them.
 
 
-By default, every atom returns 1 to allow exit, except for
-turfs which call Uncross() to handle it for them. 
-> [!
 > [!NOTE]
-> ]
-> The following
-behavior only applies to
-[LEGACY_MOVEMENT_MODE](/ref/world/var/movement_mode.md). In all other
-movement modes, the turf\'s contents are not taken into account. Only
-the result of turf.Uncross() matters. 
-
-In the default Exit
-handler for turfs, Uncross() is called for the turf itself and then
-Uncross() will also be called for any atoms in turf.contents that cover
-the entire tile. If any Uncross() call fails, Exit() fails too and will
-return 0. In games using pixel movement, Uncross() is usually called
-separately, but this allows projects using tile-based movement instead
-to benefit from Cross() and Uncross().
-
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [movement_mode var (world)](/ref/world/var/movement_mode.md) 
\ No newline at end of file
+> The following behavior only applies to LEGACY_MOVEMENT_MODE. In all other movement modes, the turf's contents are not taken into account. Only the result of turf.Uncross() matters.
+
+In the default Exit handler for turfs, Uncross() is called for the turf itself and then Uncross() will also be called for any atoms in turf.contents that cover the entire tile. If any Uncross() call fails, Exit() fails too and will return 0. In games using pixel movement, Uncross() is usually called separately, but this allows projects using tile-based movement instead to benefit from Cross() and Uncross().
+***
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [movement_mode var (world)](/ref/world/var/movement_mode)
diff --git a/ref/atom/proc/Exited.md b/ref/atom/proc/Exited.md
index 84907e47..b5a1be5b 100644
--- a/ref/atom/proc/Exited.md
+++ b/ref/atom/proc/Exited.md
@@ -1,28 +1,28 @@
-## Exited proc (atom)
+
+## Exited (proc)
 
 **Format:**
 +   Exited(atom/movable/Obj, atom/newloc)
 
-**When:**
-+   Called when an object has exited from the contents list through a
-    call to Move(). Directly setting the object\'s loc or step_x/y vars
-    does not result in a call to Exited() or any other movement
-    side-effects. The same goes for deletion of an object.
-
-**Args:**
+**Arguments:**
 +   Obj: the object that exited (a mob or obj).
-+   newloc 507 : the object\'s new location.
++   : the object's new location.
 
-**Default action:**
-+   None for most atoms, but turfs will call Uncrossed().
+**Called When:**
++   Called when an object has exited from the contents list through a call to
+Move().  Directly setting the object's loc or step_x/y vars does not result
+in a call to Exited() or any other movement side-effects.  The same goes for
+deletion of an object.
 
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
\ No newline at end of file
+**Default Action:**
++   None for most atoms, but turfs will call Uncrossed().
+******
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
diff --git a/ref/atom/proc/MouseDown.md b/ref/atom/proc/MouseDown.md
index 56c08630..de59555a 100644
--- a/ref/atom/proc/MouseDown.md
+++ b/ref/atom/proc/MouseDown.md
@@ -1,42 +1,35 @@
-## MouseDown proc (atom)
 
+## MouseDown (proc)
 
 **Format:**
 +   MouseDown(location,control,params)
 
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. in which the object
-    was clicked
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. in which the object was clicked
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when a mouse button is pressed while pointing to this object.
 
-This is called when a mouse button is pressed while pointing to
-this object. 
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The other procedures are simply available for completeness.
 
-Don\'t define this unless you need it, because it
-generates extra communication that is otherwise avoided. Most operations
-can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The
-other procedures are simply available for completeness.
-Note: In BYOND 3.5 this procedure took three different arguments:
-`location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have
-been replaced, old code will need to be modified. Games compiled before
-this change will still work normally.
 
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (client)](/ref/client/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+> [!TIP]
+> Note: In BYOND 3.5 this procedure took three different arguments: `location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have been replaced, old code will need to be modified. Games compiled before this change will still work normally.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown proc (client)](/ref/client/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseDrag.md b/ref/atom/proc/MouseDrag.md
index 86b1a50f..91c939e1 100644
--- a/ref/atom/proc/MouseDrag.md
+++ b/ref/atom/proc/MouseDrag.md
@@ -1,45 +1,35 @@
-## MouseDrag proc (atom)
 
+## MouseDrag (proc)
 
 **Format:**
 +   MouseDrag(over_object,src_location,over_location,src_control,over_control,params)
 
-**Args:**
+**Arguments:**
 +   over_object: the object under the mouse pointer
-+   src_location: the turf, stat panel, grid cell, etc. from where the
-    src object was dragged
-+   over_location: the turf, stat panel, grid cell, etc. containing the
-    object under the mouse pointer
++   src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged
++   over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer
 +   src_control: The id of the skin control the object was dragged from
 +   over_control: The id of the skin control the object was dragged over
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called while dragging this object by pressing and holding the left mouse button over the object and moving the mouse. The over_object may be null if dragging over a stat panel or over other empty space.
 
-This is called while dragging this object by pressing and
-holding the left mouse button over the object and moving the mouse. The
-over_object may be null if dragging over a stat panel or over other
-empty space. 
-
-Don\'t define this unless you need it, because it
-generates extra communication that is otherwise avoided. Most operations
-can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The
-other procedures are simply available for completeness.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The other procedures are simply available for completeness.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag proc (client)](/ref/client/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseDrop.md b/ref/atom/proc/MouseDrop.md
index b523d9f4..ca28ed5f 100644
--- a/ref/atom/proc/MouseDrop.md
+++ b/ref/atom/proc/MouseDrop.md
@@ -1,39 +1,33 @@
-## MouseDrop proc (atom)
 
+## MouseDrop (proc)
 
 **Format:**
-+   MouseDrop(over_object, src_location, over_location, src_control, over_control, params)
++   MouseDrop(over_object,src_location,over_location,src_control,over_control,params)
 
-**Args:**
+**Arguments:**
 +   over_object: the object under the mouse pointer
-+   src_location: the turf, stat panel, grid cell, etc. from where the
-    src object was dragged
-+   over_location: the turf, stat panel, grid cell, etc. containing the
-    object under the mouse pointer
++   src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged
++   over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer
 +   src_control: The id of the skin control the object was dragged from
 +   over_control: The id of the skin control the object was dropped onto
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
-
-This is called when the a mouse button is released after
-dragging this object. The over_object may be null if dropping over a
-stat panel or over other empty space.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when the a mouse button is released after dragging this object. The over_object may be null if dropping over a stat panel or over other empty space.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop proc (client)](/ref/client/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseEntered.md b/ref/atom/proc/MouseEntered.md
index c4dd5559..8df0e7f5 100644
--- a/ref/atom/proc/MouseEntered.md
+++ b/ref/atom/proc/MouseEntered.md
@@ -1,37 +1,31 @@
-## MouseEntered proc (atom)
 
+## MouseEntered (proc)
 
 **Format:**
-+   MouseEntered(location, control, params)
++   MouseEntered(location,control,params)
 
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. containing the
-    object
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. containing the object
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when the mouse moves onto the object with no buttons pressed.
 
-This is called when the mouse moves onto the object with no
-buttons pressed. 
-
-Don\'t define this unless you need it, because
-it generates extra communication that is otherwise avoided. Defining it
-on only the objects that require it reduces overhead.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered proc (client)](/ref/client/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseExited.md b/ref/atom/proc/MouseExited.md
index 0c80165e..f72f8542 100644
--- a/ref/atom/proc/MouseExited.md
+++ b/ref/atom/proc/MouseExited.md
@@ -1,37 +1,31 @@
-## MouseExited proc (atom)
 
+## MouseExited (proc)
 
 **Format:**
-+   MouseExited(location, control, params)
++   MouseExited(location,control,params)
 
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. containing the
-    object
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. containing the object
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when the mouse moves off of an object with no buttons pressed.
 
-This is called when the mouse moves off of an object with no
-buttons pressed. 
-
-Don\'t define this unless you need it, because
-it generates extra communication that is otherwise avoided. Defining it
-on only the objects that require it reduces overhead.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (client)](/ref/client/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited proc (client)](/ref/client/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseMove.md b/ref/atom/proc/MouseMove.md
index 6684834a..d78308af 100644
--- a/ref/atom/proc/MouseMove.md
+++ b/ref/atom/proc/MouseMove.md
@@ -1,40 +1,31 @@
-## MouseMove proc (atom) 
-###### BYOND Version 500
 
+## MouseMove (proc)
 
 **Format:**
-+   MouseMove(location, control, params)
++   MouseMove(location,control,params)
 
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. containing the
-    object
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. containing the object
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when the mouse moves over the object with no buttons pressed. When the mouse moves over for the first time, MouseEntered() is called instead.
 
-This is called when the mouse moves over the object with no
-buttons pressed. When the mouse moves over for the first time,
-MouseEntered() is called instead. 
-
-Don\'t define this unless you
-need it, because it generates extra communication that is otherwise
-avoided. Defining it on only the objects that require it reduces
-overhead.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (client)](/ref/client/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove proc (client)](/ref/client/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseUp.md b/ref/atom/proc/MouseUp.md
index b3b5ca20..599f525b 100644
--- a/ref/atom/proc/MouseUp.md
+++ b/ref/atom/proc/MouseUp.md
@@ -1,44 +1,36 @@
-## MouseUp proc (atom)
 
+## MouseUp (proc)
 
 **Format:**
-+   MouseUp(location, control, params)
++   MouseUp(location,control,params)
 
-**Args:**
-+   location: the turf, stat panel, grid cell, etc. in which the object
-    was clicked
+**Arguments:**
++   location: the turf, stat panel, grid cell, etc. in which the object was clicked
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when a mouse button is released while pointing to this object.
 
-This is called when a mouse button is released while pointing
-to this object. 
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The other procedures are simply available for completeness.
 
-Don\'t define this unless you need it, because
-it generates extra communication that is otherwise avoided. Most
-operations can be done through `Click()`, `DblClick()`, and
-`MouseDrop()`. The other procedures are simply available for
-completeness.
-Note: In BYOND 3.5 this procedure took three different arguments:
-`location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have
-been replaced, old code will need to be modified. Games compiled before
-this change will still work normally.
 
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (client)](/ref/client/proc/MouseUp.md) 
-> +   [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
-> +   [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) 
\ No newline at end of file
+> [!TIP]
+> Note: In BYOND 3.5 this procedure took three different arguments: `location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have been replaced, old code will need to be modified. Games compiled before this change will still work normally.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp proc (client)](/ref/client/proc/MouseUp)
++    [MouseWheel](/ref/atom/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
++    [show_popup_menus var](/ref/client/var/show_popup_menus)
diff --git a/ref/atom/proc/MouseWheel.md b/ref/atom/proc/MouseWheel.md
index e46fd01d..3e0bb93f 100644
--- a/ref/atom/proc/MouseWheel.md
+++ b/ref/atom/proc/MouseWheel.md
@@ -1,42 +1,33 @@
-## MouseWheel proc (atom) 
-###### BYOND Version 508
 
+## MouseWheel (proc)
 
 **Format:**
-+   MouseWheel(delta_x, delta_y, location, control, params)
++   MouseWheel(delta_x,delta_y,location,control,params)
 
-**Args:**
+**Arguments:**
 +   delta_x,delta_y: amount of wheel movement
-+   location: the turf, stat panel, grid cell, etc. containing the
-    object
++   location: the turf, stat panel, grid cell, etc. containing the object
 +   control: the name of the skin control involved
-+   params: other parameters including mouse/keyboard flags, icon
-    offsets, etc.; see [mouse handling](/ref/DM/mouse.md) 
++   params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse)
+***
+This is called when the mouse wheel is moved while over an object.
 
-This is called when the mouse wheel is moved while over an
-object. 
+Positive values of delta_x and delta_y refer to scrolling right or up, respectively. Negative values are left and down, respectively.
 
-Positive values of delta_x and delta_y refer to
-scrolling right or up, respectively. Negative values are left and down,
-respectively. 
-
-Don\'t define this unless you need it, because it
-generates extra communication that is otherwise avoided. Defining it on
-only the objects that require it reduces overhead.
-
-> [!TIP] 
-> **See also:**
-> +   [Click proc (atom)](/ref/atom/proc/Click.md) 
-> +   [DblClick proc (atom)](/ref/atom/proc/DblClick.md) 
-> +   [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) 
-> +   [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) 
-> +   [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) 
-> +   [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) 
-> +   [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) 
-> +   [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) 
-> +   [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) 
-> +   [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) 
-> +   [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) 
-> +   [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) 
-> +   [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) 
-> +   [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) 
\ No newline at end of file
+Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead.
+***
+**Related Pages:**
++    [Click](/ref/atom/proc/Click)
++    [DblClick](/ref/atom/proc/DblClick)
++    [MouseDown](/ref/atom/proc/MouseDown)
++    [MouseDrag](/ref/atom/proc/MouseDrag)
++    [MouseDrop](/ref/atom/proc/MouseDrop)
++    [MouseEntered](/ref/atom/proc/MouseEntered)
++    [MouseExited](/ref/atom/proc/MouseExited)
++    [MouseMove](/ref/atom/proc/MouseMove)
++    [MouseUp](/ref/atom/proc/MouseUp)
++    [MouseWheel proc (client)](/ref/client/proc/MouseWheel)
++    [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer)
++    [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer)
++    [mouse_opacity var](/ref/atom/var/mouse_opacity)
++    [mouse_over_pointer](/ref/atom/var/mouse_over_pointer)
diff --git a/ref/atom/proc/New.md b/ref/atom/proc/New.md
index 4c0d8fbf..bed9b3c2 100644
--- a/ref/atom/proc/New.md
+++ b/ref/atom/proc/New.md
@@ -1,69 +1,41 @@
-## New proc (atom)
 
+## New (proc)
 
 **Format:**
 +   New(loc)
-+   supports [named arguments](/ref/proc/arguments/named.md)
++   
 
-**When:**
-+   Called when the object is created.
-
-**Args:**
+**Arguments:**
 +   loc: The initial location.
 
-**Default action:**
-+   None.
+**Called When:**
++   Called when the object is created.
 
+**Default Action:**
++   None.
+***
+By the time New() is called, the object has already been created at the specified location and all of its variables have been initialized. You can perform additional initialization by overriding this procedure.
 
-By the time New() is called, the object has already been
-created at the specified location and all of its variables have been
-initialized. You can perform additional initialization by overriding
-this procedure. 
+Since the initial location parameter passed to new() is applied before New() is even called, there is some special handling of the `loc` variable when using named arguments in a call. Normally, if a procedure is overridden, named arguments in a call are matched against those in the the overridden definition. In this case, however, the `loc` parameter name is hard-coded. Regardless of what you call the first argument in your definition of New(), the initial location will be taken from the first positional argument, or from the argument named `loc` if there are no positional arguments.
 
-Since the initial location parameter passed to
-`new()` is applied before New() is even called, there is some special
-handling of the `loc` variable when using named arguments in
-a call. Normally, if a procedure is overridden, named arguments in a
-call are matched against those in the the overridden definition. In this
-case, however, the `loc` parameter name is hard-coded.
-Regardless of what you call the first argument in your definition of
-New(), the initial location will be taken from the first positional
-argument, or from the argument named `loc` if there are no
-positional arguments. 
+The following example does some extra initialization that is not possible in the variable definition section, because it requires a runtime evaluation. This is a common reason to use New().
 
-The following example does some extra
-initialization that is not possible in the variable definition section,
-because it requires a runtime evaluation. This is a common reason to use
-New().
-### Example:
 
 ```dm
-mob
-	var birthdate //time stamp
-	
-	New()
-		birthdate = world.realtime
-		return ..()
-	
-	verb/look()
-		set src in view()
-		usr << "[src] was born on [time2text(birthdate,"DD-MMM-YYYY")]."
 
-```
+mob
+   var
+      birthdate //time stamp
+   New()
+      birthdate = world.realtime
+      return ..()
+   verb/look()
+      set src in view()
+      usr << "[src] was born on [time2text(birthdate,"DD-MMM-YYYY")]."
 
-Below are a few various ways of initializing objects:
-```dm
-var/obj/O = new
-```
-```dm
-new/atom()
-```
-```dm
-var/wackysubtype = /obj/test
-var/obj/O = new wackysubtype
 ```
 
-> [!TIP] 
-> **See also:**
-> +   [New proc (datum)](/ref/datum/proc/New.md) 
-> +   [new proc](/ref/proc/new.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [New proc (datum)](/ref/datum/proc/New)
++    [new proc](/ref/proc/new)
diff --git a/ref/atom/proc/Stat.md b/ref/atom/proc/Stat.md
index 967b3235..1a8049cb 100644
--- a/ref/atom/proc/Stat.md
+++ b/ref/atom/proc/Stat.md
@@ -1,29 +1,30 @@
-## Stat proc (atom)
+
+## Stat (proc)
 
 **Format:**
 +   Stat()
 
-**When:**
+**Called When:**
 +   Called periodically by the client to update the stat window.
 
-**Default action:**
+**Default Action:**
 +   none.
+***
+The following code could be used to display a player's current status.
 
 
-The following code could be used to display a player\'s current
-status.
-### Example:
-
 ```dm
-mob/var health = 100
+
+mob/var
+   health = 100
 mob/Stat()
-	stat("health",health)
-	statpanel("Inventory",contents) 
-```
+   stat("health",health)
+   statpanel("Inventory",contents)
 
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Stat proc (client)](/ref/client/proc/Stat.md) 
-> +   [stat proc](/ref/proc/stat.md) 
-> +   [Info control (skin)](/ref/skin/control/info.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Stat proc (client)](/ref/client/proc/Stat)
++    [stat proc](/ref/proc/stat)
++    [Info](/ref/{skin}/control/info)
diff --git a/ref/atom/proc/Uncross.md b/ref/atom/proc/Uncross.md
index 6e3db8d5..8f9909fd 100644
--- a/ref/atom/proc/Uncross.md
+++ b/ref/atom/proc/Uncross.md
@@ -1,30 +1,29 @@
-## Uncross proc (atom) 
-###### BYOND Version 490
+
+## Uncross (proc)
 
 **Format:**
 +   Uncross(atom/movable/O)
 
+**Arguments:**
++   O: the object attempting to get away.
+
 **Returns:**
 +   1 to permit; 0 to deny.
 
-**When:**
+**Called When:**
 +   Called when another object attempts to stop overlapping this one.
 
-**Args:**
-+   O: the object attempting to get away.
-
-**Default action:**
+**Default Action:**
 +   Allow the object to get away (returning 1)
-
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [group var (mob)](/ref/mob/var/group.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+******
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [group](/ref/mob/var/group)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc/Uncrossed.md b/ref/atom/proc/Uncrossed.md
index 45d6bdb5..2c6442cf 100644
--- a/ref/atom/proc/Uncrossed.md
+++ b/ref/atom/proc/Uncrossed.md
@@ -1,41 +1,42 @@
-## Uncrossed proc (atom) 
-###### BYOND Version 490
+
+## Uncrossed (proc)
 
 **Format:**
 +   Uncrossed(atom/movable/O)
 
-**When:**
-+   Called when an object has stopped overlapping this one through a
-    call to Move(). Directly setting the object\'s loc or step_x/y vars
-    does not result in a call to Uncrossed() or any other movement
-    side-effects. The same goes for deletion of an object.
-
-**Args:**
+**Arguments:**
 +   O: the object that moved and is no longer overlapping.
 
-**Default action:**
+**Called When:**
++   Called when an object has stopped overlapping this one through a call to
+Move().  Directly setting the object's loc or step_x/y vars does not result
+in a call to Uncrossed() or any other movement side-effects.  The same goes
+for deletion of an object.
+
+**Default Action:**
 +   none
-### Example:
+***
 
 ```dm
+
 obj/pressure_plate
-    Uncrossed(O)
-    // if no other mobs are standing on it...
-    if(!(locate(/mob) in bounds()))
-        // do something
-        Release() 
-```
+   Uncrossed(O)
+      // if no other mobs are standing on it...
+      if(!(locate(/mob) in bounds()))
+         // do something
+         Release()
 
+```
 
-> [!TIP] 
-> **See also:**
-> +   [Enter proc (atom)](/ref/atom/proc/Enter.md) 
-> +   [Entered proc (atom)](/ref/atom/proc/Entered.md) 
-> +   [Exit proc (atom)](/ref/atom/proc/Exit.md) 
-> +   [Exited proc (atom)](/ref/atom/proc/Exited.md) 
-> +   [Cross proc (atom)](/ref/atom/proc/Cross.md) 
-> +   [Crossed proc (atom)](/ref/atom/proc/Crossed.md) 
-> +   [Uncross proc (atom)](/ref/atom/proc/Uncross.md) 
-> +   [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) 
-> +   [group var (mob)](/ref/mob/var/group.md) 
-> +   [Pixel movement](/ref/notes/pixel-movement.md) 
\ No newline at end of file
+***
+**Related Pages:**
++    [Enter proc (atom)](/ref/atom/proc/Enter)
++    [Entered](/ref/atom/proc/Entered)
++    [Exit proc (atom)](/ref/atom/proc/Exit)
++    [Exited](/ref/atom/proc/Exited)
++    [Cross proc (atom)](/ref/atom/proc/Cross)
++    [Crossed proc (atom)](/ref/atom/proc/Crossed)
++    [Uncross proc (atom)](/ref/atom/proc/Uncross)
++    [Move proc (movable atom)](/ref/atom/movable/proc/Move)
++    [group](/ref/mob/var/group)
++    [Pixel movement](/ref/{notes}/pixel-movement)
diff --git a/ref/atom/proc/index.md b/ref/atom/proc/index.md
new file mode 100644
index 00000000..60b43eba
--- /dev/null
+++ b/ref/atom/proc/index.md
@@ -0,0 +1,5 @@
+
+## proc (proc)
+***
+Built-in atom procs:
+***
\ No newline at end of file
diff --git a/ref/atom/var.md b/ref/atom/var.md
deleted file mode 100644
index 4db76bf4..00000000
--- a/ref/atom/var.md
+++ /dev/null
@@ -1,58 +0,0 @@
-## vars (atom)
-
-
-Built-in atom vars:
-atom/var
-+   [alpha](/ref/atom/var/alpha.md) 
-+   [appearance](/ref/atom/var/appearance.md) 
-+   [appearance_flags](/ref/atom/var/appearance_flags.md) 
-+   [blend_mode](/ref/atom/var/blend_mode.md) 
-+   [color](/ref/atom/var/color.md) 
-+   [contents](/ref/atom/var/contents.md) 
-+   [density](/ref/atom/var/density.md) 
-+   [desc](/ref/atom/var/desc.md) 
-+   [dir](/ref/atom/var/dir.md) 
-+   [filters](/ref/atom/var/filters.md) 
-+   [gender](/ref/atom/var/gender.md) 
-+   [icon](/ref/atom/var/icon.md) 
-+   [icon_state](/ref/atom/var/icon_state.md) 
-+   [icon_w](/ref/atom/var/icon_w.md) 
-+   [icon_z](/ref/atom/var/icon_z.md) 
-+   [invisibility](/ref/atom/var/invisibility.md) 
-+   [infra_luminosity](/ref/atom/var/infra_luminosity.md) 
-+   [loc](/ref/atom/var/loc.md) 
-+   [layer](/ref/atom/var/layer.md) 
-+   [luminosity](/ref/atom/var/luminosity.md) 
-+   [maptext](/ref/atom/var/maptext.md) 
-+   [maptext_width](/ref/atom/var/maptext_width.md) 
-+   [maptext_height](/ref/atom/var/maptext_height.md) 
-+   [maptext_x](/ref/atom/var/maptext_x.md) 
-+   [maptext_y](/ref/atom/var/maptext_y.md) 
-+   [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) 
-+   [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) 
-+   [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) 
-+   [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) 
-+   [mouse_opacity var](/ref/atom/var/mouse_opacity.md) 
-+   [name](/ref/atom/var/name.md) 
-+   [opacity](/ref/atom/var/opacity.md) 
-+   [overlays](/ref/atom/var/overlays.md) 
-+   [override](/ref/atom/var/override.md)  (images only)
-+   [parent_type](/ref/datum/var/parent_type.md) 
-+   [pixel_x](/ref/atom/var/pixel_x.md) 
-+   [pixel_y](/ref/atom/var/pixel_y.md) 
-+   [pixel_w](/ref/atom/var/pixel_w.md) 
-+   [pixel_z](/ref/atom/var/pixel_z.md) 
-+   [plane](/ref/atom/var/plane.md) 
-+   [render_source](/ref/atom/var/render_source.md) 
-+   [render_target](/ref/atom/var/render_target.md) 
-+   [suffix](/ref/atom/var/suffix.md) 
-+   [tag](/ref/datum/var/tag.md) 
-+   [text](/ref/atom/var/text.md) 
-+   [transform](/ref/atom/var/transform.md) 
-+   [type](/ref/datum/var/type.md) 
-+   [underlays](/ref/atom/var/underlays.md) 
-+   [vars](/ref/datum/var/vars.md) 
-+   [verbs](/ref/atom/var/verbs.md) 
-+   [x](/ref/atom/var/x.md) 
-+   [y](/ref/atom/var/y.md) 
-+   [z](/ref/atom/var/z.md) 
\ No newline at end of file
diff --git a/ref/atom/var/alpha.md b/ref/atom/var/alpha.md
index b3ca01b0..fef76069 100644
--- a/ref/atom/var/alpha.md
+++ b/ref/atom/var/alpha.md
@@ -1,25 +1,15 @@
-## alpha var (atom) 
-###### BYOND Version 500
-
-**Default value:**
-+   255 (opaque)
-
-**Possible values:**
-+   0 (transparent) through 255 (opaque)
 
+## alpha (var)
 
-Controls the opacity of the icon displayed on players\'
-screens. A value of 128 means the atom is half-transparent, so it will
-have a ghostly appearance. This can be used to fade an atom in and out,
-especially when combined with animation. Alpha is also applied to
-maptext. 
-
-Overlays and images will also be affected by alpha,
-unless they use the RESET_ALPHA value in appearance_flags.
-
-> [!TIP] 
-> **See also:**
-> +   [vars (atom)](/ref/atom/var.md) 
-> +   [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) 
-> +   [blend_mode var (atom)](/ref/atom/var/blend_mode.md) 
-> +   [color var (atom)](/ref/atom/var/color.md) 
\ No newline at end of file
+**Default Value:**
++   255 (opaque)
+***
+Controls the opacity of the icon displayed on players' screens. A value of 128 means the atom is half-transparent, so it will have a ghostly appearance. This can be used to fade an atom in and out, especially when combined with animation. Alpha is also applied to maptext.
+
+Overlays and images will also be affected by alpha, unless they use the RESET_ALPHA value in appearance_flags.
+***
+**Related Pages:**
++    [vars (atom)](/ref/atom/var)
++    [appearance_flags var (atom)](/ref/atom/var/appearance_flags)
++    [Blend mode](/ref/atom/var/blend_mode)
++    [color var (atom)](/ref/atom/var/color)
diff --git a/ref/atom/var/appearance.md b/ref/atom/var/appearance.md
index 1ddde86b..943f4b4a 100644
--- a/ref/atom/var/appearance.md
+++ b/ref/atom/var/appearance.md
@@ -1,67 +1,15 @@
-## appearance var (atom) 
-###### BYOND Version 508
 
+## appearance (var)
+***
+Every atom or image has an appearance, which controls all of the values relating to how it appears on the map. (The overlays and underlays lists are lists of appearances.) When read, this var provides a copy of the current appearance.
 
+This value can also be used to change an atom's appearance, altering multiple values at once. Setting atom.appearance to another appearance will change all of the following values to match:
 
-Every atom or image has an appearance, which controls all of
-the values relating to how it appears on the map. (The overlays and
-underlays lists are lists of appearances.) When read, this var provides
-a copy of the current appearance. 
+Other vars that are technically part of the appearance, but don't make any sense to change when cloning, are not changed. These include `density`, `dir`, `screen_loc`, and `verbs`. However, those vars ARE copied when you assign a `/mutable_appearance`.
 
-This value can also be used
-to change an atom\'s appearance, altering multiple values at once.
-Setting atom.appearance to another appearance will change all of the
-following values to match:  
-> [alpha](/ref/atom/var/alpha.md)  
-[appearance_flags](/ref/atom/var/appearance_flags.md)  
-[blend_mode](/ref/atom/var/blend_mode.md)  
-[color](/ref/atom/var/color.md)  
-[desc](/ref/atom/var/desc.md)  
-[gender](/ref/atom/var/gender.md)  
-[icon](/ref/atom/var/icon.md)  
-[icon_state](/ref/atom/var/icon_state.md)  
-[icon_w](/ref/atom/var/icon_w.md)  
-[icon_z](/ref/atom/var/icon_z.md)  
-[invisibility](/ref/atom/var/invisibility.md)  
-[infra_luminosity](/ref/atom/var/infra_luminosity.md)  
-[filters](/ref/atom/var/filters.md)  
-[layer](/ref/atom/var/layer.md)  
-[luminosity](/ref/atom/var/luminosity.md)  
-[maptext](/ref/atom/var/maptext.md)  
-[maptext_width](/ref/atom/var/maptext_width.md), [maptext_height](/ref/atom/var/maptext_height.md), [maptext_x](/ref/atom/var/maptext_x.md), [maptext_y](/ref/atom/var/maptext_y.md)  
-[mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md),
-[mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md),
-[mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md)  
-[mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md)  
-[mouse_opacity var](/ref/atom/var/mouse_opacity.md)  
-[name](/ref/atom/var/name.md)  
-[opacity](/ref/atom/var/opacity.md)  
-[overlays](/ref/atom/var/overlays.md)  
-[override](/ref/atom/var/override.md)  (images only)  
-[pixel_x](/ref/atom/var/pixel_x.md), 
-[pixel_y](/ref/atom/var/pixel_y.md), 
-[pixel_w](/ref/atom/var/pixel_w.md), 
-[pixel_z](/ref/atom/var/pixel_z.md)  
-[plane](/ref/atom/var/plane.md)  
-[render_source](/ref/atom/var/render_source.md), 
-[render_target](/ref/atom/var/render_target.md)  
-[suffix](/ref/atom/var/suffix.md)  
-[text](/ref/atom/var/text.md)  
-[transform](/ref/atom/var/transform.md)  
-[underlays](/ref/atom/var/underlays.md)  
-[vis_flags](/ref/atom/var/vis_flags.md)  
-
-Other vars that are technically part of the appearance, but
-don\'t make any sense to change when cloning, are not changed. These
-include `density`, `dir`, `screen_loc`, and `verbs`. However, those vars
-ARE copied when you assign a `/mutable_appearance`. 
-
-If you set
-`atom.appearance` to another atom, the other atom\'s appearance will be
-copied.
-
-> [!TIP] 
-> **See also:**
-> +   [vars (atom)](/ref/atom/var.md) 
-> +   [mutable appearance](/ref/mutable_appearance.md) 
-> +   [Understanding the renderer](/ref/notes/renderer.md) 
\ No newline at end of file
+If you set `atom.appearance` to another atom, the other atom's appearance will be copied.
+***
+**Related Pages:**
++    [vars (atom)](/ref/atom/var)
++    [mutable appearance](/ref/mutable_appearance)
++    [Understanding the renderer](/ref/{notes}/renderer)
diff --git a/ref/atom/var/appearance_flags.md b/ref/atom/var/appearance_flags.md
index 4c036475..f7a2dc9b 100644
--- a/ref/atom/var/appearance_flags.md
+++ b/ref/atom/var/appearance_flags.md
@@ -1,194 +1,82 @@
-## appearance_flags var (atom) 
-###### BYOND Version 509
 
+## appearance_flags (var)
 
-**Default value:**
+**Default Value:**
 +   0
+***
+The appearance_flags value controls miscellaneous behavior of an atom or appearance that doesn't make sense to handle in any other var.
+
+These values are bitflags, and can be combined with the `+` or `|` operator.
+
+Gliding is normally done by Euclidean (straight-line) distance, so diagonal gliding across a square tile takes about 41% longer, since the distance is multiplied by sqrt(2). With `LONG_GLIDE`, the dominant X or Y direction of the glide is used to adjust the glide size so it takes just as long as if the object were gliding in a cardinal direction.
+
+These flags cause this overlay not to inherit aspects of its parent object. Ordinarily, transforms on a parent get applied to overlays too, as does color.
+
+All of these flags are ignored if `KEEP_TOGETHER` is used on the parent (and this object does not override with `KEEP_APART`), since then the parent icon along with all of its overlays get drawn to a single surface and color, transform, etc. are applied afterward.
+
+The value of client.color is normally applied to all icons. This flag says that the icon is an exception. Generally `client.color` has been superseded by the use of plane masters anyway.
+
+The `NO_CLIENT_COLOR` flag is inherited by overlays and images automatically unless they have the `RESET_COLOR` flag. It is also basically meaningless when used on an overlay that's inside of a `KEEP_TOGETHER` group, since the client's color is applied to the entire group.
+
+This flag is used to force the overlays and underlays of this icon (its "children") to be drawn with it all at once, not each icon individually. One reason you might want to do this is if your player's icon uses overlays for hair and equipment, and you want to change the alpha value to make them fade out. With regular drawing, changing the parent icon's alpha means that each individual icon becomes translucent; with `KEEP_TOGETHER`, the whole combination fades as one unit. Because this incurs some small overhead, it should be avoided for atoms that do not need it.
+
+Any child appearances underneath `KEEP_TOGETHER` use `NO_CLIENT_COLOR` automatically, and `RESET_COLOR`, `RESET_ALPHA`, and `RESET_TRANSFORM` become meaningless. Use `KEEP_APART` with them if you want to use those flags.
+
+Icons that are in a different plane from the parent icon will automatically have `KEEP_APART` set and therefore won't be included.
+
+If this appearance is a child of something that uses `KEEP_TOGETHER`, it will be separated out from the main icon and drawn separately. This may be useful for things such as health meters, for instance.
+
+This flag is automatically applied to icons that are on a different plane from their parents.
+
+Use this flag to group all icons in the same plane and draw them on a temporary surface the size of the whole screen, and then that image is drawn over the existing scene. This is useful for post-processing effects, like lighting. The plane master's icon is not drawn, but its color, transform, and blend_mode are all taken into account when drawing.
 
-**Possible values:**
-
-Any combination of:
-+   **LONG_GLIDE**: Diagonal glides take as long as cardinal ones
-+   **RESET_COLOR**: If this is an overlay/image/etc., ignore the
-    parent\'s color
-+   **RESET_ALPHA**: If this is an overlay/image/etc., ignore the
-    parent\'s alpha value
-+   **RESET_TRANSFORM**: If this is an overlay/image/etc., ignore the
-    parent\'s transform
-+   **NO_CLIENT_COLOR**: Ignore client.color
-+   **KEEP_TOGETHER**: Draw this icon along with its overlays and
-    underlays, as one unit
-+   **KEEP_APART**: Detach from a parent icon that uses `KEEP_TOGETHER`
-+   **PLANE_MASTER**: Groups all other icons in the same plane
-+   **TILE_BOUND**: Avoids more accurate visibility calculations
-+   **PIXEL_SCALE**: Use point sampling when transforming this icon
-+   **PASS_MOUSE**: If this icon has a `render_source`, pass any mouse 
-    hits to the render source
-+   **TILE_MOVER**: This atom is always locked to the grid
-
-
-The appearance_flags value controls miscellaneous behavior of
-an atom or appearance that doesn\'t make sense to handle in any other
-var. 
-
-These values are bitflags, and can be combined with the
-`+` or `|` operator.
-### LONG_GLIDE
-
-
-Gliding is normally done by Euclidean (straight-line) distance,
-so diagonal gliding across a square tile takes about 41% longer, since
-the distance is multiplied by sqrt(2). With `LONG_GLIDE`, the dominant X
-or Y direction of the glide is used to adjust the glide size so it takes
-just as long as if the object were gliding in a cardinal direction.
-### RESET_COLOR, RESET_ALPHA, RESET_TRANSFORM
-
-
-These flags cause this overlay not to inherit aspects of its
-parent object. Ordinarily, transforms on a parent get applied to
-overlays too, as does color. 
-
-All of these flags are ignored if
-`KEEP_TOGETHER` is used on the parent (and this object does not override
-with `KEEP_APART`), since then the parent icon along with all of its
-overlays get drawn to a single surface and color, transform, etc. are
-applied afterward.
-### NO_CLIENT_COLOR
-
-
-The value of [client.color](/ref/client/var/color.md)  is
-normally applied to all icons. This flag says that the icon is an
-exception. Generally `client.color` has been superseded by the use of
-plane masters anyway. 
-
-The `NO_CLIENT_COLOR` flag is inherited
-by overlays and images automatically unless they have the `RESET_COLOR`
-flag. It is also basically meaningless when used on an overlay that\'s
-inside of a `KEEP_TOGETHER` group, since the client\'s color is applied
-to the entire group.
-### KEEP_TOGETHER 510
-
-
-This flag is used to force the overlays and underlays of this
-icon (its "children") to be drawn with it all at once, not each icon
-individually. One reason you might want to do this is if your player\'s
-icon uses overlays for hair and equipment, and you want to change the
-alpha value to make them fade out. With regular drawing, changing the
-parent icon\'s alpha means that each individual icon becomes
-translucent; with `KEEP_TOGETHER`, the whole combination fades as one
-unit. Because this incurs some small overhead, it should be avoided for
-atoms that do not need it. 
-
-Any child appearances underneath
-`KEEP_TOGETHER` use `NO_CLIENT_COLOR` automatically, and `RESET_COLOR`,
-`RESET_ALPHA`, and `RESET_TRANSFORM` become meaningless. Use
-`KEEP_APART` with them if you want to use those flags. 
-
-Icons
-that are in a different plane from the parent icon will automatically
-have `KEEP_APART` set and therefore won\'t be included.
-### KEEP_APART 510
-
-
-If this appearance is a child of something that uses
-`KEEP_TOGETHER`, it will be separated out from the main icon and drawn
-separately. This may be useful for things such as health meters, for
-instance. 
-
-This flag is automatically applied to icons that are
-on a different plane from their parents.
-### PLANE_MASTER 510
-
-
-Use this flag to group all icons in the same plane and draw
-them on a temporary surface the size of the whole screen, and then that
-image is drawn over the existing scene. This is useful for
-post-processing effects, like lighting. The plane master\'s icon is not
-drawn, but its color, transform, and blend_mode are all taken into
-account when drawing.
-### Example
 
 ```dm
+
 obj/lighting_plane
     screen_loc = "1,1"
     plane = 2
     blend_mode = BLEND_MULTIPLY
-    appearance_flags = PLANE_MASTER | NO_CLIENT_COLOR // use 20% ambient lighting; be sure to add full alpha
+    appearance_flags = PLANE_MASTER | NO_CLIENT_COLOR
+    // use 20% ambient lighting; be sure to add full alpha
     color = list(null,null,null,null,"#333f")
-    mouse_opacity = 0 // nothing on this plane is mouse-visible
+    mouse_opacity = 0    // nothing on this plane is mouse-visible
 
-image/spotlight plane = 2
+image/spotlight
+    plane = 2
     blend_mode = BLEND_ADD
-    icon = 'spotlight.dmi' // a 96x96 white circle
+    icon = 'spotlight.dmi'  // a 96x96 white circle
     pixel_x = -32
     pixel_y = -32
-    
+
 mob/Login()
     ..()
     client.screen += new/obj/lighting_plane
-    overlays += /image/spotlight 
+    overlays += /image/spotlight
+
 ```
- 
-
-In the example, all
-objects in plane 2 are lights. They\'re added together, and then the
-whole image is put through the color matrix, then multiplied over the
-rest of the scene below. This will darken everything that doesn\'t have
-a spotlight overlay, but anywhere a spotlight exists will have a circle
-of light. 
-
-The example also makes a point of adding full alpha
-to the plane, because a plane is fully transparent by default. However,
-it\'s usually a better idea not to mess with the alpha color, and
-instead use another icon, scaled to the appropriate size, as a backdrop.
-
-
-The [mouse_opacity](/ref/atom/var/mouse_opacity.md)  set by the
-plane master will determine how the mouse interacts with objects on the
-plane. A value of 0 will mean everything in the plane is invisible to
-the mouse; 1 means the plane is mouse-invisible but the objects in it
-use their own `mouse_opacity`. 2 is the same except the plane itself is
-mouse-visible.
-
-### TILE_BOUND 510
-
-There are many ways an object may be shifted out of the normal
-bounds of the tile it\'s on: a large icon, pixel offsets, step offsets,
-and transform. Ordinarily it\'s desirable to be able to see the object
-if it touches any visible turf. However, in some cases it\'s more
-desirable to only show the object if its actual loc is in view. The
-`TILE_BOUND` flag will accomplish that. This flag is inherited by images
-and overlays.
-
-### PIXEL_SCALE 511
-
-Normally if an icon is transformed via atom.transform, it uses
-bilinear texture sampling which produces a nice smooth effect. If you
-want a granular pixel-art effect instead, `PIXEL_SCALE` will do that for
-you by using nearest-neighbor sampling.
-
-### PASS_MOUSE 513
-
-If this object has a `render_source` it will take on the
-rendered appearance of another object (source). This is just a visual
-copy, so the mouse still interacts with this object, not the source. The
-`PASS_MOUSE` flag causes any mouse interaction to happen with the source
-instead of this object.
-
-### TILE_MOVER 514
-
-This flag indicates this atom is locked to the tile grid as it
-would be in [TILE_MOVEMENT_MODE](/ref/world/var/movement_mode.md),
-regardless of the setting of `world.movement_mode`. In this way, pixel
-movers and tile movers can coexist.
-
-> [!TIP] 
-> **See also:**
-> +   [vars (atom)](/ref/atom/var.md) 
-> +   [alpha var (atom)](/ref/atom/var/alpha.md) 
-> +   [color var (atom)](/ref/atom/var/color.md) 
-> +   [transform var (atom)](/ref/atom/var/transform.md) 
-> +   [color var (client)](/ref/client/var/color.md) 
-> +   [Gliding](/ref/notes/gliding.md) 
-> +   [movement_mode var (world)](/ref/world/var/movement_mode.md) 
-> +   [Understanding the renderer](/ref/notes/renderer.md) 
+
+
+In the example, all objects in plane 2 are lights. They're added together, and then the whole image is put through the color matrix, then multiplied over the rest of the scene below. This will darken everything that doesn't have a spotlight overlay, but anywhere a spotlight exists will have a circle of light.
+
+The example also makes a point of adding full alpha to the plane, because a plane is fully transparent by default. However, it's usually a better idea not to mess with the alpha color, and instead use another icon, scaled to the appropriate size, as a backdrop.
+
+The mouse_opacity set by the plane master will determine how the mouse interacts with objects on the plane. A value of 0 will mean everything in the plane is invisible to the mouse; 1 means the plane is mouse-invisible but the objects in it use their own `mouse_opacity`. 2 is the same except the plane itself is mouse-visible.
+
+There are many ways an object may be shifted out of the normal bounds of the tile it's on: a large icon, pixel offsets, step offsets, and transform. Ordinarily it's desirable to be able to see the object if it touches any visible turf. However, in some cases it's more desirable to only show the object if its actual loc is in view. The `TILE_BOUND` flag will accomplish that. This flag is inherited by images and overlays.
+
+Normally if an icon is transformed via atom.transform, it uses bilinear texture sampling which produces a nice smooth effect. If you want a granular pixel-art effect instead, `PIXEL_SCALE` will do that for you by using nearest-neighbor sampling.
+
+If this object has a `render_source` it will take on the rendered appearance of another object (source). This is just a visual copy, so the mouse still interacts with this object, not the source. The `PASS_MOUSE` flag causes any mouse interaction to happen with the source instead of this object.
+
+This flag indicates this atom is locked to the tile grid as it would be in TILE_MOVEMENT_MODE, regardless of the setting of `world.movement_mode`. In this way, pixel movers and tile movers can coexist.
+***
+**Related Pages:**
++    [vars (atom)](/ref/atom/var)
++    [alpha](/ref/atom/var/alpha)
++    [color var (atom)](/ref/atom/var/color)
++    [transform var (atom)](/ref/atom/var/transform)
++    [color var (client)](/ref/client/var/color)
++    [Gliding](/ref/{notes}/gliding)
++    [movement_mode var (world)](/ref/world/var/movement_mode)
++    [Understanding the renderer](/ref/{notes}/renderer)
diff --git a/ref/atom/var/blend_mode.md b/ref/atom/var/blend_mode.md
index ff00a9dd..0c6fe8c7 100644
--- a/ref/atom/var/blend_mode.md
+++ b/ref/atom/var/blend_mode.md
@@ -1,56 +1,25 @@
-## blend_mode var (atom) 
-###### BYOND Version 501
 
+## blend_mode (var)
 
-**Default value:**
+**Default Value:**
 +   0 (none/overlay)
+***
+[* This blend type appears only when using graphics hardware mode. It is also not visible in the map editor.]
[ Since the alpha of the icon underneath is used for alpha masking, mouse hits take it into account.] -**Possible values:** -+ BLEND_DEFAULT (0) -+ BLEND_OVERLAY -+ BLEND_ADD -+ BLEND_SUBTRACT[*](#*) -+ BLEND_MULTIPLY[*†](#*†) -+ BLEND_INSET_OVERLAY[*†](#*†) - - -###### * This blend type appears only when using graphics hardware mode. It is also not visible in the map editor. -###### † Since the alpha of the icon underneath is used for alpha masking, mouse hits take it into account. - -Controls the way -the atom\'s icon is blended onto the icons behind it. The blend mode -used by an atom is inherited by any attached overlays, unless they -override it. `BLEND_DEFAULT` will use the main atom\'s blend mode; for -the atom itself, it\'s the same as `BLEND_OVERLAY`. - +Controls the way the atom's icon is blended onto the icons behind it. The blend mode used by an atom is inherited by any attached overlays, unless they override it. `BLEND_DEFAULT` will use the main atom's blend mode; for the atom itself, it's the same as `BLEND_OVERLAY`. `BLEND_OVERLAY` will draw an icon the normal way. +`BLEND_ADD` will do additive blending, so that the colors in the icon are added to whatever is behind it. Light effects like explosions will tend to look better in this mode. -`BLEND_ADD` will do additive blending, so that the colors in -the icon are added to whatever is behind it. Light effects like -explosions will tend to look better in this mode. - - -`BLEND_SUBTRACT` is for subtractive blending. This may be -useful for special effects. - -`BLEND_MULTIPLY` will multiply the -icon\'s colors by whatever is behind it. This is typically only useful -for applying a colored light effect; for simply darkening, using a -translucent black icon with normal overlay blending is a better option. - +`BLEND_SUBTRACT` is for subtractive blending. This may be useful for special effects. -`BLEND_INSET_OVERLAY` overlays the icon, but masks it by the -image being drawn on. This is pretty much not at all useful directly on -the map, but can be very useful for an overlay for an atom that uses -`KEEP_TOGETHER` (see -[appearance_flags](/ref/atom/var/appearance_flags.md) ), or for the -[layering filter](/ref/notes/filters/layer.md) +`BLEND_MULTIPLY` will multiply the icon's colors by whatever is behind it. This is typically only useful for applying a colored light effect; for simply darkening, using a translucent black icon with normal overlay blending is a better option. -> [!TIP] -> **See also:** -> + [vars (atom)](/ref/atom/var.md) -> + [alpha var (atom)](/ref/atom/var/alpha.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) \ No newline at end of file +`BLEND_INSET_OVERLAY` overlays the icon, but masks it by the image being drawn on. This is pretty much not at all useful directly on the map, but can be very useful for an overlay for an atom that uses `KEEP_TOGETHER` (see appearance_flags), or for the layering filter. +*** +**Related Pages:** ++ [vars (atom)](/ref/atom/var) ++ [alpha](/ref/atom/var/alpha) ++ [color var (atom)](/ref/atom/var/color) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) diff --git a/ref/atom/var/color.md b/ref/atom/var/color.md index 881d6f94..76155aac 100644 --- a/ref/atom/var/color.md +++ b/ref/atom/var/color.md @@ -1,53 +1,24 @@ -## color var (atom) -###### BYOND Version 500 +## color (var) -**Default value:** +**Default Value:** + null (white) +*** +Controls the color of the icon displayed on players' screens. This color is multiplied by the icon, so that a white icon will become this color. The color multiplier is also applied to `maptext`. -**Possible values:** -+ null (white) -+ any [color](/ref/appendix/html-colors.md) generated by `rgb()` - (e.g., `"#00ff00"` for green) -+ a [color matrix](/ref/notes/color-matrix.md) (in list form) - -> [!NOTE] -> values `"white"` and `"#ffffff"` will evaluate to `null` - - -Controls the color of the icon displayed on players\' screens. -This color is multiplied by the icon, so that a white icon will become -this color. The color multiplier is also applied to `maptext`. - - -If you include an alpha component in the color, the atom\'s -alpha var will be set at the same time. - -Overlays and images -will also be multiplied by this color, unless they use the `RESET_COLOR` -value in `appearance_flags`. +If you include an alpha component in the color, the atom's alpha var will be set at the same time. -The color value can be set to a -[color matrix](/ref/notes/color-matrix.md) which is a list of values. -This allows for more complex transformations such as adding or -subtracting color, inverting the color, turning to grayscale, shifting -hue, etc. Using an RGB-only color matrix will include the existing alpha -value in the matrix. +Overlays and images will also be multiplied by this color, unless they use the `RESET_COLOR` value in `appearance_flags`. -When reading the `color` var, if it is a -matrix it will be read out as a list with 20 items (full RGBA format). -That list is a copy, so if you save it and make changes to that list -later it will not impact the actual color of the atom. This also means -you can\'t use `color[9] = 0.5`; you would have to grab the value of -`color` first, make sure it\'s a list, change it, and then assign the -changed list back to the `color` var. +The color value can be set to a color matrix, which is a list of values. This allows for more complex transformations such as adding or subtracting color, inverting the color, turning to grayscale, shifting hue, etc. Using an RGB-only color matrix will include the existing alpha value in the matrix. -> [!TIP] -> **See also:** -> + [vars (atom)](/ref/atom/var.md) -> + [alpha var (atom)](/ref/atom/var/alpha.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [blend_mode var (atom)](/ref/atom/var/blend_mode.md) -> + [color var (client)](/ref/client/var/color.md) -> + [rgb proc](/ref/proc/rgb.md) -> + [MapColors proc (icon)](/ref/icon/proc/MapColors.md) +When reading the `color` var, if it is a matrix it will be read out as a list with 20 items (full RGBA format). That list is a copy, so if you save it and make changes to that list later it will not impact the actual color of the atom. This also means you can't use `color[9] = 0.5`; you would have to grab the value of `color` first, make sure it's a list, change it, and then assign the changed list back to the `color` var. +*** +**Related Pages:** ++ [vars (atom)](/ref/atom/var) ++ [alpha](/ref/atom/var/alpha) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) ++ [Blend mode](/ref/atom/var/blend_mode) ++ [color var (client)](/ref/client/var/color) ++ [rgb proc](/ref/proc/rgb) ++ [MapColors proc (icon)](/ref/icon/proc/MapColors) diff --git a/ref/atom/var/contents.md b/ref/atom/var/contents.md index fa43b8ab..076a4463 100644 --- a/ref/atom/var/contents.md +++ b/ref/atom/var/contents.md @@ -1,42 +1,25 @@ -## contents list var (atom) +## contents (var) -**Default value:** +**Default Value:** + List of contained objects. +*** +Except in the case of areas, this list is always restricted to objs and mobs (ie movable objects). Only direct contents are listed. Items inside of a bag object, for example, would not show up in the mob's contents list. +The contents of areas are a little different. The turfs contained in the area are in the list along with any objs or mobs directly contained by those turfs. -Except in the case of areas, this list is always restricted to -objs and mobs (ie movable objects). Only direct contents are listed. -Items inside of a bag object, for example, would not show up in the -mob\'s contents list. +If a movable atom uses the bound vars to change its physical size, or `step_x` or `step_y` to change its position, it may cover more than one turf. In that case, those turfs' contents won't just contain anything directly in them, but also any atoms overhanging them. I.e., if a turf is in a mob's `locs` list, then the mob is in that turf's contents list. (See locs for more information.) -The contents of areas are a little -different. The turfs contained in the area are in the list along with -any objs or mobs directly contained by those turfs. -If a -movable atom uses the bound vars to change its physical size, or -`step_x` or `step_y` to change its position, it may cover more than one -turf. In that case, those turfs\' contents won\'t just contain anything -directly in them, but also any atoms overhanging them. I.e., if a turf -is in a mob\'s `locs` list, then the mob is in that turf\'s contents -list. (See [locs](/ref/atom/movable/var/locs.md) for more information.) -Note: Looping through all of the atoms, or even just turfs, in a -particular area actually loops through every turf in the world. E.g., -`for(var/turf/T in area)`. The engine will check each turf to see if it -belongs to that area, and then includes the turf and/or its contents in -the results depending on what the loop is looking for. This also applies -to any situation where you might grab area.contents as a list, e.g. -`area.contents.Copy()`. Therefore in a large world, it\'s advisable not -to loop through area contents at all. - -> [!TIP] -> **See also:** -> + [Enter proc (atom)](/ref/atom/proc/Enter.md) -> + [Entered proc (atom)](/ref/atom/proc/Entered.md) -> + [Exit proc (atom)](/ref/atom/proc/Exit.md) -> + [Exited proc (atom)](/ref/atom/proc/Exited.md) -> + [locs list var (movable atom)](/ref/atom/movable/var/locs.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) -> + [list](/ref/list.md) -> + [loc var (atom)](/ref/atom/var/loc.md) \ No newline at end of file +> [!TIP] +> Note: Looping through all of the atoms, or even just turfs, in a particular area actually loops through every turf in the world. E.g., `for(var/turf/T in area)`. The engine will check each turf to see if it belongs to that area, and then includes the turf and/or its contents in the results depending on what the loop is looking for. This also applies to any situation where you might grab area.contents as a list, e.g. `area.contents.Copy()`. Therefore in a large world, it's advisable not to loop through area contents at all. +*** +**Related Pages:** ++ [Enter proc (atom)](/ref/atom/proc/Enter) ++ [Entered](/ref/atom/proc/Entered) ++ [Exit proc (atom)](/ref/atom/proc/Exit) ++ [Exited](/ref/atom/proc/Exited) ++ [locs list var (movable atom)](/ref/atom/movable/var/locs) ++ [Pixel movement](/ref/{notes}/pixel-movement) ++ [list](/ref/list) ++ [loc](/ref/atom/var/loc) diff --git a/ref/atom/var/density.md b/ref/atom/var/density.md index 76adaaef..629d0765 100644 --- a/ref/atom/var/density.md +++ b/ref/atom/var/density.md @@ -1,15 +1,13 @@ -## density var (atom) - -**Default value:** -+ 0 (1 for mobs) +## density (var) -This turns the object\'s density on or off (1 or 0). Two dense -objects may not occupy the same space in the standard movement system. - -> [!TIP] -> **See also:** -> + [Enter proc (atom)](/ref/atom/proc/Enter.md) -> + [Entered proc (atom)](/ref/atom/proc/Entered.md) -> + [Exit proc (atom)](/ref/atom/proc/Exit.md) -> + [Exited proc (atom)](/ref/atom/proc/Exited.md) \ No newline at end of file +**Default Value:** ++ 0 (1 for mobs) +*** +This turns the object's density on or off (1 or 0). Two dense objects may not occupy the same space in the standard movement system. +*** +**Related Pages:** ++ [Enter proc (atom)](/ref/atom/proc/Enter) ++ [Entered](/ref/atom/proc/Entered) ++ [Exit proc (atom)](/ref/atom/proc/Exit) ++ [Exited](/ref/atom/proc/Exited) diff --git a/ref/atom/var/desc.md b/ref/atom/var/desc.md index faf9e004..8bcc9d0a 100644 --- a/ref/atom/var/desc.md +++ b/ref/atom/var/desc.md @@ -1,14 +1,18 @@ -# desc var (atom) -**Default value:** -+ null +## desc (var) +**Default Value:** ++ null +*** This is the description of the object. -### Example: + ```dm + mob/verb/look(atom/O in view()) - if(O.desc) usr << O.desc - else - usr << "It's just \an [O]." + if(O.desc) usr << O.desc + else usr << "It's just \an [O]." + ``` + +*** \ No newline at end of file diff --git a/ref/atom/var/dir.md b/ref/atom/var/dir.md index 62011f91..9a82b097 100644 --- a/ref/atom/var/dir.md +++ b/ref/atom/var/dir.md @@ -1,37 +1,15 @@ -## dir var (atom) -**Default value:** -+ SOUTH - -**Possible values:** -+ NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST - -| Dir | Val | Binary | -|:----------|:---:|:------:| -| NORTH | 1 | 0001 | -| SOUTH | 2 | 0010 | -| EAST | 4 | 0100 | -| WEST | 8 | 1000 | -| NORTHEAST | 5 | 0101 | -| NORTHWEST | 9 | 1001 | -| SOUTHEAST | 6 | 0110 | -| SOUTHWEST | 10 | 1010 | - -This is the direction that the object is facing. This has -little effect unless the object\'s icon is directional. In the case of a -directional icon, this selects the corresponding orientation from the -icon file. you should use the value names instead of the values, as -`dir = NORTHEAST` is more comprehendible then `dir = 5` +## dir (var) -An icon file with only four (cardinal) directions -makes the choice of orientation ambiguous when the true direction is a -diagonal. In that case, of the two possibilities, the one closest to the -previous orientation is displayed. Sounds complicated, but it\'s what -one would naturally expect. - -> [!TIP] -> **See also:** -> + [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [turn proc](/ref/proc/turn.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) +**Default Value:** ++ SOUTH +*** +This is the direction that the object is facing. This has little effect unless the object's icon is directional. In the case of a directional icon, this selects the corresponding orientation from the icon file. + +An icon file with only four (cardinal) directions makes the choice of orientation ambiguous when the true direction is a diagonal. In that case, of the two possibilities, the one closest to the previous orientation is displayed. Sounds complicated, but it's what one would naturally expect. +*** +**Related Pages:** ++ [Move proc (movable atom)](/ref/atom/movable/proc/Move) ++ [icon var (atom)](/ref/atom/var/icon) ++ [turn proc](/ref/proc/turn) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/atom/var/filters.md b/ref/atom/var/filters.md index d3008d8b..6f1b7d68 100644 --- a/ref/atom/var/filters.md +++ b/ref/atom/var/filters.md @@ -1,50 +1,32 @@ -## filters var (atom) -###### BYOND Version 512 +## filters (var) -**Default value:** +**Default Value:** + empty list +*** +This var is a list of graphical filters to use for post-processing effects, applied in order. You can assign this value a list, an individual filter, or null to empty it. -This var is a list of graphical filters to use for -post-processing effects, applied in order. You can assign this value a -list, an individual filter, or null to empty it. -### Example: - ```dm - obj/blurry - filters = filter(type="blur", size=1) + +obj/blurry + filters = filter(type="blur", size=1) ``` - - -Atoms with the `KEEP_TOGETHER` flag will apply their -filters after the composite image has been drawn. Filters will also -apply to any maptext the atom has. - -See the -[filters](/ref/notes/filters.md) section for more information on -individual filters. -### Named Filters 516 - - -Filters can be created with a `name` argument. That name can be -used to access the filter in the list (e.g. `filters["drunk_blur"]` -instead of using a numeric index, which is helpful for managing -animations and updating multiple filters on an object. - -Adding a -new filter with the same name as an existing filter will remove the old -one, since only one of a given filter name can be used on an appearance -at a time. - -You can also remove a named filter from the list -simply by subtracting the name instead of the filter itself. That is, -`filters -= filters["foo"]` and `filters -= "foo"` do the same thing. - -> [!TIP] -> **See also:** -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [filter proc](/ref/proc/filter.md) -> + [animate proc](/ref/proc/animate.md) -> + [Filter effects](/ref/notes/filters.md) \ No newline at end of file + + +Atoms with the KEEP_TOGETHER flag will apply their filters after the composite image has been drawn. Filters will also apply to any maptext the atom has. + +See the filters section for more information on individual filters. + +Filters can be created with a `name` argument. That name can be used to access the filter in the list (e.g. `filters["drunk_blur"]` instead of using a numeric index, which is helpful for managing animations and updating multiple filters on an object. + +Adding a new filter with the same name as an existing filter will remove the old one, since only one of a given filter name can be used on an appearance at a time. + +You can also remove a named filter from the list simply by subtracting the name instead of the filter itself. That is, `filters -= filters["foo"]` and `filters -= "foo"` do the same thing. +*** +**Related Pages:** ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) ++ [filter proc](/ref/proc/filter) ++ [animate proc](/ref/proc/animate) ++ [Filter effects](/ref/{notes}/filters) diff --git a/ref/atom/var/gender.md b/ref/atom/var/gender.md index dd58c595..8a32f855 100644 --- a/ref/atom/var/gender.md +++ b/ref/atom/var/gender.md @@ -1,29 +1,33 @@ -## gender var (atom) -**Default value:** +## gender (var) + +**Default Value:** + "neuter" +*** +This sets the object's gender. This influences text macros like \he, which may expand to "it", "he", "she", or "they". Valid values are: -This sets the object\'s gender. This influences text macros -like `\he`, which may expand to "it", "he", "she", or "they". -Valid values are: ```dm - "neuter" - "male" - "female" - "plural" + +"neuter" +"male" +"female" +"plural" + ``` - These are also defined as constants, which may -help prevent typos, since the compiler will complain if it doesn\'t -recognize what you type: + + + ```dm - NEUTER - MALE - FEMALE - PLURAL + +NEUTER +MALE +FEMALE +PLURAL + ``` -> [!TIP] -> **See also:** -> + [macros (text)](/ref/DM/text/macros.md) -> + [name var (atom)](/ref/atom/var/name.md) \ No newline at end of file +*** +**Related Pages:** ++ [macros (text)](/ref/DM/text/macros) ++ [name var (atom)](/ref/atom/var/name) diff --git a/ref/atom/var/icon.md b/ref/atom/var/icon.md index 644c435b..115df4d2 100644 --- a/ref/atom/var/icon.md +++ b/ref/atom/var/icon.md @@ -1,41 +1,30 @@ -## icon var (atom) -**Default value:** -+ null +## icon (var) +**Default Value:** ++ null +*** +This is the icon file that will be used to represent the object on graphical clients. -This is the icon file that will be used to represent the object -on graphical clients. -### Example: ```dm + turf/wall - icon = 'wall.dmi' + icon = 'wall.dmi' + ``` - - -You can -also assign this to an external file at run-time with an expression such -as file("wall.dmi"), but you would only want to do that when the other -method is not possible, because it requires addition of the file to the -resource cache, which can take a little time. - -When this -variable is set to any dynamically created icon object, that object gets -dumped into the world\'s resource cache (the `.rsc` file), and a -reference to that cached file is assigned to atom.icon. In other words, -don\'t expect comparisons such as `usr.icon == MyDynamicallyCreatedIcon` -to work unless you have used fcopy_rsc() to get a cache reference to -your dynamically created icon first. This is almost never an issue, so -don\'t worry about it if none of that made any sense to you! - -> [!TIP] -> **See also:** -> + [icon proc](/ref/proc/icon.md) -> + [icon_state var (atom)](/ref/atom/var/icon_state.md) -> + [icons](/ref/DM/icon.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [underlays var (atom)](/ref/atom/var/underlays.md) -> + [load_resource proc](/ref/proc/load_resource.md) -> + [icon_w var (atom)](/ref/atom/var/icon_w.md) -> + [icon_z var (atom)](/ref/atom/var/icon_z.md) \ No newline at end of file + + +You can also assign this to an external file at run-time with an expression such as file("wall.dmi"), but you would only want to do that when the other method is not possible, because it requires addition of the file to the resource cache, which can take a little time. + +When this variable is set to any dynamically created icon object, that object gets dumped into the world's resource cache (the `.rsc` file), and a reference to that cached file is assigned to atom.icon. In other words, don't expect comparisons such as usr.icon == MyDynamicallyCreatedIcon to work unless you have used fcopy_rsc() to get a cache reference to your dynamically created icon first. This is almost never an issue, so don't worry about it if none of that made any sense to you! +*** +**Related Pages:** ++ [icon proc](/ref/proc/icon) ++ [icon_state](/ref/atom/var/icon_state) ++ [icons](/ref/DM/icon) ++ [overlays](/ref/atom/var/overlays) ++ [underlays](/ref/atom/var/underlays) ++ [load_resource proc](/ref/proc/load_resource) ++ [icon_w var (atom)](/ref/atom/var/icon_w) ++ [icon_z var (atom)](/ref/atom/var/icon_z) diff --git a/ref/atom/var/icon_state.md b/ref/atom/var/icon_state.md index b5af97b3..4a9336f8 100644 --- a/ref/atom/var/icon_state.md +++ b/ref/atom/var/icon_state.md @@ -1,33 +1,31 @@ -## icon_state var (atom) -**Default value:** -+ null +## icon_state (var) +**Default Value:** ++ null +*** +Icons may appear differently depending on the icon state. For example, turf door icons could have "open" and "closed" states. If a state is specified that does not exist in the icon file, the default null state will be displayed if it exists. -Icons may appear differently depending on the icon state. For -example, turf door icons could have "open" and "closed" states. If a -state is specified that does not exist in the icon file, the default -null state will be displayed if it exists. -### Example: ```dm + turf/door - icon_state = "closed" - density = 1 - verb - open() - set src in view(1) - icon_state = "open" - density = 0 - close() - set src in view(1) - icon_state = "closed" - density = 1 -``` + icon_state = "closed" + density = 1 + verb + open() + set src in view(1) + icon_state = "open" + density = 0 + close() + set src in view(1) + icon_state = "closed" + density = 1 +``` -> [!TIP] -> **See also:** -> + [flick proc](/ref/proc/flick.md) -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [icon_states proc](/ref/proc/icon_states.md) \ No newline at end of file +*** +**Related Pages:** ++ [flick proc](/ref/proc/flick) ++ [icon var (atom)](/ref/atom/var/icon) ++ [icon_states proc](/ref/proc/icon_states) diff --git a/ref/atom/var/icon_w.md b/ref/atom/var/icon_w.md index ec03847a..f89283b5 100644 --- a/ref/atom/var/icon_w.md +++ b/ref/atom/var/icon_w.md @@ -1,23 +1,14 @@ -## icon_w var (atom) -###### BYOND Version 516 +## icon_w (var) -**Default value:** +**Default Value:** + 0 - - -Defines the anchor point for this icon, from the bottom left. -Higher values of icon_w will offset this icon to the left; lower values -offset it to the right. It acts like a negative pixel_w except it\'s not -inherited by any [overlays](/ref/atom/var/overlays.md) , [images](/ref/image.md) , or -[visual contents](/ref/atom/var/vis_contents.md) It applies ONLY to this -icon. - -This var is meant to replace the `bound_x` var, which was -applied very inconsistently in old versions. - -> [!TIP] -> **See also:** -> + [icon_z var (atom)](/ref/atom/var/icon_z.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [icon var (atom)](/ref/atom/var/icon.md) \ No newline at end of file +*** +Defines the anchor point for this icon, from the bottom left. Higher values of icon_w will offset this icon to the left; lower values offset it to the right. It acts like a negative pixel_w except it's not inherited by any overlays, images, or visual contents. It applies ONLY to this icon. + +This var is meant to replace the `bound_x` var, which was applied very inconsistently in old versions. +*** +**Related Pages:** ++ [icon_z var (atom)](/ref/atom/var/icon_z) ++ [pixel_w var (atom)](/ref/atom/var/pixel_w) ++ [icon var (atom)](/ref/atom/var/icon) diff --git a/ref/atom/var/icon_z.md b/ref/atom/var/icon_z.md index dd876edb..50202c7f 100644 --- a/ref/atom/var/icon_z.md +++ b/ref/atom/var/icon_z.md @@ -1,23 +1,14 @@ -## icon_z var (atom) -###### BYOND Version 516 +## icon_z (var) -**Default value:** +**Default Value:** + 0 - - -Defines the anchor point for this icon, from the bottom left. -Higher values of icon_w will offset this icon downward; lower values -offset it upward. It acts like a negative pixel_z except it\'s not -inherited by any [overlays](/ref/atom/var/overlays.md) , [images](/ref/image.md) , or -[visual contents](/ref/atom/var/vis_contents.md) It applies ONLY to this -icon. - -This var is meant to replace the `bound_y` var, which was -applied very inconsistently in old versions. - -> [!TIP] -> **See also:** -> + [icon_w var (atom)](/ref/atom/var/icon_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [icon var (atom)](/ref/atom/var/icon.md) \ No newline at end of file +*** +Defines the anchor point for this icon, from the bottom left. Higher values of icon_w will offset this icon downward; lower values offset it upward. It acts like a negative pixel_z except it's not inherited by any overlays, images, or visual contents. It applies ONLY to this icon. + +This var is meant to replace the `bound_y` var, which was applied very inconsistently in old versions. +*** +**Related Pages:** ++ [icon_w var (atom)](/ref/atom/var/icon_w) ++ [pixel_z var (atom)](/ref/atom/var/pixel_z) ++ [icon var (atom)](/ref/atom/var/icon) diff --git a/ref/atom/var/index.md b/ref/atom/var/index.md new file mode 100644 index 00000000..1541d0a9 --- /dev/null +++ b/ref/atom/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in atom vars: +*** \ No newline at end of file diff --git a/ref/atom/var/infra_luminosity.md b/ref/atom/var/infra_luminosity.md index 159c6c0a..6576e053 100644 --- a/ref/atom/var/infra_luminosity.md +++ b/ref/atom/var/infra_luminosity.md @@ -1,18 +1,13 @@ -## infra_luminosity var (atom) - -**Default value:** -+ 0 +## infra_luminosity (var) -This causes the object to be visible in the dark to mobs that -can see infrared light. Nothing but the object itself is lit up by the -infrared emission. The scale is identical to luminosity: 1 makes it -visible only from the same location; 2 makes it visible from a -neighboring position; and so on. - -> [!TIP] -> **See also:** -> + [luminosity var (atom)](/ref/atom/var/luminosity.md) -> + [see_infrared var (mob)](/ref/mob/var/see_infrared.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +This causes the object to be visible in the dark to mobs that can see infrared light. Nothing but the object itself is lit up by the infrared emission. The scale is identical to luminosity: 1 makes it visible only from the same location; 2 makes it visible from a neighboring position; and so on. +*** +**Related Pages:** ++ [luminosity](/ref/atom/var/luminosity) ++ [see_infrared var (mob)](/ref/mob/var/see_infrared) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view proc](/ref/proc/view) diff --git a/ref/atom/var/invisibility.md b/ref/atom/var/invisibility.md index 6c793f99..5602fcd1 100644 --- a/ref/atom/var/invisibility.md +++ b/ref/atom/var/invisibility.md @@ -1,25 +1,16 @@ -## invisibility var (atom) - -**Default value:** -+ 0 - -**Possible values:** -+ 0 to 101 +## invisibility (var) -This determines the object\'s level of invisibility. The -corresponding mob variable `see_invisible` controls the maximum level of -invisibility that the mob may see. - -A value of 101 is absolutely -invisible, no matter what, and it is filtered from all lists of possible -values for verb arguments. This is intended for objects that exist -purely for some internal purpose, such as "verb containers". +**Default Value:** ++ 0 +*** +This determines the object's level of invisibility. The corresponding mob variable see_invisible controls the maximum level of invisibility that the mob may see. -> [!TIP] -> **See also:** -> + [invisibility setting (verb)](/ref/verb/set/invisibility.md) -> + [opacity var (atom)](/ref/atom/var/opacity.md) -> + [see_invisible var (mob)](/ref/mob/var/see_invisible.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +A value of 101 is absolutely invisible, no matter what, and it is filtered from all lists of possible values for verb arguments. This is intended for objects that exist purely for some internal purpose, such as "verb containers". +*** +**Related Pages:** ++ [invisibility setting (verb)](/ref/verb/set/invisibility) ++ [opacity](/ref/atom/var/opacity) ++ [see_invisible var (mob)](/ref/mob/var/see_invisible) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view proc](/ref/proc/view) diff --git a/ref/atom/var/layer.md b/ref/atom/var/layer.md index 64974d85..189aca6b 100644 --- a/ref/atom/var/layer.md +++ b/ref/atom/var/layer.md @@ -1,76 +1,42 @@ -## layer var (atom) -**Default value:** +## layer (var) + +**Default Value:** + 1 (AREA_LAYER) + 2 (TURF_LAYER) + 3 (OBJ_LAYER) + 4 (MOB_LAYER) +*** +This numerical value determines the layer in which the object is drawn on the map. By default, the order is area, turf, obj, mob, followed by missiles and images (in FLY_LAYER, which is 5). -This numerical value determines the layer in which the object -is drawn on the map. By default, the order is area, turf, obj, mob, -followed by missiles and images (in FLY_LAYER, which is 5). -### Example: - ```dm -turf - archway - layer = MOB_LAYER+1 //overhead -``` +turf + archway + layer = MOB_LAYER+1 //overhead +``` -When making objects to be used as graphical overlays, you -should also be aware of the special `FLOAT_LAYER` value. This causes the -overlay (or underlay) to be in the same drawing layer as the base -object, no matter how that layer changes after the addition of the -overlay. Otherwise, the overlay object\'s own drawing layer is used. - - -The actual drawing order of icons may change depending on -world.map_format. An isometric map for instance has to display tiles -that are "closer" to the viewer in front of tiles that are in the -back, so the layer var takes a backseat to the needs of the map. If you -use the `TOPDOWN_MAP` or `TILED_ICON_MAP` map formats, the layer is more -important. -If you are using a `world.map_format` that does not -display topdown, such as `ISOMETRIC_MAP` or `SIDE_MAP`, then you can use -a special layer for showing certain portions of the map in topdown mode. -For those parts of the map, you can add `TOPDOWN_LAYER` to every atom\'s -layer to make the atom appear in topdown mode. This is for special -cases, like for instance a battle map in an RPG, where a regular topdown -view is preferable to the special mapping used by the rest of the game. -It is recommended that you use `TOPDOWN_LAYER` with every atom in that -portion of the map, since topdown and isometric maps for instance don\'t -mix. If you use `TOPDOWN_LAYER`, it is best to use a square size in -`world.icon_size` if any of these atoms will be moving around. +When making objects to be used as graphical overlays, you should also be aware of the special `FLOAT_LAYER` value. This causes the overlay (or underlay) to be in the same drawing layer as the base object, no matter how that layer changes after the addition of the overlay. Otherwise, the overlay object's own drawing layer is used. +The actual drawing order of icons may change depending on world.map_format. An isometric map for instance has to display tiles that are "closer" to the viewer in front of tiles that are in the back, so the layer var takes a backseat to the needs of the map. If you use the `TOPDOWN_MAP` or `TILED_ICON_MAP` map formats, the layer is more important. -Another special layer, `EFFECTS_LAYER`, is also available. -Icons that use this layer will display above icons that don\'t. -`TOPDOWN_LAYER` will then display above that. This layer is useful for -situations such as using a floating name or health meter overlay on a -mob in isometric mode. When using `EFFECTS_LAYER`, other icons on the -regular map won\'t cover the overlay. (It is preferable to use -atom.plane for this, when possible.) +If you are using a `world.map_format` that does not display topdown, such as `ISOMETRIC_MAP` or `SIDE_MAP`, then you can use a special layer for showing certain portions of the map in topdown mode. For those parts of the map, you can add `TOPDOWN_LAYER` to every atom's layer to make the atom appear in topdown mode. This is for special cases, like for instance a battle map in an RPG, where a regular topdown view is preferable to the special mapping used by the rest of the game. It is recommended that you use `TOPDOWN_LAYER` with every atom in that portion of the map, since topdown and isometric maps for instance don't mix. If you use `TOPDOWN_LAYER`, it is best to use a square size in `world.icon_size` if any of these atoms will be moving around. -Finally there is -BACKGROUND_LAYER. Adding this to an atom\'s layer will make it appear -below any atoms that do not use BACKGROUND_LAYER. (It is preferable to -use atom.plane when possible.) +Another special layer, `EFFECTS_LAYER`, is also available. Icons that use this layer will display above icons that don't. `TOPDOWN_LAYER` will then display above that. This layer is useful for situations such as using a floating name or health meter overlay on a mob in isometric mode. When using `EFFECTS_LAYER`, other icons on the regular map won't cover the overlay. (It is preferable to use atom.plane for this, when possible.) -The `atom.plane` var takes -priority over layer. This is the preferred method of handling background -and effects. +Finally there is BACKGROUND_LAYER. Adding this to an atom's layer will make it appear below any atoms that do not use BACKGROUND_LAYER. (It is preferable to use atom.plane when possible.) -> [!TIP] -> **See also:** -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [plane var (atom)](/ref/atom/var/plane.md) -> + [z var (atom)](/ref/atom/var/z.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -> + [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -> + [TOPDOWN_LAYER](/ref/notes/TOPDOWN_LAYER.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +The `atom.plane` var takes priority over layer. This is the preferred method of handling background and effects. +*** +**Related Pages:** ++ [overlays](/ref/atom/var/overlays) ++ [plane var (atom)](/ref/atom/var/plane) ++ [z](/ref/atom/var/z) ++ [map_format var (world)](/ref/world/var/map_format) ++ [BACKGROUND_LAYER](/ref/{notes}/BACKGROUND_LAYER) ++ [EFFECTS_LAYER](/ref/{notes}/EFFECTS_LAYER) ++ [TOPDOWN_LAYER](/ref/{notes}/TOPDOWN_LAYER) ++ [Understanding the renderer](/ref/{notes}/renderer) diff --git a/ref/atom/var/loc.md b/ref/atom/var/loc.md index 3b4aadd8..2b04fd38 100644 --- a/ref/atom/var/loc.md +++ b/ref/atom/var/loc.md @@ -1,16 +1,13 @@ -## loc var (atom) - -**Default value:** -+ The location of the object or null if there is none. +## loc (var) -The container is always an atom (or null). For areas, this -value is always null, since an area may not be contained by any other -object. - -> [!TIP] -> **See also:** -> + [contents list var (atom)](/ref/atom/var/contents.md) -> + [x var (atom)](/ref/atom/var/x.md) -> + [y var (atom)](/ref/atom/var/y.md) -> + [z var (atom)](/ref/atom/var/z.md) \ No newline at end of file +**Default Value:** ++ The location of the object or null if there is none. +*** +The container is always an atom (or null). For areas, this value is always null, since an area may not be contained by any other object. +*** +**Related Pages:** ++ [contents list var (atom)](/ref/atom/var/contents) ++ [x](/ref/atom/var/x) ++ [y](/ref/atom/var/y) ++ [z](/ref/atom/var/z) diff --git a/ref/atom/var/luminosity.md b/ref/atom/var/luminosity.md index eabd7834..706b81e4 100644 --- a/ref/atom/var/luminosity.md +++ b/ref/atom/var/luminosity.md @@ -1,12 +1,11 @@ -# luminosity var (atom) -**Default value:** -+ 0 -+ 1 (areas) +## luminosity (var) -This sets the object\'s luminosity (how far it casts light). It -must be an integer in the range 0 to 6. +**Default Value:** ++ 0 ++ 1 (areas) +*** +This sets the object's luminosity (how far it casts light). It must be an integer in the range 0 to 6. -Areas are a little -different. Any non-zero value in an area results in all objects within -the area being bathed in light. \ No newline at end of file +Areas are a little different. Any non-zero value in an area results in all objects within the area being bathed in light. +*** \ No newline at end of file diff --git a/ref/atom/var/maptext.md b/ref/atom/var/maptext.md index 595f2f82..82216055 100644 --- a/ref/atom/var/maptext.md +++ b/ref/atom/var/maptext.md @@ -1,49 +1,25 @@ -## maptext var (atom) -###### BYOND Version 494 - -**Default value:** -+ null - - -This is optional text that will be displayed in the same -position as the atom. If an atom has both an icon and maptext, the text -will be displayed in front of the icon. Usually however, this is -something that would be added to an overlay or image object, which can -then be positioned with pixel offsets. - -Map text is constrained -to the bounds set by maptext_width and maptext_height, which default to -a single icon in size. It can be offset by maptext_x and maptext_y. +## maptext (var) -Text can use HTML and CSS, mostly the same limited subset -supported by regular text output, and different styles can be used in -the same block of text. In addition, alpha colors can also be used, by -specifying a color as #rrggbbaa instead of just #rrggbb. (Alpha -transparency will be ignored when the map is drawn without hardware -rendering, so anything below 50% opacity is not displayed in those -cases.) - -Maptext supports links with the `` tag. -Left-clicking on a link will follow the link, but also generate other -events such as `MouseDown` or `Click`. - -### Example: -```dm -obj/mapTextHolder - maptext = "Hello World" // Displays 'Hello World' -``` - -> [!TIP] -> **See also:** -> + [maptext_width var (atom)](/ref/atom/var/maptext_width.md) -> + [maptext_height var (atom)](/ref/atom/var/maptext_height.md) -> + [maptext_x var (atom)](/ref/atom/var/maptext_x.md) -> + [maptext_y var (atom)](/ref/atom/var/maptext_y.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [image objects](/ref/image.md) -> + [pixel_x var (atom)](/ref/atom/var/pixel_x.md) -> + [pixel_y var (atom)](/ref/atom/var/pixel_y.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [MeasureText (client)](ref/client/proc/MeasureText.md) +**Default Value:** ++ null +*** +This is optional text that will be displayed in the same position as the atom. If an atom has both an icon and maptext, the text will be displayed in front of the icon. Usually however, this is something that would be added to an overlay or image object, which can then be positioned with pixel offsets. + +Map text is constrained to the bounds set by maptext_width and maptext_height, which default to a single icon in size. It can be offset by maptext_x and maptext_y. + +Text can use HTML and CSS, mostly the same limited subset supported by regular text output, and different styles can be used in the same block of text. In addition, alpha colors can also be used, by specifying a color as #rrggbbaa instead of just #rrggbb. (Alpha transparency will be ignored when the map is drawn without hardware rendering, so anything below 50% opacity is not displayed in those cases.) + +Maptext supports links with the `<a>` tag. Left-clicking on a link will follow the link, but also generate other events such as `MouseDown` or `Click`. +*** +**Related Pages:** ++ [maptext_width](/ref/atom/var/maptext_width) ++ [maptext_height](/ref/atom/var/maptext_height) ++ [maptext_x](/ref/atom/var/maptext_x) ++ [maptext_y](/ref/atom/var/maptext_y) ++ [overlays](/ref/atom/var/overlays) ++ [image objects](/ref/image) ++ [pixel_x](/ref/atom/var/pixel_x) ++ [pixel_y](/ref/atom/var/pixel_y) ++ [pixel_w var (atom)](/ref/atom/var/pixel_w) ++ [pixel_z var (atom)](/ref/atom/var/pixel_z) diff --git a/ref/atom/var/maptext_height.md b/ref/atom/var/maptext_height.md index d9b420f0..be11f427 100644 --- a/ref/atom/var/maptext_height.md +++ b/ref/atom/var/maptext_height.md @@ -1,22 +1,15 @@ -## maptext_height var (atom) -###### BYOND Version 494 - -**Default value:** -+ 32 (depends on world.icon_size) +## maptext_height (var) -This is the height of the text shown in the maptext var. The -default value depends on world.icon_size and world.map_format. In a -topdown (default) or tiled map_format, the icon height is used. In other -map views, tile "footprints" are square and height is irrelevant, so -the default will be the icon width instead.) - -> [!TIP] -> **See also:** -> + [maptext var (atom)](/ref/atom/var/maptext.md) -> + [maptext_width var (atom)](/ref/atom/var/maptext_width.md) -> + [maptext_x var (atom)](/ref/atom/var/maptext_x.md) -> + [maptext_y var (atom)](/ref/atom/var/maptext_y.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [MeasureText (client)](ref/client/proc/MeasureText.md) +**Default Value:** ++ 32 (depends on world.icon_size) +*** +This is the height of the text shown in the maptext var. The default value depends on world.icon_size and world.map_format. In a topdown (default) or tiled map_format, the icon height is used. In other map views, tile "footprints" are square and height is irrelevant, so the default will be the icon width instead.) +*** +**Related Pages:** ++ [maptext](/ref/atom/var/maptext) ++ [maptext_width](/ref/atom/var/maptext_width) ++ [maptext_x](/ref/atom/var/maptext_x) ++ [maptext_y](/ref/atom/var/maptext_y) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) diff --git a/ref/atom/var/maptext_width.md b/ref/atom/var/maptext_width.md index a2ef8bb5..00916372 100644 --- a/ref/atom/var/maptext_width.md +++ b/ref/atom/var/maptext_width.md @@ -1,18 +1,14 @@ -## maptext_width var (atom) -###### BYOND Version 494 - -**Default value:** -+ 32 (depends on world.icon_size) +## maptext_width (var) -This is the width of the text shown in the maptext var. By -default, it uses the icon width provided in world.icon_size. - -> [!TIP] -> **See also:** -> + [maptext var (atom)](/ref/atom/var/maptext.md) -> + [maptext_x var (atom)](/ref/atom/var/maptext_x.md) -> + [maptext_y var (atom)](/ref/atom/var/maptext_y.md) -> + [maptext_height var (atom)](/ref/atom/var/maptext_height.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [MeasureText (client)](ref/client/proc/MeasureText.md) \ No newline at end of file +**Default Value:** ++ 32 (depends on world.icon_size) +*** +This is the width of the text shown in the maptext var. By default, it uses the icon width provided in world.icon_size. +*** +**Related Pages:** ++ [maptext](/ref/atom/var/maptext) ++ [maptext_x](/ref/atom/var/maptext_x) ++ [maptext_y](/ref/atom/var/maptext_y) ++ [maptext_height](/ref/atom/var/maptext_height) ++ [icon_size var (world)](/ref/world/var/icon_size) diff --git a/ref/atom/var/maptext_x.md b/ref/atom/var/maptext_x.md index d6401599..849f0da0 100644 --- a/ref/atom/var/maptext_x.md +++ b/ref/atom/var/maptext_x.md @@ -1,16 +1,14 @@ -## maptext_x var (atom) -###### BYOND Version 508 - -**Default value:** -+ 0 +## maptext_x (var) +**Default Value:** ++ 0 +*** Maptext, if used, is offset by this many pixels to the right. - -> [!TIP] -> **See also:** -> + [maptext var (atom)](/ref/atom/var/maptext.md) -> + [maptext_width var (atom)](/ref/atom/var/maptext_width.md) -> + [maptext_height var (atom)](/ref/atom/var/maptext_height.md) -> + [maptext_y var (atom)](/ref/atom/var/maptext_y.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) \ No newline at end of file +*** +**Related Pages:** ++ [maptext](/ref/atom/var/maptext) ++ [maptext_width](/ref/atom/var/maptext_width) ++ [maptext_height](/ref/atom/var/maptext_height) ++ [maptext_y](/ref/atom/var/maptext_y) ++ [icon_size var (world)](/ref/world/var/icon_size) diff --git a/ref/atom/var/maptext_y.md b/ref/atom/var/maptext_y.md index 1920afd4..d4f1cb1c 100644 --- a/ref/atom/var/maptext_y.md +++ b/ref/atom/var/maptext_y.md @@ -1,16 +1,14 @@ -## maptext_y var (atom) -###### BYOND Version 508 - -**Default value:** -+ 0 +## maptext_y (var) +**Default Value:** ++ 0 +*** Maptext, if used, is offset by this many pixels upward. - -> [!TIP] -> **See also:** -> + [maptext var (atom)](/ref/atom/var/maptext.md) -> + [maptext_width var (atom)](/ref/atom/var/maptext_width.md) -> + [maptext_height var (atom)](/ref/atom/var/maptext_height.md) -> + [maptext_x var (atom)](/ref/atom/var/maptext_x.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) \ No newline at end of file +*** +**Related Pages:** ++ [maptext](/ref/atom/var/maptext) ++ [maptext_width](/ref/atom/var/maptext_width) ++ [maptext_height](/ref/atom/var/maptext_height) ++ [maptext_x](/ref/atom/var/maptext_x) ++ [icon_size var (world)](/ref/world/var/icon_size) diff --git a/ref/atom/var/mouse_drag_pointer.md b/ref/atom/var/mouse_drag_pointer.md index 83d4f19b..2a63900e 100644 --- a/ref/atom/var/mouse_drag_pointer.md +++ b/ref/atom/var/mouse_drag_pointer.md @@ -1,29 +1,19 @@ -## mouse_drag_pointer var (atom) +## mouse_drag_pointer (var) -**Default value:** +**Default Value:** + MOUSE_INACTIVE_POINTER (0) +*** +This defines how the mouse looks when dragging this object. Assigning this to MOUSE_ACTIVE_POINTER (1) enables the default dragging indicator. +This variable may also be set to any of the other built-in mouse pointers, or a custom icon or icon state. If an icon state is specified, this is applied against the object's main icon to find a custom pointer. -This defines how the mouse looks when dragging this object. -Assigning this to MOUSE_ACTIVE_POINTER (1) enables the default dragging -indicator. - -This variable may also be set to any of the other -[built-in mouse pointers](/ref/DM/mouse/pointers.md) or a custom icon or icon -state. If an icon state is specified, this is applied against the -object\'s main icon to find a custom pointer. - -Note that all -mouse pointers are purely visual indicators. They do not effect what -objects may actually be manipulated with the mouse. You control all of -the real behavior in the associated procedures. - -> [!TIP] -> **See also:** -> + [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) -> + [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) -> + [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) -> + [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +Note that all mouse pointers are purely visual indicators. They do not effect what objects may actually be manipulated with the mouse. You control all of the real behavior in the associated procedures. +*** +**Related Pages:** ++ [MouseDrag](/ref/atom/proc/MouseDrag) ++ [MouseDrop](/ref/atom/proc/MouseDrop) ++ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer) ++ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/atom/var/mouse_drop_pointer.md b/ref/atom/var/mouse_drop_pointer.md index a7361c50..a0bb0ccb 100644 --- a/ref/atom/var/mouse_drop_pointer.md +++ b/ref/atom/var/mouse_drop_pointer.md @@ -1,33 +1,20 @@ -## mouse_drop_pointer var (atom) +## mouse_drop_pointer (var) -**Default value:** +**Default Value:** + MOUSE_ACTIVE_POINTER (1) +*** +This defines how the mouse looks when dragging this object over another object that has `mouse_drop_zone` set. The default value enables the addition of a standard "droppable" indicator to whatever `mouse_drag_pointer` is (unless `mouse_drag_pointer` is turned off). +This variable may also be set to any of the other built-in mouse pointers, or a custom icon or icon state. If an icon state is specified, this is applied against the object's main icon to find a custom pointer. -This defines how the mouse looks when dragging this object over -another object that has `mouse_drop_zone` set. The default -value enables the addition of a standard "droppable" indicator to -whatever `mouse_drag_pointer` is (unless -`mouse_drag_pointer` is turned off). - -This variable -may also be set to any of the other [built-in mouse -pointers](/ref/DM/mouse/pointers.md) or a custom icon or icon state. If an -icon state is specified, this is applied against the object\'s main icon -to find a custom pointer. - -Note that all mouse pointers are -purely visual indicators. They do not effect what objects may actually -be manipulated with the mouse. You control all of the real behavior in -the associated procedures. - -> [!TIP] -> **See also:** -> + [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) -> + [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) -> + [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) -> + [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +Note that all mouse pointers are purely visual indicators. They do not effect what objects may actually be manipulated with the mouse. You control all of the real behavior in the associated procedures. +*** +**Related Pages:** ++ [MouseDrag](/ref/atom/proc/MouseDrag) ++ [MouseDrop](/ref/atom/proc/MouseDrop) ++ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer) ++ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/atom/var/mouse_drop_zone.md b/ref/atom/var/mouse_drop_zone.md index 4624cb5a..f6c8d390 100644 --- a/ref/atom/var/mouse_drop_zone.md +++ b/ref/atom/var/mouse_drop_zone.md @@ -1,22 +1,16 @@ -## mouse_drop_zone var (atom) - -**Default value:** -+ 0 +## mouse_drop_zone (var) -Setting this to 1 indicates that this object is a valid site on -which to drop other objects. While dragging, -`mouse_drop_cursor` of the object being dragged will become -active in this case. Note that this is a purely visual effect. It does -not control what the user may do with the mouse. You control the real -behavior with the associated procedures. - -> [!TIP] -> **See also:** -> + [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) -> + [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) -> + [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) -> + [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +Setting this to 1 indicates that this object is a valid site on which to drop other objects. While dragging, `mouse_drop_cursor` of the object being dragged will become active in this case. Note that this is a purely visual effect. It does not control what the user may do with the mouse. You control the real behavior with the associated procedures. +*** +**Related Pages:** ++ [MouseDrag](/ref/atom/proc/MouseDrag) ++ [MouseDrop](/ref/atom/proc/MouseDrop) ++ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer) ++ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/atom/var/mouse_opacity.md b/ref/atom/var/mouse_opacity.md index 9f9a1d1f..12750eb1 100644 --- a/ref/atom/var/mouse_opacity.md +++ b/ref/atom/var/mouse_opacity.md @@ -1,43 +1,18 @@ -## mouse_opacity var (atom) +## mouse_opacity (var) -**Default value:** +**Default Value:** + 1 - -**Possible values:** -+ 0 // transparent to mouse -+ 1 // mouse-opaque where icon is also opaque -+ 2 // completely mouse-opaque - - -This may be used to control how mouse operations on an object -are interpreted. A click or mouse movement over an object\'s icon -normally applies to that object only if it is the topmost object that is -not transparent at the position of the mouse. Setting `mouse_opacity` to -0 would cause the object to be ignored completely, and setting it to 2 -causes it to always be chosen over any lower-level objects, regardless -of the transparency of its icon. - -Note that overlays and -underlays are not distinct objects, so their `mouse_opacity` is -completely ignored in favor of the object they\'re attached to. The same -applies to [image objects](/ref/image.md) , which act like special overlays as -well. [Visual contents](/ref/atom/var/vis_contents.md) , on the other hand, are -separate objects that can act like overlays in some ways, but because -they\'re separate their `mouse_opacity` *is* taken into account. - - -When this is applied to a `PLANE_MASTER` object (see -[appearance_flags](/ref/atom/var/appearance_flags.md) , a value of 0 means -everything on the plane is mouse-transparent. 1 means everything on the -plane is mouse-visible (using the objects\' normal mouse_opacity), but -the plane master itself is not. 2 means everything on the plane is -mouse-visible, and so is the plane master. - -> [!TIP] -> **See also:** -> + [mouse handling](/ref/DM/mouse.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [underlays var (atom)](/ref/atom/var/underlays.md) -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [render_source var (atom)](/ref/atom/var/render_source.md) \ No newline at end of file +*** +This may be used to control how mouse operations on an object are interpreted. A click or mouse movement over an object's icon normally applies to that object only if it is the topmost object that is not transparent at the position of the mouse. Setting `mouse_opacity` to 0 would cause the object to be ignored completely, and setting it to 2 causes it to always be chosen over any lower-level objects, regardless of the transparency of its icon. + +Note that overlays and underlays are not distinct objects, so their `mouse_opacity` is completely ignored in favor of the object they're attached to. The same applies to image objects, which act like special overlays as well. Visual contents, on the other hand, are separate objects that can act like overlays in some ways, but because they're separate their `mouse_opacity` *is* taken into account. + +When this is applied to a `PLANE_MASTER` object (see appearance_flags), a value of 0 means everything on the plane is mouse-transparent. 1 means everything on the plane is mouse-visible (using the objects' normal mouse_opacity), but the plane master itself is not. 2 means everything on the plane is mouse-visible, and so is the plane master. +*** +**Related Pages:** ++ [mouse handling](/ref/DM/mouse) ++ [overlays](/ref/atom/var/overlays) ++ [underlays](/ref/atom/var/underlays) ++ [vis_contents](/ref/atom/var/vis_contents) ++ [render_source](/ref/atom/var/render_source) diff --git a/ref/atom/var/mouse_over_pointer.md b/ref/atom/var/mouse_over_pointer.md index 95a3ba78..f385f228 100644 --- a/ref/atom/var/mouse_over_pointer.md +++ b/ref/atom/var/mouse_over_pointer.md @@ -1,33 +1,22 @@ -## mouse_over_pointer var (atom) +## mouse_over_pointer (var) -**Default value:** +**Default Value:** + MOUSE_INACTIVE_POINTER (0) +*** +This defines how the mouse looks when no buttons are pressed and it is held over this object. Assigning this to MOUSE_ACTIVE_POINTER (1) enables the default indicator that there is something special under the mouse (crosshairs). +This variable may also be set to any of the other built-in mouse pointers, or a custom icon or icon state. If an icon state is specified, this is applied against the object's main icon to find a custom pointer. -This defines how the mouse looks when no buttons are pressed -and it is held over this object. Assigning this to MOUSE_ACTIVE_POINTER -(1) enables the default indicator that there is something special under -the mouse (crosshairs). - -This variable may also be set to any of -the other [built-in mouse pointers](/ref/DM/mouse/pointers.md) or a custom -icon or icon state. If an icon state is specified, this is applied -against the object\'s main icon to find a custom pointer. - -Note -that all mouse pointers are purely visual indicators. They do not effect -what objects may actually be manipulated with the mouse. You control all -of the real behavior in the associated procedures. - -> [!TIP] -> **See also:** -> + [Click proc (atom)](/ref/atom/proc/Click.md) -> + [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) -> + [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) -> + [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) -> + [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) -> + [mouse_drop_pointer var (atom)](/ref/atom/var/mouse_drop_pointer.md) -> + [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +Note that all mouse pointers are purely visual indicators. They do not effect what objects may actually be manipulated with the mouse. You control all of the real behavior in the associated procedures. +*** +**Related Pages:** ++ [Click](/ref/atom/proc/Click) ++ [MouseEntered](/ref/atom/proc/MouseEntered) ++ [MouseExited](/ref/atom/proc/MouseExited) ++ [MouseMove](/ref/atom/proc/MouseMove) ++ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer) ++ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer) ++ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/atom/var/name.md b/ref/atom/var/name.md index ad2f3c2d..8eaf0a4d 100644 --- a/ref/atom/var/name.md +++ b/ref/atom/var/name.md @@ -1,8 +1,8 @@ -## name var (atom) -**Default value:** -+ The name of the object type with underscores converted to spaces. +## name (var) -> [!TIP] -> **See also:** -> + [gender var (atom)](/ref/atom/var/gender.md) \ No newline at end of file +**Default Value:** ++ The name of the object type with underscores converted to spaces. +****** +**Related Pages:** ++ [gender](/ref/atom/var/gender) diff --git a/ref/atom/var/opacity.md b/ref/atom/var/opacity.md index 4e01a2ff..4577a43c 100644 --- a/ref/atom/var/opacity.md +++ b/ref/atom/var/opacity.md @@ -1,7 +1,8 @@ -# opacity var (atom) -**Default value:** -+ 0 +## opacity (var) -This turns the object\'s opacity on or off (1 or 0). Opaque -objects block light. \ No newline at end of file +**Default Value:** ++ 0 +*** +This turns the object's opacity on or off (1 or 0). Opaque objects block light. +*** \ No newline at end of file diff --git a/ref/atom/var/overlays.md b/ref/atom/var/overlays.md index 51b52754..76094f06 100644 --- a/ref/atom/var/overlays.md +++ b/ref/atom/var/overlays.md @@ -1,123 +1,83 @@ -## overlays var (atom) +## overlays (var) -**Default value:** +**Default Value:** + empty list +*** +Overlays are relatively static and cannot be altered on the fly, only replaced. They're your best-performing option for very simple things that won't change often. If you need something that allows dynamic changes you may prefer to look into image objects (which can also be selectively shown to only certain players) or visual contents which are more versatile. -> [!IMPORTANT] -> Overlays are relatively static and cannot be altered on the -fly, only replaced. They\'re your best-performing option for very simple -things that won\'t change often. If you need something that allows -dynamic changes you may prefer to look into [image objects](/ref/image.md) -(which can also be selectively shown to only certain players) or [visual -contents](/ref/atom/var/vis_contents.md) which are more versatile. +This is a list of simple icons which are displayed on top of the object's main icon. +The individual items in the list may not be directly accessed, since they are stored in a special internal format. However, the list operators +=, -=, and the procedures Add, Remove, and Cut work normally. -This is a list of simple icons which are displayed on top of -the object\'s main icon. - -The individual items in the list may -not be directly accessed, since they are stored in a [special internal -format](/ref/atom/var/appearance.md) However, the list operators `+=`, `-=`, -and the procedures `Add`, `Remove`, and `Cut` work normally. - -### Example: ```dm -turf/verb/AddOverlay(I as icon) - overlays += I +turf/verb/AddOverlay(I as icon) + overlays += I turf/verb/RemoveOverlay(I as icon) - overlays -= I + overlays -= I + ``` -The -data types that may be used as overlays are icons, icon states (text -strings), objects, and object types. When an icon state is used, the -corresponding image in the object\'s icon is displayed. When another -object is used as an overlay, a static "snapshot" of the object is -taken at the time when the overlay is created. Future changes to the -object will not change the appearance of the overlay, except that in -some cases the overlay may inherit things from the base object like its -icon (if left empty), direction, and moving state. - -Overlays -have their own independent drawing layer. It is normally the special -value FLOAT_LAYER, which makes them float above the base object. If the -overlay is a snapshot of another object, the drawing layer of that -object is used (and in that case, the overlay can appear beneath the -object if its layer is lower). The important advantage of using -FLOAT_LAYER is that if the layer of the base object changes, the -overlays will move with it into the new layer. - -Any negative -number may be used in place of FLOAT_LAYER (which happens to be -1). -They all cause the same "floating" behavior. However, the overlays are -ordered amongst themselves according to their own relative layer values -(-2 below -1 and so on). This may be useful if you have several classes -of overlays that should always appear in a certain order, because you -would not have to worry about the order in which you add them to the -list. -### Example: + +The data types that may be used as overlays are icons, icon states (text strings), objects, and object types. When an icon state is used, the corresponding image in the object's icon is displayed. When another object is used as an overlay, a static "snapshot" of the object is taken at the time when the overlay is created. Future changes to the object will not change the appearance of the overlay, except that in some cases the overlay may inherit things from the base object like its icon (if left empty), direction, and moving state. + +Overlays have their own independent drawing layer. It is normally the special value FLOAT_LAYER, which makes them float above the base object. If the overlay is a snapshot of another object, the drawing layer of that object is used (and in that case, the overlay can appear beneath the object if its layer is lower). The important advantage of using FLOAT_LAYER is that if the layer of the base object changes, the overlays will move with it into the new layer. + +Any negative number may be used in place of FLOAT_LAYER (which happens to be -1). They all cause the same "floating" behavior. However, the overlays are ordered amongst themselves according to their own relative layer values (-2 below -1 and so on). This may be useful if you have several classes of overlays that should always appear in a certain order, because you would not have to worry about the order in which you add them to the list. + ```dm + var/const - ARMOR_LAYER = FLOAT_LAYER-1 - CLOTHES_LAYER = FLOAT_LAYER-2 - + ARMOR_LAYER = FLOAT_LAYER-1 + CLOTHES_LAYER = FLOAT_LAYER-2 obj/overlay - armor - icon = 'armor.dmi' - layer = ARMOR_LAYER - clothes - icon = 'clothes.dmi' - layer = CLOTHES_LAYER - + armor + icon = 'armor.dmi' + layer = ARMOR_LAYER + clothes + icon = 'clothes.dmi' + layer = CLOTHES_LAYER mob/verb - wear_clothes() - overlays += /obj/overlay/clothes - wear_armor() - overlays += /obj/overlay/armor - remove_clothes() - overlays -= /obj/overlay/clothes - remove_armor() - overlays -= /obj/overlay/armor + wear_clothes() + overlays += /obj/overlay/clothes + wear_armor() + overlays += /obj/overlay/armor + remove_clothes() + overlays -= /obj/overlay/clothes + remove_armor() + overlays -= /obj/overlay/armor + ``` - -That -example used object types, but you can use instances of objects as well. -Rather than using different "float" layers, you can also just make -your own list of overlays with the order you want and assign that to the -actual overlays list. -### Example: +That example used object types, but you can use instances of objects as well. Rather than using different "float" layers, you can also just make your own list of overlays with the order you want and assign that to the actual overlays list. + ```dm + mob/var - boots - clothes + boots + clothes armor - mob/proc - ShowOverlays() - var/L[0] - if(boots) - L += boots - if(clothes) - L += clothes - if(armor) - L += armor - overlays = L -``` + ShowOverlays() + var/L[0] + if(boots) L += boots + if(clothes) L += clothes + if(armor) L += armor + overlays = L +``` -> [!TIP] -> **See also:** -> + [underlays var (atom)](/ref/atom/var/underlays.md) -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [list](/ref/list.md) -> + [image objects](/ref/image.md) -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +*** +**Related Pages:** ++ [underlays](/ref/atom/var/underlays) ++ [icon var (atom)](/ref/atom/var/icon) ++ [layer var (atom)](/ref/atom/var/layer) ++ [list](/ref/list) ++ [image objects](/ref/image) ++ [vis_contents](/ref/atom/var/vis_contents) ++ [Understanding the renderer](/ref/{notes}/renderer) diff --git a/ref/atom/var/override.md b/ref/atom/var/override.md index 7820e10b..0d3c5b82 100644 --- a/ref/atom/var/override.md +++ b/ref/atom/var/override.md @@ -1,18 +1,12 @@ -## override var (atom) -**Default value:** -+ 0 - -> [!IMPORTANT] -> Currently this only applies to [images](/ref/image.md) +## override (var) +**Default Value:** ++ 0 +*** +**Currently this only applies to images.** -If you attach an image to an atom, normally it is seen only in -addition to the atom\'s regular icon. If the image\'s override var is 1, -it will be seen *in place of* the original atom (and its overlays). It -will inherit the atom\'s color, alpha, transform, and appearance_flags, -unless its own appearance_flags say otherwise. +If you attach an image to an atom, normally it is seen only in addition to the atom's regular icon. If the image's override var is 1, it will be seen *in place of* the original atom (and its overlays). It will inherit the atom's color, alpha, transform, and appearance_flags, unless its own appearance_flags say otherwise. -If the image has -a specific name and/or suffix value, those will override the parent atom -too. Leaving them blank will let the original atom take precedence. \ No newline at end of file +If the image has a specific name and/or suffix value, those will override the parent atom too. Leaving them blank will let the original atom take precedence. +*** \ No newline at end of file diff --git a/ref/atom/var/pixel_w.md b/ref/atom/var/pixel_w.md index 8d417370..5e3c52d3 100644 --- a/ref/atom/var/pixel_w.md +++ b/ref/atom/var/pixel_w.md @@ -1,26 +1,18 @@ -## pixel_w var (atom) -###### BYOND Version 511 -**Default value:** -+ 0 - -This displaces the object\'s icon horizontally by the specified -number of pixels. This is meant to be used in situations where -world.map_format is used to display something other than a top-down -form, for instance in an isometric or side-view display. In a top-down -mode pixel_w behaves the same as pixel_x, except that it does not rotate -with changes to client.dir. +## pixel_w (var) -This effect is purely visual and -does not influence such things as movement bumping or view() range -calculations. +**Default Value:** ++ 0 +*** +This displaces the object's icon horizontally by the specified number of pixels. This is meant to be used in situations where world.map_format is used to display something other than a top-down form, for instance in an isometric or side-view display. In a top-down mode pixel_w behaves the same as pixel_x, except that it does not rotate with changes to client.dir. -> [!TIP] -> **See also:** -> + [animate_movement var (movable atoms)](/ref/atom/movable/var/animate_movement.md) -> + [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) -> + [pixel_x var (atom)](/ref/atom/var/pixel_x.md) -> + [pixel_y var (atom)](/ref/atom/var/pixel_y.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) \ No newline at end of file +This effect is purely visual and does not influence such things as movement bumping or view() range calculations. +*** +**Related Pages:** ++ [animate_movement var (movable atom)](/ref/atom/movable/var/animate_movement) ++ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size) ++ [pixel_x](/ref/atom/var/pixel_x) ++ [pixel_y](/ref/atom/var/pixel_y) ++ [pixel_z var (atom)](/ref/atom/var/pixel_z) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) diff --git a/ref/atom/var/pixel_x.md b/ref/atom/var/pixel_x.md index 09070e62..a0887247 100644 --- a/ref/atom/var/pixel_x.md +++ b/ref/atom/var/pixel_x.md @@ -1,32 +1,21 @@ -## pixel_x var (atom) +## pixel_x (var) -**Default value:** +**Default Value:** + 0 +*** +This displaces the object's icon on the x-axis by the specified number of pixels. In a project with a standard 32x32 tile size, this can range from -32 to +32. (You can get away with larger displacements, but they are not guaranteed to work for objects off the edge of the map.) +Since overlays and images can each have their own additional displacements, this makes it possible to create visual effects that extend beyond the object's own cell in the turf grid, but which automatically move around with the object. -This displaces the object\'s icon on the x-axis by the -specified number of pixels. In a project with a standard 32x32 tile -size, this can range from -32 to +32. (You can get away with larger -displacements, but they are not guaranteed to work for objects off the -edge of the map.) - -Since overlays and images can each have their -own additional displacements, this makes it possible to create visual -effects that extend beyond the object\'s own cell in the turf grid, but -which automatically move around with the object. - -This effect is -purely visual and does not influence such things as movement bumping or -view() range calculations. - -> [!TIP] -> **See also:** -> + [animate_movement var (movable atoms)](/ref/atom/movable/var/animate_movement.md) -> + [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) -> + [pixel_y var (atom)](/ref/atom/var/pixel_y.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +This effect is purely visual and does not influence such things as movement bumping or view() range calculations. +*** +**Related Pages:** ++ [animate_movement var (movable atom)](/ref/atom/movable/var/animate_movement) ++ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size) ++ [pixel_y](/ref/atom/var/pixel_y) ++ [pixel_w var (atom)](/ref/atom/var/pixel_w) ++ [pixel_z var (atom)](/ref/atom/var/pixel_z) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/atom/var/pixel_y.md b/ref/atom/var/pixel_y.md index 97b01a04..aa1065c8 100644 --- a/ref/atom/var/pixel_y.md +++ b/ref/atom/var/pixel_y.md @@ -1,32 +1,21 @@ -## pixel_y var (atom) +## pixel_y (var) -**Default value:** +**Default Value:** + 0 +*** +This displaces the object's icon on the y-axis by the specified number of pixels. In a project with a standard 32x32 tile size, this can range from -32 to +32. (You can get away with larger displacements, but they are not guaranteed to work for objects off the edge of the map.) +Since overlays and images can each have their own additional displacements, this makes it possible to create visual effects that extend beyond the object's own cell in the turf grid, but which automatically move around with the object. -This displaces the object\'s icon on the y-axis by the -specified number of pixels. In a project with a standard 32x32 tile -size, this can range from -32 to +32. (You can get away with larger -displacements, but they are not guaranteed to work for objects off the -edge of the map.) - -Since overlays and images can each have their -own additional displacements, this makes it possible to create visual -effects that extend beyond the object\'s own cell in the turf grid, but -which automatically move around with the object. - -This effect is -purely visual and does not influence such things as movement bumping or -view() range calculations. - -> [!TIP] -> **See also:** -> + [animate_movement var (movable atoms)](/ref/atom/movable/var/animate_movement.md) -> + [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) -> + [pixel_x var (atom)](/ref/atom/var/pixel_x.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +This effect is purely visual and does not influence such things as movement bumping or view() range calculations. +*** +**Related Pages:** ++ [animate_movement var (movable atom)](/ref/atom/movable/var/animate_movement) ++ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size) ++ [pixel_x](/ref/atom/var/pixel_x) ++ [pixel_w var (atom)](/ref/atom/var/pixel_w) ++ [pixel_z var (atom)](/ref/atom/var/pixel_z) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/atom/var/pixel_z.md b/ref/atom/var/pixel_z.md index e98b594d..49ccd18e 100644 --- a/ref/atom/var/pixel_z.md +++ b/ref/atom/var/pixel_z.md @@ -1,27 +1,18 @@ -## pixel_z var (atom) +## pixel_z (var) -**Default value:** +**Default Value:** + 0 +*** +This displaces the object's icon vertically by the specified number of pixels. This is meant to be used in situations where world.map_format is used to display something other than a top-down form, for instance in an isometric or side-view display. In a top-down mode pixel_z behaves the same as pixel_y, except that it does not rotate with changes to client.dir. - -This displaces the object\'s icon vertically by the specified -number of pixels. This is meant to be used in situations where -world.map_format is used to display something other than a top-down -form, for instance in an isometric or side-view display. In a top-down -mode pixel_z behaves the same as pixel_y, except that it does not rotate -with changes to client.dir. - -This effect is purely visual and -does not influence such things as movement bumping or view() range -calculations. - -> [!TIP] -> **See also:** -> + [animate_movement var (movable atoms)](/ref/atom/movable/var/animate_movement.md) -> + [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) -> + [pixel_x var (atom)](/ref/atom/var/pixel_x.md) -> + [pixel_y var (atom)](/ref/atom/var/pixel_y.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) \ No newline at end of file +This effect is purely visual and does not influence such things as movement bumping or view() range calculations. +*** +**Related Pages:** ++ [animate_movement var (movable atom)](/ref/atom/movable/var/animate_movement) ++ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size) ++ [pixel_x](/ref/atom/var/pixel_x) ++ [pixel_y](/ref/atom/var/pixel_y) ++ [pixel_w var (atom)](/ref/atom/var/pixel_w) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) diff --git a/ref/atom/var/pixloc.md b/ref/atom/var/pixloc.md index 885eb811..cf13fedc 100644 --- a/ref/atom/var/pixloc.md +++ b/ref/atom/var/pixloc.md @@ -1,43 +1,32 @@ -## pixloc var (atom) -###### BYOND Version 516 +## pixloc (var) +*** +Returns a pixloc representing this atom's physical position. The position is based on its `loc`, `step_x`, `step_y`, `bound_x`, and `bound_y`. This var is read-only for areas and turfs, but writable for movable atoms. When changed, it will alter the related vars. A movable's pixloc is null if it isn't located on a turf. +A pixloc can be used for calculating distances, or passed to various procs such as get_dir() and Move(). -Returns a [pixloc](/ref/pixloc.md) representing this atom\'s `loc`, `step_x`, and -`step_y` positions. This var is read-only for areas and turfs, but -writable for movable atoms. When changed, it will alter the related -vars. A movable\'s pixloc is null if it isn\'t located on a turf. +This pixloc is equivalent to bound_pixloc(src,SOUTHWEST). You can use the `bound_pixloc()` proc to get the pixloc of an atom's other corners or center of bounds. +The returned pixloc is not tied to this atom, so changing its vars will not alter the atom's pixloc. The only exception is when using operators such as `+=`, since `a += b` is just a shortcut for `a = a + b`. -A pixloc can be used for calculating distances, or passed to -various procs such as [get_dir()](/ref/proc/get_dir.md) and -[Move()](/ref/atom/movable/proc/Move.md) . -This pixloc does not -take bounds into account. See -[bound_pixloc()](/ref/proc/bound_pixloc.md) for getting the pixloc of -an atom\'s corners or center of bounds. - -The returned pixloc is -not tied to this atom, so changing its vars will not alter the atom\'s -pixloc. The only exception is when using operators such as `+=`, since -`a += b` is just a shortcut for `a = a + b`. ```dm + // does not alter obj's position var/pixloc/p = obj.pixloc -p.step_x += 12 +p.step_x += 12 // does alter obj's position, since a += b is just a = a + b -obj.pixloc += vector(12,0) -``` +obj.pixloc += vector(12,0) +``` -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [loc var (atom)](/ref/atom/var/loc.md) -> + [step_x var (movable atoms)](/ref/atom/movable/var/step_x.md) -> + [step_y var (movable atoms)](/ref/atom/movable/var/step_y.md) -> + [pixloc proc](/ref/proc/pixloc.md) -> + [bound_pixloc proc](/ref/proc/bound_pixloc.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [loc](/ref/atom/var/loc) ++ [step_x var (movable atom)](/ref/atom/movable/var/step_x) ++ [step_y var (movable atom)](/ref/atom/movable/var/step_y) ++ [pixloc proc](/ref/proc/pixloc) ++ [bound_pixloc proc](/ref/proc/bound_pixloc) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/atom/var/plane.md b/ref/atom/var/plane.md index 870b450f..096b1121 100644 --- a/ref/atom/var/plane.md +++ b/ref/atom/var/plane.md @@ -1,36 +1,18 @@ -## plane var (atom) -###### BYOND Version 509 +## plane (var) -**Default value:** -+ `FLOAT_PLANE` +**Default Value:** ++ +*** +The value of plane overrides layer, and is mainly used for non-topdown map formats like isometric. Positive values are drawn on top, and negative values are drawn below. This mostly deprecates `EFFECTS_LAYER` and `BACKGROUND_LAYER`, but they can still be useful when using `PLANE_MASTER` for effects (see appearance_flags). -**Possible values:** -+ -10000 to 10000 (integers only), `FLOAT_PLANE+p` +The special value `FLOAT_PLANE` can be used for images and overlays, to take on the plane of the parent atom. Whenever an icon or icon_state is used directly as an overlay, this is its plane. If there is no parent atom, the plane is 0. - -The value of plane overrides layer, and is mainly used for -non-topdown map formats like isometric. Positive values are drawn on -top, and negative values are drawn below. This mostly deprecates -`EFFECTS_LAYER` and `BACKGROUND_LAYER`, but they can still be useful -when using `PLANE_MASTER` for effects (see -[appearance_flags](/ref/atom/var/appearance_flags.md)). - -The -special value `FLOAT_PLANE` can be used for images and overlays, to take -on the plane of the parent atom. Whenever an icon or icon_state is used -directly as an overlay, this is its plane. If there is no parent atom, -the plane is 0. -You can also use `FLOAT_PLANE` as a relative value, so `FLOAT_PLANE+1` -adds 1 to the parent atom\'s plane. This may be useful for some -applications where an object is included in visual contents. The added -value should still be kept in the range of -10000 to 10000, or -preferably much smaller. - -> [!TIP] -> **See also:** -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +You can also use `FLOAT_PLANE` as a relative value, so `FLOAT_PLANE+1` adds 1 to the parent atom's plane. This may be useful for some applications where an object is included in visual contents. The added value should still be kept in the range of -10000 to 10000, or preferably much smaller. +*** +**Related Pages:** ++ [layer var (atom)](/ref/atom/var/layer) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) ++ [vis_contents](/ref/atom/var/vis_contents) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Understanding the renderer](/ref/{notes}/renderer) diff --git a/ref/atom/var/render_source.md b/ref/atom/var/render_source.md index fef8a891..eab98b5f 100644 --- a/ref/atom/var/render_source.md +++ b/ref/atom/var/render_source.md @@ -1,39 +1,19 @@ -## render_source var (atom) -**Default value:** -+ null - -**Possible values:** -+ Any non-empty text string +## render_source (var) -If any icon uses `render_source`, the renderer will look for -another icon with a matching `render_target` value on the visible map, -and draw that in place of the `icon`/`icon_state`/`dir` that it normally -would. The same render target might be used as a source multiple times, -and for a complex image this can save some rendering time. This is also -usable for special effects such as [filters](/ref/notes/filters.md) that -might require copies of an image. - -Note: The corresponding -`render_target` *must* be visible to the player for a render source to -be used. +**Default Value:** ++ null +*** +If any icon uses `render_source`, the renderer will look for another icon with a matching `render_target` value on the visible map, and draw that in place of the `icon`/`icon_state`/`dir` that it normally would. The same render target might be used as a source multiple times, and for a complex image this can save some rendering time. This is also usable for special effects such as filters that might require copies of an image. -The replacement icon from the `render_source` will be -anchored to the bottom left of the icon it replaces. +Note: The corresponding `render_target` *must* be visible to the player for a render source to be used. -Other vars -that would normally affect the appearance of this icon, such as `color`, -`transform`, `filters`, `appearance_flags`, etc. are all applied. -Additionally, if this object has overlays, underlays, or visual -contents, those will still be drawn as well. +The replacement icon from the `render_source` will be anchored to the bottom left of the icon it replaces. -Note: Any mouse -hits on this object belong to the object itself, not to the object used -in the `render_source` or its children. If you want mouse clicks and -other behavior to go to the source, use the `PASS_MOUSE` [appearance -flag](/ref/atom/var/appearance_flags.md) +Other vars that would normally affect the appearance of this icon, such as `color`, `transform`, `filters`, `appearance_flags`, etc. are all applied. Additionally, if this object has overlays, underlays, or visual contents, those will still be drawn as well. -> [!TIP] -> **See also:** -> + [render_target var (atom)](/ref/atom/var/render_target.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) \ No newline at end of file +Note: Any mouse hits on this object belong to the object itself, not to the object used in the `render_source` or its children. If you want mouse clicks and other behavior to go to the source, use the `PASS_MOUSE` appearance flag. +*** +**Related Pages:** ++ [render_target var (atom)](/ref/atom/var/render_target) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) diff --git a/ref/atom/var/render_target.md b/ref/atom/var/render_target.md index 2890b396..edf1e012 100644 --- a/ref/atom/var/render_target.md +++ b/ref/atom/var/render_target.md @@ -1,48 +1,24 @@ -## render_target var (atom) -**Default value:** -+ null +## render_target (var) -**Possible values:** -+ Any non-empty text string +**Default Value:** ++ null +*** +If any icon uses `render_target`, and another icon in the scene has a matching `render_source`, this icon will be drawn to a temporary image called a "slate", which can be reused mutiple times for faster drawing and for special effects. -If any icon uses `render_target`, and another icon in the scene -has a matching `render_source`, this icon will be drawn to a temporary -image called a "slate", which can be reused mutiple times for faster -drawing and for special effects. +If the `render_target` value starts with an asterisk (`"*"`), it will not be drawn on the map, but will still be drawn to a slate for reuse. -If the `render_target` value -starts with an asterisk (`"*"`), it will not be drawn on the map, but -will still be drawn to a slate for reuse. +Other vars that would normally affect the appearance of this icon, such as `color`, `transform`, `filters`, `appearance_flags`, etc. are all applied when drawing to the slate. Additionally, if this object has overlays, underlays, or visual contents and uses the `KEEP_TOGETHER` flag to group all of the icons together, those will also be included in the slate. -Other vars that would -normally affect the appearance of this icon, such as `color`, -`transform`, `filters`, `appearance_flags`, etc. are all applied when -drawing to the slate. Additionally, if this object has overlays, -underlays, or visual contents and uses the -[`KEEP_TOGETHER`](/ref/atom/var/appearance_flags.md) flag to group all of the -icons together, those will also be included in the slate. +If the render target is a `PLANE_MASTER`, vars like `pixel_x/y/w/z` will not apply when it is re-drawn as a `render_source`. -If -the render target is a [`PLANE_MASTER`](/ref/atom/var/appearance_flags.md) -vars like `pixel_x/y/w/z` will not apply when it is re-drawn as a -`render_source`. -> [!NOTE] -> To use a `render_target`, the object it belongs to must be -> within the visible part of the map, or in the HUD, etc., so that it -> would be visible to the user under normal circumstances. If not, it will -> not be included in the render process and therefore it can\'t be reused -> as a `render_source`. -> -> Additionally, if you use multiple map -> controls, a given render target can only be used as a source on the same -> map control where it appears. This is because each map is rendered -> separately. +To use a `render_target`, the object it belongs to must be within the visible part of the map, or in the HUD, etc., so that it would be visible to the user under normal circumstances. If not, it will not be included in the render process and therefore it can't be reused as a `render_source`. -> [!TIP] -> **See also:** -> + [render_source var (atom)](/ref/atom/var/render_source.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [filters var (atom)](/ref/atom/var/filters.md) -> + [transform var (atom)](/ref/atom/var/transform.md) \ No newline at end of file +Additionally, if you use multiple map controls, a given render target can only be used as a source on the same map control where it appears. This is because each map is rendered separately. +*** +**Related Pages:** ++ [render_source](/ref/atom/var/render_source) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) ++ [color var (atom)](/ref/atom/var/color) ++ [filters var (atom)](/ref/atom/var/filters) ++ [transform var (atom)](/ref/atom/var/transform) diff --git a/ref/atom/var/suffix.md b/ref/atom/var/suffix.md index 9c15803e..ee2dbeac 100644 --- a/ref/atom/var/suffix.md +++ b/ref/atom/var/suffix.md @@ -1,8 +1,8 @@ -# suffix var (atom) -**Default value:** -+ null +## suffix (var) -This is an optional text string that follows the object\'s name -in the stat panels. For example, items in an inventory list are -displayed as an icon, a name, and a suffix. \ No newline at end of file +**Default Value:** ++ null +*** +This is an optional text string that follows the object's name in the stat panels. For example, items in an inventory list are displayed as an icon, a name, and a suffix. +*** \ No newline at end of file diff --git a/ref/atom/var/text.md b/ref/atom/var/text.md index 21c85e0f..070aa425 100644 --- a/ref/atom/var/text.md +++ b/ref/atom/var/text.md @@ -1,40 +1,30 @@ -# text var (atom) -**Default value:** -+ The first letter of the object's name. +## text (var) -This is the character used to represent the object on text -clients. +**Default Value:** ++ The first letter of the object's name. +*** +This is the character used to represent the object on text clients. -Entering several characters produces a text movie (the -state of the art!). In that case, each character is displayed for a 10th -of a second. +Entering several characters produces a text movie (the state of the art!). In that case, each character is displayed for a 10th of a second. -HTML tags in the text can be used to modify the -colors of the text characters. As a convenience, the tag may -include a `bgcolor` attribute, so you don't have to do a CSS style -setting to accomplish the same thing. +HTML tags in the text can be used to modify the colors of the text characters. As a convenience, the <font> tag may include a bgcolor attribute, so you don't have to do a CSS style setting to accomplish the same thing. -### Example: ```dm - world - maxx = 10 - maxy = 10 +world + maxx = 10 + maxy = 10 area - text = " " - + text = " " turf - text = "......" + text = "......" + ``` - -The example above produces a map with a -blue background (from the area) and turfs (depicted by ".") that flash -from bright red to a shorter span of light red. - -> [!NOTE] -> In order to see text icons, the user must switch to the text map in Dream -Seeker. If your DM code never does anything with the icon variable, then -this is the default configuration. Such applications are known as -*advanced* iconic text games :) \ No newline at end of file + + +The example above produces a map with a blue background (from the area) and turfs (depicted by ".") that flash from bright red to a shorter span of light red. + +Note that in order to see text icons, the user must switch to the text map in Dream Seeker. If your DM code never does anything with the icon variable, then this is the default configuration. Such applications are known as advanced iconic text games:) +*** \ No newline at end of file diff --git a/ref/atom/var/transform.md b/ref/atom/var/transform.md index 5ba72b59..6c42a6d7 100644 --- a/ref/atom/var/transform.md +++ b/ref/atom/var/transform.md @@ -1,33 +1,17 @@ -## transform var (atom) -###### BYOND Version 500 - - -An atom can be made to appear rotated, scaled, and/or -translated (moved) by using affine transforms. This takes a matrix and -multiplies the x and y positions of the icon\'s corners like so: -``` - a d 0 - x y 1 * b e 0 = x' y' 1 - c f 1 -``` +## transform (var) +*** +An atom can be made to appear rotated, scaled, and/or translated (moved) by using affine transforms. This takes a matrix and multiplies the x and y positions of the icon's corners like so: This is equivalent to: -``` - x' = a*x + b*y + c - y' = d*x + e*y + f -``` - -You do not need to understand matrix math to use transforms, -because you can use the [matrix datum](/ref/matrix.md) to do this for you. +You do not need to understand matrix math to use transforms, because you can use the matrix datum to do this for you. -Transformations are relative to the center of the icon. They do -not apply to maptext. +Transformations are relative to the center of the icon. They do not apply to maptext. -### Examples: ```dm + // Rotate the atom by 45° clockwise src.transform = turn(src.transform, 45) @@ -42,19 +26,15 @@ src.transform *= 2 // OR var/matrix/M = matrix() M.Scale(2,2) -src.transform = M +src.transform = M + ``` -Whenever you read the atom.transform var, you will get a *copy* -of the atom\'s current transformation. Whenever you assign a value to -the var, you will update the transformation. -Assigning null to -atom.transform will revert the atom to using no transformation at all. -It is also legal to assign a list with six values, which is equivalent -to using a matrix. +Whenever you read the atom.transform var, you will get a *copy* of the atom's current transformation. Whenever you assign a value to the var, you will update the transformation. -> [!TIP] -> **See also:** -> + [vars (atom)](/ref/atom/var.md) -> + [matrix](/ref/matrix.md) \ No newline at end of file +Assigning null to atom.transform will revert the atom to using no transformation at all. It is also legal to assign a list with six values, which is equivalent to using a matrix. +*** +**Related Pages:** ++ [vars (atom)](/ref/atom/var) ++ [matrix](/ref/matrix) diff --git a/ref/atom/var/underlays.md b/ref/atom/var/underlays.md index f2353a5f..daf5ffbb 100644 --- a/ref/atom/var/underlays.md +++ b/ref/atom/var/underlays.md @@ -1,29 +1,17 @@ -## underlays var (atom) +## underlays (var) -**Default value:** +**Default Value:** + empty list - - -This is a list of icons which are displayed underneath the -object\'s main icon. Since these are basically the same as overlays, see -[overlays](/ref/atom/var/overlays.md) for more detailed information. - - -The only real differences between items in the underlays list -vs. the overlays list is that they\'re processed first, and if they use -`FLOAT_LAYER` (or any other negative layer value) they\'ll appear below -the object instead of above it. For this reason, the underlays list -isn\'t used nearly as much as overlays since it\'s easier to throw most -things into the overlays list. - -When multiple turfs are stacked -on top of one another in the map editor, there is actually only one turf -(the topmost) and the rest are all underlays. - -> [!TIP] -> **See also:** -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [list](/ref/list.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +*** +This is a list of icons which are displayed underneath the object's main icon. Since these are basically the same as overlays, see overlays for more detailed information. + +The only real differences between items in the underlays list vs. the overlays list is that they're processed first, and if they use `FLOAT_LAYER` (or any other negative layer value) they'll appear below the object instead of above it. For this reason, the underlays list isn't used nearly as much as overlays since it's easier to throw most things into the overlays list. + +When multiple turfs are stacked on top of one another in the map editor, there is actually only one turf (the topmost) and the rest are all underlays. +*** +**Related Pages:** ++ [icon var (atom)](/ref/atom/var/icon) ++ [list](/ref/list) ++ [overlays](/ref/atom/var/overlays) ++ [Understanding the renderer](/ref/{notes}/renderer) diff --git a/ref/atom/var/verbs.md b/ref/atom/var/verbs.md index 3b3b7fe0..2e52dac8 100644 --- a/ref/atom/var/verbs.md +++ b/ref/atom/var/verbs.md @@ -1,30 +1,27 @@ -## verbs list var (atom) -**Default value:** -+ The list of verbs defined for the object's prototype. +## verbs (var) -This is a list of the object\'s verbs. Initially, it contains -all of the verbs defined in the prototype. It may be used to add and -remove verbs at runtime. +**Default Value:** ++ The list of verbs defined for the object's prototype. +*** +This is a list of the object's verbs. Initially, it contains all of the verbs defined in the prototype. It may be used to add and remove verbs at runtime. -Note that this variable is not -automatically saved when the object is written to a savefile. That -behavior may change in the future. In the mean time, you must save any -necessary changes yourself or they will not be preserved when the object -is loaded. +Note that this variable is not automatically saved when the object is written to a savefile. That behavior may change in the future. In the mean time, you must save any necessary changes yourself or they will not be preserved when the object is loaded. -### Example: ```dm + mob/proc/kazaam() - usr << "Kazaam!" + usr << "Kazaam!" mob/verb/add_kazaam() - verbs += /mob/proc/kazaam mob/verb/remove_kazaam() - verbs -= /mob/proc/kazaam + verbs += /mob/proc/kazaam +mob/verb/remove_kazaam() + verbs -= /mob/proc/kazaam + ``` -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [typesof proc](/ref/proc/typesof.md) \ No newline at end of file +*** +**Related Pages:** ++ [list](/ref/list) ++ [typesof proc](/ref/proc/typesof) diff --git a/ref/atom/var/vis_contents.md b/ref/atom/var/vis_contents.md index 18624233..efdfe001 100644 --- a/ref/atom/var/vis_contents.md +++ b/ref/atom/var/vis_contents.md @@ -1,68 +1,27 @@ -## vis_contents var (atom) -###### BYOND Version 512 +## vis_contents (var) -**Default value:** +**Default Value:** + Empty list. +*** +Turfs, movable atoms, and images can be given a list of atoms (limited to turfs and movable atoms) that are attached to them visually, like an overlay or image object, but act independently and have their own identity. These are **visual contents**. The purpose of visual contents is to provide an alternative system to overlays and images, with a little more flexibility for various special effects. +For example, a mob with an obj in its visual contents will show the obj as if it's following the mob around like an overlay, but clicking on the obj will not—unlike an overlay or an image object—count as a click on the mob. Likewise, the obj will retain its own separate `mouse_opacity` setting, which is not true of regular overlays. -Turfs, movable atoms, and images can be given a list of atoms -(limited to turfs and movable atoms) that are attached to them visually, -like an overlay or image object, but act independently and have their -own identity. These are **visual contents**. The purpose of visual -contents is to provide an alternative system to overlays and images, -with a little more flexibility for various special effects. +An atom that appears on the map normally can still be in the visual contents of another atom. However it will not apply gliding and step offsets here. Also, considerations like visibility will not apply. -For -example, a mob with an obj in its visual contents will show the obj as -if it\'s following the mob around like an overlay, but clicking on the -obj will not---unlike an overlay or an image object---count as a click -on the mob. Likewise, the obj will retain its own separate -`mouse_opacity` setting, which is not true of regular overlays. +If a turf is in an atom's visual contents, the turf and all of that turf's contents will be displayed. (In the case of big atoms, or movable atoms with step offsets, only atoms that actually have that turf as their loc will appear. "Overhangers" will not.) Gliding and step offsets will be applied to that turf's contents normally; but again visibility, opacity, etc. will not be considered. (If you have one or more turfs in visual contents, an object gliding to a new turf outside of that list will not be shown because it's already technically on the new turf.) +If *multiple* turfs are present in visual contents, they will be offset as needed (relative to the southwest-most turf) to appear in the correct positions. That is, `pixel_x` and `pixel_y` offsets will be applied automatically, so if you add an entire block to visual contents (be aware this will impact performance), you don't have to do anything else to make the block appear normal. -An atom that appears on the map normally can still be in the -visual contents of another atom. However it will not apply gliding and -step offsets here. Also, considerations like visibility will not apply. +You can alter some aspects of how an object behaves when in visual contents by changing its vis_flags var. In particular this is useful if you want an object to behave more like an overlay, inheriting aspects of its parent object or even acting like a part of that object instead of an independent one. Also this can make an object act like an underlay instead of an overlay when using a floating layer. +Visual contents do not impact the results of `view()` or `range()`, or verb availability, in any way. This is strictly a visual effect. -If a turf is in an atom\'s visual contents, the turf and all of -that turf\'s contents will be displayed. (In the case of big atoms, or -movable atoms with step offsets, only atoms that actually have that turf -as their loc will appear. "Overhangers" will not.) Gliding and step -offsets *will* be applied to that turf\'s contents normally; but again -visibility, opacity, etc. will not be considered. (If you have one or -more turfs in visual contents, an object gliding to a new turf outside -of that list will not be shown because it\'s already technically on the -new turf.) - -If *multiple* turfs are present in visual contents, -they will be offset as needed (relative to the southwest-most turf) to -appear in the correct positions. That is, `pixel_x` and `pixel_y` -offsets will be applied automatically, so if you add an entire block to -visual contents (be aware this will impact performance), you don\'t have -to do anything else to make the block appear normal. - -You can -alter some aspects of how an object behaves when in visual contents by -changing its [vis_flags](/ref/atom/var/vis_flags.md) var. In particular -this is useful if you want an object to behave more like an overlay, -inheriting aspects of its parent object or even acting like a part of -that object instead of an independent one. Also this can make an object -act like an underlay instead of an overlay when using a floating layer. - - -Visual contents do not impact the results of `view()` or -`range()`, or verb availability, in any way. This is strictly a visual -effect. - -Being in a visual contents list counts as a -[reference](/ref/DM/garbage.md) for anything in the list, the same way that -being on the map or inside of a movable counts as a reference. - -> [!TIP] -> **See also:** -> + [vis_locs var (atom)](/ref/atom/var/vis_locs.md) -> + [vis_flags var (atom)](/ref/atom/var/vis_flags.md) -> + [image objects](/ref/image.md) -> + [HUD / screen objects](/ref/notes/HUD.md) \ No newline at end of file +Being in a visual contents list counts as a reference for anything in the list, the same way that being on the map or inside of a movable counts as a reference. +*** +**Related Pages:** ++ [vis_locs](/ref/atom/var/vis_locs) ++ [vis_flags](/ref/atom/var/vis_flags) ++ [image objects](/ref/image) ++ [HUD / screen objects](/ref/{notes}/HUD) diff --git a/ref/atom/var/vis_flags.md b/ref/atom/var/vis_flags.md index c01b4b92..e2074b1e 100644 --- a/ref/atom/var/vis_flags.md +++ b/ref/atom/var/vis_flags.md @@ -1,51 +1,19 @@ -## vis_flags var (atom) -###### BYOND Version 513 +## vis_flags (var) -**Default value:** +**Default Value:** + 0 +*** +This is a set of flags that determine how this object will behave when it is in another object's visual contents. -**Possible values:** -+ Any combination of: -+ **VIS_INHERIT_ICON**: Use the parent object\'s icon. -+ **VIS_INHERIT_ICON_STATE**: Use the parent object\'s icon_state. -+ **VIS_INHERIT_DIR**: Use the parent object\'s dir. -+ **VIS_INHERIT_LAYER**: Use the parent object\'s layer. -+ **VIS_INHERIT_PLANE**: Use the parent object\'s plane. -+ **VIS_INHERIT_ID**: Use the parent object\'s identity, so it acts - like part of the same object. -+ **VIS_UNDERLAY**: Act as if this is at the bottom of the parent\'s - underlays list instead of overlays (only relevant if using - `VIS_INHERIT_LAYER` or a [FLOAT_LAYER](/ref/atom/var/layer.md) ). -+ **VIS_HIDE**: Do not show this object in visual contents at all. +Because only turfs, objs, and mobs can be in visual contents, this var belongs only to those types. +The `VIS_INHERIT_ID` flag effectively makes this object act like an ordinary overlay when in visual contents. This means its mouse_opacity will be meaningless, for example. -This is a set of flags that determine how this object will -behave when it is in another object\'s visual contents. +Sometimes it's desirable for an object not to show up in visual contents, so `VIS_HIDE` will prevent that. The flag applies even if this object appears indirectly, like if it's in the contents of a turf that is in the visual contents of something else. -Because -only turfs, objs, and mobs can be in visual contents, this var belongs -only to those types. - -The `VIS_INHERIT_ID` flag effectively -makes this object act like an ordinary overlay when in visual contents. -This means its [mouse_opacity](/ref/atom/var/mouse_opacity.md) will be -meaningless, for example. - -Sometimes it\'s desirable for an -object not to show up in visual contents, so `VIS_HIDE` will prevent -that. The flag applies even if this object appears indirectly, like if -it\'s in the contents of a turf that is in the visual contents of -something else. - -Note: Using any of the the flags -`VIS_INHERIT_ICON`, `VIS_INHERIT_ICON_STATE`, `VIS_INHERIT_DIR`, or -`VIS_INHERIT_ID` will cause movable atoms to inherit the "moving" flag -of their container that appears during gliding. E.g., if your mob is -walking, anything in its visual contents that uses these flags will use -a moving icon state instead of a non-moving icon state, when available. - -> [!TIP] -> **See also:** -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [vis_locs var (atom)](/ref/atom/var/vis_locs.md) \ No newline at end of file +Note: Using any of the the flags `VIS_INHERIT_ICON`, `VIS_INHERIT_ICON_STATE`, `VIS_INHERIT_DIR`, or `VIS_INHERIT_ID` will cause movable atoms to inherit the "moving" flag of their container that appears during gliding. E.g., if your mob is walking, anything in its visual contents that uses these flags will use a moving icon state instead of a non-moving icon state, when available. +*** +**Related Pages:** ++ [vis_contents](/ref/atom/var/vis_contents) ++ [vis_locs](/ref/atom/var/vis_locs) diff --git a/ref/atom/var/vis_locs.md b/ref/atom/var/vis_locs.md index 11a7f180..337b1c5c 100644 --- a/ref/atom/var/vis_locs.md +++ b/ref/atom/var/vis_locs.md @@ -1,27 +1,17 @@ -## vis_locs var (atom) -###### BYOND Version 512 +## vis_locs (var) -**Default value:** +**Default Value:** + Empty list. +*** +This list is the opposite of the vis_contents list. If this atom is in any other atoms' visual contents, those parent atoms will appear in this list. +Because only turfs, objs, and mobs can be in visual contents, this var belongs only to those types. -This list is the opposite of the `vis_contents` list. If this -atom is in any other atoms\' visual contents, those parent atoms will -appear in this list. - -Because only turfs, objs, and mobs can be -in visual contents, this var belongs only to those types. - -Being -in a visual locs list does not count as a [reference](/ref/DM/garbage.md) the -same way that being a movable\'s loc does not count as a reference. If -an object in this list otherwise runs out of references, it will be -garbage collected and therefore removed from this list. - -> [!TIP] -> **See also:** -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [vis_flags var (atom)](/ref/atom/var/vis_flags.md) -> + [image objects](/ref/image.md) -> + [HUD / screen objects](/ref/notes/HUD.md) \ No newline at end of file +Being in a visual locs list does not count as a reference, the same way that being a movable's loc does not count as a reference. If an object in this list otherwise runs out of references, it will be garbage collected and therefore removed from this list. +*** +**Related Pages:** ++ [vis_contents](/ref/atom/var/vis_contents) ++ [vis_flags](/ref/atom/var/vis_flags) ++ [image objects](/ref/image) ++ [HUD / screen objects](/ref/{notes}/HUD) diff --git a/ref/atom/var/x.md b/ref/atom/var/x.md index 27a52ee9..3b38cdce 100644 --- a/ref/atom/var/x.md +++ b/ref/atom/var/x.md @@ -1,21 +1,12 @@ -## x var (atom) -**Default value:** -+ The x coordinate of the object on the map. - -> [!IMPORTANT] -> If an object exists on the map (not inside the contents of an `atom/movable`) and any of `atom.x`, `atom.y` or `atom.z` are 0, then the objects `loc` will be set to `null` +## x (var) -You may assign the coordinates of movable objects (mobs and -objs), but this is not advisable. It is better to compute the new -location (with `locate()`) and move them to that. Then you can use the -normal `Move()` procedure, which enables all the normal movement -behavior. - -For areas that are on the map, this is the coordinate -of the turf with the lowest z, y, and x coordinate (in that order) that -is contained by the area. +**Default Value:** ++ The x coordinate of the object on the map. +*** +You may assign the coordinates of movable objects (mobs and objs), but this is not advisable. It is better to compute the new location (with locate()) and move them to that. Then you can use the normal Move() procedure, which enables all the normal movement behavior. -> [!TIP] -> **See also:** -> + [loc var (atom)](/ref/atom/var/loc.md) \ No newline at end of file +For areas that are on the map, this is the coordinate of the turf with the lowest z, y, and x coordinate (in that order) that is contained by the area. +*** +**Related Pages:** ++ [loc](/ref/atom/var/loc) diff --git a/ref/atom/var/y.md b/ref/atom/var/y.md index 8b25a38d..3cc19af4 100644 --- a/ref/atom/var/y.md +++ b/ref/atom/var/y.md @@ -1,21 +1,12 @@ -## y var (atom) -**Default value:** -+ The y coordinate of the object on the map. - -> [!IMPORTANT] -> If an object exists on the map (not inside the contents of an `atom/movable`) and any of `atom.x`, `atom.y` or `atom.z` are 0, then the objects `loc` will be set to `null` +## y (var) -You may assign the coordinates of movable objects (mobs and -objs), but this is not advisable. It is better to compute the new -location (with `locate()`) and move them to that. Then you can use the -normal `Move()` procedure, which enables all the normal movement -behavior. - -For areas that are on the map, this is the coordinate -of the turf with the lowest z, y, and x coordinate (in that order) that -is contained by the area. +**Default Value:** ++ The y coordinate of the object on the map. +*** +You may assign the coordinates of movable objects (mobs and objs), but this is not advisable. It is better to compute the new location (with locate()) and move them to that. Then you can use the normal Move() procedure, which enables all the normal movement behavior. -> [!TIP] -> **See also:** -> + [loc var (atom)](/ref/atom/var/loc.md) \ No newline at end of file +For areas that are on the map, this is the coordinate of the turf with the lowest z, y, and x coordinate (in that order) that is contained by the area. +*** +**Related Pages:** ++ [loc](/ref/atom/var/loc) diff --git a/ref/atom/var/z.md b/ref/atom/var/z.md index 4d0a039c..f1fb2310 100644 --- a/ref/atom/var/z.md +++ b/ref/atom/var/z.md @@ -1,33 +1,17 @@ -## z var (atom) -**Default value:** -+ The z coordinate of the object on the map. - -> [!IMPORTANT] -> If an object exists on the map (not inside the contents of an `atom/movable`) and any of `atom.x`, `atom.y` or `atom.z` are 0, then the objects `loc` will be set to `null` +## z (var) -The z coordinate is how objects move between maps. When you -include several maps in a project, they are placed on different z levels -so that the full map is a single 3-dimensional space. It is also -possible for a single map file to contain multiple z levels. - -Do -not confuse this with drawing layer. The z coordinate moves an object -between different maps. The layer variable determines the order in which -an object is drawn graphically relative to other objects at the same -position on the map. +**Default Value:** ++ The z coordinate of the object on the map. +*** +The z coordinate is how objects move between maps. When you include several maps in a project, they are placed on different z levels so that the full map is a single 3-dimensional space. It is also possible for a single map file to contain multiple z levels. -You may assign the coordinates of movable -objects (mobs and objs), but this is not advisable. It is better to -compute the new location (with `locate()`) and move them to that. Then -you can use the normal `Move()` procedure, which enables all the normal -movement behavior. +Do not confuse this with drawing layer. The z coordinate moves an object between different maps. The layer variable determines the order in which an object is drawn graphically relative to other objects at the same position on the map. -For areas that are on the map, this is the -coordinate of the turf with the lowest z, y, and x coordinate (in that -order) that is contained by the area. +You may assign the coordinates of movable objects (mobs and objs), but this is not advisable. It is better to compute the new location (with locate()) and move them to that. Then you can use the normal Move() procedure, which enables all the normal movement behavior. -> [!TIP] -> **See also:** -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [loc var (atom)](/ref/atom/var/loc.md) \ No newline at end of file +For areas that are on the map, this is the coordinate of the turf with the lowest z, y, and x coordinate (in that order) that is contained by the area. +*** +**Related Pages:** ++ [layer var (atom)](/ref/atom/var/layer) ++ [loc](/ref/atom/var/loc) diff --git a/ref/callee.md b/ref/callee.md new file mode 100644 index 00000000..d15f43b0 --- /dev/null +++ b/ref/callee.md @@ -0,0 +1,34 @@ + +## callee (info) +*** +A primitive type representing a running or sleeping proc. This gives access to the proc's information, and can be used to output a stack trace in situations such as writing your own custom `world.Error()` handler. + +You can get a `/callee` for the current running proc with its callee var, or its caller with the caller var. You can follow callers up the call chain. + + +```dm + +world/Error(err) + world.log << "Error [err]:" + for(var/callee/p = caller, p, p = p.caller) + world.log << " [p.proc.type] (src=[p.src], usr=[p.usr])" + if(p.file) world.log << " at [p.file]:[p.line]" + +``` + + +Built-in callee vars (read-only): + +* These vars are quick aliases for `proc.*varname*`. `proc.type` is excluded since `/callee` has its own type var. + +The `file` and `line` vars are available if debugging information was turned on when the world was compiled. The other vars are all aliases for info about the running/sleeping proc or its prototype. + +Even though the `args` var itself is read-only, the list it returns is mutable. Making changes to the list will affect the proc it belongs to. +*** +**Related Pages:** ++ [procs](/ref/proc) ++ [vars (procs)](/ref/proc/var) ++ [callee var (proc)](/ref/proc/var/callee) ++ [caller var (proc)](/ref/proc/var/caller) ++ [Error proc (world)](/ref/world/proc/Error) ++ [try and catch statements](/ref/proc/try) diff --git a/ref/callee/callee.md b/ref/callee/callee.md deleted file mode 100644 index 512fca58..00000000 --- a/ref/callee/callee.md +++ /dev/null @@ -1,60 +0,0 @@ -## callee -###### BYOND Version 516 - - - -A primitive type representing a running or sleeping proc. This -gives access to the proc\'s information, and can be used to output a -stack trace in situations such as writing your own custom -`world.Error()` handler. - -You can get a `/callee` for the -current running proc with its [callee](/ref/proc/var/callee.md) var, or -its caller with the [caller](/ref/proc/var/caller.md) var. You can -follow callers up the call chain. -### Example: - -```dm -world/Error(err) - world.log << "Error [err]:" - for(var/callee/p = caller, p, p = p.caller) - world.log << "[p.proc.type] (src=[p.src], usr=[p.usr])" - if(p.file) - world.log << " at [p.file]:[p.line]" -``` - - -Built-in callee vars (read-only): -+ [args](/ref/proc/var/args.md) -+ [caller](/ref/proc/var/caller.md) -+ [category](/ref/verb/set/category.md) * -+ [desc](/ref/verb/set/desc.md) * -+ file -+ [name](/ref/verb/set/name.md) * -+ line -+ proc -+ [src](/ref/proc/var/src.md) -+ type -+ [usr](/ref/proc/var/usr.md) - -\* These vars are quick aliases for `proc.`*`varname`*. -`proc.type` is excluded since `/callee` has its own type var. - - -The `file` and `line` vars are available if debugging -information was turned on when the world was compiled. The other vars -are all aliases for info about the running/sleeping proc or its -prototype. - -Even though the `args` var itself is read-only, the -list it returns is mutable. Making changes to the list will affect the -proc it belongs to. - -> [!TIP] -> **See also:** -> + [proc](/ref/proc.md) -> + [vars (proc)](/ref/proc/var.md) -> + [callee var (proc)](/ref/proc/var/callee.md) -> + [caller var (proc)](/ref/proc/var/caller.md) -> + [Error proc (world)](/ref/world/proc/Error.md) -> + [try and catch statements](/ref/proc/try.md) \ No newline at end of file diff --git a/ref/client/client.md b/ref/client/client.md deleted file mode 100644 index 4681c0b8..00000000 --- a/ref/client/client.md +++ /dev/null @@ -1,23 +0,0 @@ -## client - - -Each connected player has a corresponding client object. It has -variables and procedures which control aspects of player input/output. -This object is also responsible for linking the player up to a mob. - - -The client can be reassigned from its original mob M to a new -mob N by setting N.client = M.client. This process disconnects the -player from M (calling M.Logout()) and connects the player to N (calling -N.Login()). Setting the mob\'s key has the same effect. - - -Additional vars, procs, and verbs may be added to the client in -order to give the player properties that are independent of the mob. - -> [!TIP] -> **See also:** -> + [client var (mob)](/ref/mob/var/client.md) -> + [key var (mob)](/ref/mob/var/key.md) -> + [procs (client)](/ref/client/proc.md) -> + [vars (client)](/ref/client/var.md) \ No newline at end of file diff --git a/ref/client/index.md b/ref/client/index.md new file mode 100644 index 00000000..1c4795b7 --- /dev/null +++ b/ref/client/index.md @@ -0,0 +1,14 @@ + +## client (info) +*** +Each connected player has a corresponding client object. It has variables and procedures which control aspects of player input/output. This object is also responsible for linking the player up to a mob. + +The client can be reassigned from its original mob M to a new mob N by setting N.client = M.client. This process disconnects the player from M (calling M.Logout()) and connects the player to N (calling N.Login()). Setting the mob's key has the same effect. + +Additional vars, procs, and verbs may be added to the client in order to give the player properties that are independent of the mob. +*** +**Related Pages:** ++ [client](/ref/mob/var/client) ++ [key var (mob)](/ref/mob/var/key) ++ [procs (client)](/ref/client/proc) ++ [vars (client)](/ref/client/var) diff --git a/ref/client/proc.md b/ref/client/proc.md deleted file mode 100644 index 8f7adc78..00000000 --- a/ref/client/proc.md +++ /dev/null @@ -1,41 +0,0 @@ -## procs (client) - - -Built-in client procs: -client/proc -+ [AllowUpload](/ref/client/proc/AllowUpload.md) -+ [Center](/ref/client/proc/Center.md) -+ [CheckPassport](/ref/client/proc/CheckPassport.md) -+ [Click](/ref/client/proc/Click.md) -+ [Command](/ref/client/proc/Command.md) -+ [DblClick](/ref/client/proc/DblClick.md) -+ [Del](/ref/client/proc/Del.md) -+ [East](/ref/client/proc/East.md) -+ [Export](/ref/client/proc/Export.md) -+ [GetAPI proc](/ref/client/proc/GetAPI.md) -+ [Import](/ref/client/proc/Import.md) -+ [IsByondMember](/ref/client/proc/IsByondMember.md) -+ [MeasureText](/ref/client/proc/MeasureText.md) -+ [MouseDown](/ref/client/proc/MouseDown.md) -+ [MouseDrag](/ref/client/proc/MouseDrag.md) -+ [MouseDrop](/ref/client/proc/MouseDrop.md) -+ [MouseEntered](/ref/client/proc/MouseEntered.md) -+ [MouseExited](/ref/client/proc/MouseExited.md) -+ [MouseMove](/ref/client/proc/MouseMove.md) -+ [MouseUp](/ref/client/proc/MouseUp.md) -+ [MouseWheel](/ref/client/proc/MouseWheel.md) -+ [Move](/ref/client/proc/Move.md) -+ [New](/ref/client/proc/New.md) -+ [North](/ref/client/proc/North.md) -+ [Northeast](/ref/client/proc/Northeast.md) -+ [Northwest](/ref/client/proc/Northwest.md) -+ [RenderIcon](/ref/client/proc/RenderIcon.md) -+ [SendPage](/ref/client/proc/SendPage.md) -+ [SetAPI proc](/ref/client/proc/SetAPI.md) -+ [SoundQuery](/ref/client/proc/SoundQuery.md) -+ [South](/ref/client/proc/South.md) -+ [Southeast](/ref/client/proc/Southeast.md) -+ [Southwest](/ref/client/proc/Southwest.md) -+ [Stat](/ref/client/proc/Stat.md) -+ [Topic](/ref/client/proc/Topic.md) -+ [West](/ref/client/proc/West.md) \ No newline at end of file diff --git a/ref/client/proc/AllowUpload.md b/ref/client/proc/AllowUpload.md index 414f7ca4..10d844ed 100644 --- a/ref/client/proc/AllowUpload.md +++ b/ref/client/proc/AllowUpload.md @@ -1,30 +1,29 @@ -## AllowUpload proc (client) + +## AllowUpload (proc) **Format:** + AllowUpload(filename, filelength) -**When:** -+ Called when the player attempts to upload a file to the server, - through input() or a command. +**Called When:** ++ Called when the player attempts to upload a file to the server, through input() or a command. -**Default action:** +**Default Action:** + Allows the upload by returning 1. +*** +The client who owns this proc (src) is the one trying to upload the file. If this proc returns a true value, the upload will be allowed. Otherwise, it will be rejected. -The client who owns this proc (src) is the one trying to upload -the file. If this proc returns a true value, the upload will be allowed. -Otherwise, it will be rejected. - -### Example: ```dm + client - AllowUpload(filename, filelength) - if(filelength >= 524288) // 512K (0.5M) - src << "[filename] is too big to upload!" - return 0 - return 1 + AllowUpload(filename, filelength) + if(filelength >= 524288) // 512K (0.5M) + src << "[filename] is too big to upload!" + return 0 + return 1 + ``` -> [!TIP] -> **See also:** -> + [input proc](/ref/proc/input.md) \ No newline at end of file +*** +**Related Pages:** ++ [input proc](/ref/proc/input) diff --git a/ref/client/proc/Center.md b/ref/client/proc/Center.md index 688fbeb3..1fafcc8d 100644 --- a/ref/client/proc/Center.md +++ b/ref/client/proc/Center.md @@ -1,14 +1,14 @@ -## Center proc (client) + +## Center (proc) **Format:** + Center() -**When:** +**Called When:** + Called when the player presses the "center" key or cursor. -**Default action:** +**Default Action:** + Cancels any automated movement by calling walk(usr,0). - -> [!TIP] -> **See also:** -> + [walk proc](/ref/proc/walk.md) \ No newline at end of file +****** +**Related Pages:** ++ [walk proc](/ref/proc/walk) diff --git a/ref/client/proc/CheckPassport.md b/ref/client/proc/CheckPassport.md index ca8b35ce..fe7e03fb 100644 --- a/ref/client/proc/CheckPassport.md +++ b/ref/client/proc/CheckPassport.md @@ -1,15 +1,17 @@ -## CheckPassport proc (client) + +## CheckPassport (proc) **Format:** + CheckPassport(passport_identifier) -**Args:** -+ passport_identifier -a text string assigned to you by the BYOND hub (or an ID/token for a different API; see below). +**Arguments:** ++ passport_identifier: a text string assigned to you by the BYOND hub (or an ID/token for a different API; see below). +*** This built-in procedure checks to see if the user is subscribed to a particular BYOND hub entry. If the user is subscribed, the result is the number of days left (rounded up) on their subscription, or -1 for lifetime subscribers. -Example: + ```dm + world hub = "My.Hub" //change this to your own hub entry @@ -20,20 +22,20 @@ mob/Login() if(client.CheckPassport("0123456789abcdef")) full_access = 1 else - src << "For full access, subscribe!" + src << "For full access, subscribe!" return ..() + ``` + + Note that in general the value of world.hub has nothing to do with the passport you happen to check. This example assumes the passport number belongs to world.hub just for the purpose of forwarding the user to the appropriate subscription page. -Other APIs 514 You can use this with other APIs that are supported by BYOND, which currently only applies to Steam and only if the game is specially built for Steam support. -To check ownership of a Steam game or DLC (must be the current game's ID or one of its DLCs), use "steam:NNNNNN" for the passport string, where NNNNNN is a Steam app ID. Note that the user must be logged into Steam for this to work. - -> [!TIP] -> + See also: -> + [IsSubscribed proc (world)](ref/client/proc/IsSubscribed.md) -> + [IsByondMember proc (client)](ref/client/proc/IsBYONDMember.md) -> + [GetAPI proc (client)](ref/client/proc/GetAPU.md) -> + [SetAPI proc (client)](ref/client/proc/SetAPI.md) \ No newline at end of file +To check ownership of a Steam game or DLC (must be the current game's ID or one of its DLCs), use `"steam:*NNNNNN*"` for the passport string, where *NNNNNN* is a Steam app ID. Note that the user must be logged into Steam for this to work. +*** +**Related Pages:** ++ [IsSubscribed](/ref/world/proc/IsSubscribed) ++ [IsByondMember proc (client)](/ref/client/proc/IsByondMember) ++ [GetAPI proc (client)](/ref/client/proc/GetAPI) ++ [SetAPI proc (client)](/ref/client/proc/SetAPI) diff --git a/ref/client/proc/Click.md b/ref/client/proc/Click.md index af8646c0..c2209cb9 100644 --- a/ref/client/proc/Click.md +++ b/ref/client/proc/Click.md @@ -1,58 +1,57 @@ -## Click proc (client) +## Click (proc) **Format:** + Click(object,location,control,params) -**When:** -+ Called when the player clicks on the map or in the stat panels. - -**Args:** +**Arguments:** + object: the object clicked -+ location: the client stat panel, location (turf) of object on map, - grid cell, or other control-specific info ++ location: the client stat panel, location (turf) of object on map, grid cell, or other control-specific info + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) -**Default action:** -+ Call object.Click(location,control,params). ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) -### Example: +**Called When:** ++ Called when the player clicks on the map or in the stat panels. + +**Default Action:** ++ Call object.Click(location,control,params). +*** ```dm + client - Click(O) usr << "You clicked [O]" - ..() // do default action + Click(O) + usr << "You clicked [O]" + ..() // do default action + ``` - -Note that due to network lag, it is -possible when clicking on moving objects for the location of those -objects to have changed by the time the Click() proc is executed. That -is the reason for the location argument. It tells you where the click -originally took place. + +Note that due to network lag, it is possible when clicking on moving objects for the location of those objects to have changed by the time the Click() proc is executed. That is the reason for the location argument. It tells you where the click originally took place. The argument format for this verb is: + ```dm + Click(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) -``` +``` -> [!TIP] -> **See also:** -> + [Click proc (atom)](/ref/atom/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click](/ref/atom/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/Command.md b/ref/client/proc/Command.md index 274fa677..9fd909ad 100644 --- a/ref/client/proc/Command.md +++ b/ref/client/proc/Command.md @@ -1,26 +1,19 @@ -# Command proc (client) + +## Command (proc) + **Format:** + Command(command as command_text) -**When:** -+ Called when the player types in something that is not understood as - a valid command, or if the player is connected via telnet. +**Called When:** ++ Called when the player types in something that is not understood as a +valid command, or if the player is connected via telnet. -**Default action:** +**Default Action:** + None. +*** +If this proc is used, players will be able to connect to your world via telnet. All telnet users' commands are routed through this proc instead of being parsed into verbs. Players who join the world through Dream Seeker will have their commands parsed as verbs first, and those commands will end up here only if there is no applicable verb. +Note that text received by this proc is not interpreted beforehand, so quotes " and backslashes \ should come through unaltered. -If this proc is used, players will be able to connect to your -world via telnet. All telnet users\' commands are routed through this -proc instead of being parsed into verbs. Players who join the world -through Dream Seeker will have their commands parsed as verbs first, and -those commands will end up here only if there is no applicable verb. - - -Note that text received by this proc is not interpreted -beforehand, so quotes " and backslashes \\ should come through -unaltered. - -This proc is primarily useful if you want to handle -parsing yourself (like for a MUD), or if your world is a chat server and -verbs are not used much. \ No newline at end of file +This proc is primarily useful if you want to handle parsing yourself (like for a MUD), or if your world is a chat server and verbs are not used much. +*** \ No newline at end of file diff --git a/ref/client/proc/DblClick.md b/ref/client/proc/DblClick.md index 2d99d8ca..e47feda6 100644 --- a/ref/client/proc/DblClick.md +++ b/ref/client/proc/DblClick.md @@ -1,57 +1,55 @@ -## DblClick proc (client) +## DblClick (proc) **Format:** + DblClick(object,location,control,params) -**When:** -+ Called when the player double-clicks on the map or in the stat - panels. - -**Args:** +**Arguments:** + object: the object double-clicked -+ location: the client stat panel, location (turf) of object on map, - grid cell, or other control-specific info ++ location: the client stat panel, location (turf) of object on map, grid cell, or other control-specific info + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) -**Default action:** ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) + +**Called When:** ++ Called when the player double-clicks on the map or in the stat panels. + +**Default Action:** + Call object.DblClick(location,control,params). -### Example: +*** ```dm + client DblClick(O) usr << "You double-clicked [O]" - ..() // do default action + ..() // do default action + ``` - + + +Note that due to network lag, it is possible when clicking on moving objects for the location of those objects to have changed by the time the DblClick() proc is executed. That is the reason for the location argument. It tells you where the click originally took place. + + ```dm + DblClick(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) + ``` ->[!NOTE] -> Due to network -lag, it is possible when clicking on moving objects for the location of -those objects to have changed by the time the DblClick() proc is -executed. That is the reason for the location argument. It tells you -where the click originally took place. - - -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (atom)](/ref/atom/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick](/ref/atom/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/Del.md b/ref/client/proc/Del.md index c9d83f75..e9f9c295 100644 --- a/ref/client/proc/Del.md +++ b/ref/client/proc/Del.md @@ -1,20 +1,17 @@ -## Del proc (client) + +## Del (proc) **Format:** + Del() -**When:** +**Called When:** + Called when the player disconnects from the world. -**Default action:** -+ If the player is connected to a mob, call mob.Logout() to - disconnect. If the player\'s connection to the world is still not - dead, kill it. - - -Note that this does not automatically delete the player\'s mob. -If you want to do that, you could do so in mob.Logout(). - -> [!TIP] -> **See also:** -> + [Logout proc (mob)](/ref/mob/proc/Logout.md) \ No newline at end of file +**Default Action:** ++ If the player is connected to a mob, call mob.Logout() to disconnect. +If the player's connection to the world is still not dead, kill it. +*** +Note that this does not automatically delete the player's mob. If you want to do that, you could do so in mob.Logout(). +*** +**Related Pages:** ++ [Logout proc (mob)](/ref/mob/proc/Logout) diff --git a/ref/client/proc/East.md b/ref/client/proc/East.md index 68779077..fe1f7b99 100644 --- a/ref/client/proc/East.md +++ b/ref/client/proc/East.md @@ -1,4 +1,5 @@ -## East proc (client) + +## East (proc) **Format:** + East() @@ -6,12 +7,11 @@ **Returns:** + 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "right" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the east. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Export.md b/ref/client/proc/Export.md index 6fa0d75b..95b85e00 100644 --- a/ref/client/proc/Export.md +++ b/ref/client/proc/Export.md @@ -1,36 +1,21 @@ -## Export proc (client) +## Export (proc) **Format:** + client.Export(file) -**Args:** +**Arguments:** + file: file to send to client +*** +This stores the file on the user's computer in a special location unique to each registered world.hub setting. This is most useful for writing a client-side savefile, but any type of file may be stored. The purpose of this is to exchange information between different worlds running under the same hub path. +When a file is exported to the player's computer, it replaces any previous file stored by a game with the same world.hub value. This should not be used for anything requiring high security, because any other world could make use of the same hub path and access the file. It is also possible for the user to tinker with the file, since it resides on their computer. -This stores the file on the user\'s computer in a special -location unique to each registered [world.hub](/ref/world/var/hub.md) setting. -This is most useful for writing a client-side savefile, but any type of -file may be stored. The purpose of this is to exchange information -between different worlds running under the same hub path. +To delete the client-side file completely, call client.Export() with no argument at all. -> [!TIP] -> This file can be found in the BYOND Documents folder on the users machine under the following path: -> `..\Documents\BYOND\KeyInfo\ckey\.sav` - -When -a file is exported to the player\'s computer, it replaces any previous -file stored by a game with the same `world.hub` value. This should not -be used for anything requiring high security, because any other world -could make use of the same hub path and access the file. It is also -possible for the user to tinker with the file, since it resides on their -computer. - -To delete the client-side file completely, call -`client.Export()` with no argument at all. -### Example: ```dm + mob/verb/save() var/savefile/F = new() F << usr //write the player's mob @@ -42,12 +27,12 @@ client/New() var/savefile/F = new(client_file) //open it as a savefile F >> usr //read the player's mob return ..() -``` +``` -> [!TIP] -> **See also:** -> + [Import proc (client)](/ref/client/proc/Import.md) -> + [New proc (client)](/ref/client/proc/New.md) -> + [hub var (world)](/ref/world/var/hub.md) -> + [savefile](/ref/savefile.md) +*** +**Related Pages:** ++ [Import proc (client)](/ref/client/proc/Import) ++ [New proc (client)](/ref/client/proc/New) ++ [hub var (world)](/ref/world/var/hub) ++ [savefile](/ref/savefile) diff --git a/ref/client/proc/GetAPI.md b/ref/client/proc/GetAPI.md index 44dfb0c1..1d73bce7 100644 --- a/ref/client/proc/GetAPI.md +++ b/ref/client/proc/GetAPI.md @@ -1,37 +1,17 @@ -## GetAPI proc (client) -###### BYOND Version 514 +## GetAPI (proc) **Format:** + GetAPI(Api, Name) -**Args:** +**Arguments:** + Api: the name of the API (e.g. "steam") + Key: the name of the value to read - -Interfaces with supported external APIs to read information. -Currently this only has meaning for Steam, for specially built games -that have a Steam app ID. - -This proc returns null any time the -call or its results are invalid: for instance, trying to query a Steam -stat from a user who isn\'t logged into Steam. - -## Steam API -#### API name: "steam" -> [!IMPORTANT] -> Requires that the server and client are using a valid Steam app ID, such as when a game is built for standalone distribution. - -| Key | Return type | Description | -| --- | --- | --- | -| id | text |Returns the user's numeric Steam ID, if any. Because this number is too big to fit in BYOND\'s numbering system, it is returned as text. | -| name | text | Returns the user's persona name on Steam. | -| stat:*Name* | num | Returns the value of the stat called `Name`. | -| achievement:*Name* | num | Returns the date (for use with [time2text](/ref/proc/time2text.md)) the achievement called `Name`, or 0 if it hasn't been earned. | -| achievement-data:*Name* | list | Returns information about the achievement called `Name`. The result is an associative list with named values `name` (display name), `desc` (description), and optionally `hidden` and `icon`. (This call is the same no matter which client you call it for.) | -| achievements | list | Returns a list of all possible achievements. Each item in the list is the internal name of the achievement, and it is associated with a list in the form described for `achievement-data:`*`Name`*. (This call is the same no matter which client you call it for.) | - -> [!TIP] -> **See also:** -> + [SetAPI proc (client)](/ref/client/proc/SetAPI.md) -> + [CheckPassport proc (client)](/ref/client/proc/CheckPassport.md) \ No newline at end of file +*** +Interfaces with supported external APIs to read information. Currently this only has meaning for Steam, for specially built games that have a Steam app ID. + +This proc returns null any time the call or its results are invalid: for instance, trying to query a Steam stat from a user who isn't logged into Steam. +*** +**Related Pages:** ++ [SetAPI proc (client)](/ref/client/proc/SetAPI) ++ [CheckPassport proc (client)](/ref/client/proc/CheckPassport) diff --git a/ref/client/proc/Import.md b/ref/client/proc/Import.md index ddbf9df2..63c514d6 100644 --- a/ref/client/proc/Import.md +++ b/ref/client/proc/Import.md @@ -1,25 +1,17 @@ -## Import proc (client) +## Import (proc) **Format:** + client.Import(Query) -**Args:** +**Arguments:** + Query: optional query parameters +*** +When no query parameters are given, this returns the client-side file last exported with client.Export(). This comes as an entry in the resource cache, which can be opened as a savefile among other things. If there is no file, null is returned. For an example, see client.Export. - -When no query parameters are given, this returns the -client-side file last exported with `client.Export()`. This comes as an -entry in the resource cache, which can be opened as a savefile among -other things. If there is no file, null is returned. For an example, see -[client.Export](/ref/client/proc/Export.md) - -When there are query -parameters, these may be used to import a file from some alternate -source. Currently this is not supported. - -> [!TIP] -> **See also:** -> + [Export proc (client)](/ref/client/proc/Export.md) -> + [New proc (client)](/ref/client/proc/New.md) -> + [savefile](/ref/savefile.md) \ No newline at end of file +When there are query parameters, these may be used to import a file from some alternate source. Currently this is not supported. +*** +**Related Pages:** ++ [Export proc (client)](/ref/client/proc/Export) ++ [New proc (client)](/ref/client/proc/New) ++ [savefile](/ref/savefile) diff --git a/ref/client/proc/IsByondMember.md b/ref/client/proc/IsByondMember.md index 02d0a356..e19701b4 100644 --- a/ref/client/proc/IsByondMember.md +++ b/ref/client/proc/IsByondMember.md @@ -1,20 +1,19 @@ -# IsByondMember proc (client) + +## IsByondMember (proc) + **Format:** + IsByondMember() -**Args:** +**Arguments:** + None. +*** +This built-in procedure checks to see if the user is a BYOND Member. Use it to give special in-game rewards to those who support BYOND. +If the user is a Member, the result is the number of days left (rounded up) on their Membership, or -1 for lifetime Members. -This built-in procedure checks to see if the user is a BYOND -Member. Use it to give special in-game rewards to those who support -BYOND. - -If the user is a Member, the result is the number of -days left (rounded up) on their Membership, or -1 for lifetime Members. -### Example: ```dm + mob/var special_features @@ -22,7 +21,9 @@ mob/Login() if(client.IsByondMember()) special_features = 1 else - src << "For special features, become a BYOND Member!" + src << "For special features, become a BYOND Member!" return ..() + ``` + +*** \ No newline at end of file diff --git a/ref/client/proc/MeasureText.md b/ref/client/proc/MeasureText.md index ba52c80d..b393e79a 100644 --- a/ref/client/proc/MeasureText.md +++ b/ref/client/proc/MeasureText.md @@ -1,26 +1,20 @@ -## MeasureText proc (client) -###### BYOND Version 513 + +## MeasureText (proc) **Format:** + MeasureText(text, style, width=0) -**Args:** +**Arguments:** + text: The text to be measured -+ style: Stylesheet to be used (leave blank to use the default map - control\'s styles, if any) -+ width: Width limit, if you only want to measure height; 0 means no - limit ++ style: Stylesheet to be used (leave blank to use the default map control's styles, if any) ++ width: Width limit, if you only want to measure height; 0 means no limit **Returns:** -+ A size value in `"[width]x[height]"` format, e.g. "60x16" - - -Because maptext rendering may vary by client, `MeasureText` -lets you get a measurement of how text will be laid out, so you can -adjust `maptext_width` and `maptext_height` accordingly. - -> [!TIP] -> **See also:** -> + [maptext var (atom)](/ref/atom/var/maptext.md) -> + [maptext_width var (atom)](/ref/atom/var/maptext_width.md) -> + [maptext_height var (atom)](/ref/atom/var/maptext_height.md) \ No newline at end of file ++ A size value in format, e.g. "60x16" +*** +Because maptext rendering may vary by client, `MeasureText` lets you get a measurement of how text will be laid out, so you can adjust `maptext_width` and `maptext_height` accordingly. +*** +**Related Pages:** ++ [maptext](/ref/atom/var/maptext) ++ [maptext_width](/ref/atom/var/maptext_width) ++ [maptext_height](/ref/atom/var/maptext_height) diff --git a/ref/client/proc/MouseDown.md b/ref/client/proc/MouseDown.md index 305cb215..9ed5e87a 100644 --- a/ref/client/proc/MouseDown.md +++ b/ref/client/proc/MouseDown.md @@ -1,58 +1,49 @@ -## MouseDown proc (client) +## MouseDown (proc) **Format:** + MouseDown(object,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer -+ location: the turf, stat panel, grid cell, etc. containing the - object where it was clicked ++ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) -**Default action:** -+ Call object.MouseDown(location,control,params). ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) +**Default Action:** ++ Call object.MouseDown(location,control,params). +*** +This is called when the a mouse button is pressed while pointing to the object. Note that MouseUp() will always be called after MouseDown() is called, even if over empty space. That means `object` and `location` may be null. -This is called when the a mouse button is pressed while -pointing to the object. Note that MouseUp() will always be called after -MouseDown() is called, even if over empty space. That means -`object` and `location` may be null. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The other procedures are simply available for completeness. +The argument format for this verb is: -> [!IMPORTANT] -> Don't define this unless you need it, because it generates -extra communication that is otherwise avoided. Most operations can be -done through `Click()`, `DblClick()`, and `MouseDrop()`. The other -procedures are simply available for completeness. -The argument -format for this verb is: ```dm + MouseDown(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) + ``` -> [!NOTE] -> In BYOND 3.5 this procedure took three different arguments: -`location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have -been replaced, old code will need to be modified. Games compiled before -this change will still work normally. - -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (atom)](/ref/atom/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file + + +> [!TIP] +> Note: In BYOND 3.5 this procedure took three different arguments: `location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have been replaced, old code will need to be modified. Games compiled before this change will still work normally. +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown](/ref/atom/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseDrag.md b/ref/client/proc/MouseDrag.md index 34c308bc..e645ac7d 100644 --- a/ref/client/proc/MouseDrag.md +++ b/ref/client/proc/MouseDrag.md @@ -1,57 +1,49 @@ -## MouseDrag proc (client) +## MouseDrag (proc) **Format:** -+ MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params) ++ MouseDrag(src_object,over_object,src_location,over_location,src_control,over_control,params) -**Args:** +**Arguments:** + src_object: the object being dragged + over_object: the object under the mouse pointer -+ src_location: the turf, stat panel, grid cell, etc. from where the - src object was dragged -+ over_location: the turf, stat panel, grid cell, etc. containing the - object under the mouse pointer ++ src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged ++ over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer + src_control: The id of the skin control the object was dragged from + over_control: The id of the skin control the object was dragged over -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** -+ Call `object.MouseDrag(over_object, src_location, over_location, src_control, over_control, params)`. ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) +**Default Action:** ++ Call object.MouseDrag(over_object,src_location,over_location,src_control,over_control,params). +*** +This is called while dragging an object by pressing and holding the left mouse button over the object and moving the mouse. The over_object may be null if dragging over a stat panel or over other empty space. -This is called while dragging an object by pressing and holding -the left mouse button over the object and moving the mouse. The -over_object may be null if dragging over a stat panel or over other -empty space. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through Click(), DblClick(), and MouseDrop(). The other procedures are simply available for completeness. + +The argument format for this verb is: -> [!IMPORTANT] -> Don't define this unless you need it, because it -generates extra communication that is otherwise avoided. Most operations can be done through Click(), DblClick(), and MouseDrop(). The other -procedures are simply available for completeness. -The argument -format for this verb is: ```dm + MouseDrag(src_object as null|atom in usr.client,\ over_object as null|atom in usr.client,\ src_location as null|turf|text in usr.client,\ over_location as null|turf|text in usr.client,\ src_control as text, over_control as text, params as text) -``` +``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (atom)](/ref/atom/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag](/ref/atom/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseDrop.md b/ref/client/proc/MouseDrop.md index cebd500d..d336bfbe 100644 --- a/ref/client/proc/MouseDrop.md +++ b/ref/client/proc/MouseDrop.md @@ -1,51 +1,47 @@ -## MouseDrop proc (client) +## MouseDrop (proc) **Format:** -+ MouseDrop(src_object, over_object, src_location, over_location, src_control, over_control,params) ++ MouseDrop(src_object,over_object,src_location,over_location,src_control,over_control,params) -**Args:** +**Arguments:** + src_object: the object being dropped + over_object: the object under the mouse pointer -+ src_location: the turf, stat panel, grid cell, etc. from where the - src object was dragged -+ over_location: the turf, stat panel, grid cell, etc. containing the - object under the mouse pointer ++ src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged ++ over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer + src_control: The id of the skin control the object was dragged from + over_control: The id of the skin control the object was dropped onto -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** -+ Call `object.MouseDrop(over_object, src_location, over_location, src_control, over_control, params)`. ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) - -This is called when a mouse button is released after dragging -an object. The over_object may be null if dropping over a stat panel or -over other empty space. +**Default Action:** ++ Call object.MouseDrop(over_object,src_location,over_location,src_control,over_control,params). +*** +This is called when a mouse button is released after dragging an object. The over_object may be null if dropping over a stat panel or over other empty space. The argument format for this verb is: + ```dm + MouseDrag(src_object as null|atom in usr.client,\ over_object as null|atom in usr.client,\ src_location as null|turf|text in usr.client,\ over_location as null|turf|text in usr.client,\ src_control as text, over_control as text, params as text) -``` +``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (atom)](/ref/atom/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop](/ref/atom/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseEntered.md b/ref/client/proc/MouseEntered.md index 289cd17b..d84f4b81 100644 --- a/ref/client/proc/MouseEntered.md +++ b/ref/client/proc/MouseEntered.md @@ -1,47 +1,44 @@ -## MouseEntered proc (client) +## MouseEntered (proc) **Format:** -+ MouseEntered(object, location, control, params) ++ MouseEntered(object,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer -+ location: the turf, stat panel, grid cell, etc. containing the - object where it was clicked ++ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** -+ Call `object.MouseEntered(location, control, params)`. ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) +**Default Action:** ++ Call object.MouseEntered(location,control,params). +*** +This is called when no mouse buttons are pressed while pointing to the object. -This is called when no mouse buttons are pressed while pointing -to the object. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead. + +The argument format for this verb is: -> [!IMPORTANT] -> Don't define this unless you need it, because -it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead. -The -argument format for this verb is: ```dm + MouseEntered(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) + ``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (atom)](/ref/atom/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered](/ref/atom/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseExited.md b/ref/client/proc/MouseExited.md index b06084e5..d277447c 100644 --- a/ref/client/proc/MouseExited.md +++ b/ref/client/proc/MouseExited.md @@ -1,49 +1,44 @@ -## MouseExited proc (client) +## MouseExited (proc) **Format:** + MouseExited(object,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer -+ location: the turf, stat panel, grid cell, etc. containing the - object where it was clicked ++ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** -+ Call object.MouseExited(location,control,params). - ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) +**Default Action:** ++ Call object.MouseExited(location,control,params). +*** This is called when the mouse moves off of an object. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead. + +The argument format for this verb is: -> [!IMPORTANT] -> Don't define this unless you need it, because it generates -extra communication that is otherwise avoided. Defining it on only the -objects that require it reduces overhead. -The argument format -for this verb is: ```dm + MouseExited(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) -``` +``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (atom)](/ref/atom/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited](/ref/atom/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseMove.md b/ref/client/proc/MouseMove.md index c51d87ad..cff91a65 100644 --- a/ref/client/proc/MouseMove.md +++ b/ref/client/proc/MouseMove.md @@ -1,49 +1,44 @@ -## MouseMove proc (client) -###### BYOND Version 500 +## MouseMove (proc) **Format:** + MouseMove(object,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer -+ location: the turf, stat panel, grid cell, etc. containing the - object where it was clicked ++ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** -+ Call object.MouseMove(location,control,params). - ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) -This is called when no mouse buttons are pressed while pointing -to the object, and the mouse has moved. The first time the mouse moves -over the object, MouseEntered() is called instead. +**Default Action:** ++ Call object.MouseMove(location,control,params). +*** +This is called when no mouse buttons are pressed while pointing to the object, and the mouse has moved. The first time the mouse moves over the object, MouseEntered() is called instead. -> [!IMPORTANT] -> Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Defining it on only the objects that require it reduces overhead. The argument format for this verb is: + ```dm + MouseMove(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) -``` +``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (atom)](/ref/atom/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove](/ref/atom/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseUp.md b/ref/client/proc/MouseUp.md index 722d2a8c..5ef0be22 100644 --- a/ref/client/proc/MouseUp.md +++ b/ref/client/proc/MouseUp.md @@ -1,56 +1,49 @@ -## MouseUp proc (client) +## MouseUp (proc) **Format:** + MouseUp(object,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer -+ location: the turf, stat panel, grid cell, etc. containing the - object where it was clicked ++ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) + +**Default Action:** + Call object.MouseUp(location,control,params). +*** +This is called when a mouse button is released while pointing to an object. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. Most operations can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The other procedures are simply available for completeness. -This is called when a mouse button is released while pointing -to an object. +The argument format for this verb is: -> [!IMPORTANT] -> Don\'t define this unless you need it, because it -generates extra communication that is otherwise avoided. Most operations -can be done through `Click()`, `DblClick()`, and `MouseDrop()`. The -other procedures are simply available for completeness. -The -argument format for this verb is: ```dm + MouseUp(object as null|atom in usr.client,\ location as null|turf|text in usr.client,\ control as text, params as text) + ``` -> [!NOTE] -> In BYOND 3.5 this procedure took three different arguments: -`location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have -been replaced, old code will need to be modified. Games compiled before -this change will still work normally. - -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (atom)](/ref/atom/proc/MouseUp.md) -> + [MouseWheel proc (client)](/ref/client/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) -> + [show_popup_menus var (client)](/ref/client/var/show_popup_menus.md) \ No newline at end of file + + +> [!TIP] +> Note: In BYOND 3.5 this procedure took three different arguments: `location`, `icon_x`, and `icon_y`. Since `icon_x` and `icon_y` have been replaced, old code will need to be modified. Games compiled before this change will still work normally. +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp](/ref/atom/proc/MouseUp) ++ [MouseWheel proc (client)](/ref/client/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) ++ [show_popup_menus var](/ref/client/var/show_popup_menus) diff --git a/ref/client/proc/MouseWheel.md b/ref/client/proc/MouseWheel.md index 6209d9c0..93b8b7ea 100644 --- a/ref/client/proc/MouseWheel.md +++ b/ref/client/proc/MouseWheel.md @@ -1,57 +1,48 @@ -## MouseWheel proc (client) -###### BYOND Version 508 +## MouseWheel (proc) **Format:** + MouseWheel(object,delta_x,delta_y,location,control,params) -**Args:** +**Arguments:** + object: the object under the mouse pointer + delta_x,delta_y: amount of wheel movement -+ location: the turf, stat panel, grid cell, etc. containing the - object ++ location: the turf, stat panel, grid cell, etc. containing the object + control: the name of the skin control involved -+ params: other parameters including mouse/keyboard flags, icon - offsets, etc.; see [mouse handling](/ref/DM/mouse.md) - -**Default action:** ++ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see [mouse handling](/ref/DM/mouse) + +**Default Action:** + Call object.MouseWheel(delta_x,delta_y,location,control,params). +*** +This is called when the mouse wheel is moved while over an object or control. It is NOT called if over a browser control, or any control that is currently scrollable. -This is called when the mouse wheel is moved while over an -object or control. It is NOT called if over a browser control, or any -control that is currently scrollable. +Positive values of delta_x and delta_y refer to scrolling right or up, respectively. Negative values are left and down, respectively. -Positive values of -delta_x and delta_y refer to scrolling right or up, respectively. -Negative values are left and down, respectively. +Don't define this unless you need it, because it generates extra communication that is otherwise avoided. If you only need wheel support on specific objects, use atom.MouseWheel() instead which is more selective. -> [!IMPORTANT] -> Don\'t define -this unless you need it, because it generates extra communication that -is otherwise avoided. If you only need wheel support on specific -objects, use atom.MouseWheel() instead which is more selective. +The argument format for this verb is: -The argument format for this verb is: ```dm -MouseWheel(object as null\|atom in usr.client,\\ delta_x as num, delta_y -as num,\\ location as null\|turf\|text in usr.client,\\ control as text, -params as text) -``` +MouseWheel(object as null|atom in usr.client,\ + delta_x as num, delta_y as num,\ + location as null|turf|text in usr.client,\ + control as text, params as text) +``` -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [MouseWheel proc (atom)](/ref/atom/proc/MouseWheel.md) -> + [mouse_opacity var (atom)](/ref/atom/var/mouse_opacity.md) -> + [mouse_pointer_icon var (client)](/ref/client/var/mouse_pointer_icon.md) \ No newline at end of file +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [MouseWheel](/ref/atom/proc/MouseWheel) ++ [mouse_opacity var](/ref/atom/var/mouse_opacity) ++ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon) diff --git a/ref/client/proc/Move.md b/ref/client/proc/Move.md index b77a024f..c74f3535 100644 --- a/ref/client/proc/Move.md +++ b/ref/client/proc/Move.md @@ -1,4 +1,5 @@ -## Move proc (client) + +## Move (proc) **Format:** + Move(loc,dir) @@ -6,21 +7,20 @@ **Returns:** + 1 on success; 0 on failure -**When:** +**Called When:** + Called by the direction procs. -**Default action:** -+ Calls src.mob.Move(). Also cancels any automated movement by calling - walk(usr,0). - -> [!TIP] -> **See also:** -> + [East proc (client)](/ref/client/proc/East.md) -> + [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) -> + [North proc (client)](/ref/client/proc/North.md) -> + [Northeast proc (client)](/ref/client/proc/Northeast.md) -> + [Northwest proc (client)](/ref/client/proc/Northwest.md) -> + [South proc (client)](/ref/client/proc/South.md) -> + [Southeast proc (client)](/ref/client/proc/Southeast.md) -> + [Southwest proc (client)](/ref/client/proc/Southwest.md) -> + [West proc (client)](/ref/client/proc/West.md) \ No newline at end of file +**Default Action:** ++ Calls src.mob.Move(). Also cancels any automated movement by + calling walk(usr,0). +****** +**Related Pages:** ++ [East proc (client)](/ref/client/proc/East) ++ [Move proc (movable atom)](/ref/atom/movable/proc/Move) ++ [North proc (client)](/ref/client/proc/North) ++ [Northeast proc (client)](/ref/client/proc/Northeast) ++ [Northwest proc (client)](/ref/client/proc/Northwest) ++ [South proc (client)](/ref/client/proc/South) ++ [Southeast proc (client)](/ref/client/proc/Southeast) ++ [Southwest proc (client)](/ref/client/proc/Southwest) ++ [West proc (client)](/ref/client/proc/West) diff --git a/ref/client/proc/New.md b/ref/client/proc/New.md index 2839d4f0..ff946484 100644 --- a/ref/client/proc/New.md +++ b/ref/client/proc/New.md @@ -1,40 +1,34 @@ -## New proc (client) +## New (proc) **Format:** + New(TopicData) +**Arguments:** ++ usr: The mob in the world with the same key as the player, if it exists. ++ TopicData: If the player accessed the world with a "connection topic", + this is the topic text. Otherwise it is null. + **Returns:** -+ The newly connected mob, client.mob; or null to disallow the - connection. ++ The newly connected mob, client.mob, or null to disallow the connection. -**When:** +**Called When:** + Called when the player first tries to connect to the world. -**Args:** -+ usr: The mob in the world with the same key as the player, if it - exists. -+ TopicData: If the player accessed the world with a "connection - topic", this is the topic text. Otherwise it is null. - -**Default action:** -+ Look for an existing mob with the same key as the player. - + If found, connect the player to that mob (mob.Login()). - + Otherwise, look for a prototype mob with the same key as the player. - + If found, create a mob of that type and connect the player to it. - + Otherwise, create a mob of type world.mob, give it the same name and gender as the player's key, and connect the player to it. -+ If TopicData is not null, call client.Topic(TopicData). -+ Finally, the player\'s mob is - returned. +**Default Action:** ++ Look for an existing mob with the same key as the player. If found, + connect the player to that mob (mob.Login()). Otherwise, look for a + prototype mob with the same key as the player. If found, create a mob of + that type and connect the player to it. Otherwise, create a mob of type + world.mob, give it the same name and gender as the player's key, and + connect the player to it. If TopicData is not null, call + client.Topic(TopicData). Finally, the player's mob is returned. +*** +This is a fairly low-level procedure that you would only want to override if you cannot accomplish the same thing in mob/Login() or mob/New(). One reason to override client/New() is if player mobs are created from a savefile. In that case, you don't need a temporary mob to be created first. -This is a fairly low-level procedure that you would only want -to override if you cannot accomplish the same thing in `mob/Login()` or -`mob/New()`. One reason to override `client/New()` is if player mobs are -created from a savefile. In that case, you don\'t need a temporary mob -to be created first. -### Example: ```dm + client/New() if(usr) return ..() //reconnecting to existing mob else @@ -48,25 +42,19 @@ mob/Logout() var/savefile/F = new(player_sav) F << src del src + ``` -> [!NOTE] -> that for the above example to work, you **must** make proper use of the -[tmp](/ref/var/tmp.md) flag when defining new object variables. Otherwise, -this can end up sucking large portions of your world into each player -savefile, which can have all sorts of unexpected consequences! -If you want to do any user-interaction before -loading the saved mob, you will have to create a temporary mob first in -order to interact with the player. In that case, you are better off -doing things in `mob/Login()`, rather than `client/New()`. +If you want to do any user-interaction before loading the saved mob, you will have to create a temporary mob first in order to interact with the player. In that case, you are better off doing things in mob/Login(), rather than client/New(). -> [!TIP] -> **See also:** -> + [Export proc (client)](/ref/client/proc/Export.md) -> + [Import proc (client)](/ref/client/proc/Import.md) -> + [Login proc (mob)](/ref/mob/proc/Login.md) -> + [New proc (datum)](/ref/datum/proc/New.md) -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [mob var (world)](/ref/world/var/mob.md) -> + [savefile](/ref/savefile.md) \ No newline at end of file +Note that for the above example to work, you must make proper use of the tmp flag when defining new object variables. Otherwise, this can end up sucking large portions of your world into each player savefile, which can have all sorts of unexpected consequences! +*** +**Related Pages:** ++ [Export proc (client)](/ref/client/proc/Export) ++ [Import proc (client)](/ref/client/proc/Import) ++ [Login proc (mob)](/ref/mob/proc/Login) ++ [New proc (datum)](/ref/datum/proc/New) ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [mob](/ref/world/var/mob) ++ [savefile](/ref/savefile) diff --git a/ref/client/proc/North.md b/ref/client/proc/North.md index b46ab267..64155109 100644 --- a/ref/client/proc/North.md +++ b/ref/client/proc/North.md @@ -1,4 +1,5 @@ -## North proc (client) + +## North (proc) **Format:** + North() @@ -6,12 +7,11 @@ **Returns:** + 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "up" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the north. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Northeast.md b/ref/client/proc/Northeast.md index d706dadc..59bcf261 100644 --- a/ref/client/proc/Northeast.md +++ b/ref/client/proc/Northeast.md @@ -1,4 +1,5 @@ -## Northeast proc (client) + +## Northeast (proc) **Format:** + Northeast() @@ -6,12 +7,11 @@ **Returns:** + 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "up-right" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the northeast. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Northwest.md b/ref/client/proc/Northwest.md index da75cd34..d281c4be 100644 --- a/ref/client/proc/Northwest.md +++ b/ref/client/proc/Northwest.md @@ -1,4 +1,5 @@ -## Northwest proc (client) + +## Northwest (proc) **Format:** + Northwest() @@ -6,12 +7,11 @@ **Returns:** + Returns 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "up-left" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the northwest. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/RenderIcon.md b/ref/client/proc/RenderIcon.md index 592072fb..1211adcd 100644 --- a/ref/client/proc/RenderIcon.md +++ b/ref/client/proc/RenderIcon.md @@ -1,41 +1,31 @@ -## RenderIcon proc (client) -###### BYOND Version 515 +## RenderIcon (proc) **Format:** + RenderIcon(object) -**Args:** +**Arguments:** + object: An atom or appearance to render. **Returns:** -+ A single-image icon file in which the object is rendered with all - its overlays, visual contents, etc. ++ A single-image icon file in which the object is rendered with all its +overlays, visual contents, etc. +*** +Use this proc to render an atom or an appearance as a single icon. This is a client proc because the server is not capable of rendering anything on its own. +Any overlays, image objects known to this client that are attached to the object, visual contents, maptext, and so on will be included in the render. The returned icon is sized to fit all of the above, and to include room for any expansion due to filter effects. -Use this proc to render an atom or an appearance as a single -icon. This is a client proc because the server is not capable of -rendering anything on its own. -Any overlays, image objects -known to this client that are attached to the object, visual contents, -maptext, and so on will be included in the render. The returned icon is -sized to fit all of the above, and to include room for any expansion due -to filter effects. +```dm -### Example: +mob/proc/GetFlatIcon() + return client?.RenderIcon(src) -```dm - mob/proc/GetFlatIcon() return client?.RenderIcon(src) ``` -> [!IMPORTANT] -> Important notes regarding this proc: -> - The returned icon is a cache file, *not* an `/icon` datum. -> - If `object` is an [`/image` object](/ref/image.md) , the image must be known to the client. Otherwise the return value is null. -> - If this object doesn\'t appear on the client\'s map, it will be sent to them on the next map tick, along with any visual contents. The server will hold a reference to the object until the map tick ends, so an object you create temporarily should remain valid long enough to be rendered. -> - [render_source](/ref/atom/var/render_source.md) will not work unless the corresponding [render_target](/ref/atom/var/render_target.md) appears in the same render stack. That is, this object or appearance will be rendered in an isolated "scene" rather than as part of the map, so it won't be able to use other objects on the map as render sources. - -> [!TIP] -> **See also:** -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [Filter effects](/ref/notes/filters.md) \ No newline at end of file + + +Important notes regarding this proc: +*** +**Related Pages:** ++ [vis_contents](/ref/atom/var/vis_contents) ++ [Filter effects](/ref/{notes}/filters) diff --git a/ref/client/proc/SendPage.md b/ref/client/proc/SendPage.md index dbe4470b..5d8e38b2 100644 --- a/ref/client/proc/SendPage.md +++ b/ref/client/proc/SendPage.md @@ -1,32 +1,18 @@ -# SendPage proc (client) + +## SendPage (proc) + **Format:** + SendPage(msg,recipient,options) -**Returns:** -+ Returns number of recipients successfully contacted. - -**Args:** +**Arguments:** + msg: text to send + recipient: key or list of keys to page + options: text string containing key=value options +**Returns:** ++ Returns number of recipients successfully contacted. +*** +The user is prompted to authorize sending of the pager message. The recipient may easily respond or jump to the sender's location by clicking on the link in the pager message. The effect is identical to that of the sending a page through the Dream Seeker pager. -The user is prompted to authorize sending of the pager message. -The recipient may easily respond or jump to the sender\'s location by -clicking on the link in the pager message. The effect is identical to -that of the sending a page through the Dream Seeker pager. - -The -options are encoded in the same format read by text2params(). The valid -options are: -+ `summon` (0/1): If not included in the options, this is 0. If included in the - options without assigning it to anything, it is 1. A value of 1 - sends the recipient the sender\'s location so they can join by - clicking on the message. -+ `email` (0/1): If not included in the options, this is 0. If included in the - options without assigning it to anything, it is 1. A value of 1 - sends causes the message to be delivered as email. If this is not - possible, it is delivered as a long-lived pager message. Normally, - pager messages expire within a short time after being sent (half an - hour). -+ `subject`: For email messages, this specifies the subject to use. \ No newline at end of file +The options are encoded in the same format read by text2params(). The valid options are: +*** \ No newline at end of file diff --git a/ref/client/proc/SetAPI.md b/ref/client/proc/SetAPI.md index 0a30e370..010a6cad 100644 --- a/ref/client/proc/SetAPI.md +++ b/ref/client/proc/SetAPI.md @@ -1,33 +1,18 @@ -## SetAPI proc (client) -###### BYOND Version 514 + +## SetAPI (proc) **Format:** + SetAPI(Api, Key, Value) -**Args:** +**Arguments:** + Api: the name of the API (e.g. "steam") + Key: the name of the value to change + Value: the new value to set - - -Interfaces with supported external APIs to write information. -Currently this only has meaning for Steam, for specially built games -that have a Steam app ID. - -This proc returns null any time the -call or its results are invalid. - -## Steam API -#### API name: "steam" -> [!IMPORTANT] -> Requires that the server and client are using a valid Steam app ID, such as when a game is built for standalone distribution. - -| Key | Return type | Description | -| --- | --- | --- | -| stat:*Name* | num | Changes the value of the stat called Name. Returns 1 on success. This may fail if the stat change is too much or is out of range. | -| achievement:*Name* | num | Earns the achievement called Name, or clears it. Value is expected to be a number, or number in text form, where 0 will clear the achievement and 1 will earn it. | - -> [!TIP] -> **See also:** -> + [GetAPI proc (client)](/ref/client/proc/GetAPI.md) -> + [CheckPassport proc (client)](/ref/client/proc/CheckPassport.md) \ No newline at end of file +*** +Interfaces with supported external APIs to write information. Currently this only has meaning for Steam, for specially built games that have a Steam app ID. + +This proc returns null any time the call or its results are invalid. +*** +**Related Pages:** ++ [GetAPI proc (client)](/ref/client/proc/GetAPI) ++ [CheckPassport proc (client)](/ref/client/proc/CheckPassport) diff --git a/ref/client/proc/SoundQuery.md b/ref/client/proc/SoundQuery.md index 6994468e..cbca1745 100644 --- a/ref/client/proc/SoundQuery.md +++ b/ref/client/proc/SoundQuery.md @@ -1,39 +1,19 @@ -## SoundQuery proc (client) -###### BYOND Version 513 + +## SoundQuery (proc) **Format:** + SoundQuery() -**Args:** +**Arguments:** + none **Returns:** -+ A list of `/sound` datums with information about currently playing - sounds. - - -This proc is used to ask a client about sounds that are -playing. The `/sound` datums in the returned list have the following -vars set: -- file: Sound/music file, or null if none -- channel: Channel of sound, if one was set when the sound was played -- repeat: The `repeat` value of the sound -- status: Status flags active for this channel; currently only - `SOUND_PAUSED` is supported -- offset: Current time index, in seconds, of the sound at the current - frequency -- len: Total duration, in seconds, of the sound at the current - frequency -- wait: Total duration of sounds queued to play later on this channel - (does not apply to channel 0) - - -Not all info about the sounds is retrieved, such as `volume`, -`frequency`, etc. If those are needed, it should be a simple matter to -keep track of them in your code. The main purpose of `SoundQuery()` is -to ascertain the current status of playing sounds. - -> [!TIP] -> **See also:** -> + [/sound datum](/ref/sound.md) -> + [sound proc](/ref/proc/sound.md) \ No newline at end of file ++ A list of datums with information about currently playing sounds. +*** +This proc is used to ask a client about sounds that are playing. The `/sound` datums in the returned list have the following vars set: + +Not all info about the sounds is retrieved, such as `volume`, `frequency`, etc. If those are needed, it should be a simple matter to keep track of them in your code. The main purpose of `SoundQuery()` is to ascertain the current status of playing sounds. +*** +**Related Pages:** ++ [sound datum](/ref/sound) ++ [sound proc](/ref/proc/sound) diff --git a/ref/client/proc/South.md b/ref/client/proc/South.md index 9b0e260a..0852a3ca 100644 --- a/ref/client/proc/South.md +++ b/ref/client/proc/South.md @@ -1,4 +1,5 @@ -## South proc (client) + +## South (proc) **Format:** + South() @@ -6,12 +7,11 @@ **Returns:** + Returns 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "down" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the south. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Southeast.md b/ref/client/proc/Southeast.md index f4b8abef..7717c64f 100644 --- a/ref/client/proc/Southeast.md +++ b/ref/client/proc/Southeast.md @@ -1,4 +1,5 @@ -## Southeast proc (client) + +## Southeast (proc) **Format:** + Southeast() @@ -6,12 +7,11 @@ **Returns:** + 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "down-right" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the southeast. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Southwest.md b/ref/client/proc/Southwest.md index 6fe60e17..b0168b8a 100644 --- a/ref/client/proc/Southwest.md +++ b/ref/client/proc/Southwest.md @@ -1,4 +1,5 @@ -## Southwest proc (client) + +## Southwest (proc) **Format:** + Southwest() @@ -6,12 +7,11 @@ **Returns:** + Returns 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "down-left" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the southwest. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/Stat.md b/ref/client/proc/Stat.md index e1bf1907..bf560fd1 100644 --- a/ref/client/proc/Stat.md +++ b/ref/client/proc/Stat.md @@ -1,37 +1,24 @@ -## Stat proc (client) + +## Stat (proc) **Format:** + Stat() -**When:** +**Called When:** + Called periodically by the client to update the stat window. -**Default action:** +**Default Action:** + Call statobj.Stat(). +*** +If this procedure sleeps (or engages in some other waiting operation), it will not be called again until it finally returns. This allows you to effectively decrease the frequency of calls to the proc. You might want to do that if it is a fairly lengthy procedure, and frequent calls are slowing things down. +To increase the frequency of stat updates, you can lower world.tick_lag. -If this procedure sleeps (or engages in some other waiting -operation), it will not be called again until it finally returns. This -allows you to effectively decrease the frequency of calls to the proc. -You might want to do that if it is a fairly lengthy procedure, and -frequent calls are slowing things down. - -To increase the -frequency of stat updates, you can lower `world.tick_lag`. - - -> [!NOTE] -> Typically only the currently viewed statpanel is updated, -which saves on some network activity and a little time. If however the -proc sleeps, you need to be sure that any pending updates are displayed -once the right panel is available. Therefore if you\'re resetting a var -that indicates the proc should sleep next time, it should not be reset -unless you know the player is looking at the right statpanel and has -received the updates. +Note: Typically only the currently viewed statpanel is updated, which saves on some network activity and a little time. If however the proc sleeps, you need to be sure that any pending updates are displayed once the right panel is available. Therefore if you're resetting a var that indicates the proc should sleep next time, it should not be reset unless you know the player is looking at the right statpanel and has received the updates. -### Example ```dm + client/var/updategold = 1 // set to 1 if gold changes client/var/updateinventory = 1 // set to 1 if inventory changes @@ -45,18 +32,16 @@ client/Stat() if(statpanel("Inventory")) stat(mob.contents) updateinventory = 0 + ``` - - -Because sleeping in Stat() -requires more thinking through, it\'s best to do so only in cases where -Stat() has to do a lot of intensive calculations. - -> [!TIP] -> **See also:** -> + [Stat proc (atom)](/ref/atom/proc/Stat.md) -> + [stat proc](/ref/proc/stat.md) -> + [statobj var (client)](/ref/client/var/statobj.md) -> + [statpanel proc](/ref/proc/statpanel.md) -> + [statpanel var (client)](/ref/client/var/statpanel.md) -> + [Info control (skin)](/ref/skin/control/info.md) \ No newline at end of file + + +Because sleeping in Stat() requires more thinking through, it's best to do so only in cases where Stat() has to do a lot of intensive calculations. +*** +**Related Pages:** ++ [Stat](/ref/atom/proc/Stat) ++ [stat proc](/ref/proc/stat) ++ [statobj var (client)](/ref/client/var/statobj) ++ [statpanel proc](/ref/proc/statpanel) ++ [statpanel var (client)](/ref/client/var/statpanel) ++ [Info](/ref/{skin}/control/info) diff --git a/ref/client/proc/Topic.md b/ref/client/proc/Topic.md index 887b78de..0c9f2587 100644 --- a/ref/client/proc/Topic.md +++ b/ref/client/proc/Topic.md @@ -1,30 +1,29 @@ -## Topic proc (client) -**Format:** -+ Topic(href, href_list[], hsrc) - -**When:** -+ Called when a player connects to a world with a "connection topic" - or when the player runs a hyperlink in the current world by clicking - one embedded in text or generated by the link() instruction. +## Topic (proc) -**Args:** -+ href: The topic text (everything after the \'?\' in the full href). -+ href_list: List of key/value pairs in href (produced from - params2list(href)). -+ hsrc: The object referenced by the "src" parameter in href or null - if none. +**Format:** ++ Topic(href,href_list[],hsrc) -**Default action:** -+ Call the hsrc object\'s own Topic() proc. +**Arguments:** ++ href: The topic text (everything after the '?' in the full href). ++ href_list: List of key/value pairs in href (produced from params2list(href)). ++ hsrc: The object referenced by the "src" parameter in href or null if none. +**Called When:** ++ Called when a player connects to a world with a "connection topic" or + when the player runs a hyperlink in the current world by clicking one + embedded in text or generated by the link() instruction. +**Default Action:** ++ Call the hsrc object's own Topic() proc. +*** The following example uses a very simple href value. -### Example: + ```dm + mob/Login() - src << "Click here to download the source code." + src << "Click here to download the source code." return ..() client/Topic(href) @@ -32,32 +31,27 @@ client/Topic(href) usr << file("world.dm") usr << file("world.rsc") else ..() + ``` -Be sure to call the default handler unless you want -to prevent rerouting of topics to other objects. -> [!CAUTION] -> Always validate the input in `Topic()` calls to make sure it\'s correct -and the query you\'re recieving is legitimate. For security reasons, you -will probably want to control which objects a player has access to, -since a player could spoof a topic link containing any arbitrary object -reference. (Never trust those sneaky players!) +Be sure to call the default handler unless you want to prevent rerouting of topics to other objects. -The next example -demonstrates an href that gets handled by another object. This is how -you would normally want to do things. It is best not to override -client/Topic() (as in the example above) unless you need to intervene in -the low-level details of routing the request to the right object. -You specify the object that will handle the request by using a -parameter called "src". +> [!CAUTION] +> +> > [!NOTE] +> > Always validate the input in `Topic()` calls to make sure it's correct and the query you're recieving is legitimate. For security reasons, you will probably want to control which objects a player has access to, since a player could spoof a topic link containing any arbitrary object reference. (Never trust those sneaky players!) + +The next example demonstrates an href that gets handled by another object. This is how you would normally want to do things. It is best not to override client/Topic() (as in the example above) unless you need to intervene in the low-level details of routing the request to the right object. + +You specify the object that will handle the request by using a parameter called "src". -### Example: ```dm + mob/Login() - src << "Click here to start." + src << "Click here to start." return ..() mob/Topic(href,href_list[]) @@ -66,18 +60,14 @@ mob/Topic(href,href_list[]) usr << "Starting game..." else return ..() + ``` - - -Although it is slightly more complex, the use of the -parameter list allows you to easily include extra data and new -functionality. Just remember that the data in the list is always stored -as text, so if you are expecting a number or an object, you must convert -it yourself (with text2num(), locate(), or whatever). - -> [!TIP] -> **See also:** -> + [New proc (client)](/ref/client/proc/New.md) -> + [Topic proc (datum)](/ref/datum/proc/Topic.md) -> + [link proc](/ref/proc/link.md) -> + [ref text macro](/ref/DM/text/macros/ref.md) + + +Although it is slightly more complex, the use of the parameter list allows you to easily include extra data and new functionality. Just remember that the data in the list is always stored as text, so if you are expecting a number or an object, you must convert it yourself (with text2num(), locate(), or whatever). +*** +**Related Pages:** ++ [New proc (client)](/ref/client/proc/New) ++ [Topic](/ref/datum/proc/Topic) ++ [link proc](/ref/proc/link) ++ [\ref text macro](/ref/DM/text/macros/ref) diff --git a/ref/client/proc/West.md b/ref/client/proc/West.md index 008ff42a..2c7dcb1a 100644 --- a/ref/client/proc/West.md +++ b/ref/client/proc/West.md @@ -1,4 +1,5 @@ -## West proc (client) + +## West (proc) **Format:** + West() @@ -6,12 +7,11 @@ **Returns:** + Returns 1 on success; 0 on failure. -**When:** +**Called When:** + Called when the player presses the "left" key or cursor. -**Default action:** +**Default Action:** + Calls src.Move() towards the west. - -> [!TIP] -> **See also:** -> + [Move proc (client)](/ref/client/proc/Move.md) \ No newline at end of file +****** +**Related Pages:** ++ [Move proc (client)](/ref/client/proc/Move) diff --git a/ref/client/proc/index.md b/ref/client/proc/index.md new file mode 100644 index 00000000..6b9b38a1 --- /dev/null +++ b/ref/client/proc/index.md @@ -0,0 +1,5 @@ + +## proc (proc) +*** +Built-in client procs: +*** \ No newline at end of file diff --git a/ref/client/var.md b/ref/client/var.md deleted file mode 100644 index a8fbb332..00000000 --- a/ref/client/var.md +++ /dev/null @@ -1,48 +0,0 @@ -## vars (client) - - -Built-in client vars: -client/var -+ [address](/ref/client/var/address.md) -+ [authenticate](/ref/client/var/authenticate.md) -+ [bounds](/ref/client/var/bounds.md) -+ [byond_build](/ref/client/var/byond_build.md) -+ [byond_version](/ref/client/var/byond_version.md) -+ [CGI](/ref/client/var/CGI.md) -+ [ckey](/ref/client/var/ckey.md) -+ [color](/ref/client/var/color.md) -+ [command_text](/ref/client/var/command_text.md) -+ [connection](/ref/client/var/connection.md) -+ [control_freak](/ref/client/var/control_freak.md) -+ [computer_id](/ref/client/var/computer_id.md) -+ [default_verb_category](/ref/client/var/default_verb_category.md) -+ [dir](/ref/client/var/dir.md) -+ [edge_limit](/ref/client/var/edge_limit.md) -+ [eye](/ref/client/var/eye.md) -+ [fps](/ref/client/var/fps.md) -+ [gender](/ref/client/var/gender.md) -+ [glide_size](/ref/client/var/glide_size.md) -+ [images](/ref/client/var/images.md) -+ [inactivity](/ref/client/var/inactivity.md) -+ [key](/ref/client/var/key.md) -+ [lazy_eye](/ref/client/var/lazy_eye.md) -+ [mob](/ref/client/var/mob.md) -+ [mouse_pointer_icon](/ref/client/var/mouse_pointer_icon.md) -+ [perspective](/ref/client/var/perspective.md) -+ [pixel_x](/ref/client/var/pixel_x.md) -+ [pixel_y](/ref/client/var/pixel_y.md) -+ [pixel_w](/ref/client/var/pixel_w.md) -+ [pixel_z](/ref/client/var/pixel_z.md) -+ [preload_rsc](/ref/client/var/preload_rsc.md) -+ [screen](/ref/client/var/screen.md) -+ [script](/ref/client/var/script.md) -+ [show_map](/ref/client/var/show_map.md) -+ [show_popup_menus var](/ref/client/var/show_popup_menus.md) -+ [show_verb_panel](/ref/client/var/show_verb_panel.md) -+ [statobj](/ref/client/var/statobj.md) -+ [statpanel](/ref/client/var/statpanel.md) -+ [tick_lag](/ref/client/var/tick_lag.md) -+ [timezone](/ref/client/var/timezone.md) -+ [verbs](/ref/client/var/verbs.md) -+ [view](/ref/client/var/view.md) -+ [virtual_eye](/ref/client/var/virtual_eye.md) \ No newline at end of file diff --git a/ref/client/var/CGI.md b/ref/client/var/CGI.md index 0064a9d1..cd6b223a 100644 --- a/ref/client/var/CGI.md +++ b/ref/client/var/CGI.md @@ -1,11 +1,7 @@ -# CGI var (client) +## CGI (var) +*** +In CGI mode, DreamDaemon is normally being executed by a web server and accessed by a web browser. The CGI object is an add-on to the basic client object for handling this case. -In CGI mode, DreamDaemon is normally being executed by a web -server and accessed by a web browser. The CGI object is an add-on to the -basic client object for handling this case. - -The CGI object is -defined and documented in a separate code library `html/CGI.dm`. You can -find the current version at -[www.byond.com](http://www.byond.com/developer/Dantom/CGI). \ No newline at end of file +The CGI object is defined and documented in a separate code library html/CGI.dm. You can find the current version at www.byond.com. +*** \ No newline at end of file diff --git a/ref/client/var/address.md b/ref/client/var/address.md index 22026b24..1e163a14 100644 --- a/ref/client/var/address.md +++ b/ref/client/var/address.md @@ -1,7 +1,8 @@ -# address var (client) -**Default value:** -+ The network address of the player\'s client. +## address (var) -This is a read-only value which contains the player\'s network -address. \ No newline at end of file +**Default Value:** ++ The network address of the player's client. +*** +This is a read-only value which contains the player's network address. +*** \ No newline at end of file diff --git a/ref/client/var/authenticate.md b/ref/client/var/authenticate.md index 6f278971..4ce2519b 100644 --- a/ref/client/var/authenticate.md +++ b/ref/client/var/authenticate.md @@ -1,25 +1,11 @@ -# authenticate var (client) +## authenticate (var) +*** +This value may be set to 0 at compile-time to disable BYOND hub-based authentication of users. The default value is 1, which enables authentication. Hub authentication provides an additional level of assurance that the user is really the owner of the BYOND key in question. -This value may be set to 0 at compile-time to disable BYOND -hub-based authentication of users. The default value is 1, which enables -authentication. Hub authentication provides an additional level of -assurance that the user is really the owner of the BYOND key in -question. +When a world requests certification, Dream Seeker generates a random password and passes it through the hub (for certification) to the world. The certificate is saved for faster access in the future and for protection against possible hub outages. -When a world requests certification, Dream Seeker -generates a random password and passes it through the hub (for -certification) to the world. The certificate is saved for faster access -in the future and for protection against possible hub outages. +Some applications do not depend on the validity of the user's identity. In that case, it would be more efficient to turn off the extra level of authentication. In other situations, the hub may not be available, such as from behind a firewall or on a LAN without internet access. In those cases, all hub access (including authentication) can be disabled by entering the command ".configuration hub-address none" in Dream Seeker. - -Some applications do not depend on the validity of the user\'s -identity. In that case, it would be more efficient to turn off the extra -level of authentication. In other situations, the hub may not be -available, such as from behind a firewall or on a LAN without internet -access. In those cases, all hub access (including authentication) can be -disabled by entering the command ".configuration hub-address none" in -Dream Seeker. - -Connections to worlds on the same machine are not -hub-authenticated to allow for convenient offline testing. \ No newline at end of file +Connections to worlds on the same machine are not hub-authenticated to allow for convenient offline testing. +*** \ No newline at end of file diff --git a/ref/client/var/bounds.md b/ref/client/var/bounds.md index 1733986a..01fa91c6 100644 --- a/ref/client/var/bounds.md +++ b/ref/client/var/bounds.md @@ -1,24 +1,11 @@ -## bounds var (client) -###### BYOND Version 509 -(Also `bound_x`, `bound_y`, `bound_width`, and `bound_height`.) +## bounds (var) +*** +The read-only bounds var returns the map coordinates, in pixels, covered by the client's viewport when accounting for pixel offsets, eye, step, etc. (The coordinates are only relevant to the default `client.dir` value of `NORTH`, and the `TOPDOWN_MAP` or `SIDE_MAP` map formats.) -The read-only bounds var returns the map coordinates, in -pixels, covered by the client\'s viewport when accounting for pixel -offsets, eye, step, etc. (The coordinates are only relevant to the -default `client.dir` value of `NORTH`, and the `TOPDOWN_MAP` or -`SIDE_MAP` map formats.) +If the viewport is not currently on the map (for instance, when the eye is at a null location), the var reads as null. Otherwise, it is a list with five values (x, y, width, height, z) in the same form used by the bounds proc. -If the viewport is not currently on -the map (for instance, when the eye is at a null location), the var -reads as null. Otherwise, it is a list with five values (x, y, width, -height, z) in the same form used by the bounds proc. - -The alias -vars bound_x, bound_y, bound_width, and bound_height can also be used to -retrieve the individual values from the list. They too will be null if -the viewport is not on the map. - -> [!TIP] -> **See also:** -> + [bounds proc](/ref/proc/bounds.md) \ No newline at end of file +The alias vars bound_x, bound_y, bound_width, and bound_height can also be used to retrieve the individual values from the list. They too will be null if the viewport is not on the map. +*** +**Related Pages:** ++ [bounds proc](/ref/proc/bounds) diff --git a/ref/client/var/byond_build.md b/ref/client/var/byond_build.md index b5ffe1aa..398443f5 100644 --- a/ref/client/var/byond_build.md +++ b/ref/client/var/byond_build.md @@ -1,18 +1,11 @@ -## byond_build var (client) -###### BYOND Version 512 +## byond_build (var) +*** +This is the build number (minor version) of BYOND being run by this client. Typically this is not useful information, but it can come in handy when diagnosing issues reported by players using a beta build. -This is the build number (minor version) of BYOND being run by -this client. Typically this is not useful information, but it can come -in handy when diagnosing issues reported by players using a beta build. - - -Clients running versions of BYOND prior to 512 (major version) -will not have this information. It is also not guaranteed to exist for -non-Dream Seeker connections. When not available, byond_build is 0. - -> [!TIP] -> **See also:** -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) -> + [byond_version var (client)](/ref/client/var/byond_version.md) -> + [byond_version var (world)](/ref/world/var/byond_version.md) \ No newline at end of file +Clients running versions of BYOND prior to 512 (major version) will not have this information. It is also not guaranteed to exist for non-Dream Seeker connections. When not available, byond_build is 0. +*** +**Related Pages:** ++ [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION) ++ [byond_version var (client)](/ref/client/var/byond_version) ++ [byond_version var (world)](/ref/world/var/byond_version) diff --git a/ref/client/var/byond_version.md b/ref/client/var/byond_version.md index 651d896f..edc6bc71 100644 --- a/ref/client/var/byond_version.md +++ b/ref/client/var/byond_version.md @@ -1,14 +1,10 @@ -## byond_version var (client) - -This is the version of BYOND being run by this client. A game -designed to work around known bugs in older versions could use this to -adapt its behavior accordingly. It is also possible to prevent players -with much older versions from joining the game. - -> [!TIP] -> **See also:** -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) -> + [byond_build var (client)](/ref/client/var/byond_build.md) -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [system_type var (world)](/ref/world/var/system_type.md) \ No newline at end of file +## byond_version (var) +*** +This is the version of BYOND being run by this client. A game designed to work around known bugs in older versions could use this to adapt its behavior accordingly. It is also possible to prevent players with much older versions from joining the game. +*** +**Related Pages:** ++ [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION) ++ [byond_build var (client)](/ref/client/var/byond_build) ++ [byond_version var (world)](/ref/world/var/byond_version) ++ [system_type var (world)](/ref/world/var/system_type) diff --git a/ref/client/var/ckey.md b/ref/client/var/ckey.md index 16acd6af..d60d357d 100644 --- a/ref/client/var/ckey.md +++ b/ref/client/var/ckey.md @@ -1,12 +1,8 @@ -## ckey var (client) - -This is a read-only value that is the canonical form of the -player\'s key (ie the value returned by ckey()). Among other things, -this could be used as a unique directory name in a server-side save file -for storing player information. See the ckey() proc for an example. - -> [!TIP] -> **See also:** -> + [ckey proc](/ref/proc/ckey.md) -> + [key var (client)](/ref/client/var/key.md) \ No newline at end of file +## ckey (var) +*** +This is a read-only value that is the canonical form of the player's key (ie the value returned by ckey()). Among other things, this could be used as a unique directory name in a server-side save file for storing player information. See the ckey() proc for an example. +*** +**Related Pages:** ++ [ckey proc](/ref/proc/ckey) ++ [key var (client)](/ref/client/var/key) diff --git a/ref/client/var/color.md b/ref/client/var/color.md index 233a0f85..182ee718 100644 --- a/ref/client/var/color.md +++ b/ref/client/var/color.md @@ -1,32 +1,26 @@ -## color var (client) -###### BYOND Version 509 +## color (var) +*** +Casts a color multiplication or matrix effect over the entire main map. This behaves exactly the same as atom.color, and will be combined with atom.color (which comes first) where present. See atom.color for more information. +If a matrix is used, the alpha column and row will have no effect. -Casts a color multiplication or -[matrix](/ref/notes/color-matrix.md) effect over the entire main map. -This behaves exactly the same as atom.color, and will be combined with -atom.color (which comes first) where present. See -[atom.color](/ref/atom/var/color.md) for more information. - -If a -matrix is used, the alpha column and row will have no effect. +Icons that have the NO_CLIENT_COLOR value in appearance_flags will not be subject to client.color. This can be useful for HUD objects. +This value can be animated. -Icons that have the NO_CLIENT_COLOR value in appearance_flags -will not be subject to client.color. This can be useful for HUD objects. +```dm -This value can be animated. -### Example: +mob/proc/DayNight(is_day) + if(client) + client.color = is_day ? \ + null : \ + list(0.2,0.05,0.05, 0.1,0.3,0.2, 0.1,0.1,0.4) -```dm - mob/proc/DayNight(is_day) if(client) client.color = is_day -? \\ null : \\ list(0.2,0.05,0.05, 0.1,0.3,0.2, 0.1,0.1,0.4) ``` - -> [!TIP] -> **See also:** -> + [color var (atom)](/ref/atom/var/color.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) \ No newline at end of file +*** +**Related Pages:** ++ [color var (atom)](/ref/atom/var/color) ++ [appearance_flags var (atom)](/ref/atom/var/appearance_flags) diff --git a/ref/client/var/command_text.md b/ref/client/var/command_text.md index 8e67b67e..7faf682c 100644 --- a/ref/client/var/command_text.md +++ b/ref/client/var/command_text.md @@ -1,54 +1,49 @@ -## command_text (client) -###### BYOND Version d_text (client) {#command_text-client deprecated="1 +## command_text (var) -**Default value:** +**Default Value:** + null -Note: In BYOND 4.0 this var is deprecated. The -[command](/ref/skin/param/command.md) parameter for an [Input -control](/ref/skin/control/input.md) can be set to `!command` (`!` in -front of your default command) which does the same thing. - -This -text is placed onto the command line, to be followed by whatever the -user may type. It is usually the name of a verb followed by a space, -such as `"say "`. The user can clear this and enter a different command -by hitting backspace, escape, delete, or `/`. -### Example: +*** + +> [!TIP] +> Note: In BYOND 4.0 this var is deprecated. The command parameter for an Input control can be set to `!command` (`!` in front of your default command) which does the same thing. + +This text is placed onto the command line, to be followed by whatever the user may type. It is usually the name of a verb followed by a space, such as `"say "`. The user can clear this and enter a different command by hitting backspace, escape, delete, or `/`. + ```dm - client command_text = "say " verb/say(T as text) world -<< "[usr] says, \'[T]\'" + +client + command_text = "say " + + verb/say(T as text) + world << "[usr] says, '[T]'" + ``` - -It is also possible -to turn on macro mode, in which each keypress executes a [keyboard -macro](/ref/client/var/script/macro.md) by setting `command_text` to -`".alt "`. That stands for the *Alt* key, which can be used to execute -macros in normal mode. -This variable could also be used to -create a specialized command prompt. For example, a traditional style -MUD command-line could be implemented like this: -### Example: +It is also possible to turn on macro mode, in which each keypress executes a keyboard macro, by setting command_text to `".alt "`. That stands for the *Alt* key, which can be used to execute macros in normal mode. + +This variable could also be used to create a specialized command prompt. For example, a traditional style MUD command-line could be implemented like this: + ```dm - client command_text = "> " verb/command(C as -command_text) set name = ">" usr << "Your command: [C]" + +client + command_text = "> " + verb/command(C as command_text) + set name = ">" + usr << "Your command: [C]" ``` - - -This example uses the `command_text` input type, -which accepts raw text, with no quoting, escaping, or translating, so -that you can invent whatever syntax you want. - -> [!TIP] -> **See also:** -> + [arguments (verb)](/ref/verb/arguments.md) -> + [command parameter](/ref/skin/param/command.md) -> + [macros (client script)](/ref/client/var/script/macro.md) -> + [Input control (skin)](/ref/skin/control/input.md) -> + [command parameter (skin)](/ref/skin/param/command.md) -> + [macros (skin)](/ref/skin/macros.md) \ No newline at end of file + + +This example uses the `command_text` input type, which accepts raw text, with no quoting, escaping, or translating, so that you can invent whatever syntax you want. +*** +**Related Pages:** ++ [arguments (verb)](/ref/verb/arguments) ++ [command parameter](/ref/{skin}/param/command) ++ [macros (client script)](/ref/client/var/script/macro) ++ [Input](/ref/{skin}/control/input) ++ [command parameter](/ref/{skin}/param/command) ++ [macros (skin)](/ref/{skin}/macros) diff --git a/ref/client/var/computer_id.md b/ref/client/var/computer_id.md index 72610ec7..fe254320 100644 --- a/ref/client/var/computer_id.md +++ b/ref/client/var/computer_id.md @@ -1,11 +1,8 @@ -# computer_id var (client) -**Default value:** -+ A unique numerical identifier for the player\'s computer. The value - is in text form. +## computer_id (var) -This is a read-only text value which contains a unique -numerical identifier for the player\'s computer. Its primary purpose is -to detect if players are connecting to a server with multiple accounts -on the same machine, while still allowing for multiple accounts on the -same network (eg, through a router). \ No newline at end of file +**Default Value:** ++ A unique numerical identifier for the player's computer. The value is in text form. +*** +This is a read-only text value which contains a unique numerical identifier for the player's computer. Its primary purpose is to detect if players are connecting to a server with multiple accounts on the same machine, while still allowing for multiple accounts on the same network (eg, through a router). +*** \ No newline at end of file diff --git a/ref/client/var/connection.md b/ref/client/var/connection.md index 95362cfc..a28bb556 100644 --- a/ref/client/var/connection.md +++ b/ref/client/var/connection.md @@ -1,23 +1,9 @@ -# connection var (client) -###### BYOND Version 487 +## connection (var) +*** +This is a read-only var describing the type of client that is connected. -This is a read-only var describing the type of client that is -connected. -**Possible values:** -+ "seeker" - The player is connected through Dream Seeker -+ "telnet" - The player is connected through telnet -+ "world" - The client is actually a world.Export() connection from - another server -+ "cgi" - The client is connected via CGI (irrelevant to most - worlds) -+ "web" - The client is connected via the Web client -+ "http" - The client is an HTTP connection (used by the Web - client\'s virtual server) +Other values may be supported in the future. - -Other values may be supported in the future. - -An empty -value means the connection type is unknown because a full handshake -hasn\'t been completed yet. \ No newline at end of file +An empty value means the connection type is unknown because a full handshake hasn't been completed yet. +*** \ No newline at end of file diff --git a/ref/client/var/control_freak.md b/ref/client/var/control_freak.md index 4f344cb0..6556408b 100644 --- a/ref/client/var/control_freak.md +++ b/ref/client/var/control_freak.md @@ -1,49 +1,18 @@ -## control_freak (client) -**Default value:** -+ 0 - - -This var lets you set flags to turn off options that are -normally present for the end user. You can combine these flags with the -`|` operator. The value 1 is equivalent to `CONTROL_FREAK_ALL` and will -disable everything. -CONTROL_FREAK_ALL -+ If this value is used, it affects all the options below. - - User-defined macros may not be used. - - Only the world\'s skin or the default BYOND skin will be loaded, - not a user-customized version. - - The Options & Messages window in Dream Seeker is inaccessible. - It will only come up while first connecting to a remotely hosted - world, or if a world takes a long time to load. The .options - command will not make it appear. - - The menu items from Options & Messages are unavailable in Dream - Seeker\'s system menu. - - The default F2 macro for the .screenshot command is turned off. - The command is then only accessible through the skin you create. -CONTROL_FREAK_SKIN -+ Toggles the ability to create a custom version of the skin. -CONTROL_FREAK_MACROS -+ Toggles the ability to use and define custom macros. +## control_freak (var) +**Default Value:** ++ 0 +*** +This var lets you set flags to turn off options that are normally present for the end user. You can combine these flags with the `|` operator. The value 1 is equivalent to `CONTROL_FREAK_ALL` and will disable everything. -Using `CONTROL_FREAK_ALL` will default to disabling everything, -and the other flags will reenable only the features you want. For -example, `CONTROL_FREAK_MACROS` alone will disable the ability to use -your own macros but nothing else. -`CONTROL_FREAK_ALL | CONTROL_FREAK_MACROS` will disable everything -*except* macros. +Using `CONTROL_FREAK_ALL` will default to disabling everything, and the other flags will reenable only the features you want. For example, `CONTROL_FREAK_MACROS` alone will disable the ability to use your own macros but nothing else. `CONTROL_FREAK_ALL | CONTROL_FREAK_MACROS` will disable everything *except* macros. This value can be changed at runtime. - -Note: If you define your own skin for the world, and disable -the ability to use a custom skin or user-defined macros, you must be -sure to define any macros your world may need. For instance, arrow keys -may be needed for movement. - -> [!TIP] -> **See also:** -> + [User interface skins](/ref/skin.md) -> + [macros (skin)](/ref/skin/macros.md) -> + [macros (client script)](/ref/client/var/script/macro.md) \ No newline at end of file +Note: If you define your own skin for the world, and disable the ability to use a custom skin or user-defined macros, you must be sure to define any macros your world may need. For instance, arrow keys may be needed for movement. +*** +**Related Pages:** ++ [User interface skins](/ref/{skin}) ++ [macros (skin)](/ref/{skin}/macros) ++ [macros (client script)](/ref/client/var/script/macro) diff --git a/ref/client/var/default_verb_category.md b/ref/client/var/default_verb_category.md index ffb1caec..02fc9d59 100644 --- a/ref/client/var/default_verb_category.md +++ b/ref/client/var/default_verb_category.md @@ -1,15 +1,11 @@ -## default_verb_category var (client) - -**Default value:** -+ "Commands" +## default_verb_category (var) -All verbs with category "" (the default value) are treated as -though they had this category setting instead. In other words, this is -the name of the panel that contains them. You could even turn that panel -off by setting this value to null. - -> [!TIP] -> **See also:** -> + [category setting (verb)](/ref/verb/set/category.md) -> + [show_verb_panel var (client)](/ref/client/var/show_verb_panel.md) \ No newline at end of file +**Default Value:** ++ "Commands" +*** +All verbs with category "" (the default value) are treated as though they had this category setting instead. In other words, this is the name of the panel that contains them. You could even turn that panel off by setting this value to null. +*** +**Related Pages:** ++ [category setting (verb)](/ref/verb/set/category) ++ [show_verb_panel var (client)](/ref/client/var/show_verb_panel) diff --git a/ref/client/var/dir.md b/ref/client/var/dir.md index 3ac4b842..25aaf7f7 100644 --- a/ref/client/var/dir.md +++ b/ref/client/var/dir.md @@ -1,22 +1,12 @@ -# dir var (client) -**Default value:** -+ NORTH +## dir (var) -This defines the relationship between the world\'s coordinate -system and the player\'s screen. The default means that the player sees -the map exactly as it was created (in the map-editor or at runtime). -Changing it to one of the other directions causes the player to see the -map as if it were rotated to that direction. This means that a player -with client.dir = SOUTH would see the map inverted relative to a person -with client.dir = NORTH. That\'s handy in two-player board games where -you want both players to see their side in the same place. +**Default Value:** ++ NORTH +*** +This defines the relationship between the world's coordinate system and the player's screen. The default means that the player sees the map exactly as it was created (in the map-editor or at runtime). Changing it to one of the other directions causes the player to see the map as if it were rotated to that direction. This means that a player with client.dir = SOUTH would see the map inverted relative to a person with client.dir = NORTH. That's handy in two-player board games where you want both players to see their side in the same place. -Note -that this does not turn icons upside down! The map is rotated, but the -icons on the map remain in their normal orientation. +Note that this does not turn icons upside down! The map is rotated, but the icons on the map remain in their normal orientation. -Movement -keys are remapped so that a player with client.dir = SOUTH hitting the -up arrow will generate a call to client.South() rather than the usual -client.North(). \ No newline at end of file +Movement keys are remapped so that a player with client.dir = SOUTH hitting the up arrow will generate a call to client.South() rather than the usual client.North(). +*** \ No newline at end of file diff --git a/ref/client/var/edge_limit.md b/ref/client/var/edge_limit.md index a445acc2..945da4ae 100644 --- a/ref/client/var/edge_limit.md +++ b/ref/client/var/edge_limit.md @@ -1,35 +1,33 @@ -## edge_limit var (client) -**Default value:** -+ null +## edge_limit (var) +**Default Value:** ++ null +*** +This value determines the limits that a client's eye will display. If client.perspective uses the EDGE_PERSPECTIVE flag, the view shouldn't scroll beyond the bounds set by edge_limit. If the bounds of edge_limit are as big as or smaller than the client's view, no scrolling will occur even if EDGE_PERSPECTIVE is not used. Normally this value is null, which provides freedom for the eye to move anywhere on the map. It may be changed to a text value describing the limits in more detail. -This value determines the limits that a client\'s eye will -display. If `client.perspective` uses the `EDGE_PERSPECTIVE` flag, the -view shouldn\'t scroll beyond the bounds set by `edge_limit`. If the -bounds of `edge_limit` are as big as or smaller than the client\'s view, -no scrolling will occur even if `EDGE_PERSPECTIVE` is not used. Normally -this value is null, which provides freedom for the eye to move anywhere -on the map. It may be changed to a text value describing the limits in -more detail. +The format is similar to atom.screen_loc which uses "[x1],[y1] to [x2],[y2]". It can also use directions such as "SOUTHWEST to NORTHEAST", which refer to the limits of the map. -The format is similar to `atom.screen_loc` which -uses `"[x1],[y1] to [x2],[y2]"`. It can also use directions such as -`"SOUTHWEST to NORTHEAST"`, which refer to the limits of the map. -### Example: ```dm - area/house var/x1,x2,y1,y2 Entered(mob/M) if(ismob(M) && -M.client) M.client.edge_limit = "[x1],[y1] to [x2],[y2]" -Exited(mob/M) if(ismob(M) && M.client) M.client.edge_limit = null -``` +area/house + var/x1,x2,y1,y2 + Entered(mob/M) + if(ismob(M) && M.client) + M.client.edge_limit = "[x1],[y1] to [x2],[y2]" + + Exited(mob/M) + if(ismob(M) && M.client) + M.client.edge_limit = null + +``` -> [!TIP] -> **See also:** -> + [eye var (client)](/ref/client/var/eye.md) -> + [lazy_eye var (client)](/ref/client/var/lazy_eye.md) -> + [perspective var (client)](/ref/client/var/perspective.md) -> + [view var (client)](/ref/client/var/view.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) \ No newline at end of file +*** +**Related Pages:** ++ [eye var (client)](/ref/client/var/eye) ++ [lazy_eye var (client)](/ref/client/var/lazy_eye) ++ [perspective var (client)](/ref/client/var/perspective) ++ [view var (client)](/ref/client/var/view) ++ [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc) diff --git a/ref/client/var/eye.md b/ref/client/var/eye.md index c7db4c94..30a2342f 100644 --- a/ref/client/var/eye.md +++ b/ref/client/var/eye.md @@ -1,51 +1,36 @@ -## eye var (client) -**Default value:** +## eye (var) + +**Default Value:** + The connected mob, client.mob. +*** +This value determines the center of the player's map. The default value simply means that the visible region is normally centered on the player's mob. Effects such as setting perspective to EDGE_PERSPECTIVE or using lazy_eye can move the map off-center temporarily. The eye is the *ideal* center, not necessarily the actual center; to find the actual center, use virtual_eye. +The eye's step_x/y vars, if present, are also used to allow smooth scrolling of the map. These also obey lazy_eye and edge_limit. -This value determines the center of the player\'s map. The -default value simply means that the visible region is normally centered -on the player\'s mob. Effects such as setting `perspective` to -`EDGE_PERSPECTIVE` or using `lazy_eye` can move the map off-center -temporarily. The eye is the *ideal* center, not necessarily the actual -center; to find the actual center, use `virtual_eye`. +Note that the visibility of objects is still computed from the point of view of the mob rather than the eye. This allows the use of lazy_eye or similar effects that control the panning of the map while still having the player see only what the mob can see. To determine visibility from the eye, you can change the value of client.perspective. -The -eye\'s step_x/y vars, if present, are also used to allow smooth -scrolling of the map. These also obey lazy_eye and edge_limit. +If a player connects to a new mob M, client.eye automatically changes to M. -Note that the visibility of objects is still computed from the -point of view of the mob rather than the eye. This allows the use of -`lazy_eye` or similar effects that control the panning of the map while -still having the player see only what the mob can see. To determine -visibility from the eye, you can change the value of -`client.perspective`. +```dm -If a player connects to a new mob M, -client.eye automatically changes to M. -### Example: +client + eye = locate(5,5,1) -```dm - client eye = locate(5,5,1) ``` - - -This fixes -the center of the player\'s map at the turf coordinate (5,5,1). Since -the eye is fixed, the map will not scroll even as the player\'s mob -moves out of the visible range. - -> [!TIP] -> **See also:** -> + [edge_limit var (client)](/ref/client/var/edge_limit.md) -> + [lazy_eye var (client)](/ref/client/var/lazy_eye.md) -> + [mob var (client)](/ref/client/var/mob.md) -> + [perspective var (client)](/ref/client/var/perspective.md) -> + [glide_size var (client)](/ref/client/var/glide_size.md) -> + [view var (client)](/ref/client/var/view.md) -> + [virtual_eye var (client)](/ref/client/var/virtual_eye.md) -> + [view var (world)](/ref/world/var/view.md) -> + [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) -> + [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) \ No newline at end of file + + +This fixes the center of the player's map at the turf coordinate (5,5,1). Since the eye is fixed, the map will not scroll even as the player's mob moves out of the visible range. +*** +**Related Pages:** ++ [edge_limit var (client)](/ref/client/var/edge_limit) ++ [lazy_eye var (client)](/ref/client/var/lazy_eye) ++ [mob var (client)](/ref/client/var/mob) ++ [perspective var (client)](/ref/client/var/perspective) ++ [glide_size var (client)](/ref/client/var/glide_size) ++ [view var (client)](/ref/client/var/view) ++ [virtual_eye var (client)](/ref/client/var/virtual_eye) ++ [view var (world)](/ref/world/var/view) ++ [step_x var (movable atom)](/ref/atom/movable/var/step_x) ++ [step_y var (movable atom)](/ref/atom/movable/var/step_y) diff --git a/ref/client/var/fps.md b/ref/client/var/fps.md index 39e4a307..f9325cd5 100644 --- a/ref/client/var/fps.md +++ b/ref/client/var/fps.md @@ -1,22 +1,14 @@ -## fps var (client) -###### BYOND Version 511 -**Default value:** -+ 0 (uses world.fps value) - - -This is a client version of world.fps, so that the client can -run at a faster speed for animations. For example, setting client.fps to -40 while world.fps is the default 10 will mean that all animations and -glides are smoothed out and displayed at 40 FPS, even though the server -still runs at 10 FPS. The result is a nicer-looking game with no -additional impact on the server. +## fps (var) -When this value is 0, the -client and server tick at the same rate. - -> [!TIP] -> **See also:** -> + [fps var (world)](/ref/world/var/fps.md) -> + [tick_lag var (client)](/ref/client/var/tick_lag.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +**Default Value:** ++ 0 (uses world.fps value) +*** +This is a client version of world.fps, so that the client can run at a faster speed for animations. For example, setting client.fps to 40 while world.fps is the default 10 will mean that all animations and glides are smoothed out and displayed at 40 FPS, even though the server still runs at 10 FPS. The result is a nicer-looking game with no additional impact on the server. + +When this value is 0, the client and server tick at the same rate. +*** +**Related Pages:** ++ [fps var (world)](/ref/world/var/fps) ++ [tick_lag var (client)](/ref/client/var/tick_lag) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/client/var/gender.md b/ref/client/var/gender.md index 9a544b1c..45aed66f 100644 --- a/ref/client/var/gender.md +++ b/ref/client/var/gender.md @@ -1,20 +1,21 @@ -## gender var (client) + +## gender (var) +*** +This is the client's gender, which is an attribute of the player's key. By default, when a new mob is made for a player (in client.New()), the new mob gets the same name and gender as the player's key. This influences text macros like \he, which may expand to "it", "he", "she", or "they". Valid values are: -This is the client\'s gender, which is an attribute of the -player\'s key. By default, when a new mob is made for a player (in -client.New()), the new mob gets the same name and gender as the -player\'s key. This influences text macros like `\he`, which may expand -to "it", "he", "she", or "they". Valid values are: ```dm -"neuter" "male" "female" "plural" -``` +"neuter" +"male" +"female" +"plural" +``` -> [!TIP] -> **See also:** -> + [New proc (client)](/ref/client/proc/New.md) -> + [gender var (atom)](/ref/atom/var/gender.md) -> + [key var (client)](/ref/client/var/key.md) -> + [macros (text)](/ref/DM/text/macros.md) \ No newline at end of file +*** +**Related Pages:** ++ [New proc (client)](/ref/client/proc/New) ++ [gender](/ref/atom/var/gender) ++ [key var (client)](/ref/client/var/key) ++ [macros (text)](/ref/DM/text/macros) diff --git a/ref/client/var/glide_size.md b/ref/client/var/glide_size.md index a3b1cdb0..e79f86e4 100644 --- a/ref/client/var/glide_size.md +++ b/ref/client/var/glide_size.md @@ -1,29 +1,17 @@ -## glide_size var (client) -###### BYOND Version 490 +## glide_size (var) -**Default value:** +**Default Value:** + 0 +*** +Note: The way this setting is used depends on world.movement_mode. See Gliding for more details. +This controls the number of pixels the map is moved in each step during scrolling of the map. The default value of 0 chooses automated control over this value, which generally results in a minimum step of 4 pixels that is increased when necessary to keep up with motion of the map. -Note: The way this setting is used depends on -[world.movement_mode](/ref/world/var/movement_mode.md) . See -[Gliding](/ref/notes/gliding.md) for more details. - -This -controls the number of pixels the map is moved in each step during -scrolling of the map. The default value of 0 chooses automated control -over this value, which generally results in a minimum step of 4 pixels -that is increased when necessary to keep up with motion of the map. - - -Be careful about using small step sizes. Icons with high -contrast pixel-level detail can look pretty ugly when displaced by short -distances. +Be careful about using small step sizes. Icons with high contrast pixel-level detail can look pretty ugly when displaced by short distances. This was renamed from `pixel_step_size`. - -> [!TIP] -> **See also:** -> + [eye var (client)](/ref/client/var/eye.md) -> + [glide_size var (movable atoms)](/ref/atom/movable/var/glide_size.md) \ No newline at end of file +*** +**Related Pages:** ++ [eye var (client)](/ref/client/var/eye) ++ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size) diff --git a/ref/client/var/images.md b/ref/client/var/images.md index d4b4c1de..acb18048 100644 --- a/ref/client/var/images.md +++ b/ref/client/var/images.md @@ -1,26 +1,27 @@ -## images var (client) +## images (var) +*** +This is a list of images that are displayed to the user. The output operator is one way to add entries to this list. Deleting an image object will automatically remove it from the display, but if you want to retain an image (so other people can still see it), it can be removed by directly modifying this list. -This is a list of images that are displayed to the user. The -output operator is one way to add entries to this list. Deleting an -image object will automatically remove it from the display, but if you -want to retain an image (so other people can still see it), it can be -removed by directly modifying this list. -### Example: ```dm - var/image/I = new(\'image.dmi\',usr) usr.client.images += -I //display it sleep(50) usr.client.images -= I //remove it from the -display + +var/image/I = new('image.dmi',usr) +usr.client.images += I //display it +sleep(50) +usr.client.images -= I //remove it from the display + ``` - Displaying the image can also be achieved like this: + + ```dm - usr << I -``` +usr << I + +``` -> [!TIP] -> **See also:** -> + [image objects](/ref/image.md) -> + [image proc](/ref/proc/image.md) \ No newline at end of file +*** +**Related Pages:** ++ [image objects](/ref/image) ++ [image proc](/ref/proc/image) diff --git a/ref/client/var/inactivity.md b/ref/client/var/inactivity.md index 631d8990..cab617bd 100644 --- a/ref/client/var/inactivity.md +++ b/ref/client/var/inactivity.md @@ -1,19 +1,16 @@ -## inactivity var (client) +## inactivity (var) +*** +This is equal to the amount of time (in server ticks, which default to 1/10s) since the player's last action (such as executing a verb, moving, clicking an object, or selecting a topic link). This value is reset to 0 after each new action so you can use it to determine the time that has passed since the last one. -This is equal to the amount of time (in server ticks, which -default to 1/10s) since the player\'s last action (such as executing a -verb, moving, clicking an object, or selecting a topic link). This value -is reset to 0 after each new action so you can use it to determine the -time that has passed since the last one. -### Example: ```dm - mob/verb/inactivity() usr << "You have been inactive -for [client.inactivity/10] seconds." -``` +mob/verb/inactivity() + usr << "You have been inactive for [client.inactivity/10] seconds." + +``` -> [!TIP] -> **See also:** -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) \ No newline at end of file +*** +**Related Pages:** ++ [tick_lag var (world)](/ref/world/var/tick_lag) diff --git a/ref/client/var/index.md b/ref/client/var/index.md new file mode 100644 index 00000000..fb66a13d --- /dev/null +++ b/ref/client/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in client vars: +*** \ No newline at end of file diff --git a/ref/client/var/key.md b/ref/client/var/key.md index 135a940b..89074721 100644 --- a/ref/client/var/key.md +++ b/ref/client/var/key.md @@ -1,12 +1,10 @@ -## key var (client) -**Default value:** -+ The player\'s key identity. +## key (var) - -This is a read-only value that contains the player\'s key. Once -the player is attached to a mob M, M.key == M.client.key. - -> [!TIP] -> **See also:** -> + [key var (mob)](/ref/mob/var/key.md) \ No newline at end of file +**Default Value:** ++ The player's key identity. +*** +This is a read-only value that contains the player's key. Once the player is attached to a mob M, M.key == M.client.key. +*** +**Related Pages:** ++ [key var (mob)](/ref/mob/var/key) diff --git a/ref/client/var/lazy_eye.md b/ref/client/var/lazy_eye.md index fb05f4bd..11a62ca2 100644 --- a/ref/client/var/lazy_eye.md +++ b/ref/client/var/lazy_eye.md @@ -1,39 +1,26 @@ -## lazy_eye var (client) -**Default value:** +## lazy_eye (var) + +**Default Value:** + 0 +*** +This is the maximum "lag" between client.eye and client.mob. The mob can stray up to this many tiles before the eye will move to keep it in view. The default value of 0 means that the eye always moves as the mob moves, keeping the mob at the center of the player's map. +Setting this value to a non-zero value automatically initializes client.eye to client.mob.loc (or to the center of the full map if that is possible). Thereafter, client.eye will stray from the mob as it moves about the map, making one big jump to catch up whenever the mob gets out of range. -This is the maximum "lag" between client.eye and client.mob. -The mob can stray up to this many tiles before the eye will move to keep -it in view. The default value of 0 means that the eye always moves as -the mob moves, keeping the mob at the center of the player\'s map. +```dm -Setting this value to a non-zero value automatically -initializes client.eye to client.mob.loc (or to the center of the full -map if that is possible). Thereafter, client.eye will stray from the mob -as it moves about the map, making one big jump to catch up whenever the -mob gets out of range. -### Example: +client + lazy_eye = 5 -```dm - client lazy_eye = 5 ``` - - -This setting -allows client.mob to move onto the entire 11x11 visible region without -changing the value of client.eye. The moment it steps out of this -region, the entire region will shift 5 tiles in the direction of motion. -You can assign lazy_eye to any value valid as a view size, so, -for example, if you have a non-square setting for client.view, say, -"17x11", you could apply a similar setting to lazy_eye. You can even -make one dimension lazy and the other one strictly centered: "0x5". +This setting allows client.mob to move onto the entire 11x11 visible region without changing the value of client.eye. The moment it steps out of this region, the entire region will shift 5 tiles in the direction of motion. -> [!TIP] -> **See also:** -> + [view var (client)](/ref/client/var/view.md) -> + [view var (world)](/ref/world/var/view.md) \ No newline at end of file +You can assign lazy_eye to any value valid as a view size, so, for example, if you have a non-square setting for client.view, say, "17x11", you could apply a similar setting to lazy_eye. You can even make one dimension lazy and the other one strictly centered: "0x5". +*** +**Related Pages:** ++ [view var (client)](/ref/client/var/view) ++ [view var (world)](/ref/world/var/view) diff --git a/ref/client/var/mob.md b/ref/client/var/mob.md index f0a1be41..dc1cde67 100644 --- a/ref/client/var/mob.md +++ b/ref/client/var/mob.md @@ -1,11 +1,18 @@ -# mob var (client) -**Default value:** + +## mob (var) + +**Default Value:** + Determined in client.New(), by default world.mob. +*** +This is the mob to which the client is connected. The client and its connected mob have the following symmetry: -This is the mob to which the client is connected. The client -and its connected mob have the following symmetry: ```dm - client -== mob.client client.mob == mob client.key == mob.key + +client == mob.client +client.mob == mob +client.key == mob.key + ``` + +*** \ No newline at end of file diff --git a/ref/client/var/mouse_pointer_icon.md b/ref/client/var/mouse_pointer_icon.md index 5c28b1e8..8b39201e 100644 --- a/ref/client/var/mouse_pointer_icon.md +++ b/ref/client/var/mouse_pointer_icon.md @@ -1,36 +1,18 @@ -## mouse_pointer_icon var (client) - -**Default value:** -+ null +## mouse_pointer_icon (var) -This is an icon file (.dmi) containing custom mouse cursors to -use in place of the standard ones. The different possible mouse states -are distinguished by special icon state names: -"" -+ Activated when over empty space or an object with mouse_over_pointer - = MOUSE_INACTIVE_POINTER. -"over" -+ Activated when over an object with mouse_over_pointer = - MOUSE_ACTIVE_POINTER. -"drag" -+ Activated when dragging an object with mouse_drag_pointer = - MOUSE_ACTIVE_POINTER. -"drop" -+ Activated when dragging an object over with mouse_drop_pointer = - MOUSE_ACTIVE_POINTER and the object underneath has mouse_drop_zone - set. -"all" -+ Always activated, no matter what the state of the mouse. - -> [!TIP] -> **See also:** -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) -> + [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) -> + [mouse_drag_pointer var (atom)](/ref/atom/var/mouse_drag_pointer.md) -> + [mouse_drop_zone var (atom)](/ref/atom/var/mouse_drop_zone.md) -> + [mouse_over_pointer var (atom)](/ref/atom/var/mouse_over_pointer.md) \ No newline at end of file +**Default Value:** ++ null +*** +This is an icon file (.dmi) containing custom mouse cursors to use in place of the standard ones. The different possible mouse states are distinguished by special icon state names: +*** +**Related Pages:** ++ [Click proc (client)](/ref/client/proc/Click) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) ++ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer) ++ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer) ++ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone) ++ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer) diff --git a/ref/client/var/perspective.md b/ref/client/var/perspective.md index 7723961a..7a68e76f 100644 --- a/ref/client/var/perspective.md +++ b/ref/client/var/perspective.md @@ -1,32 +1,17 @@ -## perspective var (client) - -**Default value:** -+ MOB_PERSPECTIVE - -**Possible values:** -+ - MOB_PERSPECTIVE - - EYE_PERSPECTIVE - - EDGE_PERSPECTIVE +## perspective (var) -This controls the eye\'s apparent center and what can be seen -by the client. - -EYE_PERSPECTIVE determines how visibility -calculations are performed when `client.eye` and `client.mob` are -different. Normally, visibility is done from the position of the mob, -rather than from the eye (which is actually just the center of the map -view). The alternative flag is MOB_PERSPECTIVE, the default. - +**Default Value:** ++ MOB_PERSPECTIVE +*** +This controls the eye's apparent center and what can be seen by the client. -EDGE_PERSPECTIVE limits scrolling to the bounds of the map (1,1 -to world.maxx,world.maxy), and does not keep the mob centered if it -strays near the edge. +EYE_PERSPECTIVE determines how visibility calculations are performed when client.eye and client.mob are different. Normally, visibility is done from the position of the mob, rather than from the eye (which is actually just the center of the map view). The alternative flag is MOB_PERSPECTIVE, the default. -The above values can be used together via -the \| operator. +EDGE_PERSPECTIVE limits scrolling to the bounds of the map (1,1 to world.maxx,world.maxy), and does not keep the mob centered if it strays near the edge. -> [!TIP] -> **See also:** -> + [eye var (client)](/ref/client/var/eye.md) -> + [mob var (client)](/ref/client/var/mob.md) \ No newline at end of file +The above values can be used together via the | operator. +*** +**Related Pages:** ++ [eye var (client)](/ref/client/var/eye) ++ [mob var (client)](/ref/client/var/mob) diff --git a/ref/client/var/pixel_step_size.md b/ref/client/var/pixel_step_size.md index 558b0c09..3c2889d4 100644 --- a/ref/client/var/pixel_step_size.md +++ b/ref/client/var/pixel_step_size.md @@ -1,4 +1,5 @@ -## pixel_step_size var (client) - -Renamed to [glide_size](/ref/atom/movable/var/glide_size.md) \ No newline at end of file +## pixel_step_size (var) +*** +Renamed to glide_size. +*** \ No newline at end of file diff --git a/ref/client/var/pixel_w.md b/ref/client/var/pixel_w.md index 956a61d0..9196d3c5 100644 --- a/ref/client/var/pixel_w.md +++ b/ref/client/var/pixel_w.md @@ -1,18 +1,14 @@ -## pixel_w var (client) - -**Default value:** -+ 0 +## pixel_w (var) -This displaces the player\'s viewpoint horizontally by the -specified number of pixels. This value is meant to be used when -world.map_format is not set to a default top-down view. Can be animated -with the animate() proc. - -> [!TIP] -> **See also:** -> + [glide_size var (client)](/ref/client/var/glide_size.md) -> + [pixel_x var (client)](/ref/client/var/pixel_x.md) -> + [pixel_y var (client)](/ref/client/var/pixel_y.md) -> + [pixel_z var (client)](/ref/client/var/pixel_z.md) -> + [map_format var (world)](/ref/world/var/map_format.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +This displaces the player's viewpoint horizontally by the specified number of pixels. This value is meant to be used when world.map_format is not set to a default top-down view. Can be animated with the animate() proc. +*** +**Related Pages:** ++ [glide_size var (client)](/ref/client/var/glide_size) ++ [pixel_x var (client)](/ref/client/var/pixel_x) ++ [pixel_y var (client)](/ref/client/var/pixel_y) ++ [pixel_z var (client)](/ref/client/var/pixel_z) ++ [map_format var (world)](/ref/world/var/map_format) diff --git a/ref/client/var/pixel_x.md b/ref/client/var/pixel_x.md index 94c103fc..0b16f14b 100644 --- a/ref/client/var/pixel_x.md +++ b/ref/client/var/pixel_x.md @@ -1,15 +1,13 @@ -## pixel_x var (client) - -**Default value:** -+ 0 +## pixel_x (var) -This displaces the player\'s viewpoint on the x-axis by the -specified number of pixels. Can be animated with the animate() proc. - -> [!TIP] -> **See also:** -> + [glide_size var (client)](/ref/client/var/glide_size.md) -> + [pixel_y var (client)](/ref/client/var/pixel_y.md) -> + [pixel_w var (client)](/ref/client/var/pixel_w.md) -> + [pixel_z var (client)](/ref/client/var/pixel_z.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +This displaces the player's viewpoint on the x-axis by the specified number of pixels. Can be animated with the animate() proc. +*** +**Related Pages:** ++ [glide_size var (client)](/ref/client/var/glide_size) ++ [pixel_y var (client)](/ref/client/var/pixel_y) ++ [pixel_w var (client)](/ref/client/var/pixel_w) ++ [pixel_z var (client)](/ref/client/var/pixel_z) diff --git a/ref/client/var/pixel_y.md b/ref/client/var/pixel_y.md index 92c53d16..3d13eec4 100644 --- a/ref/client/var/pixel_y.md +++ b/ref/client/var/pixel_y.md @@ -1,15 +1,13 @@ -## pixel_y var (client) - -**Default value:** -+ 0 +## pixel_y (var) -This displaces the player\'s viewpoint on the y-axis by the -specified number of pixels. Can be animated with the animate() proc. - -> [!TIP] -> **See also:** -> + [glide_size var (client)](/ref/client/var/glide_size.md) -> + [pixel_x var (client)](/ref/client/var/pixel_x.md) -> + [pixel_w var (client)](/ref/client/var/pixel_w.md) -> + [pixel_z var (client)](/ref/client/var/pixel_z.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +This displaces the player's viewpoint on the y-axis by the specified number of pixels. Can be animated with the animate() proc. +*** +**Related Pages:** ++ [glide_size var (client)](/ref/client/var/glide_size) ++ [pixel_x var (client)](/ref/client/var/pixel_x) ++ [pixel_w var (client)](/ref/client/var/pixel_w) ++ [pixel_z var (client)](/ref/client/var/pixel_z) diff --git a/ref/client/var/pixel_z.md b/ref/client/var/pixel_z.md index c4c8db5c..5ee62989 100644 --- a/ref/client/var/pixel_z.md +++ b/ref/client/var/pixel_z.md @@ -1,18 +1,14 @@ -## pixel_z var (client) - -**Default value:** -+ 0 +## pixel_z (var) -This displaces the player\'s viewpoint vertically by the -specified number of pixels. This value is meant to be used when -world.map_format is not set to a default top-down view. Can be animated -with the animate() proc. - -> [!TIP] -> **See also:** -> + [glide_size var (client)](/ref/client/var/glide_size.md) -> + [pixel_x var (client)](/ref/client/var/pixel_x.md) -> + [pixel_y var (client)](/ref/client/var/pixel_y.md) -> + [pixel_w var (client)](/ref/client/var/pixel_w.md) -> + [map_format var (world)](/ref/world/var/map_format.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +This displaces the player's viewpoint vertically by the specified number of pixels. This value is meant to be used when world.map_format is not set to a default top-down view. Can be animated with the animate() proc. +*** +**Related Pages:** ++ [glide_size var (client)](/ref/client/var/glide_size) ++ [pixel_x var (client)](/ref/client/var/pixel_x) ++ [pixel_y var (client)](/ref/client/var/pixel_y) ++ [pixel_w var (client)](/ref/client/var/pixel_w) ++ [map_format var (world)](/ref/world/var/map_format) diff --git a/ref/client/var/preload_rsc.md b/ref/client/var/preload_rsc.md index b68bdc20..16ed1450 100644 --- a/ref/client/var/preload_rsc.md +++ b/ref/client/var/preload_rsc.md @@ -1,56 +1,28 @@ -# preload_rsc var (client) -**Default value:** -+ 1. +## preload_rsc (var) -This variable controls whether resource files (icons and -sounds) are automatically downloaded by Dream Seeker when first -connecting, or whether they should be downloaded as needed. Resource -files are cached (in byond.rsc) for future use, so this should only -affect people who have not played the game before or who have not played -it for some time. +**Default Value:** ++ 1. +*** +This variable controls whether resource files (icons and sounds) are automatically downloaded by Dream Seeker when first connecting, or whether they should be downloaded as needed. Resource files are cached (in byond.rsc) for future use, so this should only affect people who have not played the game before or who have not played it for some time. The three possible settings are: -0 -+ do not preload any resources -1 -+ preload compiled-in resources only -2 -+ preload all resources including those uploaded by players -URL -+ preload resources from specified file +Preloading resource files will eliminate delays later on, but may cause a very long initial delay when logging in. -Preloading resource files will eliminate delays later on, but -may cause a very long initial delay when logging in. +Resources may also be distributed from a website to save bandwidth on the machine hosting the game. Simply zip up the .rsc file, upload it to a web site, and put the URL here. -Resources -may also be distributed from a website to save bandwidth on the machine -hosting the game. Simply zip up the .rsc file, upload it to a web site, -and put the URL here. -### Example: ```dm - client/preload_rsc = -"http://dan.byond.com/mygame_rsc.zip" + +client/preload_rsc = "http://dan.byond.com/mygame_rsc.zip" + ``` - - -Instead of -putting the .rsc file in the .zip, you can also put the individual -resource files there. This would allow you to select specific files that -you would like to be preloaded. For example, you could create a -different resource package for different parts of the game world and -assign client.preload_rsc dynamically as the player moves into each -different area. - -Once Dream Seeker has downloaded a resource -package, it caches it and will not download it again, even if you upload -a new version of the file. This allows you to make small changes without -forcing a complete refresh. Any files which are not found in the preload -package are simply downloaded from the game server directly. - -If -you want to force a complete refresh, simply change the name of the -resource package. For example, you could put a version number in the -name of the file: `mygame_rsc_01.zip`, `mygame_rsc_02.zip`, and so on. \ No newline at end of file + + +Instead of putting the .rsc file in the .zip, you can also put the individual resource files there. This would allow you to select specific files that you would like to be preloaded. For example, you could create a different resource package for different parts of the game world and assign client.preload_rsc dynamically as the player moves into each different area. + +Once Dream Seeker has downloaded a resource package, it caches it and will not download it again, even if you upload a new version of the file. This allows you to make small changes without forcing a complete refresh. Any files which are not found in the preload package are simply downloaded from the game server directly. + +If you want to force a complete refresh, simply change the name of the resource package. For example, you could put a version number in the name of the file: `mygame_rsc_01.zip`, `mygame_rsc_02.zip`, and so on. +*** \ No newline at end of file diff --git a/ref/client/var/screen.md b/ref/client/var/screen.md index 8e8d5b58..371ce36c 100644 --- a/ref/client/var/screen.md +++ b/ref/client/var/screen.md @@ -1,22 +1,18 @@ -## screen var (client) +## screen (var) +*** +This is a list of objects that are displayed on the user's screen. The object's screen_loc variable controls where it appears (if it appears at all). This allows one to create the elements of a graphical user interface, with such features as buttons, drag/drop areas, and stat monitors. + +Screen objects (visible or otherwise) may also be used to make verbs available to users. To make them accessible, define verbs on the screen object like this: -This is a list of objects that are displayed on the user\'s -screen. The object\'s screen_loc variable controls where it appears (if -it appears at all). This allows one to create the elements of a -graphical user interface, with such features as buttons, drag/drop -areas, and stat monitors. -Screen objects (visible or otherwise) -may also be used to make verbs available to users. To make them -accessible, define verbs on the screen object like this: ```dm -set src in usr.client.screen -``` +set src in usr.client.screen +``` -> [!TIP] -> **See also:** -> + [HUD / screen objects](/ref/notes/HUD.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) \ No newline at end of file +*** +**Related Pages:** ++ [HUD / screen objects](/ref/{notes}/HUD) ++ [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc) diff --git a/ref/client/var/script.md b/ref/client/var/script.md deleted file mode 100644 index 131823b2..00000000 --- a/ref/client/var/script.md +++ /dev/null @@ -1,64 +0,0 @@ -## script var (client) - - script)](/ref/client/var/script/PASSWORD_TRIGGER.md) -+ [URL (client script)](/ref/client/var/script/URL.md) -+ [aliases (client script)](/ref/client/var/script/alias.md) -+ [browser configuration](/ref/client/var/script/URL/browser.md) -+ [command_text (client)](/ref/client/var/command_text.md) -+ [macros (client script)](/ref/client/var/script/macro.md) -+ [macros (skin)](/ref/skin/macros.md) -+ [style sheets](/ref/DM/text/style.md) -+ [style sheets (in scripts)](/ref/client/var/script/style.md) -**Default value:** -+ none - - -Client scripts are mini-programs used to configure the client. -The language they use is called DM Script, and will undoubtedly expand -in the future. Currently, client scripts can be used to define style -sheets, command aliases, and macros. When executed directly by a player, -they can also be used to specify an initial URL to open and a password -trigger (for some ancient telnet worlds that don\'t suppress password -echo). - -For the specific syntax of DM Script, see the relevant -reference sections listed above. - -The `client.script` variable -may be assigned to script code in a text string (double quotes) or in a -file (single quotes). You can also simply include the file in your -project or explicitly use the `#include` statement. Files containing DM -Script should have the extension `.dms`. - - -### Example: - -```dm - client/script = " -" -``` - - -This example selects a default monospace font for -all output to the terminal. - -In addition to scripts loaded via -`client.script`, the player may have *client-side* scripts. These are -either called *connection* scripts or *post-connection* scripts -depending on whether they are used to automatically connect to a world -or whether they are executed automatically after connecting to a world. -In either case, the player\'s scripts are always executed before the -designer\'s `client.script` script, so style sheets from the designer -have higher precedence by default. - -There are three -post-connection client-side scripts for the three types of worlds the -client can connect to: `byond.dms`, `telnet.dms`, and `irc.dms`. These -are automatically executed if the player connects directly to a world -without using a connection script to do so. The intention is to load any -standard configurations such as style sheets and command aliases. - -> [!TIP] -> **See also:** -> + [#include directive](/ref/DM/preprocessor/include.md) -> + [PASSWORD_TRIGGER (client \ No newline at end of file diff --git a/ref/client/var/script/PASSWORD_TRIGGER.md b/ref/client/var/script/PASSWORD_TRIGGER.md index eaabc4bc..a07936e7 100644 --- a/ref/client/var/script/PASSWORD_TRIGGER.md +++ b/ref/client/var/script/PASSWORD_TRIGGER.md @@ -1,14 +1,10 @@ -# PASSWORD_TRIGGER (client script) -**Format:** -+ #define PASSWORD_TRIGGER "assword:" +## PASSWORD_TRIGGER (var) -This defines a special text *trigger* used to detect when the -user is being prompted for a password in telnet mode. Most MUDs -automatically suppress password echo, but if they do not, it is -necessary to use this setting to hide it. Multiple triggers may be -defined as necessary. +**Format:** ++ #define PASSWORD_TRIGGER "assword:" +*** +This defines a special text trigger used to detect when the user is being prompted for a password in telnet mode. Most MUDs automatically suppress password echo, but if they do not, it is necessary to use this setting to hide it. Multiple triggers may be defined as necessary. -The example above is more robust than the -more polite version because it works whether they capitalize the \'P\' -or not... \ No newline at end of file +The example above is more robust than the more polite version because it works whether they capitalize the 'P' or not... +*** \ No newline at end of file diff --git a/ref/client/var/script/URL.md b/ref/client/var/script/URL.md deleted file mode 100644 index af239ab6..00000000 --- a/ref/client/var/script/URL.md +++ /dev/null @@ -1,15 +0,0 @@ -# URL (client script) -**Format:** -+ #define URL "byond://byond.com:6000" - - -Defining a URL in a script, specifies the world to connect to -when the script is executed by the player. This is referred to as a -connection script, because the player uses it to connect to a world. -Other post-connection scripts such as `byond.dms` or a script loaded -through `client.script` are only used to configure the client after it -has connected to a world. In those cases, the URL setting has no effect. - - -It is important to enclose the URL in double quotes. Otherwise, -the `//` symbol would be mistaken for a comment. \ No newline at end of file diff --git a/ref/client/var/script/URL/browser.md b/ref/client/var/script/URL/browser.md index 37f35468..f675bda8 100644 --- a/ref/client/var/script/URL/browser.md +++ b/ref/client/var/script/URL/browser.md @@ -1,39 +1,39 @@ -## browser configuration +## browser (var) +*** +DM Script can be used to effectively make a hyperlink in a web document to a BYOND world. This is done by making a DM Script file that defines the desired URL. It need do nothing more than that. When a user clicks on the link in a web browser, DreamSeeker will pop up, execute the script, and connect to the specified URL. -DM Script can be used to effectively make a hyperlink in a web -document to a BYOND world. This is done by making a DM Script file that -defines the desired URL. It need do nothing more than that. When a user -clicks on the link in a web browser, DreamSeeker will pop up, execute -the script, and connect to the specified URL. +Some browsers may need to be configured to know what to do with a DM Script file. For example, in Netscape, you can add an entry to the list of helper applications. You should add a MIME type called 'application/x-dms' with the description 'DM Script' and the extension dms. Have this execute DreamSeeker with the .dms file as an argument. -Some browsers may -need to be configured to know what to do with a DM Script file. For -example, in Netscape, you can add an entry to the list of helper -applications. You should add a MIME type called \'`application/x-dms`\' -with the description \'DM Script\' and the extension `dms`. Have this -execute DreamSeeker with the `.dms` file as an argument. -### Example: -### myworld.dms ```dm - /*If your browser shows you this, you either need to -install BYOND (it\'s free!) from www.byond.com, or you need to configure -your browser to execute DreamSeeker with DM Script (.dms) files. */ -#define URL "byond://myworld" + +/*If your browser shows you this, you either need + to install BYOND (it's free!) from www.byond.com, + or you need to configure your browser to execute + DreamSeeker with DM Script (.dms) files. +*/ +#define URL "byond://myworld" + ``` -### myworld.html + ```dm +Welcome to My World + +You can connect to my world +here. + + -You can connect to my world [here](myworld.dms). ``` -> [!TIP] -> **See also:** -> + [URL (client script)](/ref/client/var/script/URL.md) \ No newline at end of file +You can connect to my world here. +*** +**Related Pages:** ++ [URL (client script)](/ref/client/var/script/URL) diff --git a/ref/client/var/script/URL/index.md b/ref/client/var/script/URL/index.md new file mode 100644 index 00000000..a8772c1e --- /dev/null +++ b/ref/client/var/script/URL/index.md @@ -0,0 +1,10 @@ + +## URL (var) + +**Format:** ++ #define URL "byond://byond.com:6000" +*** +Defining a URL in a script, specifies the world to connect to when the script is executed by the player. This is referred to as a connection script, because the player uses it to connect to a world. Other post-connection scripts such as byond.dms or a script loaded through client.script are only used to configure the client after it has connected to a world. In those cases, the URL setting has no effect. + +It is important to enclose the URL in double quotes. Otherwise, the // symbol would be mistaken for a comment. +*** \ No newline at end of file diff --git a/ref/client/var/script/alias.md b/ref/client/var/script/alias.md index 661c67e8..890fe88d 100644 --- a/ref/client/var/script/alias.md +++ b/ref/client/var/script/alias.md @@ -1,40 +1,27 @@ -## aliases (client script) +## alias (var) +*** +Command aliases have a syntax similar to verbs. They define a command and a series of arguments which can then be used to execute a new command. The most common use for this is in a telnet world like a MUD. By defining aliases corresponding to the MUD commands, the player can have primitive command expansion and help. -Command aliases have a syntax similar to verbs. They define a -command and a series of arguments which can then be used to execute a -new command. The most common use for this is in a telnet world like a -MUD. By defining aliases corresponding to the MUD commands, the player -can have primitive command expansion and help. +The syntax of an alias definition is best illustrated by the following example: -The syntax of an -alias definition is best illustrated by the following example: ```dm - alias/say(msg as text) set desc = "speak your mind" -return "say [msg]" + +alias/say(msg as text) + set desc = "speak your mind" + return "say [msg]" + ``` - - -As you can see, it is just -like a verb. Alias have all the same properties as verbs, except the -`src` setting is always equal to the player. - -The value returned -by an alias is executed as a command. In telnet mode, the command to -execute is often simply the same as the command that was entered (since -the alias was only defined to provide command expansion and help). Since -that is such a common case, the return value defaults to the alias name -followed by each of the arguments. The example above, for instance, -would have the same effect without an explicit return statement. - - -Note that commands executed via an alias are never interpreted -as aliases. Otherwise, examples such as the one above would result in an -infinite loop. - -> [!TIP] -> **See also:** -> + [macros (client script)](/ref/client/var/script/macro.md) -> + [script var (client)](/ref/client/var/script.md) -> + [verbs](/ref/verb.md) \ No newline at end of file + + +As you can see, it is just like a verb. Alias have all the same properties as verbs, except the src setting is always equal to the player. + +The value returned by an alias is executed as a command. In telnet mode, the command to execute is often simply the same as the command that was entered (since the alias was only defined to provide command expansion and help). Since that is such a common case, the return value defaults to the alias name followed by each of the arguments. The example above, for instance, would have the same effect without an explicit return statement. + +Note that commands executed via an alias are never interpreted as aliases. Otherwise, examples such as the one above would result in an infinite loop. +*** +**Related Pages:** ++ [macros (client script)](/ref/client/var/script/macro) ++ [script var (client)](/ref/client/var/script) ++ [verbs](/ref/verb) diff --git a/ref/client/var/script/index.md b/ref/client/var/script/index.md new file mode 100644 index 00000000..8de27269 --- /dev/null +++ b/ref/client/var/script/index.md @@ -0,0 +1,37 @@ + +## script (var) + +**Default Value:** ++ none +*** +Client scripts are mini-programs used to configure the client. The language they use is called DM Script, and will undoubtedly expand in the future. Currently, client scripts can be used to define style sheets, command aliases, and macros. When executed directly by a player, they can also be used to specify an initial URL to open and a password trigger (for some ancient telnet worlds that don't suppress password echo). + +For the specific syntax of DM Script, see the relevant reference sections listed above. + +The client.script variable may be assigned to script code in a text string (double quotes) or in a file (single quotes). You can also simply include the file in your project or explicitly use the #include statement. Files containing DM Script should have the extension .dms. + + +```dm + +client/script = "" + +``` + + +This example selects a default monospace font for all output to the terminal. + +In addition to scripts loaded via client.script, the player may have client-side scripts. These are either called connection scripts or post-connection scripts depending on whether they are used to automatically connect to a world or whether they are executed automatically after connecting to a world. In either case, the player's scripts are always executed before the designer's client.script script, so style sheets from the designer have higher precedence by default. + +There are three post-connection client-side scripts for the three types of worlds the client can connect to: byond.dms, telnet.dms, and irc.dms. These are automatically executed if the player connects directly to a world without using a connection script to do so. The intention is to load any standard configurations such as style sheets and command aliases. +*** +**Related Pages:** ++ [#include directive](/ref/DM/preprocessor/include) ++ [PASSWORD_TRIGGER (client script)](/ref/client/var/script/PASSWORD_TRIGGER) ++ [URL (client script)](/ref/client/var/script/URL) ++ [aliases (client script)](/ref/client/var/script/alias) ++ [browser configuration](/ref/client/var/script/URL/browser) ++ [command_text (client)](/ref/client/var/command_text) ++ [macros (client script)](/ref/client/var/script/macro) ++ [macros (skin)](/ref/{skin}/macros) ++ [style sheets](/ref/DM/text/style) ++ [style sheets (in scripts)](/ref/client/var/script/style) diff --git a/ref/client/var/script/macro.md b/ref/client/var/script/macro.md index 33c814f8..8fd8dbf6 100644 --- a/ref/client/var/script/macro.md +++ b/ref/client/var/script/macro.md @@ -1,35 +1,28 @@ -## macros (client script) +## macro (var) +*** +Macros are just like aliases, except that they are triggered by a single key (or combination of keys) instead of a full command. When a macro is executed, it returns a text string which is then executed as a command. So a macro is just a short-cut for entering a command. +The following example illustrates the syntax for entering a typical set of macros. -Macros are just like aliases, except that they are triggered by -a single key (or combination of keys) instead of a full command. When a -macro is executed, it returns a text string which is then executed as a -command. So a macro is just a short-cut for entering a command. +```dm -The following example illustrates the syntax for entering a -typical set of macros. -### Example; +macro + ALT+I return "inventory" + ALT+SHIFT+I return "inventory\nequipment" //multiple commands + ALT+s return "say \..." //command to be edited -```dm - macro ALT+I return "inventory" ALT+SHIFT+I return -"inventory\\nequipment" //multiple commands ALT+s return "say -\..." //command to be edited ``` -Note: In old versions of BYOND, character keys required the Alt key to -be pressed to trigger the macro, and did not include `"ALT+"` to do so. -This behavior has changed, and the name of the macro is just like the -format used in skin files. You can now use a key name, and modifiers -like `SHIFT+`, `CTRL+`, `ALT+`, `+REP`, and `+UP`. Old .dms and -[client.script](/ref/client/var/script.md) files (prior to version 507) -should be updated accordingly when recompiling in a newer version. - -> [!TIP] -> **See also:** -> + [macros (skin)](/ref/skin/macros.md) -> + [aliases (client script)](/ref/client/var/script/alias.md) -> + [command_text (client)](/ref/client/var/command_text.md) -> + [script var (client)](/ref/client/var/script.md) -> + [verbs](/ref/verb.md) \ No newline at end of file + + +> [!TIP] +> Note: In old versions of BYOND, character keys required the Alt key to be pressed to trigger the macro, and did not include `"ALT+"` to do so. This behavior has changed, and the name of the macro is just like the format used in skin files. You can now use a key name, and modifiers like `SHIFT+`, `CTRL+`, `ALT+`, `+REP`, and `+UP`. Old .dms and client.script files (prior to version 507) should be updated accordingly when recompiling in a newer version. +*** +**Related Pages:** ++ [macros (skin)](/ref/{skin}/macros) ++ [aliases (client script)](/ref/client/var/script/alias) ++ [command_text (client)](/ref/client/var/command_text) ++ [script var (client)](/ref/client/var/script) ++ [verbs](/ref/verb) diff --git a/ref/client/var/script/style.md b/ref/client/var/script/style.md index d7dc1e9c..d13f4c24 100644 --- a/ref/client/var/script/style.md +++ b/ref/client/var/script/style.md @@ -1,28 +1,18 @@ -## style sheets (in scripts) +## style (var) +*** +Style sheets may be included in DM Script by putting the style sheet inside the HTML tags <STYLE> and </STYLE>. In general, any text enclosed in start and end tags will be sent to the player's terminal, so you could use client.script to output a welcome message as well as loading a style sheet. -Style sheets may be included in DM Script by putting the style -sheet inside the HTML tags ``. In general, any -text enclosed in start and end tags will be sent to the player\'s -terminal, so you could use `client.script` to output a welcome message -as well as loading a style sheet. - +```dm -### Example: +client/script = "" -```dm - client/script = " -" ``` - -This example style sheet makes the player\'s -terminal have a black background and aqua colored text. When changing -the background color, it is important to change the color of system and -link text as well. See the section on [style sheets](/ref/DM/text/style.md) for an example. -> [!TIP] -> **See also:** -> + [script var (client)](/ref/client/var/script.md) -> + [style sheets](/ref/DM/text/style.md) \ No newline at end of file +This example style sheet makes the player's terminal have a black background and aqua colored text. When changing the background color, it is important to change the color of system and link text as well. See the section on style sheets for an example. +*** +**Related Pages:** ++ [script var (client)](/ref/client/var/script) ++ [style sheets](/ref/DM/text/style) diff --git a/ref/client/var/show_map.md b/ref/client/var/show_map.md index 3bf5e858..8b630169 100644 --- a/ref/client/var/show_map.md +++ b/ref/client/var/show_map.md @@ -1,30 +1,27 @@ -## show_map var (client) -**Default value:** -+ 1 +## show_map (var) +**Default Value:** ++ 1 +*** +This variable may be used to turn off the view of the map in Dream Seeker. This could be useful for making text MUDs where the rooms are turfs (ie most rooms can be laid out on a grid but you don't want the user interface to show the map in any way). -This variable may be used to turn off the view of the map in -Dream Seeker. This could be useful for making text MUDs where the rooms -are turfs (ie most rooms can be laid out on a grid but you don\'t want -the user interface to show the map in any way). +The following example shows one useful combination of settings. Note that setting world.view=-1 also disables the map, but it also sets the default value of the view() depth in such a way as to always return an empty list. -The following -example shows one useful combination of settings. Note that setting -`world.view=-1` also disables the map, but it also sets the default -value of the `view()` depth in such a way as to always return an empty -list. -### Example: ```dm - client show_map = 0 //Text is best! world view = 0 //You -can interact only with objects in same turf. mob density = 0 //Allow -multiple mobs in a room. -``` +client + show_map = 0 //Text is best! +world + view = 0 //You can interact only with objects in same turf. +mob + density = 0 //Allow multiple mobs in a room. + +``` -> [!TIP] -> **See also:** -> + [show_verb_panel var (client)](/ref/client/var/show_verb_panel.md) -> + [view var (client)](/ref/client/var/view.md) -> + [view var (world)](/ref/world/var/view.md) \ No newline at end of file +*** +**Related Pages:** ++ [show_verb_panel var (client)](/ref/client/var/show_verb_panel) ++ [view var (client)](/ref/client/var/view) ++ [view var (world)](/ref/world/var/view) diff --git a/ref/client/var/show_popup_menus.md b/ref/client/var/show_popup_menus.md index 1a0f0e96..70062fbc 100644 --- a/ref/client/var/show_popup_menus.md +++ b/ref/client/var/show_popup_menus.md @@ -1,23 +1,19 @@ -## show_popup_menus var (client) - -**Default value:** -+ 1 +## show_popup_menus (var) -This variable may be used to turn off the popup "context" -menus that are displayed by default when an object on the map or stat -panels is right-clicked. If client.show_popup_menus==0, then -right-clicks will instead be passed to the various mouse functions. - -> [!TIP] -> **See also:** -> + [right-click parameter (skin)](/ref/skin/param/right-click.md) -> + [Click proc (client)](/ref/client/proc/Click.md) -> + [DblClick proc (client)](/ref/client/proc/DblClick.md) -> + [MouseDown proc (client)](/ref/client/proc/MouseDown.md) -> + [MouseDrag proc (client)](/ref/client/proc/MouseDrag.md) -> + [MouseDrop proc (client)](/ref/client/proc/MouseDrop.md) -> + [MouseEntered proc (client)](/ref/client/proc/MouseEntered.md) -> + [MouseExited proc (client)](/ref/client/proc/MouseExited.md) -> + [MouseMove proc (client)](/ref/client/proc/MouseMove.md) -> + [MouseUp proc (client)](/ref/client/proc/MouseUp.md) \ No newline at end of file +**Default Value:** ++ 1 +*** +This variable may be used to turn off the popup "context" menus that are displayed by default when an object on the map or stat panels is right-clicked. If client.show_popup_menus==0, then right-clicks will instead be passed to the various mouse functions. +*** +**Related Pages:** ++ [right-click](/ref/{skin}/param/right-click) ++ [Click proc (client)](/ref/client/proc/Click) ++ [DblClick proc (client)](/ref/client/proc/DblClick) ++ [MouseDown proc (client)](/ref/client/proc/MouseDown) ++ [MouseDrag proc (client)](/ref/client/proc/MouseDrag) ++ [MouseDrop proc (client)](/ref/client/proc/MouseDrop) ++ [MouseEntered proc (client)](/ref/client/proc/MouseEntered) ++ [MouseExited proc (client)](/ref/client/proc/MouseExited) ++ [MouseMove proc (client)](/ref/client/proc/MouseMove) ++ [MouseUp proc (client)](/ref/client/proc/MouseUp) diff --git a/ref/client/var/show_verb_panel.md b/ref/client/var/show_verb_panel.md index a88d629f..2dbfae70 100644 --- a/ref/client/var/show_verb_panel.md +++ b/ref/client/var/show_verb_panel.md @@ -1,22 +1,21 @@ -## show_verb_panel var (client) - (client)](/ref/client/var/default_verb_category.md) -+ [show_map var (client)](/ref/client/var/show_map.md) -**Default value:** -+ 1 +## show_verb_panel (var) +**Default Value:** ++ 1 +*** +Setting this to 0 turns off the verb panel in Dream Seeker. You might want to do that, for instance, if you've only got one verb (like "say") and the panel looks stupid with just one verb in it. -Setting this to 0 turns off the verb panel in Dream Seeker. You -might want to do that, for instance, if you\'ve only got one verb (like -"say") and the panel looks stupid with just one verb in it. -### Example: ```dm - client show_verb_panel = 0 -``` +client + show_verb_panel = 0 + +``` -> [!TIP] -> **See also:** -> + [category setting (verb)](/ref/verb/set/category.md) -> + [default_verb_category var \ No newline at end of file +*** +**Related Pages:** ++ [category setting (verb)](/ref/verb/set/category) ++ [default_verb_category var (client)](/ref/client/var/default_verb_category) ++ [show_map var (client)](/ref/client/var/show_map) diff --git a/ref/client/var/statobj.md b/ref/client/var/statobj.md index 6647861f..392fcc5f 100644 --- a/ref/client/var/statobj.md +++ b/ref/client/var/statobj.md @@ -1,16 +1,14 @@ -## statobj var (client) -**Default value:** -+ client.mob (the player\'s mob). - - -This value indicates which object the player currently has -loaded in the stat panels. - -> [!TIP] -> **See also:** -> + [Stat proc (client)](/ref/client/proc/Stat.md) -> + [stat proc](/ref/proc/stat.md) -> + [statpanel proc](/ref/proc/statpanel.md) -> + [statpanel var (client)](/ref/client/var/statpanel.md) -> + [Info control (skin)](/ref/skin/control/info.md) \ No newline at end of file +## statobj (var) + +**Default Value:** ++ client.mob (the player's mob). +*** +This value indicates which object the player currently has loaded in the stat panels. +*** +**Related Pages:** ++ [Stat proc (client)](/ref/client/proc/Stat) ++ [stat proc](/ref/proc/stat) ++ [statpanel proc](/ref/proc/statpanel) ++ [statpanel var (client)](/ref/client/var/statpanel) ++ [Info](/ref/{skin}/control/info) diff --git a/ref/client/var/statpanel.md b/ref/client/var/statpanel.md index f6657df7..071df0bf 100644 --- a/ref/client/var/statpanel.md +++ b/ref/client/var/statpanel.md @@ -1,17 +1,14 @@ -## statpanel var (client) - -**Default value:** -+ null +## statpanel (var) -This value indicates which stat panel is currently visible to -the player. You can assign it to force a different panel to become the -top panel. The special value "verbs" activates the panel of commands. - -> [!TIP] -> **See also:** -> + [Stat proc (client)](/ref/client/proc/Stat.md) -> + [stat proc](/ref/proc/stat.md) -> + [statobj var (client)](/ref/client/var/statobj.md) -> + [statpanel proc](/ref/proc/statpanel.md) -> + [Info control (skin)](/ref/skin/control/info.md) \ No newline at end of file +**Default Value:** ++ null +*** +This value indicates which stat panel is currently visible to the player. You can assign it to force a different panel to become the top panel. The special value "verbs" activates the panel of commands. +*** +**Related Pages:** ++ [Stat proc (client)](/ref/client/proc/Stat) ++ [stat proc](/ref/proc/stat) ++ [statobj var (client)](/ref/client/var/statobj) ++ [statpanel proc](/ref/proc/statpanel) ++ [Info](/ref/{skin}/control/info) diff --git a/ref/client/var/tick_lag.md b/ref/client/var/tick_lag.md index 9260cf54..02d8f269 100644 --- a/ref/client/var/tick_lag.md +++ b/ref/client/var/tick_lag.md @@ -1,23 +1,14 @@ -## tick_lag var (client) -###### BYOND Version 511 -**Default value:** -+ 0 (uses world.tick_lag value) - - -This is a client version of world.tick_lag, so that the client -can run at a faster speed for animations. For example, setting -client.tick_lag to 0.25 while world.tick_lag is the default 1 will mean -that all animations and glides are smoothed out and displayed at 40 FPS, -even though the server still runs at 10 FPS. The result is a -nicer-looking game with no additional impact on the server. +## tick_lag (var) - -When this value is 0, the client and server tick at the same -rate. - -> [!TIP] -> **See also:** -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) -> + [fps var (client)](/ref/client/var/fps.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +**Default Value:** ++ 0 (uses world.tick_lag value) +*** +This is a client version of world.tick_lag, so that the client can run at a faster speed for animations. For example, setting client.tick_lag to 0.25 while world.tick_lag is the default 1 will mean that all animations and glides are smoothed out and displayed at 40 FPS, even though the server still runs at 10 FPS. The result is a nicer-looking game with no additional impact on the server. + +When this value is 0, the client and server tick at the same rate. +*** +**Related Pages:** ++ [tick_lag var (world)](/ref/world/var/tick_lag) ++ [fps var (client)](/ref/client/var/fps) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/client/var/timezone.md b/ref/client/var/timezone.md index a3839fa5..21f3a1fa 100644 --- a/ref/client/var/timezone.md +++ b/ref/client/var/timezone.md @@ -1,13 +1,10 @@ -## timezone var (client) -###### BYOND Version 514 - -This is the time offset from UTC, in hours, for the client\'s -time zone. It can be used in the `time2text()` proc. - -> [!TIP] -> **See also:** -> + [realtime var (world)](/ref/world/var/realtime.md) -> + [timeofday var (world)](/ref/world/var/timeofday.md) -> + [timezone var (world)](/ref/world/var/timezone.md) -> + [time2text proc](/ref/proc/time2text.md) \ No newline at end of file +## timezone (var) +*** +This is the time offset from UTC, in hours, for the client's time zone. It can be used in the `time2text()` proc. +*** +**Related Pages:** ++ [realtime var (world)](/ref/world/var/realtime) ++ [timeofday var (world)](/ref/world/var/timeofday) ++ [timezone](/ref/world/var/timezone) ++ [time2text proc](/ref/proc/time2text) diff --git a/ref/client/var/verbs.md b/ref/client/var/verbs.md index 460ae17f..ee275c70 100644 --- a/ref/client/var/verbs.md +++ b/ref/client/var/verbs.md @@ -1,13 +1,10 @@ -## verbs list var (client) - -**Default value:** -+ The list of verbs defined for the client. +## verbs (var) -This is a list of the client\'s verbs. Initially, it contains -all of the verbs defined for the client. It may be used to add and -remove verbs at runtime. - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) \ No newline at end of file +**Default Value:** ++ The list of verbs defined for the client. +*** +This is a list of the client's verbs. Initially, it contains all of the verbs defined for the client. It may be used to add and remove verbs at runtime. +*** +**Related Pages:** ++ [list](/ref/list) diff --git a/ref/client/var/view.md b/ref/client/var/view.md index 2d645f48..8488fc94 100644 --- a/ref/client/var/view.md +++ b/ref/client/var/view.md @@ -1,34 +1,19 @@ -## view var (client) - -**Default value:** -+ world.view (which is 5 by default) - -**Possible values:** -+ -1 to 34 or "WIDTHxHEIGHT" +## view (var) -This controls the size of the map window in Dream Seeker. -Normally, you would simply compile with world/view assigned to whatever -you want, but in some cases, you might want to customize the map size -for different players, such as admins or subscribed users. - -Like -all other view sizes in DM, this may either be a *view depth* or an -absolute size. A view depth is a single number that determines how far -from a center point the edges of a square viewable region extend. A -value of 5 creates edges which are 2*5+1 = 11 tiles long. +**Default Value:** ++ world.view (which is 5 by default) +*** +This controls the size of the map window in Dream Seeker. Normally, you would simply compile with world/view assigned to whatever you want, but in some cases, you might want to customize the map size for different players, such as admins or subscribed users. -The -newer, more flexible syntax is a text string of the form -"WIDTHxHEIGHT". For example, a view depth of 5 corresponds to -"11x11". Using this syntax, you can create non-square views as well. +Like all other view sizes in DM, this may either be a view depth or an absolute size. A view depth is a single number that determines how far from a center point the edges of a square viewable region extend. A value of 5 creates edges which are 2*5+1 = 11 tiles long. +The newer, more flexible syntax is a text string of the form "WIDTHxHEIGHT". For example, a view depth of 5 corresponds to "11x11". Using this syntax, you can create non-square views as well. The maximum view size is about 5000 tiles, or roughly 70x70. - -> [!TIP] -> **See also:** -> + [lazy_eye var (client)](/ref/client/var/lazy_eye.md) -> + [show_map var (client)](/ref/client/var/show_map.md) -> + [view proc](/ref/proc/view.md) -> + [view var (world)](/ref/world/var/view.md) \ No newline at end of file +*** +**Related Pages:** ++ [lazy_eye var (client)](/ref/client/var/lazy_eye) ++ [show_map var (client)](/ref/client/var/show_map) ++ [view proc](/ref/proc/view) ++ [view var (world)](/ref/world/var/view) diff --git a/ref/client/var/virtual_eye.md b/ref/client/var/virtual_eye.md index 351153e9..a5a1c777 100644 --- a/ref/client/var/virtual_eye.md +++ b/ref/client/var/virtual_eye.md @@ -1,21 +1,17 @@ -## virtual_eye var (client) -**Default value:** -+ client.eye - - -This value determines the actual center of the player\'s map -display. It is based on `client.eye` and whenever possible matches it; -however it may instead be a turf, or null, when the eye is off-center. +## virtual_eye (var) +**Default Value:** ++ client.eye +*** +This value determines the actual center of the player's map display. It is based on client.eye and whenever possible matches it; however it may instead be a turf, or null, when the eye is off-center. -The value of `virtual_eye` is read-only. - -> [!TIP] -> **See also:** -> + [edge_limit var (client)](/ref/client/var/edge_limit.md) -> + [eye var (client)](/ref/client/var/eye.md) -> + [lazy_eye var (client)](/ref/client/var/lazy_eye.md) -> + [mob var (client)](/ref/client/var/mob.md) -> + [perspective var (client)](/ref/client/var/perspective.md) -> + [view var (client)](/ref/client/var/view.md) \ No newline at end of file +The value of virtual_eye is read-only. +*** +**Related Pages:** ++ [edge_limit var (client)](/ref/client/var/edge_limit) ++ [eye var (client)](/ref/client/var/eye) ++ [lazy_eye var (client)](/ref/client/var/lazy_eye) ++ [mob var (client)](/ref/client/var/mob) ++ [perspective var (client)](/ref/client/var/perspective) ++ [view var (client)](/ref/client/var/view) diff --git a/ref/database/database.md b/ref/database/database.md deleted file mode 100644 index a00fd326..00000000 --- a/ref/database/database.md +++ /dev/null @@ -1,32 +0,0 @@ -## database datum -###### BYOND Version 506 - -A /database datum gives you the ability to create or access a -database using SQLite, which allows you to run complex database queries -on any platform. - -Creating a /database/query datum will let you -put together a query, and once it\'s ready you can call its Execute() -proc to run it. - -SQLite databases in BYOND support numerical -values (such as INTEGER or FLOAT), text (TEXT), and cache files such as -icons (BLOB). Null values are also allowed. -### Example: - -```dm -var/database/db = new("mydb.db") -var/database/query/q = new("SELECT * FROM my_table WHERE name=?", usr.key) - -if(q.Execute(db) && q.NextRow()) - // returns a list such as list(name="MyName", score=123) - return q.GetRowData() -// no data found -return null -``` - -> [!TIP] -> **See also:** -> + [database query datum](/ref/database/query.md) -> + [procs (database)](/ref/database/proc.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file diff --git a/ref/database/index.md b/ref/database/index.md new file mode 100644 index 00000000..db54746a --- /dev/null +++ b/ref/database/index.md @@ -0,0 +1,28 @@ + +## database (info) +*** +A /database datum gives you the ability to create or access a database using SQLite, which allows you to run complex database queries on any platform. + +Creating a /database/query datum will let you put together a query, and once it's ready you can call its Execute() proc to run it. + +SQLite databases in BYOND support numerical values (such as INTEGER or FLOAT), text (TEXT), and cache files such as icons (BLOB). Null values are also allowed. + + +```dm + +var/database/db = new("mydb.db") +var/database/query/q = new("SELECT * FROM my_table WHERE name=?", usr.key) + +if(q.Execute(db) && q.NextRow()) + // returns a list such as list(name="MyName", score=123) + return q.GetRowData() +// no data found +return null + +``` + +*** +**Related Pages:** ++ [database query datum](/ref/database/query) ++ [procs (database)](/ref/database/proc) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/database/proc.md b/ref/database/proc.md deleted file mode 100644 index 8dfd3f02..00000000 --- a/ref/database/proc.md +++ /dev/null @@ -1,16 +0,0 @@ -## procs (database) -###### BYOND Version 506 - -Built-in database procs: -database/proc -+ [Close](/ref/database/proc/Close.md) -+ [Error](/ref/database/proc/Error.md) -+ [ErrorMsg](/ref/database/proc/ErrorMsg.md) -+ [New](/ref/database/proc/New.md) -+ [Open](/ref/database/proc/Open.md) - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [procs (database query)](/ref/database/query/proc.md) \ No newline at end of file diff --git a/ref/database/proc/Close.md b/ref/database/proc/Close.md index 896b42a6..d0c2792f 100644 --- a/ref/database/proc/Close.md +++ b/ref/database/proc/Close.md @@ -1,14 +1,11 @@ -## Close proc (database) -###### BYOND Version 506 + +## Close (proc) **Format:** + Close() - -If a database is currently open, this will close the database -and any queries currently running in it. Usually you don\'t need to call -this directly, because deleting the datum will do it for you. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [Open proc (database)](/ref/database/proc/Open.md) \ No newline at end of file +*** +If a database is currently open, this will close the database and any queries currently running in it. Usually you don't need to call this directly, because deleting the datum will do it for you. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [Open proc (database)](/ref/database/proc/Open) diff --git a/ref/database/proc/Error.md b/ref/database/proc/Error.md index c1b903ad..c63aa1b0 100644 --- a/ref/database/proc/Error.md +++ b/ref/database/proc/Error.md @@ -1,13 +1,12 @@ -## Error proc (database) -###### BYOND Version 506 + +## Error (proc) **Format:** + Error() - +*** Returns the error code last received by the database. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [ErrorMsg proc (database)](/ref/database/proc/ErrorMsg.md) \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [ErrorMsg proc (database)](/ref/database/proc/ErrorMsg) diff --git a/ref/database/proc/ErrorMsg.md b/ref/database/proc/ErrorMsg.md index a2d32c61..7270bfd3 100644 --- a/ref/database/proc/ErrorMsg.md +++ b/ref/database/proc/ErrorMsg.md @@ -1,13 +1,12 @@ -## ErrorMsg proc (database) -###### BYOND Version 506 + +## ErrorMsg (proc) **Format:** + ErrorMsg() - +*** Returns the error message last received by the database. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Error proc (database)](/ref/database/proc/Error.md) \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Error proc (database)](/ref/database/proc/Error) diff --git a/ref/database/proc/New.md b/ref/database/proc/New.md index 4ff7fa5d..f85216f9 100644 --- a/ref/database/proc/New.md +++ b/ref/database/proc/New.md @@ -1,16 +1,14 @@ -## New proc (database) -###### BYOND Version 506 + +## New (proc) **Format:** + New(filename) -**Args:** +**Arguments:** + filename: The database filename to open (optional) - -Creates a new database datum, and opens the file if a filename -is provided. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [Open proc (database)](/ref/database/proc/Open.md) \ No newline at end of file +*** +Creates a new database datum, and opens the file if a filename is provided. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [Open proc (database)](/ref/database/proc/Open) diff --git a/ref/database/proc/Open.md b/ref/database/proc/Open.md index 3631eeec..f43ffe57 100644 --- a/ref/database/proc/Open.md +++ b/ref/database/proc/Open.md @@ -1,18 +1,15 @@ -## Open proc (database) -###### BYOND Version 506 + +## Open (proc) **Format:** + Open(filename) -**Args:** +**Arguments:** + filename: The database filename to open - -Opens a database file. If another database was already open, it -is closed automatically. It is more common to simply open the database -in New(). - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [Close proc (database)](/ref/database/proc/Close.md) -> + [New proc (database)](/ref/database/proc/New.md) \ No newline at end of file +*** +Opens a database file. If another database was already open, it is closed automatically. It is more common to simply open the database in New(). +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [Close proc (database)](/ref/database/proc/Close) ++ [New proc (database)](/ref/database/proc/New) diff --git a/ref/database/proc/index.md b/ref/database/proc/index.md new file mode 100644 index 00000000..8f6824ea --- /dev/null +++ b/ref/database/proc/index.md @@ -0,0 +1,9 @@ + +## proc (proc) +*** +Built-in database procs: +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [procs (database query)](/ref/database/query/proc) diff --git a/ref/database/query.md b/ref/database/query.md deleted file mode 100644 index cc6d505c..00000000 --- a/ref/database/query.md +++ /dev/null @@ -1,12 +0,0 @@ -## database query datum -###### BYOND Version 506 - -This datum lets you create a query for a database, which can be -run with the Execute() proc. The datum can be reused after a query is -run by calling Clear() and adding new text with Add(). - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [procs (database query)](/ref/database/query/proc.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file diff --git a/ref/database/query/index.md b/ref/database/query/index.md new file mode 100644 index 00000000..c333ee95 --- /dev/null +++ b/ref/database/query/index.md @@ -0,0 +1,9 @@ + +## query (info) +*** +This datum lets you create a query for a database, which can be run with the Execute() proc. The datum can be reused after a query is run by calling Clear() and adding new text with Add(). +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [procs (database query)](/ref/database/query/proc) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/database/query/proc.md b/ref/database/query/proc.md deleted file mode 100644 index 2eb91d8c..00000000 --- a/ref/database/query/proc.md +++ /dev/null @@ -1,24 +0,0 @@ -## procs (database query) -###### BYOND Version 506 - -Built-in database query procs: -database/query/proc -+ [Add](/ref/database/query/proc/Add.md) -+ [Clear](/ref/database/query/proc/Clear.md) -+ [Close](/ref/database/query/proc/Close.md) -+ [Columns](/ref/database/query/proc/Columns.md) -+ [Error](/ref/database/query/proc/Error.md) -+ [ErrorMsg](/ref/database/query/proc/ErrorMsg.md) -+ [Execute](/ref/database/query/proc/Execute.md) -+ [GetColumn](/ref/database/query/proc/GetColumn.md) -+ [GetRowData](/ref/database/query/proc/GetRowData.md) -+ [New](/ref/database/query/proc/New.md) -+ [NextRow](/ref/database/query/proc/NextRow.md) -+ [Reset](/ref/database/query/proc/Reset.md) -+ [RowsAffected](/ref/database/query/proc/RowsAffected.md) - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [procs (database)](/ref/database/proc.md) \ No newline at end of file diff --git a/ref/database/query/proc/Add.md b/ref/database/query/proc/Add.md index f758f352..8f508f9c 100644 --- a/ref/database/query/proc/Add.md +++ b/ref/database/query/proc/Add.md @@ -1,36 +1,34 @@ -## Add proc (database query) -###### BYOND Version 506 + +## Add (proc) **Format:** + Add(text, item1, item2, ...) -**Args:** -+ *text*: Text to add to the query -+ *item1, item2, etc.*: Items that will replace question marks in text +**Arguments:** ++ text: Text to add to the query ++ item1, item2, etc.: Items that will replace question marks in text +*** +Adds text to a database query. If this datum was already used to run a query, Clear() will be called automatically. -Adds text to a database query. If this datum was already used -to run a query, Clear() will be called automatically. +If your text includes question marks, they will be replaced with the other items listed in the proc arguments. If that item is a string, quotes will be put around it for the query text. Files in the cache (such as icons) will be added as BLOB values. -If your text includes question marks, they will be replaced with the other items -listed in the proc arguments. If that item is a string, quotes will be -put around it for the query text. Files in the cache (such as icons) -will be added as BLOB values. +After the query has been built, call Execute() to run it. -After the query has been built, -call Execute() to run it. -### Example: ```dm + var/database/db = new("mydb.db") var/database/query/q = new q.Add("INSERT INTO quests (name, quest, complete) VALUES (?,?,?)", usr.key, quest_name, 1) q.Execute(db) + ``` - + + In the example above, the query text might look like this: -`INSERT INTO quests (name, quest, complete) VALUES ('Tom','Save the Dog',1)` -> [!TIP] -> **See also:** -> + [database query datum](/ref/database/query.md) -> + [Clear proc (database query)](/ref/database/query/proc/Clear.md) \ No newline at end of file +`INSERT INTO quests (name, quest, complete) VALUES ('Tom','Save the Dog',1)` +*** +**Related Pages:** ++ [database query datum](/ref/database/query) ++ [Clear proc (database query)](/ref/database/query/proc/Clear) diff --git a/ref/database/query/proc/Clear.md b/ref/database/query/proc/Clear.md index 23f7bdb3..44dd039c 100644 --- a/ref/database/query/proc/Clear.md +++ b/ref/database/query/proc/Clear.md @@ -1,14 +1,11 @@ -## Clear proc (database query) -###### BYOND Version 506 + +## Clear (proc) **Format:** + Clear() - -Clears the query text so you can begin creating a new query. -This is called automatically if you already called Execute() for the -last query used by this datum. - -> [!TIP] -> **See also:** -> + [database query datum](/ref/database/query.md) -> + [Add proc (database query)](/ref/database/query/proc/Add.md) \ No newline at end of file +*** +Clears the query text so you can begin creating a new query. This is called automatically if you already called Execute() for the last query used by this datum. +*** +**Related Pages:** ++ [database query datum](/ref/database/query) ++ [Add proc (database query)](/ref/database/query/proc/Add) diff --git a/ref/database/query/proc/Close.md b/ref/database/query/proc/Close.md index 5e2c2f34..9c72cca9 100644 --- a/ref/database/query/proc/Close.md +++ b/ref/database/query/proc/Close.md @@ -1,14 +1,12 @@ -## Close proc (database query) -###### BYOND Version 506 + +## Close (proc) **Format:** + Close() - -Ends a query that is in progress. This is usually done -automatically and shouldn\'t be necessary to call in most cases. - -> [!TIP] -> **See also:** -> + [database query datum](/ref/database/query.md) -> + [Clear proc (database query)](/ref/database/query/proc/Clear.md) -> + [Reset proc (database query)](/ref/database/query/proc/Reset.md) \ No newline at end of file +*** +Ends a query that is in progress. This is usually done automatically and shouldn't be necessary to call in most cases. +*** +**Related Pages:** ++ [database query datum](/ref/database/query) ++ [Clear proc (database query)](/ref/database/query/proc/Clear) ++ [Reset proc (database query)](/ref/database/query/proc/Reset) diff --git a/ref/database/query/proc/Columns.md b/ref/database/query/proc/Columns.md index 92c8a4c1..862dd648 100644 --- a/ref/database/query/proc/Columns.md +++ b/ref/database/query/proc/Columns.md @@ -1,24 +1,21 @@ -## Columns proc (database query) -###### BYOND Version 506 -**Format:** -+ Columns()\ - *or*\ - Columns(column) +## Columns (proc) -**Args:** -+ *column*: The Nth column whose name should be read +**Format:** ++ Columns() +Columns(column) -Returns a list of column names for the current query, or the -name of the Nth column. +**Arguments:** ++ column: The Nth column whose name should be read +*** +Returns a list of column names for the current query, or the name of the Nth column. You must call Execute() before calling Columns(). - -> [!TIP] -> **See also:** -> + [database query datum](/ref/database/query.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) -> + [GetColumn proc (database query)](/ref/database/query/proc/GetColumn.md) -> + [GetRowData proc (database query)](/ref/database/query/proc/GetRowData.md) -> + [NextRow proc (database query)](/ref/database/query/proc/NextRow.md) \ No newline at end of file +*** +**Related Pages:** ++ [database query datum](/ref/database/query) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [GetColumn proc (database query)](/ref/database/query/proc/GetColumn) ++ [GetRowData proc (database query)](/ref/database/query/proc/GetRowData) ++ [NextRow proc (database query)](/ref/database/query/proc/NextRow) diff --git a/ref/database/query/proc/Error.md b/ref/database/query/proc/Error.md index 80534747..a86d840f 100644 --- a/ref/database/query/proc/Error.md +++ b/ref/database/query/proc/Error.md @@ -1,13 +1,12 @@ -## Error proc (database query) -###### BYOND Version 506 + +## Error (proc) **Format:** + Error() - +*** Returns the error code last received for this query. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [ErrorMsg proc (database query)](/ref/database/query/proc/ErrorMsg.md) \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [ErrorMsg proc (database query)](/ref/database/query/proc/ErrorMsg) diff --git a/ref/database/query/proc/ErrorMsg.md b/ref/database/query/proc/ErrorMsg.md index 4c1d7d8c..3e73be6e 100644 --- a/ref/database/query/proc/ErrorMsg.md +++ b/ref/database/query/proc/ErrorMsg.md @@ -1,13 +1,12 @@ -## ErrorMsg proc (database query) -###### BYOND Version 506 + +## ErrorMsg (proc) **Format:** + ErrorMsg() - +*** Returns the error message last received for this query. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Error proc (database query)](/ref/database/query/proc/Error.md) \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Error proc (database query)](/ref/database/query/proc/Error) diff --git a/ref/database/query/proc/Execute.md b/ref/database/query/proc/Execute.md index d1ffa11e..1dce2115 100644 --- a/ref/database/query/proc/Execute.md +++ b/ref/database/query/proc/Execute.md @@ -1,29 +1,23 @@ -## Execute proc (database query) -###### BYOND Version 506 + +## Execute (proc) **Format:** + Execute(database) -**Args:** -+ *database*: A /database datum with the database to be queried, or the - name of the database file +**Arguments:** ++ database: A /database datum with the database to be queried, or the name of the database file +*** +Runs a database query. Once the query is run, if the query is supposed to returns any rows you can call NextRow() until finished, and then GetColumn() or GetRowData() to get the information from each row. For queries that cause changes, RowsAffected() is also a useful call. -Runs a database query. Once the query is run, if the query is -supposed to returns any rows you can call NextRow() until finished, and -then GetColumn() or GetRowData() to get the information from each row. -For queries that cause changes, RowsAffected() is also a useful call. +The database argument is optional after the first time you use it. -The database argument is optional after the first time you use -it. +You can use a filename instead of a /database datum, as a shortcut; the datum will be created for you. -You can use a filename instead of a /database datum, as a -shortcut; the datum will be created for you. +After a query is executed, calling Add() to create new query text will clear out the old query text automatically. -After a query is executed, calling Add() to create new query text will clear out the old -query text automatically. -### Example: ```dm + var/database/db = new("mydb.db") var/database/query/q = new("SELECT quest,complete FROM quests WHERE name=?", usr.key) @@ -34,16 +28,17 @@ while(q.NextRow()) var/row = q.GetRowData() if(row["complete"]) completed_quests[row["quest"]] = 1 return completed_quests + ``` -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Add proc (database query)](/ref/database/query/proc/Add.md) -> + [Close proc (database query)](/ref/database/query/proc/Close.md) -> + [GetColumn proc (database query)](/ref/database/query/proc/GetColumn.md) -> + [GetRowData proc (database query)](/ref/database/query/proc/GetRowData.md) -> + [NextRow proc (database query)](/ref/database/query/proc/NextRow.md) -> + [Reset proc (database query)](/ref/database/query/proc/Reset.md) -> + [RowsAffected proc (database query)][/ref/database/query/proc/RowsAffected.md] \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Add proc (database query)](/ref/database/query/proc/Add) ++ [Close proc (database query)](/ref/database/query/proc/Close) ++ [GetColumn proc (database query)](/ref/database/query/proc/GetColumn) ++ [GetRowData proc (database query)](/ref/database/query/proc/GetRowData) ++ [NextRow proc (database query)](/ref/database/query/proc/NextRow) ++ [Reset proc (database query)](/ref/database/query/proc/Reset) ++ [RowsAffected proc (database query)](/ref/database/query/proc/RowsAffected) diff --git a/ref/database/query/proc/GetColumn.md b/ref/database/query/proc/GetColumn.md index b0dc382f..b5da0d1b 100644 --- a/ref/database/query/proc/GetColumn.md +++ b/ref/database/query/proc/GetColumn.md @@ -1,31 +1,23 @@ -## GetColumn proc (database query) -###### BYOND Version 506 + +## GetColumn (proc) **Format:** + GetColumn(column) -**Args:** -+ *column*: The column number whose value should be retrieved - -Gets the value from the Nth column in this row of results. If -you haven't already called Execute() and NextRow(), you should do that -first. - -To get the name of the column, not the value for this -row, call Columns(column) instead. +**Arguments:** ++ column: The column number whose value should be retrieved +*** +Gets the value from the Nth column in this row of results. If you haven't already called Execute() and NextRow(), you should do that first. -The value returned depends -on what type the database table thinks it is. For instance if you -defined a column as INTEGER or FLOAT, the value should be a number. TEXT -is still text, and null values are returned as null. If an icon was -saved into a BLOB field, the result is an icon file. +To get the name of the column, not the value for this row, call Columns(column) instead. -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Columns proc (database query)](/ref/database/query/proc/Columns.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) -> + [GetRowData proc (database query)](/ref/database/query/proc/GetRowData.md) -> + [NextRow proc (database query)](/ref/database/query/proc/NextRow.md) -> + [Reset proc (database query)](/ref/database/query/proc/Reset.md) \ No newline at end of file +The value returned depends on what type the database table thinks it is. For instance if you defined a column as INTEGER or FLOAT, the value should be a number. TEXT is still text, and null values are returned as null. If an icon was saved into a BLOB field, the result is an icon file. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Columns proc (database query)](/ref/database/query/proc/Columns) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [GetRowData proc (database query)](/ref/database/query/proc/GetRowData) ++ [NextRow proc (database query)](/ref/database/query/proc/NextRow) ++ [Reset proc (database query)](/ref/database/query/proc/Reset) diff --git a/ref/database/query/proc/GetRowData.md b/ref/database/query/proc/GetRowData.md index e2d65d90..d05fa5a4 100644 --- a/ref/database/query/proc/GetRowData.md +++ b/ref/database/query/proc/GetRowData.md @@ -1,30 +1,22 @@ -## GetRowData proc (database query) -###### BYOND Version 506 + +## GetRowData (proc) **Format:** + GetRowData() +*** +Returns a list with the current result row for this query. If you haven't already called Execute() and NextRow(), you should do that first. -Returns a list with the current result row for this query. If -you haven\'t already called Execute() and NextRow(), you should do that -first. - -The list returned is an associative list with name=value -pairs. A typical result might look like this: +The list returned is an associative list with name=value pairs. A typical result might look like this: `list("name" = "Tom", "quest" = "Save a Dog", complete = 1)` -The values returned depend on what type the database table -thinks they are. For instance if you defined a column as INTEGER or -FLOAT, the value should be a number. TEXT is still text, and null values -are returned as null. If an icon was saved into a BLOB field, the result -is an icon file. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Columns proc (database query)](/ref/database/query/proc/Columns.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) -> + [GetColumn proc (database query)](/ref/database/query/proc/GetColumn.md) -> + [NextRow proc (database query)](/ref/database/query/proc/NextRow.md) -> + [Reset proc (database query)](/ref/database/query/proc/Reset.md) \ No newline at end of file +The values returned depend on what type the database table thinks they are. For instance if you defined a column as INTEGER or FLOAT, the value should be a number. TEXT is still text, and null values are returned as null. If an icon was saved into a BLOB field, the result is an icon file. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Columns proc (database query)](/ref/database/query/proc/Columns) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [GetColumn proc (database query)](/ref/database/query/proc/GetColumn) ++ [NextRow proc (database query)](/ref/database/query/proc/NextRow) ++ [Reset proc (database query)](/ref/database/query/proc/Reset) diff --git a/ref/database/query/proc/New.md b/ref/database/query/proc/New.md index 1bc675d8..0de2c356 100644 --- a/ref/database/query/proc/New.md +++ b/ref/database/query/proc/New.md @@ -1,21 +1,18 @@ -## New proc (database query) -###### BYOND Version 506 + +## New (proc) **Format:** + New(text, item1, item2, ...) -**Args:** -+ *text*: Text to add to the query -+ *item1, item2, etc.*: Items that will replace question marks in text - -Creates a new query and adds text by automatically calling -Add(). See the [Add proc](/ref/database/query/proc/Add.md) for more -information. +**Arguments:** ++ text: Text to add to the query ++ item1, item2, etc.: Items that will replace question marks in text +*** +Creates a new query and adds text by automatically calling Add(). See the Add proc for more information. Call Execute() to run the query. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Add proc (database query)](/ref/database/query/proc/Add.md) \ No newline at end of file +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Add proc (database query)](/ref/database/query/proc/Add) diff --git a/ref/database/query/proc/NextRow.md b/ref/database/query/proc/NextRow.md index 7018a833..42e42d2d 100644 --- a/ref/database/query/proc/NextRow.md +++ b/ref/database/query/proc/NextRow.md @@ -1,26 +1,19 @@ -## NextRow proc (database query) -###### BYOND Version 506 + +## NextRow (proc) **Format:** + NextRow() +*** +If there are result rows in this query (Execute() must be called to run the query first), NextRow() will retrieve the next row and return 1 if it found a row, or 0 if the results are all finished. NextRow() is typically called in a while() loop. -If there are result rows in this query (Execute() must be -called to run the query first), NextRow() will retrieve the next row and -return 1 if it found a row, or 0 if the results are all finished. -NextRow() is typically called in a while() loop. - -After calling -NextRow(), you can call GetColumn() or GetRowData() to get information -about the results in this row. - -Call Reset() if you want to -rewind the query to the beginning. +After calling NextRow(), you can call GetColumn() or GetRowData() to get information about the results in this row. -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) -> + [GetColumn proc (database query)](/ref/database/query/proc/GetColumn.md) -> + [GetRowData proc (database query)](/ref/database/query/proc/GetRowData.md) -> + [Reset proc (database query)](/ref/database/query/proc/Reset.md) \ No newline at end of file +Call Reset() if you want to rewind the query to the beginning. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [GetColumn proc (database query)](/ref/database/query/proc/GetColumn) ++ [GetRowData proc (database query)](/ref/database/query/proc/GetRowData) ++ [Reset proc (database query)](/ref/database/query/proc/Reset) diff --git a/ref/database/query/proc/Reset.md b/ref/database/query/proc/Reset.md index c20c8580..d16740ae 100644 --- a/ref/database/query/proc/Reset.md +++ b/ref/database/query/proc/Reset.md @@ -1,19 +1,13 @@ -## Reset proc (database query) -###### BYOND Version 506 + +## Reset (proc) **Format:** + Reset() - -If a query returns any rows of results, Reset() will go back to -the beginning just after Execute() was called. This is useful if you -have called NextRow() repeatedly to retrieve a number of rows, but need -to go back to the start of the query for some other reason. This can -also be used to count the total number of result rows if needed, but for -best performance that isn\'t recommended. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) -> + [NextRow proc (database query)](/ref/database/query/proc/NextRow.md) \ No newline at end of file +*** +If a query returns any rows of results, Reset() will go back to the beginning just after Execute() was called. This is useful if you have called NextRow() repeatedly to retrieve a number of rows, but need to go back to the start of the query for some other reason. This can also be used to count the total number of result rows if needed, but for best performance that isn't recommended. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [NextRow proc (database query)](/ref/database/query/proc/NextRow) diff --git a/ref/database/query/proc/RowsAffected.md b/ref/database/query/proc/RowsAffected.md index 886d70f2..01714a2f 100644 --- a/ref/database/query/proc/RowsAffected.md +++ b/ref/database/query/proc/RowsAffected.md @@ -1,17 +1,13 @@ -## RowsAffected proc (database query) -###### BYOND Version 506 - query)](/ref/database/query/proc/RowsAffected.md) +## RowsAffected (proc) + **Format:** + RowsAffected() - -After running Execute() on a query that changes rows in the -database (for instance, an UPDATE query), this proc returns the number -of rows that were changed. This can be useful if you need to know -whether a query actually did anything. - -> [!TIP] -> **See also:** -> + [database datum](/ref/database.md) -> + [database query datum](/ref/database/query.md) -> + [Execute proc (database query)](/ref/database/query/proc/Execute.md) \ No newline at end of file +*** +After running Execute() on a query that changes rows in the database (for instance, an UPDATE query), this proc returns the number of rows that were changed. This can be useful if you need to know whether a query actually did anything. +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [Execute proc (database query)](/ref/database/query/proc/Execute) ++ [RowsAffected proc (database query)](/ref/database/query/proc/RowsAffected) diff --git a/ref/database/query/proc/index.md b/ref/database/query/proc/index.md new file mode 100644 index 00000000..ecf82864 --- /dev/null +++ b/ref/database/query/proc/index.md @@ -0,0 +1,9 @@ + +## proc (proc) +*** +Built-in database query procs: +*** +**Related Pages:** ++ [database datum](/ref/database) ++ [database query datum](/ref/database/query) ++ [procs (database)](/ref/database/proc) diff --git a/ref/datum/datum.md b/ref/datum/datum.md deleted file mode 100644 index 4d7ad4c8..00000000 --- a/ref/datum/datum.md +++ /dev/null @@ -1,49 +0,0 @@ -## datum - -The datum object is the ancestor of all other data types in DM, -with only a few exception called primitives. That means that the -variables and procedures of /datum are inherited by almost all other -types of objects. - -When you define a new "top level" object, -if you do not specify a parent_type, it defaults to /datum. -### Example: - -```dm -datum - //definitions to be shared by all object types - proc/DebugMe() - world.log << "/datum properties:" - world.log << "type: [type]" - world.log << "parent_type: [parent_type]" - return ..() - -MyType - var myvar = "test - DebugMe() - world.log << "/MyType properties:" - world.log << "myvar: [myvar]" - return ..() //this calls /datum/proc/DebugMe() -``` - -### Primitives 516 -Primitive types do not descend from /datum. These have no -subtypes, and may or may not be able to allow var and proc overrides. - - | Type | User-defined | Can Override | Notes | - | ----- | ----- | ----- | ----- | - | [/world](/ref/world.md) | procs only | vars and procs | - [/client](/ref/client.md) | vars and procs | vars and procs | can manually set `parent_type=/datum`
can\'t be created in [new](/ref/proc/new.md) - [/list](/ref/list.md) | \- | \- | | - [/savefile](/ref/savefile.md) | \- | [byond_version](/ref/savefile/var/byond_version.md)
[byond_build](/ref/savefile/var/byond_build.md) - [/alist](/ref/alist.md) | \- | \- | | - [/pixloc](/ref/pixloc.md) | \- | \- | | - [/vector](/ref/vector.md) | \- |\- | | - [/callee](/ref/pixloc.md) | \- |\- | can\'t be created in [new](/ref/proc/new.md)| - - -> [!TIP] -> **See also:** -> + [atom](/ref/atom.md) -> + [procs (datum)](/ref/datum/proc.md) -> + [vars (datum)](/ref/datum/var.md) \ No newline at end of file diff --git a/ref/datum/index.md b/ref/datum/index.md new file mode 100644 index 00000000..e3bd8a40 --- /dev/null +++ b/ref/datum/index.md @@ -0,0 +1,35 @@ + +## datum (info) +*** +The datum object is the ancestor of all other data types in DM, with only a few exception called primitives. That means that the variables and procedures of /datum are inherited by almost all other types of objects. + +When you define a new "top level" object, if you do not specify a parent_type, it defaults to /datum. + + +```dm + +datum + //definitions to be shared by all object types + proc/DebugMe() + world.log << "/datum properties:" + world.log << "type: [type]" + world.log << "parent_type: [parent_type]" + return ..() + +MyType + var + myvar = "test" + DebugMe() + world.log << "/MyType properties:" + world.log << "myvar: [myvar]" + return ..() //this calls /datum/proc/DebugMe() + +``` + + +Primitive types do not descend from /datum. These have no subtypes, and may or may not be able to allow var and proc overrides. +*** +**Related Pages:** ++ [atom](/ref/atom) ++ [procs (datum)](/ref/datum/proc) ++ [vars (datum)](/ref/datum/var) diff --git a/ref/datum/proc.md b/ref/datum/proc.md deleted file mode 100644 index 1fe4031b..00000000 --- a/ref/datum/proc.md +++ /dev/null @@ -1,9 +0,0 @@ -## procs (datum) - -Built-in datum procs: -datum/proc -+ [New](/ref/datum/proc/New.md) -+ [Del](/ref/datum/proc/Del.md) -+ [Write](/ref/datum/proc/Write.md) -+ [Read](/ref/datum/proc/Read.md) -+ [Topic](/ref/datum/proc/Topic.md) \ No newline at end of file diff --git a/ref/datum/proc/Del.md b/ref/datum/proc/Del.md index d8794a4a..55f2e7ea 100644 --- a/ref/datum/proc/Del.md +++ b/ref/datum/proc/Del.md @@ -1,27 +1,21 @@ -## Del proc (datum) + +## Del (proc) **Format:** + Del() -**When:** -+ Called when the object is destroyed, for example by using the `del` - instruction, or during garbage collection. - -**Default action:** -+ Delete the object. The contents of atomic objects are also destroyed - at this time, as though `del` were called on each one of them. - -When the world is destroyed, the `Del()` proc is not -automatically called. The only object for which it is called is -[/world](/ref/world.md) If you need the `Del()` proc for a particular object -to be called at that time, you should explicitly call it from -`world/Del()`. +**Called When:** ++ Called when the object is destroyed, for example by using the + instruction. -> [!NOTE] -> **Always** call `..()` at the end of this -> proc if you override it. Not doing so will prevent the object from being destroyed. +**Default Action:** ++ Delete the object. The contents of atomic objects are also destroyed at +this time, as though were called on each one of them. +*** +When the world is destroyed, the `Del()` proc is not automatically called. The only object for which it is called is /world. If you need the `Del()` proc for a particular object to be called at that time, you should explicitly call it from `world/Del()`. -> [!TIP] -> **See also:** -> + [del proc](/ref/proc/del.md) -> + [garbage collection](/ref/DM/garbage.md) +Note: **Always** call `..()` at the end of the proc if you override it. +*** +**Related Pages:** ++ [del proc](/ref/proc/del) ++ [garbage collection](/ref/DM/garbage) diff --git a/ref/datum/proc/New.md b/ref/datum/proc/New.md index 4a4730c2..553f348f 100644 --- a/ref/datum/proc/New.md +++ b/ref/datum/proc/New.md @@ -1,40 +1,36 @@ -## New proc (datum) + +## New (proc) **Format:** + New() -**When:** -+ Called when the datum is created, for example by using `new`, when - reading an object that was stored in a [savefile](/ref/savefile.md) , or - when the world is initially created. +**Called When:** ++ Called when the datum is created, for example by using , +when reading an object that was stored in a , +or when the world is initially created. [savefile](/ref/savefile) -**Default action:** +**Default Action:** + None. +*** +You can use the New() procedure to do more complicated initializations than are possible in the object definition where you assign the initial value of variables to constants. -You can use the New() procedure to do more complicated -initializations than are possible in the object definition where you -assign the initial value of variables to constants. +The following example makes use of the "Location" parameter that is passed to objects of type /atom. You can pass any number of additional arguments to New() by passing them to the new instruction which creates the object. -The following example makes use of the "Location" parameter that is passed -to objects of type [/atom](/ref/atom.md) You can pass any number of -additional arguments to New() by passing them to the `new` instruction -which creates the object. -### Example: ```dm + mob/night var/mob/squire/my_squire New(Location) my_squire = new(Location) return ..() + ``` - -Also note that the type of object being created in this case was automatically inferred from the -variable type on the left-hand side of the assignment. That's a handy -little DM short-cut. - -> [!TIP] -> **See also:** -> + [New proc (atom)](/ref/atom/proc/New.md) -> + [New proc (client)](/ref/client/proc/New.md) -> + [new proc](/ref/proc/new.md) \ No newline at end of file + + +Also note that the type of object being created in this case was automatically inferred from the variable type on the left-hand side of the assignment. That's a handy little DM short-cut. +*** +**Related Pages:** ++ [New](/ref/atom/proc/New) ++ [New proc (client)](/ref/client/proc/New) ++ [new proc](/ref/proc/new) diff --git a/ref/datum/proc/Read.md b/ref/datum/proc/Read.md index 0bd5ffc0..179dc7e3 100644 --- a/ref/datum/proc/Read.md +++ b/ref/datum/proc/Read.md @@ -1,21 +1,21 @@ -## Read proc (datum) + +## Read (proc) **Format:** + Read(savefile/F) -**When:** -+ Called when the object is read from a save file. - -**Args:** +**Arguments:** + F: the save file being read -**Default action:** -+ Read the value of each variable from a directory by the same name as - the variable. Variables marked tmp, global, or const and variables - for which there is no directory are skipped. +**Called When:** ++ Called when the object is read from a save file. -> [!TIP] -> **See also:** -> + [>> operator (savefile)](/ref/savefile/operator/%3e%3e.md) -> + [Write proc (datum)](/ref/datum/proc/Write.md) -> + [tmp vars](/ref/var/tmp.md) \ No newline at end of file +**Default Action:** ++ Read the value of each variable from a directory by the same name as the + variable. Variables marked tmp, global, or const and variables for + which there is no directory are skipped. +****** +**Related Pages:** ++ [>> operator (savefile)](/ref/savefile/operator/%3e%3e) ++ [Write](/ref/datum/proc/Write) ++ [tmp vars](/ref/var/tmp) diff --git a/ref/datum/proc/Topic.md b/ref/datum/proc/Topic.md index 6c660c86..322a4d5f 100644 --- a/ref/datum/proc/Topic.md +++ b/ref/datum/proc/Topic.md @@ -1,39 +1,36 @@ -## Topic proc (datum) + +## Topic (proc) **Format:** + Topic(href,href_list[]) -**Args:** +**Arguments:** + href: the hyperlink data (following ? in the URL). + href_list: key/value list (from params2list(href)). +*** +This procedure is called by the default `client.Topic()` proc when the href contains a parameter called "src" containing an object reference. -This procedure is called by the default `client.Topic()` proc -when the href contains a parameter called "src" containing an object -reference. - -> [!CAUTION] -> Always validate the input in `Topic()` calls to make sure it\'s correct -> and the query you\'re recieving is legitimate. - -### Example: ```dm + mob/verb/test() - usr << "Click here!" + usr << "Click here!" mob/Topic(href,href_list[]) switch(href_list["action"]) if("startgame") usr << "Starting game..." + ``` -The above example uses an embedded reference to the player\'s own mob to -create a hyperlink to that mob\'s `Topic()` proc. You can easily add -different actions, parameters, and so forth. Just remember that the -parameter values are always stored as text, so you need to convert those -to whatever data format you need using procedures such as `text2num()`, -`locate()`, etc. - -> [!TIP] -> **See also:** -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [ref text macro](/ref/DM/text/macros/ref.md) \ No newline at end of file + +The above example uses an embedded reference to the player's own mob to create a hyperlink to that mob's `Topic()` proc. You can easily add different actions, parameters, and so forth. Just remember that the parameter values are always stored as text, so you need to convert those to whatever data format you need using procedures such as `text2num()`, `locate()`, etc. + + +> [!CAUTION] +> +> > [!NOTE] +> > Always validate the input in `Topic()` calls to make sure it's correct and the query you're recieving is legitimate. +*** +**Related Pages:** ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [\ref text macro](/ref/DM/text/macros/ref) diff --git a/ref/datum/proc/Write.md b/ref/datum/proc/Write.md index 4a445d66..5e235807 100644 --- a/ref/datum/proc/Write.md +++ b/ref/datum/proc/Write.md @@ -1,23 +1,23 @@ -## Write proc (datum) + +## Write (proc) **Format:** + Write(savefile/F) -**When:** -+ Called when the object is written to a save file. - -**Args:** +**Arguments:** + F: the save file being written to -**Default action:** -+ Write the value of each variable to a directory by the same name as - the variable. Variables marked tmp, global, or const and variables - which are equal to their initial value are skipped. +**Called When:** ++ Called when the object is written to a save file. -> [!TIP] -> **See also:** -> + [<< operator (savefile)](/ref/savefile/operator/%3c%3c.md) -> + [Read proc (datum)](/ref/datum/proc/Read.md) -> + [initial proc](/ref/proc/initial.md) -> + [issaved proc](/ref/proc/issaved.md) -> + [tmp vars](/ref/var/tmp.md) \ No newline at end of file +**Default Action:** ++ Write the value of each variable to a directory by the same name as the + variable. Variables marked tmp, global, or const and variables which + are equal to their initial value are skipped. +****** +**Related Pages:** ++ [<< operator (savefile)](/ref/savefile/operator/%3c%3c) ++ [Read](/ref/datum/proc/Read) ++ [initial proc](/ref/proc/initial) ++ [issaved proc](/ref/proc/issaved) ++ [tmp vars](/ref/var/tmp) diff --git a/ref/datum/proc/index.md b/ref/datum/proc/index.md new file mode 100644 index 00000000..9be12c76 --- /dev/null +++ b/ref/datum/proc/index.md @@ -0,0 +1,5 @@ + +## proc (proc) +*** +Built-in datum procs: +*** \ No newline at end of file diff --git a/ref/datum/var.md b/ref/datum/var.md deleted file mode 100644 index a45384d2..00000000 --- a/ref/datum/var.md +++ /dev/null @@ -1,8 +0,0 @@ -## vars (datum) - -Built-in datum vars: -datum/var -+ [type](/ref/datum/var/type.md) -+ [parent_type](/ref/datum/var/parent_type.md) -+ [tag](/ref/datum/var/tag.md) -+ [vars](/ref/datum/var/vars.md) \ No newline at end of file diff --git a/ref/datum/var/index.md b/ref/datum/var/index.md new file mode 100644 index 00000000..a31f7cdd --- /dev/null +++ b/ref/datum/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in datum vars: +*** \ No newline at end of file diff --git a/ref/datum/var/parent_type.md b/ref/datum/var/parent_type.md index 29893480..796d8864 100644 --- a/ref/datum/var/parent_type.md +++ b/ref/datum/var/parent_type.md @@ -1,12 +1,14 @@ -## parent_type var -**Default value:** + +## parent_type (var) + +**Default Value:** + The path of the object definition that contains this one. +*** +This variable is set at compile-time to specify the inheritance of an object type. Normally, a new type of object inherits its variables and procedures from the object type that contains it. For example: -This variable is set at compile-time to specify the inheritance -of an object type. Normally, a new type of object inherits its variables -and procedures from the object type that contains it. For example: ```dm + obj var weight @@ -14,12 +16,15 @@ obj sword //parent type of 'sword' defaults to /obj weight = 30 color = "black" + ``` -Explicitly setting the parent type allows you to put the object -definition any place you want. That often means putting it at the top -"root" level. Example: + +Explicitly setting the parent type allows you to put the object definition any place you want. That often means putting it at the top "root" level. Example: + + ```dm + Armor parent_type = /obj var @@ -28,16 +33,15 @@ Armor weight = 100 color = "rusty" strength = 10 + ``` - -If you don\'t specify the parent_type for an object defined at the top level, -it defaults to [/datum](/ref/datum.md) which (with just a couple exceptions) -is the ultimate ancestor of all object types. You could use that fact to -define procedures or variables that you need all of your objects to -share. -### Example: + + +If you don't specify the parent_type for an object defined at the top level, it defaults to /datum, which (with just a couple exceptions) is the ultimate ancestor of all object types. You could use that fact to define procedures or variables that you need all of your objects to share. + ```dm + datum proc/Copy(datum/O) @@ -47,4 +51,7 @@ MyType Copy(MyType/O) foo = O.foo return ..() + ``` + +*** \ No newline at end of file diff --git a/ref/datum/var/tag.md b/ref/datum/var/tag.md index 75421594..49b13207 100644 --- a/ref/datum/var/tag.md +++ b/ref/datum/var/tag.md @@ -1,35 +1,30 @@ -## tag var (datum) -**Default value:** +## tag (var) + +**Default Value:** + null +*** +This may be assigned to a unique text string identifying a particular object. A reference to the object can then be obtained by using locate(). -This may be assigned to a unique text string identifying a -particular object. A reference to the object can then be obtained by -using locate(). +One reason to use tags is when making references in the code to objects and locations that will be created on the map. You can simply edit the object in the map editor, set its tag, and then use that in the code relating to the object. -One reason to use tags is when making -references in the code to objects and locations that will be created on -the map. You can simply edit the object in the map editor, set its tag, -and then use that in the code relating to the object. +The following example demonstrates how to set a tag and use it to obtain a reference to an object. -The following example demonstrates how to set a tag and use it to obtain a -reference to an object. -### Example: ```dm + mob/verb/test() - var/obj/O = new() - O.tag = "My Object" + var/obj/O = new() + O.tag = "My Object" + + var/obj/O2 = locate("My Object") - var/obj/O2 = locate("My Object") + ASSERT(O == O2) //this should always be true - ASSERT(O == O2) //this should always be true ``` - -Setting a tag to "" or null removes it. -Any object with a non-empty tag is immune to garbage collection, since -the tag is treated as an implicit reference to that object. - -> [!TIP] -> **See also:** -> + [locate proc](/ref/proc/locate.md) \ No newline at end of file + + +Setting a tag to "" or null removes it. Any object with a non-empty tag is immune to garbage collection, since the tag is treated as an implicit reference to that object. +*** +**Related Pages:** ++ [locate proc](/ref/proc/locate) diff --git a/ref/datum/var/type.md b/ref/datum/var/type.md index 05b70fbf..00f04b09 100644 --- a/ref/datum/var/type.md +++ b/ref/datum/var/type.md @@ -1,27 +1,17 @@ -# type var (datum) -**Default value:** + +## type (var) + +**Default Value:** + The "type path" of the object definition. +*** +This variable is read-only. + -All objects in BYOND are a part of the object tree. the `type` variable is the path of the objects definition on the object tree, similar to a file path on your computer. ```dm -mob - player - // type is /mob/player - enemy - // type is /mob/enemy -obj - item - sword - // type is /obj/item/sword - trap - // type is /obj/trap +mob/verb/test() + usr << type //displays "/mob" + ``` -> [!IMPORTANT] -> This variable is read-only. -> -> ```dm -> mob/verb/test() -> usr << type //displays "/mob" -> ``` +*** \ No newline at end of file diff --git a/ref/datum/var/vars.md b/ref/datum/var/vars.md index ac029817..e4d30b09 100644 --- a/ref/datum/var/vars.md +++ b/ref/datum/var/vars.md @@ -1,25 +1,24 @@ -## vars list var (datum) +## vars (var) +*** +This is a list of all the variables belonging to an object. The items in the list are the variable names. If the variable name is used as an index into the list, the value of that variable is accessed. -This is a list of all the variables belonging to an object. The -items in the list are the variable names. If the variable name is used -as an index into the list, the value of that variable is accessed. -### Example: ```dm + mob/verb/dump() var/V for(V in vars) usr << "[V] = [vars[V]]" + ``` -This example displays all the -variables belonging to your mob. -> [!TIP] -> **See also:** -> + [initial proc](/ref/proc/initial.md) -> + [issaved proc](/ref/proc/issaved.md) -> + [list](/ref/list.md) -> + [list associations](/ref/list/associations.md) -> + [vars list var (global)](/ref/DM/vars.md) \ No newline at end of file +This example displays all the variables belonging to your mob. +*** +**Related Pages:** ++ [initial proc](/ref/proc/initial) ++ [issaved proc](/ref/proc/issaved) ++ [list](/ref/list) ++ [list associations](/ref/list/associations) ++ [vars list var (global)](/ref/DM/vars) diff --git a/ref/exception.md b/ref/exception.md new file mode 100644 index 00000000..12470b47 --- /dev/null +++ b/ref/exception.md @@ -0,0 +1,16 @@ + +## exception (info) +*** +This datum is created automatically when a runtime error is encountered, **if** it happens within a try/catch block or you have defined a global error handler with `world.Error()`. (The New() proc is not called when this happens.) This provides a convenient package for getting file and line number info associated with an error. + +If you throw your own exceptions, you do not have to use this, but the `EXCEPTION` macro is provided to easily create one with the current file and line number. + +The `desc` value is only filled in when you have a world.Error() handler and there is no try/catch handling this error. Just like when no handler is present, less detail will be provided after multiple runtime errors have occurred. This only exists as a convenience feature for logging errors if you want to use something other than world.log. +*** +**Related Pages:** ++ [try and catch statements](/ref/proc/try) ++ [Error proc (world)](/ref/world/proc/Error) ++ [throw statement](/ref/proc/throw) ++ [EXCEPTION proc](/ref/proc/EXCEPTION) ++ [caller var (proc)](/ref/proc/var/caller) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/exception/exception.md b/ref/exception/exception.md deleted file mode 100644 index 49e1ad21..00000000 --- a/ref/exception/exception.md +++ /dev/null @@ -1,37 +0,0 @@ -## exception -###### BYOND Version 508 - -**Vars:** -+ *name*: A text string (such as an error message) or other value -+ *file*: The filename where the error occurred, if debugging info is - present -+ *line*: The line where the error occurred, if debugging info is - present -+ *desc*: Detailed error info including call stack, only used when sent - to world.Error() - -This datum is created automatically when a runtime error is -encountered, *if* it happens within a try/catch block or you have -defined a global error handler with `world.Error()`. (The New() proc is -not called when this happens.) This provides a convenient package for -getting file and line number info associated with an error. - -If you throw your own exceptions, you do not have to use this, but the -`EXCEPTION` macro is provided to easily create one with the current file -and line number. - -The `desc` value is only filled in when you -have a world.Error() handler and there is no try/catch handling this -error. Just like when no handler is present, less detail will be -provided after multiple runtime errors have occurred. This only exists -as a convenience feature for logging errors if you want to use something -other than world.log. - -> [!TIP] -> **See also:** -> + [try and catch statements](/ref/proc/try.md) -> + [Error proc (world)](/ref/world/proc/Error.md) -> + [throw statement](/ref/proc/throw.md) -> + [EXCEPTION proc](/ref/proc/EXCEPTION.md) -> + [caller var (proc)](/ref/proc/var/caller.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file diff --git a/ref/icon/icon.md b/ref/icon/icon.md deleted file mode 100644 index 630e37f8..00000000 --- a/ref/icon/icon.md +++ /dev/null @@ -1,52 +0,0 @@ -## icon object - -An `/icon` object is created by loading an icon file into -memory for direct access and manipulation. In order to be displayed, an -`/icon` object always gets converted back into an icon file; this -happens automatically when you assign atom.icon to an `/icon` object, -since that variable may only refer to a static icon file, rather than a -dynamic memory object. - -To create an `/icon` object, simply use -`new/icon()`, or the short-cut `icon()` proc. The following example -loads an icon file, reddens it, and then assigns it back to the -player\'s icon, which implicitly creates a new icon file. -### Example: - -```dm -mob/verb/test() - var/icon/I = new('player.dmi') - I.Blend(rgb(40,0,0)) - usr.icon = I -``` - -Note that merely displaying different icon states or directions can generally be achieved -without any icon manipulation, which saves quite a bit of overhead. For -example, the variables `atom.icon_state` and `atom.dir` can be used to -control how `atom.icon` is displayed, without any need for generating a -new icon file. - -> [!NOTE] -> Anything you can do with an atom var instead of using icon -manipulation procs will usually perform much better. Games that use the -new methods use fewer resources, use less memory, and also usually look -better too. - -Many things that used to require icon -manipulation may not need you to do so anymore, as DM has evolved new -capabilities. -| Operation | /icon proc | New method | -| --- | --- | --- | -| Multiplying by color | [`Blend`](/ref/icon/proc/Blend.md) or [SetIntensity](/ref/icon/proc/SetIntensity.md) procs | [color](/ref/atom/var/color.md) var | -| Adding color | [Blend](/ref/icon/proc/Blend.md) proc | [color](/ref/atom/var/color.md) var (using [color matrix](/ref/notes/color-matrix.md) ) | -| Applying color matrix | [MapColors](/ref/icon/proc/MapColors.md) proc | [color](/ref/atom/var/color.md) var (using [color matrix](/ref/notes/color-matrix.md) ) | -| Rotation | [Turn](/ref/icon/proc/Turn.md) proc | [transform](/ref/atom/var/transform.md) var | Flipping horizontal/vertical | [Flip](/ref/icon/proc/Flip.md) proc | [transform](/ref/atom/var/transform.md) var | -| Scaling | [Scale](/ref/icon/proc/Scale.md) proc | [transform](/ref/atom/var/transform.md) var | -| Overlaying/underlaying another icon | [Blend](/ref/icon/proc/Blend.md) proc + `ICON_OVERLAY`| Overlay/underlay + [KEEP_TOGETHER](/ref/atom/var/appearance_flags.md), or [Layering filter](/ref/notes/filters/layer.md) | - -> [!TIP] -> **See also:** -> + [procs (icon)](/ref/icon/proc.md) -> + [icons](/ref/DM/icon.md) -> + [image objects](/ref/image.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file diff --git a/ref/icon/index.md b/ref/icon/index.md new file mode 100644 index 00000000..547c5fc3 --- /dev/null +++ b/ref/icon/index.md @@ -0,0 +1,27 @@ + +## icon (info) +*** +An `/icon` object is created by loading an icon file into memory for direct access and manipulation. In order to be displayed, an `/icon` object always gets converted back into an icon file; this happens automatically when you assign atom.icon to an `/icon` object, since that variable may only refer to a static icon file, rather than a dynamic memory object. + +To create an `/icon` object, simply use `new/icon()`, or the short-cut `icon()` proc. The following example loads an icon file, reddens it, and then assigns it back to the player's icon, which implicitly creates a new icon file. + + +```dm + +mob/verb/test() + var/icon/I = new('player.dmi') + I.Blend(rgb(40,0,0)) + usr.icon = I + +``` + + +Note that merely displaying different icon states or directions can generally be achieved without any icon manipulation, which saves quite a bit of overhead. For example, the variables `atom.icon_state` and `atom.dir` can be used to control how `atom.icon` is displayed, without any need for generating a new icon file. + +Many things that used to require icon manipulation may not need you to do so anymore, as DM has evolved new capabilities. +*** +**Related Pages:** ++ [procs (icon)](/ref/icon/proc) ++ [icons](/ref/DM/icon) ++ [image objects](/ref/image) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/icon/proc.md b/ref/icon/proc.md deleted file mode 100644 index e11b1b64..00000000 --- a/ref/icon/proc.md +++ /dev/null @@ -1,23 +0,0 @@ -## procs (icon) - -icon/proc -+ [New](/ref/icon/proc/New.md) -+ [IconStates](/ref/icon/proc/IconStates.md) -+ [Turn](/ref/icon/proc/Turn.md) -+ [Flip](/ref/icon/proc/Flip.md) -+ [Shift](/ref/icon/proc/Shift.md) -+ [SetIntensity](/ref/icon/proc/SetIntensity.md) -+ [Blend](/ref/icon/proc/Blend.md) -+ [SwapColor](/ref/icon/proc/SwapColor.md) -+ [DrawBox](/ref/icon/proc/DrawBox.md) -+ [Insert](/ref/icon/proc/Insert.md) -+ [MapColors](/ref/icon/proc/MapColors.md) -+ [Scale](/ref/icon/proc/Scale.md) -+ [Crop](/ref/icon/proc/Crop.md) -+ [GetPixel](/ref/icon/proc/GetPixel.md) -+ [Width](/ref/icon/proc/Width.md) -+ [Height](/ref/icon/proc/Height.md) - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) \ No newline at end of file diff --git a/ref/icon/proc/Blend.md b/ref/icon/proc/Blend.md index af5f0bc7..56ca204d 100644 --- a/ref/icon/proc/Blend.md +++ b/ref/icon/proc/Blend.md @@ -1,48 +1,24 @@ -## Blend proc (icon) + +## Blend (proc) **Format:** -+ Blend(icon, function=ICON_ADD, x=1, y=1) ++ Blend(icon,function=ICON_ADD,x=1,y=1) -**Args:** +**Arguments:** + icon: an icon file, /icon object, or color + function: the blending operation to use + x, y: the position to blend the icon - +*** The valid blending operations are: -- ICON_ADD -- ICON_SUBTRACT -- ICON_MULTIPLY -- ICON_OVERLAY -- ICON_AND -- ICON_OR -- ICON_UNDERLAY - -The result is a combination of each corresponding pixel in the -two icons. In all but ICON_OVERLAY, ICON_UNDERLAY, and ICON_OR, the -transparent regions of the two icons are ORed together. That means if -either icon is transparent on a given pixel, the result will be -transparent. With ICON_OVERLAY or ICON_UNDERLAY, on the other hand, the -original icon shows through wherever the top icon is transparent, giving -the same effect as an overlay object, but resulting in only a single -icon. In ICON_OR, the transparent regions are ANDed together; solid -pixels are added together where they exist in both icons, or just pass -through if the other icon is transparent at that pixel. -In addition to blending with an icon, an rgb() value may also be specified. -This is treated identically to an icon of that same solid color, except -that the x and y arguments will be ignored. Blending with a color blends -the whole icon. +The result is a combination of each corresponding pixel in the two icons. In all but ICON_OVERLAY, ICON_UNDERLAY, and ICON_OR, the transparent regions of the two icons are ORed together. That means if either icon is transparent on a given pixel, the result will be transparent. With ICON_OVERLAY or ICON_UNDERLAY, on the other hand, the original icon shows through wherever the top icon is transparent, giving the same effect as an overlay object, but resulting in only a single icon. In ICON_OR, the transparent regions are ANDed together; solid pixels are added together where they exist in both icons, or just pass through if the other icon is transparent at that pixel. -By default, the icons will line up at their -lower left corners. If you want to position the second icon in a -different place for blending, use the x and y arguments to specify where -its lower left corner will be. 1,1 is the default, which is the lower -left. 11,1 for instance would be 10 pixels to the right, and 1,21 would -be 20 pixels up. +In addition to blending with an icon, an rgb() value may also be specified. This is treated identically to an icon of that same solid color, except that the x and y arguments will be ignored. Blending with a color blends the whole icon. -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [rgb proc](/ref/proc/rgb.md) \ No newline at end of file +By default, the icons will line up at their lower left corners. If you want to position the second icon in a different place for blending, use the x and y arguments to specify where its lower left corner will be. 1,1 is the default, which is the lower left. 11,1 for instance would be 10 pixels to the right, and 1,21 would be 20 pixels up. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [overlays](/ref/atom/var/overlays) ++ [rgb proc](/ref/proc/rgb) diff --git a/ref/icon/proc/Crop.md b/ref/icon/proc/Crop.md index 72cc2507..71aafcf6 100644 --- a/ref/icon/proc/Crop.md +++ b/ref/icon/proc/Crop.md @@ -1,36 +1,34 @@ -## Crop proc (icon) + +## Crop (proc) **Format:** + Crop(x1,y1,x2,y2) -**Args:** -+ x1,y1: Coordinates of one corner of the rectangle (1,1 is the lower - left) +**Arguments:** ++ x1,y1: Coordinates of one corner of the rectangle (1,1 is the lower left) + x2,y2: Coordinates of the other corner +*** +A portion of the current icon is cropped (cut). If the crop region extends outside the icon, it will be padded with transparent pixels. -A portion of the current icon is cropped (cut). If the crop -region extends outside the icon, it will be padded with transparent -pixels. +If using the TILED_ICON_MAP value for map_format, all icons must be even multiples of world.tile_size, so the icon will be padded with transparent pixels to the top and right as needed. -If using the TILED_ICON_MAP value for map_format, all -icons must be even multiples of world.tile_size, so the icon will be -padded with transparent pixels to the top and right as needed. -### Example: ```dm + // start with a simple icon var/icon/I = new('circle.dmi') // take the upper right 16x16 chunk I.Crop(17,17,32,32) // that chunk now appears in the lower left corner icon = I + ``` -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/icon_size.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) \ No newline at end of file +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [Big icons](/ref/{notes}/big-icons) ++ [Tiled icons](/ref/{notes}/tiled-icons) diff --git a/ref/icon/proc/DrawBox.md b/ref/icon/proc/DrawBox.md index a6fc13e0..90c8fcc2 100644 --- a/ref/icon/proc/DrawBox.md +++ b/ref/icon/proc/DrawBox.md @@ -1,20 +1,17 @@ -## DrawBox proc (icon) + +## DrawBox (proc) **Format:** + DrawBox(rgb,x1,y1,x2=x1,y2=y1) -**Args:** -+ rgb: `rgb(red,green,blue)` or `null` -+ x1,y1: Coordinates of one corner of the rectangle (1,1 is the lower - left) -+ x2,y2: (optional) Coordinates of the other corner -A rectangle (filled) of the given color is drawn over every -frame in the icon. If x2 and/or y2 are omitted, a line or a single pixel -is drawn. To draw a transparent box instead of an opaque color, use null -as the color. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [rgb proc](/ref/proc/rgb.md) \ No newline at end of file +**Arguments:** ++ rgb: or ++ x1,y1: Coordinates of one corner of the rectangle (1,1 is the lower left) ++ x2,y2: (optional) Coordinates of the other corner +*** +A rectangle (filled) of the given color is drawn over every frame in the icon. If x2 and/or y2 are omitted, a line or a single pixel is drawn. To draw a transparent box instead of an opaque color, use null as the color. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [rgb proc](/ref/proc/rgb) diff --git a/ref/icon/proc/Flip.md b/ref/icon/proc/Flip.md index 941b2591..835df284 100644 --- a/ref/icon/proc/Flip.md +++ b/ref/icon/proc/Flip.md @@ -1,23 +1,18 @@ -## Flip proc (icon) + +## Flip (proc) **Format:** + Flip(dir) -**Args:** +**Arguments:** + dir: direction in which to flip over the icon - -This flips the icon over in the specified direction. For -example, Flip(NORTH) would be like turning the icon upside down by -grabbing the bottom edge and flipping it up over the top edge. You would -get the same result by doing Flip(SOUTH). In general, this is not the -same as turning the icon by 180 degrees, because it produces a mirror -image. +*** +This flips the icon over in the specified direction. For example, Flip(NORTH) would be like turning the icon upside down by grabbing the bottom edge and flipping it up over the top edge. You would get the same result by doing Flip(SOUTH). In general, this is not the same as turning the icon by 180 degrees, because it produces a mirror image. If an icon is square, it may be flipped diagonally. - -> [!TIP] -> **See also:** -> + [Turn proc (icon)](/ref/icon/proc/Turn.md) -> + [dir var (atom)](/ref/atom/var/dir.md) -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) \ No newline at end of file +*** +**Related Pages:** ++ [Turn proc (icon)](/ref/icon/proc/Turn) ++ [dir](/ref/atom/var/dir) ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) diff --git a/ref/icon/proc/GetPixel.md b/ref/icon/proc/GetPixel.md index eae45f18..f92a78ef 100644 --- a/ref/icon/proc/GetPixel.md +++ b/ref/icon/proc/GetPixel.md @@ -1,25 +1,20 @@ -## GetPixel proc (icon) + +## GetPixel (proc) **Format:** + GetPixel(x, y, icon_state, dir=0, frame=0, moving=-1) -**Args:** +**Arguments:** + x,y: coordinates of the pixel to grab; 1,1 is the lower left corner + icon_state: a specific icon_state to use (may be null) + dir: a specific direction of this icon to use + frame: a specific animation frame to use (1 is the 1st frame) -+ moving: non-zero for only movement states, 0 for non-movement - states, or null (default) for either - -This finds the icon_state and the right animation/direction -frame of your choosing (it will pick the first one available if you -don\'t specify) and returns the rgb() value of a pixel at that location, -in "#RRGGBB" form. If the pixel is totally transparent, it returns -null. If the pixel is partially transparent, an alpha component is also -returned in "#RRGGBBAA" form. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [rgb proc](/ref/proc/rgb.md) \ No newline at end of file ++ moving: non-zero for only movement states, 0 for non-movement states, + or null (default) for either +*** +This finds the icon_state and the right animation/direction frame of your choosing (it will pick the first one available if you don't specify) and returns the rgb() value of a pixel at that location, in "#RRGGBB" form. If the pixel is totally transparent, it returns null. If the pixel is partially transparent, an alpha component is also returned in "#RRGGBBAA" form. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [rgb proc](/ref/proc/rgb) diff --git a/ref/icon/proc/Height.md b/ref/icon/proc/Height.md index 4e231b80..77d55b9a 100644 --- a/ref/icon/proc/Height.md +++ b/ref/icon/proc/Height.md @@ -1,12 +1,12 @@ -## Height proc (icon) + +## Height (proc) **Format:** + Height() - +*** This finds the height, in pixels, of the icon. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [Width proc](/ref/icon/proc/Width.md) \ No newline at end of file +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [Width proc](/ref/icon/proc/Width) diff --git a/ref/icon/proc/IconStates.md b/ref/icon/proc/IconStates.md index 5c88acb2..0b090a3f 100644 --- a/ref/icon/proc/IconStates.md +++ b/ref/icon/proc/IconStates.md @@ -1,17 +1,15 @@ -## IconStates proc (icon) + +## IconStates (proc) **Format:** + IconStates(mode=0) -**Args:** -+ mode: see [icon_states proc](/ref/proc/icon_states.md) - -This returns a list of all icon state text strings that exist -in the /icon object. This works in exactly the same way as -icon_states(icon). - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [icon_states proc](/ref/proc/icon_states.md) \ No newline at end of file +**Arguments:** ++ mode: see [icon_states proc](/ref/proc/icon_states) +*** +This returns a list of all icon state text strings that exist in the /icon object. This works in exactly the same way as icon_states(icon). +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [icon_states proc](/ref/proc/icon_states) diff --git a/ref/icon/proc/Insert.md b/ref/icon/proc/Insert.md index 8e969329..a30b8520 100644 --- a/ref/icon/proc/Insert.md +++ b/ref/icon/proc/Insert.md @@ -1,32 +1,28 @@ -## Insert proc (icon) +## Insert (proc) **Format:** -+ Insert(new_icon icon_state, dir, frame, moving,delay) -+ supports [named arguments](/ref/proc/arguments/named.md) ++ Insert(new_icon,icon_state,dir,frame,moving,delay) ++ -**Args:** +**Arguments:** + new_icon: an icon file or /icon object to insert -+ icon_state: an optional text string, specifying a single icon state - to change or add to this icon -+ dir: an optional direction; the inserted icon will only be added for - this direction -+ frame: an optional animation frame (starting at 1); the inserted - icon will only be added for this frame -+ moving: Non-zero to insert as a movement state, 0 for a regular - non-movement state -+ delay: 0 or null to leave unchanged; positive to set delay for a - frame and turn rewind off; negative to set delay and rewind ++ icon_state: an optional text string, specifying a single icon state to + change or add to this icon ++ dir: an optional direction; the inserted icon will only be added for this + direction ++ frame: an optional animation frame (starting at 1); the inserted icon will + only be added for this frame ++ moving: Non-zero to insert as a movement state, 0 for a regular non-movement + state ++ delay: 0 or null to leave unchanged; positive to set delay for a frame and turn + rewind off; negative to set delay and rewind +*** +This adds additional states or images to an existing icon, allowing you to build directional, animated, and multi-state icons on the fly. If the state you wish to insert already exists in the file, it will be altered; otherwise it will be added. An animation may be built a piece at a time, for example by inserting an icon into the NORTH direction for animation frame 3. -This adds additional states or images to an existing icon, -allowing you to build directional, animated, and multi-state icons on -the fly. If the state you wish to insert already exists in the file, it -will be altered; otherwise it will be added. An animation may be built a -piece at a time, for example by inserting an icon into the NORTH -direction for animation frame 3. -### Example: ```dm + // start with a non-animated arrow icon var/icon/I = new('arrow.dmi') // make a new state called "blink" @@ -40,36 +36,21 @@ for(var/light=9, light>=5, light--) I.Insert(J, "blink", frame=n++) // congratulations, you have a pulsating arrow icon = I + ``` - -The icon resulting from -this example has two states: The original arrow, and a new state called -"blink" that pulsates between full and ½ luminance. To use the -blinking state after that, set the atom\'s icon_state to "blink". -(Note for animations: When building an animated icon_state from -scratch, you can only add 16 new animation frames at a time; i.e., -frame<=total_frames+16. Higher values for frame will be ignored. This -is a safety precaution.) -If you insert an icon of a different -size, the src icon will be resized to match the size of new_icon. (The -only exception is if you are using the TILED_ICON_MAP map_format, and -new_icon is a single tile being inserted as a chunk into a larger icon. -If icon_state, such as "2,0" or "open 0,0", already exists in src as -one of its smaller pieces, then new_icon will be inserted in its place.) +The icon resulting from this example has two states: The original arrow, and a new state called "blink" that pulsates between full and ½ luminance. To use the blinking state after that, set the atom's icon_state to "blink". + +(Note for animations: When building an animated icon_state from scratch, you can only add 16 new animation frames at a time; i.e., frame<=total_frames+16. Higher values for frame will be ignored. This is a safety precaution.) -When inserting an individual animation frame, you can change -the delay for just that frame only. If you don\'t specify a delay, the -nearest frame\'s delay will be used. If this is the first frame being -inserted into an icon, then the delay will default to 1 tick. Remember, -if your delay is positive, it will turn off the rewind flag for that -entire icon state; negative will turn it on. +If you insert an icon of a different size, the src icon will be resized to match the size of new_icon. (The only exception is if you are using the TILED_ICON_MAP map_format, and new_icon is a single tile being inserted as a chunk into a larger icon. If icon_state, such as "2,0" or "open 0,0", already exists in src as one of its smaller pieces, then new_icon will be inserted in its place.) -> [!TIP] -> **See also:** -> + [procs (icon)](/ref/icon/proc.md) -> + [New proc](/ref/icon/proc/New.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) \ No newline at end of file +When inserting an individual animation frame, you can change the delay for just that frame only. If you don't specify a delay, the nearest frame's delay will be used. If this is the first frame being inserted into an icon, then the delay will default to 1 tick. Remember, if your delay is positive, it will turn off the rewind flag for that entire icon state; negative will turn it on. +*** +**Related Pages:** ++ [procs (icon)](/ref/icon/proc) ++ [New proc (icon)](/ref/icon/proc/New) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Big icons](/ref/{notes}/big-icons) ++ [Tiled icons](/ref/{notes}/tiled-icons) diff --git a/ref/icon/proc/MapColors.md b/ref/icon/proc/MapColors.md index d4e19d99..e05766ea 100644 --- a/ref/icon/proc/MapColors.md +++ b/ref/icon/proc/MapColors.md @@ -1,84 +1,65 @@ -## MapColors proc (icon) + +## MapColors (proc) **Format:** -+ MapColors(rr, rg, rb, gr, gg, gb, br, bg, bb, r0=0, g0=0, b0=0)\ - *or*\ - MapColors(r_rgb, g_rgb, b_rgb, rgb0=rgb(0,0,0))\ - *or*\ - MapColors(rr, rg, rb, ra, gr, gg, gb, ga, br, bg, bb, ba, ar, ag, - ab, aa, r0=0, g0=0, b0=0, a0=0)\ - *or*\ - MapColors(r_rgba, g_rgba, b_rgba, a_rgba, rgba0) - -**Args:** ++ MapColors(rr, rg, rb, gr, gg, gb, br, bg, bb, r0=0, g0=0, b0=0) + + MapColors(r_rgb, g_rgb, b_rgb, rgb0=rgb(0,0,0)) + + MapColors(rr, rg, rb, ra, gr, gg, gb, ga, br, bg, bb, ba, ar, ag, ab, aa, r0=0, g0=0, b0=0, a0=0) + + MapColors(r_rgba, g_rgba, b_rgba, a_rgba, rgba0) + +**Arguments:** + rr: portion of old red component -> new red component + rg: portion of old red component -> new green component + rb: portion of old red component -> new blue component + ra: portion of old red component -> new alpha component + r0: new base red component + ... - -*or* + r_rgb: red component is converted to this color + g_rgb: green component is converted to this color + b_rgb: blue component is converted to this color + rgb0: this color is added to the result +*** +This is used for complex color mapping that can be used for many special effects. For the number form, values usually range from 0 to 1, but you can use anything you like, including negative numbers. 1 means 100% of the original color will be used. If rg=1, for example, then the amount of red in the original icon becomes the same amount of green in the new icon's colors. + +There is also an alternate form that can use `rgb()` values instead, though it is less flexible. r_rgb is the color that will be used in place of 100% red; any darker shades of red will become a darker shade of that color. g_rgb converts green to another color, and b_rgb converts blue to still another color, and all of them are added together. + +Either of these calls change the icon to grayscale: + -This is used for complex color mapping that can be used for -many special effects. For the number form, values usually range from 0 -to 1, but you can use anything you like, including negative numbers. 1 -means 100% of the original color will be used. If rg=1, for example, -then the amount of red in the original icon becomes the same amount of -green in the new icon\'s colors. - -There is also an alternate -form that can use `rgb()` values instead, though it is less flexible. -r_rgb is the color that will be used in place of 100% red; any darker -shades of red will become a darker shade of that color. g_rgb converts -green to another color, and b_rgb converts blue to still another color, -and all of them are added together. - -Either of these calls -change the icon to grayscale: ```dm -icon.MapColors(0.3,0.3,0.3, 0.59,0.59,0.59, 0.11,0.11,0.11, 0,0,0) +icon.MapColors(0.299,0.299,0.299, 0.587,0.587,0.587, 0.114,0.114,0.114, 0,0,0) // or... -icon.MapColors(rgb(77,77,77), rgb(150,150,150), rgb(28,28,28), rgb(0,0,0)) +icon.MapColors(rgb(76,76,76), rgb(150,150,150), rgb(29,29,29), rgb(0,0,0)) ``` + + The calculations are as follows: -- For any red in the original icon, add 30% gray to the output. -- For any green in the original icon, add 59% gray to the output. -- For any blue in the original icon, add 11% gray to the output. -- Add an additional 0% (nothing). Or this will make a nice moonlight effect: + ```dm icon.MapColors(0.2,0.05,0.05, 0.1,0.3,0.2, 0.1,0.1,0.4, 0,0,0) // or... icon.MapColors(rgb(51,13,13), rgb(26,77,51), rgb(26,26,102), rgb(0,0,0)) -``` -- For any red in the original icon, add rgb(51,12.75,12.75) (dark - pink) to the output. -- For any green in the original icon, add rgb(25.5,76.5,51) (dark - bluish green) to the output. -- For any blue in the original icon, add rgb(25.5,25.5,102) (dark - grayish blue) to the output. -- Add an additional 0% (nothing). +``` Or a negative icon (invert all colors): + ```dm MapColors(-1,0,0, 0,-1,0, 0,0,-1, 1,1,1) ``` -The longer formats of MapColors() will allow you to also change -alpha colors. -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [rgb proc](/ref/proc/rgb.md) \ No newline at end of file +The longer formats of MapColors() will allow you to also change alpha colors. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [rgb proc](/ref/proc/rgb) diff --git a/ref/icon/proc/New.md b/ref/icon/proc/New.md index 586715e4..07e8b3dc 100644 --- a/ref/icon/proc/New.md +++ b/ref/icon/proc/New.md @@ -1,54 +1,41 @@ -## New proc (icon) + +## New (proc) **Format:** + New(icon,icon_state,dir,frame,moving) -+ supports [named arguments](/ref/proc/arguments/named.md) - -**Args:** -+ *icon*: an icon file or /icon object -+ *icon_state*: an optional text string, specifying a single icon state - to load -+ *dir*: an optional direction to extract -+ *frame*: an optional animation frame to extract -+ *moving*: Non-zero to extract only movement states, 0 for non-movement - states, or null (default) for both - -You generally don\'t call this directly but via new(). The -specified icon file is loaded into memory for direct access and -manipulation. - -If the icon state is not specified, all icon -states are loaded. Ditto for the direction, animation frame, or -preference for movement states. Animation frames are numbered from 1 and -up, so frame=4 is the 4th frame. - -(Movement states are special -versions of an existing icon_state with the same name, but appear in the -Dream Maker editor with an "M" indicator. These states are used for -animation when the atom using the icon_state moves from one tile to the -next; otherwise only the normal non-moving state is displayed.) - -The following contrived example, loads the EAST facing default -icon state "" from the user\'s icon file, rotates that a bit, and then -creates a new icon file for the user. -### Example: ++ + +**Arguments:** ++ icon: an icon file or /icon object ++ icon_state: an optional text string, specifying a single icon state to load ++ dir: an optional direction to extract ++ frame: an optional animation frame to extract ++ moving: Non-zero to extract only movement states, 0 for non-movement states, + or null (default) for both +*** +You generally don't call this directly but via new(). The specified icon file is loaded into memory for direct access and manipulation. + +If the icon state is not specified, all icon states are loaded. Ditto for the direction, animation frame, or preference for movement states. Animation frames are numbered from 1 and up, so frame=4 is the 4th frame. + +(Movement states are special versions of an existing icon_state with the same name, but appear in the Dream Maker editor with an "M" indicator. These states are used for animation when the atom using the icon_state moves from one tile to the next; otherwise only the normal non-moving state is displayed.) + +The following contrived example, loads the EAST facing default icon state "" from the user's icon file, rotates that a bit, and then creates a new icon file for the user. + ```dm + mob/verb/test() var/icon/I = new(usr.icon,icon_state = "",dir = EAST) I.Turn(90) //rotate clockwise 90 degrees usr.icon = I + ``` -Note that merely displaying different icon states or -directions can generally be achieved without any icon manipulation, -which is good, because it saves quite a bit of overhead. For example, -the variables atom.icon_state and atom.dir can be used to control how -atom.icon is displayed, without any need for generating a new icon file. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [image proc](/ref/proc/image.md) -> + [new proc](/ref/proc/new.md) \ No newline at end of file + +Note that merely displaying different icon states or directions can generally be achieved without any icon manipulation, which is good, because it saves quite a bit of overhead. For example, the variables atom.icon_state and atom.dir can be used to control how atom.icon is displayed, without any need for generating a new icon file. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [image proc](/ref/proc/image) ++ [new proc](/ref/proc/new) diff --git a/ref/icon/proc/Scale.md b/ref/icon/proc/Scale.md index dba66260..12217d61 100644 --- a/ref/icon/proc/Scale.md +++ b/ref/icon/proc/Scale.md @@ -1,26 +1,22 @@ -## Scale proc (icon) + +## Scale (proc) **Format:** + Scale(width, height) -**Args:** +**Arguments:** + width,height: size of the new icon +*** +The current icon is scaled to a new size. -The current icon is scaled to a new size. - -If world.map_format is set to TILED_ICON_MAP and the new size is not in -multiples of world.icon_size, the icon will be padded with transparent -pixels to the top and right as needed. See map_format for more -information. - -Scale() automatically performs antialiasing to -avoid unwanted artifacts. +If world.map_format is set to TILED_ICON_MAP and the new size is not in multiples of world.icon_size, the icon will be padded with transparent pixels to the top and right as needed. See map_format for more information. -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) \ No newline at end of file +Scale() automatically performs antialiasing to avoid unwanted artifacts. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Big icons](/ref/{notes}/big-icons) ++ [Tiled icons](/ref/{notes}/tiled-icons) diff --git a/ref/icon/proc/SetIntensity.md b/ref/icon/proc/SetIntensity.md index ff0a8743..04d5202d 100644 --- a/ref/icon/proc/SetIntensity.md +++ b/ref/icon/proc/SetIntensity.md @@ -1,19 +1,17 @@ -## SetIntensity proc (icon) + +## SetIntensity (proc) **Format:** + SetIntensity(r,g=r,b=r) -**Args:** +**Arguments:** + r: red component + g: green component + b: blue component - -This multiplies the pixel intensities by the specified amounts. -A value greater than 1.0 increases the intensity and a value less than -1.0 decreases the intensity. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [MapColors() proc (icon)](/ref/icon/proc/MapColors.md) \ No newline at end of file +*** +This multiplies the pixel intensities by the specified amounts. A value greater than 1.0 increases the intensity and a value less than 1.0 decreases the intensity. +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [MapColors proc (icon)](/ref/icon/proc/MapColors) diff --git a/ref/icon/proc/Shift.md b/ref/icon/proc/Shift.md index 5a949fa9..73035784 100644 --- a/ref/icon/proc/Shift.md +++ b/ref/icon/proc/Shift.md @@ -1,25 +1,19 @@ -## Shift proc (icon) + +## Shift (proc) **Format:** + Shift(dir,offset,wrap=0) -**Args:** +**Arguments:** + dir: direction in which to shift the icon + offset: distance to shift the pixels -+ wrap: if true, causes shifted pixels to wrap around to the other - side - -This moves all of the pixels by the specified amount in a -direction. For example, Shift(NORTH,1) would move everything one pixel -to the north. - -By default, pixels that move off the edge are not -wrapped around; transparent pixels are shifted onto the other side. -Calling with wrap=1 causes it to shift the pixels around to the other -side. ++ wrap: if true, causes shifted pixels to wrap around to the other side +*** +This moves all of the pixels by the specified amount in a direction. For example, Shift(NORTH,1) would move everything one pixel to the north. -> [!TIP] -> **See also:** -> + [dir var (atom)](/ref/atom/var/dir.md) -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) \ No newline at end of file +By default, pixels that move off the edge are not wrapped around; transparent pixels are shifted onto the other side. Calling with wrap=1 causes it to shift the pixels around to the other side. +*** +**Related Pages:** ++ [dir](/ref/atom/var/dir) ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) diff --git a/ref/icon/proc/SwapColor.md b/ref/icon/proc/SwapColor.md index feaaeb68..1c5adc5e 100644 --- a/ref/icon/proc/SwapColor.md +++ b/ref/icon/proc/SwapColor.md @@ -1,29 +1,22 @@ -## SwapColor proc (icon) + +## SwapColor (proc) **Format:** -+ SwapColor(old_rgb,new_rgb)\ - *or*\ - SwapColor(old_rgba,new_rgba) ++ SwapColor(old_rgb,new_rgb) + + SwapColor(old_rgba,new_rgba) -**Args:** +**Arguments:** + old_rgba: the old rgba value to be replaced + new_rgba: the new rgba value to use in its place +*** +This causes a color value in the icon's palette to be changed. You can use null in place of an RGB or RGBA value. -This causes a color value in the icon\'s palette to be changed. -You can use null in place of an RGB or RGBA value. - -If the old -color is a full RGBA color with an alpha value, such as rgb(1,2,3,4) or -"#01020304", then that exact color is the only one changed. - -If the old color is an RGB value with no alpha specified, such -as rgb(1,2,3) or "#010203", then that color will change to the new one -regardless of its alpha value, and the original icon\'s alpha will be -kept intact. (If the new color is totally transparent, however, then the -old color will be replaced with full transparency.) +If the old color is a full RGBA color with an alpha value, such as rgb(1,2,3,4) or "#01020304", then that exact color is the only one changed. -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [rgb proc](/ref/proc/rgb.md) \ No newline at end of file +If the old color is an RGB value with no alpha specified, such as rgb(1,2,3) or "#010203", then that color will change to the new one regardless of its alpha value, and the original icon's alpha will be kept intact. (If the new color is totally transparent, however, then the old color will be replaced with full transparency.) +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [rgb proc](/ref/proc/rgb) diff --git a/ref/icon/proc/Turn.md b/ref/icon/proc/Turn.md index d2d6e114..30171997 100644 --- a/ref/icon/proc/Turn.md +++ b/ref/icon/proc/Turn.md @@ -1,16 +1,17 @@ -## Turn proc (icon) + +## Turn (proc) **Format:** + Turn(angle) -**Args:** +**Arguments:** + angle: an angle in degrees - - +*** This rotates the icon clockwise by the specified amount. -### Example: + ```dm + mob/verb/drink() //this effect is very confusing! var/icon/I = new(usr.icon) @@ -22,13 +23,14 @@ mob/verb/drink() I.Turn(-90) //turn it back usr.icon = I //should have just saved original value + ``` - -If an icon is not square, it cannot be turned. -> [!TIP] -> **See also:** -> + [Flip proc (icon)](/ref/icon/proc/Flip.md) -> + [dir var (atom)](/ref/atom/var/dir.md) -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) \ No newline at end of file + +If an icon is not square, it cannot be turned. +*** +**Related Pages:** ++ [Flip proc (icon)](/ref/icon/proc/Flip) ++ [dir](/ref/atom/var/dir) ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) diff --git a/ref/icon/proc/Width.md b/ref/icon/proc/Width.md index c1d2fd61..a3ed05ba 100644 --- a/ref/icon/proc/Width.md +++ b/ref/icon/proc/Width.md @@ -1,12 +1,12 @@ -## Width proc (icon) + +## Width (proc) **Format:** + Width() - +*** This finds the width, in pixels, of the icon. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [Height proc](/ref/icon/proc/Height.md) \ No newline at end of file +*** +**Related Pages:** ++ [icon](/ref/icon) ++ [procs (icon)](/ref/icon/proc) ++ [Height proc](/ref/icon/proc/Height) diff --git a/ref/icon/proc/index.md b/ref/icon/proc/index.md new file mode 100644 index 00000000..3d744d9b --- /dev/null +++ b/ref/icon/proc/index.md @@ -0,0 +1,5 @@ + +## proc (proc) +****** +**Related Pages:** ++ [icon](/ref/icon) diff --git a/ref/image/image.md b/ref/image/image.md deleted file mode 100644 index ffe999a1..00000000 --- a/ref/image/image.md +++ /dev/null @@ -1,46 +0,0 @@ -## image objects - -The /image type contains data used to create a virtual image. -Unlike other atomic objects, this object is a purely visual effect. It -always appears attached to some other object and it behaves in every way -as though it were part of that object (e.g. if the user clicks on it, -this counts as a click on the atomic object, not the image). - -One reason for creating images is player-by-player control over -visibility. Images only become visible when they are explicitly output -to players: -### Example: - -```dm -var/image/I = image('icon.dmi',usr) //make an image attached to usr -usr << I //allow usr to see it -``` - -Images are also useful in the creation of overlays. Overlays -are like images, since they are always attached to another object, but -overlays obey the normal rules of visibility, so they are more -convenient when you do not want to hide the effect from anybody. An -overlay can be created directly from an icon file (or icon state), but -when one wishes to override some additional parameter, the image() -instruction is a convenient way to do it. -### Example: - -```dm -usr.overlays += image('shirt.dmi',icon_state = "red") -``` - -In the above example, the icon state of an overlay -was set by creating the overlay from an image with the desired icon -state. Note that after the creation of an overlay, no link remains -between the overlay and the object that was used to create it. If you -change the image after that time, it will not change the overlay, which -is simply a "snapshot" of the original image. - -> [!TIP] -> **See also:** -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [image proc](/ref/proc/image.md) -> + [vars (image)](/ref/image/var.md) -> + [images var (client)](/ref/client/var/images.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) -> + [override var (atom)](/ref/atom/var/override.md) \ No newline at end of file diff --git a/ref/image/index.md b/ref/image/index.md new file mode 100644 index 00000000..ab0976e2 --- /dev/null +++ b/ref/image/index.md @@ -0,0 +1,35 @@ + +## image (info) +*** +The /image type contains data used to create a virtual image. Unlike other atomic objects, this object is a purely visual effect. It always appears attached to some other object and it behaves in every way as though it were part of that object (e.g. if the user clicks on it, this counts as a click on the atomic object, not the image). + +One reason for creating images is player-by-player control over visibility. Images only become visible when they are explicitly output to players: + + +```dm + +var/image/I = image('icon.dmi',usr) //make an image attached to usr +usr << I //allow usr to see it + +``` + + +Images are also useful in the creation of overlays. Overlays are like images, since they are always attached to another object, but overlays obey the normal rules of visibility, so they are more convenient when you do not want to hide the effect from anybody. An overlay can be created directly from an icon file (or icon state), but when one wishes to override some additional parameter, the image() instruction is a convenient way to do it. + + +```dm + +usr.overlays += image('shirt.dmi',icon_state = "red") + +``` + + +In the above example, the icon state of an overlay was set by creating the overlay from an image with the desired icon state. Note that after the creation of an overlay, no link remains between the overlay and the object that was used to create it. If you change the image after that time, it will not change the overlay, which is simply a "snapshot" of the original image. +*** +**Related Pages:** ++ [icon var (atom)](/ref/atom/var/icon) ++ [image proc](/ref/proc/image) ++ [vars (image)](/ref/image/var) ++ [images var (client)](/ref/client/var/images) ++ [overlays](/ref/atom/var/overlays) ++ [override](/ref/atom/var/override) diff --git a/ref/image/var.md b/ref/image/var.md deleted file mode 100644 index a634744a..00000000 --- a/ref/image/var.md +++ /dev/null @@ -1,38 +0,0 @@ -## vars (image) -/image/var -+ [alpha](/ref/atom/var/alpha.md) -+ [appearance](/ref/atom/var/appearance.md) -+ [appearance_flags](/ref/atom/var/appearance_flags.md) -+ [blend_mode](/ref/atom/var/blend_mode.md) -+ [color](/ref/atom/var/color.md) -+ [icon](/ref/atom/var/icon.md) -+ [icon_state](/ref/atom/var/icon_state.md) -+ [icon_w](/ref/atom/var/icon_w.md) -+ [icon_z](/ref/atom/var/icon_z.md) -+ [text](/ref/atom/var/text.md) -+ [dir](/ref/atom/var/dir.md) -+ [filters](/ref/atom/var/filters.md) -+ [loc](/ref/image/var/loc.md) -+ [maptext](/ref/atom/var/maptext.md) -+ [maptext_width](/ref/atom/var/maptext_width.md) -+ [maptext_height](/ref/atom/var/maptext_height.md) -+ [maptext_x](/ref/atom/var/maptext_x.md) -+ [maptext_y](/ref/atom/var/maptext_y.md) -+ [overlays](/ref/atom/var/overlays.md) -+ [override](/ref/atom/var/override.md) -+ [pixel_x](/ref/atom/var/pixel_x.md) -+ [pixel_y](/ref/atom/var/pixel_y.md) -+ [pixel_w](/ref/atom/var/pixel_w.md) -+ [pixel_z](/ref/atom/var/pixel_z.md) -+ [plane](/ref/atom/var/plane.md) -+ [render_source](/ref/atom/var/render_source.md) -+ [render_target](/ref/atom/var/render_target.md) -+ [transform](/ref/atom/var/transform.md) -+ [underlays](/ref/atom/var/underlays.md) -+ [vis_contents](/ref/atom/var/vis_contents.md) -+ [x](/ref/atom/var/x.md) -+ [y](/ref/atom/var/y.md) -+ [z](/ref/atom/var/z.md) -+ [type](/ref/datum/var/type.md) -+ [tag](/ref/datum/var/tag.md) -+ [parent_type](/ref/datum/var/parent_type.md) \ No newline at end of file diff --git a/ref/image/var/index.md b/ref/image/var/index.md new file mode 100644 index 00000000..f6350edc --- /dev/null +++ b/ref/image/var/index.md @@ -0,0 +1,3 @@ + +## var (var) +****** \ No newline at end of file diff --git a/ref/image/var/loc.md b/ref/image/var/loc.md index 90e7d6f6..7a4acc5d 100644 --- a/ref/image/var/loc.md +++ b/ref/image/var/loc.md @@ -1,12 +1,7 @@ -# loc var (image) -The location of an image specifies the object to which the -image is attached. Unless the image drawing layer is specified, the -default will make it appear above this object, as though it were an -overlay. +## loc (var) +*** +The location of an image specifies the object to which the image is attached. Unless the image drawing layer is specified, the default will make it appear above this object, as though it were an overlay. -Note that the image is not *inside* the specified -location. In other words, this loc variable does not behave like -/atom/movable/var/loc which specifies the container object. It is more -like the image is on top of the specified object. If the object moves, -the image will automatically move around with it. \ No newline at end of file +Note that the image is not inside the specified location. In other words, this loc variable does not behave like /atom/movable/var/loc which specifies the container object. It is more like the image is on top of the specified object. If the object moves, the image will automatically move around with it. +*** \ No newline at end of file diff --git a/ref/list/associations.md b/ref/list/associations.md index e357b385..ee41a7cd 100644 --- a/ref/list/associations.md +++ b/ref/list/associations.md @@ -1,11 +1,11 @@ -## list associations -Each unique text string or object in a list may be associated -with another value. This is done by using the item as an index into the -list. -### Example: +## associations (info) +*** +Each unique text string or object in a list may be associated with another value. This is done by using the item as an index into the list. + ```dm + var/params[0] params["player"] = "James Byond" @@ -24,60 +24,52 @@ var/i for(i=1,i<=params.len,i++) p = params[i] usr << "[p] = [params[p]]" + ``` - -The above example illustrates the -typical way in which list associations are managed. Note that an item in -the list may be added by assigning its associated value. The example -could have started by doing `params.Add("player","score")`, but that -would have been redundant. - -Both `for` loops in the example have -the same effect. The first one loops through each item in the list, and -displays it along with its associated value. The second loop achieves -the same thing by looping through the numerical indices (referred to as -*array* indices as opposed to *associative* indices). - -Since numeric indices are treated differently, accessing the Nth item in the -list, you may not assign an associated value to a numeric list item. -Associations must have a text string or object reference as the index -item. (`alist()` is an exception to this, and can use numeric -associations. See [alist()](/ref/list/alist.md) for more information.) - -Associated values default to null if none is assigned. This is -also the value returned when the supplied index item does not exist in -the list. The list defined above, for example, would return null for -`params["time"]`. - -The [list()](/ref/proc/list.md) or [alist()](/ref/proc/alist.md) instructions may also be used to create -associative lists. -### Example: + + +The above example illustrates the typical way in which list associations are managed. Note that an item in the list may be added by assigning its associated value. The example could have started by doing params.Add("player","score"), but that would have been redundant. + +Both for loops in the example have the same effect. The first one loops through each item in the list, and displays it along with its associated value. The second loop achieves the same thing by looping through the numerical indices (referred to as array indices as opposed to associative indices). + +Since numeric indices are treated differently, accessing the Nth item in the list, you may not assign an associated value to a numeric list item. Associations must have a text string or object reference as the index item. (`alist()` is an exception to this, and can use numeric associations. See alist() for more information.) + +Associated values default to null if none is assigned. This is also the value returned when the supplied index item does not exist in the list. The list defined above, for example, would return null for params["time"]. + +The list() or alist() instructions may also be used to create associative lists. + ```dm - var/list/lst = list("player" = "James Byond", "score" = 2000) + +var/list/lst = list("player" = "James Byond", "score" = 2000) + ``` - -When the index values happen to be -text strings that satisfy all the requirements for variable names, this -may also be written in a convenient short-hand: + + +When the index values happen to be text strings that satisfy all the requirements for variable names, this may also be written in a convenient short-hand: + + ```dm -var/list/lst = list(player = "James Byond", score = 2000) + +var/list/lst = list(player = "James Byond", score = 2000) + ``` -In other words, this is exactly the same syntax as for [named -arguments](/ref/proc/arguments/named.md) . - -The [`alist` -proc](/ref/proc/alist.md) creates lists that are *strictly* associative. This -means that list items are treated as "keys" in key,value pairs. Unlike -a regular list, each "key" is unique. - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [list proc](/ref/proc/list.md) -> + [list proc](/ref/proc/alist.md) -> + [list2params proc](/ref/proc/list2params.md) -> + [params var (world)](/ref/world/var/params.md) -> + [params2list proc](/ref/proc/params2list.md) -> + [vars list var (datum)](/ref/datum/var/vars.md) \ No newline at end of file + +In other words, this is exactly the same syntax as for named arguments. + +The `alist` proc creates lists that are *strictly* associative. This means that list items are treated as "keys" in key,value pairs. Unlike a regular list, each "key" is unique. +*** +**Related Pages:** ++ [list](/ref/list) ++ [list proc](/ref/proc/list) ++ [alist proc](/ref/proc/alist) ++ [list2params](/ref/proc/list2params) ++ [params](/ref/world/var/params) ++ [params2list proc](/ref/proc/params2list) ++ [vars](/ref/datum/var/vars) ++ [values_sum proc](/ref/proc/values_sum) ++ [values_product proc](/ref/proc/values_product) ++ [values_dot proc](/ref/proc/values_dot) ++ [values_cut_over proc](/ref/proc/values_cut_over) ++ [values_cut_under proc](/ref/proc/values_cut_under) diff --git a/ref/list/index.md b/ref/list/index.md new file mode 100644 index 00000000..5856d6dd --- /dev/null +++ b/ref/list/index.md @@ -0,0 +1,94 @@ + +## list (info) +*** +Lists are used to represent groups of objects. Like objects, they have vars and procs associated with them. In order to access these attributes, list vars must be declared of type /list. These may then be assigned to existing lists, or used to create new lists. + + +```dm + +var/list/L // list reference +L = world.contents // assign to existing list +L = new/list() // make a new list +L = new() // make a new list (implicit type) +L.Add("futz") // L contains: "futz" +del(L) // delete L + +``` + + +Lists created with 'new()' have a default length of 0; this can be overridden by specifying the size; that is, new/list(size) creates a list with size (null) elements. + +The 'list()' proc may be used to more easily initialize list data. + + +```dm + +var/list/L +L = list("futz",3) // L contains: ("futz", 3) + +``` + + +Alternatively, lists may be declared by using brackets, '[]'. Empty brackets indicate a list reference, exactly as /list does, so list/L is equivalent to L[]. Setting an initial size within the brackets, for instance, L[10], creates a list of that initial size. + + +```dm + +var/L[] // same as var/list/L: list reference +var/M[10] // initially empty list of size 10 +L = M // L is now an empty list of size 10 + +``` + + +Once a list L is declared, a specific item can be accessed by putting its index in the brackets: L[index]. + +Indices range from 1 to len. If the length of the list is changed, existing elements in the list will be preserved if they are less than the new length. New elements in the list will be given the initial value of null. + + +```dm + +var/L[5] // initial length of 5 +var/i + +for(i=1, i<=L.len, i++) + L[i] = i +// L contains: (1,2,3,4,5) + +L.len = 7 // expand list +// L contains: (1,2,3,4,5,null,null) + +del(L) // destroy list + +``` + + +Multi-dimensional lists may be created by making a list of lists. + + +```dm + +var/grid[10][5] +grid[1][1] = 1 +grid[1][2] = 2 +... + +``` + + +Such a list may also be created by using new(). As in the previous example, the next one creates a list of 10 lists each having 5 elements. + + +```dm + +var/grid = new/list(10,5) + +``` + +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [list proc](/ref/proc/list) ++ [islist proc](/ref/proc/islist) ++ [procs (list)](/ref/list/proc) ++ [vars (list)](/ref/list/var) diff --git a/ref/list/list.md b/ref/list/list.md deleted file mode 100644 index 90151fbd..00000000 --- a/ref/list/list.md +++ /dev/null @@ -1,95 +0,0 @@ -## list - -Lists are used to represent groups of objects. Like objects, -they have vars and procs associated with them. In order to access these -attributes, list vars must be declared of type /list. These may then be -assigned to existing lists, or used to create new lists. -### Example: - -```dm -var/list/L // list reference -L = world.contents // assign to existing list -L = new/list() // make a new list -L = new() // make a new list (implicit type) -L.Add("futz") // L contains: "futz" -del(L) // delete L -``` - -Lists created with \'new()\' have a -default length of 0; this can be overridden by specifying the size; that -is, new/list(size) creates a list with size (null) elements. - -The \'list()\' proc may be used to more easily initialize list -data. -### Example: - -```dm -var/list/L -L = list("futz",3) // L contains: ("futz", 3) -``` - -Alternatively, lists may be declared by using -brackets, \'[]\'. Empty brackets indicate a list reference, exactly as -/list does, so list/L is equivalent to L[]. Setting an initial size -within the brackets, for instance, L[10], creates a list of that -initial size. -### Example: - -```dm -var/L[] // same as var/list/L: list reference -var/M[10] // initially empty list of size 10 -L = M // L is now an empty list of size 10 -``` - -Once a list L is declared, a -specific item can be accessed by putting its index in the brackets: -L[index]. - -Indices range from 1 to len. If the length of the -list is changed, existing elements in the list will be preserved if they -are less than the new length. New elements in the list will be given the -initial value of null. -### Example: - -```dm -var/L[5] // initial length of 5 -var/i - -for(i=1, i<=L.len, i++) - L[i] = i -// L contains: (1,2,3,4,5) - -L.len = 7 // expand list -// L contains: (1,2,3,4,5,null,null) - -del(L) // destroy list - -``` - -Multi-dimensional lists may be created by making a -list of lists. -### Example: - -```dm -var/grid[10][5] -grid[1][1] = 1 -grid[1][2] = 2 -... -``` - -Such a list may also be created by using new(). -As in the previous example, the next one creates a list of 10 lists each -having 5 elements. -### Example: - -```dm -var/grid = new/list(10,5) -``` - -> [!TIP] -> **See also:** -> + [list associations](/ref/list/associations.md) -> + [list proc](/ref/proc/list.md) -> + [islist proc](/ref/proc/islist.md) -> + [procs (list)](/ref/list/proc.md) -> + [vars (list)](/ref/list/var.md) \ No newline at end of file diff --git a/ref/list/operators.md b/ref/list/operators.md index 614c0389..74be5623 100644 --- a/ref/list/operators.md +++ b/ref/list/operators.md @@ -1,19 +1,7 @@ -## list operators +## operators (info) +*** These operators are used for accessing list items. -- [[] operator](/ref/operator/%5B%5D.md) -- [?[] operator](/ref/operator/%3F%5B%5D.md) - These operators all have special meaning when applied to lists. -- [+ operator](/ref/operator/+.md) -- [+= operator](/ref/operator/+=.md) -- [- operator](/ref/operator/-.md) -- [-= operator](/ref/operator/-=.md) -- [\| operator](/ref/operator/%7C.md) -- [\|= operator](/ref/operator/%7C=.md) -- [& operator](/ref/operator/&.md) -- [&= operator](/ref/operator/&=.md) -- [\^ operator](/ref/operator/%5E.md) -- [\^= operator](/ref/operator/%5E=.md) -- [in operator](/ref/operator/in.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/list/proc.md b/ref/list/proc.md deleted file mode 100644 index 8a91c10d..00000000 --- a/ref/list/proc.md +++ /dev/null @@ -1,19 +0,0 @@ -## procs (list) - -Built-in list procs: -list/proc -+ [Add](/ref/list/proc/Add.md) -+ [Copy](/ref/list/proc/Copy.md) -+ [Cut](/ref/list/proc/Cut.md) -+ [Find](/ref/list/proc/Find.md) -+ [Insert](/ref/list/proc/Insert.md) -+ [Join](/ref/list/proc/Join.md) -+ [Remove](/ref/list/proc/Remove.md) -+ [RemoveAll](/ref/list/proc/RemoveAll.md) -+ [Splice](/ref/list/proc/Splice.md) -+ [Swap](/ref/list/proc/Swap.md) - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [list operators](/ref/list/operators.md) \ No newline at end of file diff --git a/ref/list/proc/Add.md b/ref/list/proc/Add.md index 36fe6cf2..d47aa16f 100644 --- a/ref/list/proc/Add.md +++ b/ref/list/proc/Add.md @@ -1,16 +1,15 @@ -## Add proc (list) + +## Add (proc) **Format:** + list.Add(Item1,Item2,...) -**Args:** +**Arguments:** + One or more items to add to the list. - -Appends the specified items to the list. If an argument is -itself a list, each item in the list will be added. - -> [!TIP] -> **See also:** -> + [+ operator](/ref/operator/+.md) -> + [Remove proc (list)](/ref/list/proc/Remove.md) -> + [RemoveAll proc (list)](/ref/list/proc/RemoveAll.md) +*** +Appends the specified items to the list. If an argument is itself a list, each item in the list will be added. +*** +**Related Pages:** ++ [+ operator](/ref/operator/+) ++ [Remove proc (list)](/ref/list/proc/Remove) ++ [RemoveAll proc (list)](/ref/list/proc/RemoveAll) diff --git a/ref/list/proc/Copy.md b/ref/list/proc/Copy.md index 5807817e..ccfe8710 100644 --- a/ref/list/proc/Copy.md +++ b/ref/list/proc/Copy.md @@ -1,20 +1,18 @@ -## Copy proc (list) + +## Copy (proc) **Format:** + list.Copy(Start=1,End=0) -**Returns:** -+ A new list. - -**Args:** +**Arguments:** + Start: The list position in which to begin the copy. + End: The list position immediately following the last element to be - copied. + copied. -Copy list[Start] through list[End-1] into a new list. The -default end position of 0 stands for the position immediately after the -end of the list, so by default the entire list is copied. - -> [!TIP] -> **See also:** -> + [Cut proc (list)](/ref/list/proc/Cut.md) \ No newline at end of file +**Returns:** ++ A new list. +*** +Copy list[Start] through list[End-1] into a new list. The default end position of 0 stands for the position immediately after the end of the list, so by default the entire list is copied. +*** +**Related Pages:** ++ [Cut proc (list)](/ref/list/proc/Cut) diff --git a/ref/list/proc/Cut.md b/ref/list/proc/Cut.md index 654cbcaf..c1605506 100644 --- a/ref/list/proc/Cut.md +++ b/ref/list/proc/Cut.md @@ -1,19 +1,16 @@ -## Cut proc (list) + +## Cut (proc) **Format:** + list.Cut(Start=1,End=0) -**Args:** +**Arguments:** + Start: The list position in which to begin the cut. + End: The list position immediately following the last element to be - removed. - -Remove the elements between list[Start] and list[End-1], -decreasing the size of the list appropriately. The default end position -of 0 stands for the position immediately after the end of the list, so -by default the entire list is deleted. - -> [!TIP] -> **See also:** -> + [Copy proc (list)](/ref/list/proc/Copy.md) -> + [Insert proc (list)](/ref/list/proc/Insert.md) \ No newline at end of file + removed. +*** +Remove the elements between list[Start] and list[End-1], decreasing the size of the list appropriately. The default end position of 0 stands for the position immediately after the end of the list, so by default the entire list is deleted. +*** +**Related Pages:** ++ [Copy proc (list)](/ref/list/proc/Copy) ++ [Insert proc (list)](/ref/list/proc/Insert) diff --git a/ref/list/proc/Find.md b/ref/list/proc/Find.md index fcb15aff..9f68e5db 100644 --- a/ref/list/proc/Find.md +++ b/ref/list/proc/Find.md @@ -1,16 +1,16 @@ -# Find proc (list) + +## Find (proc) + **Format:** + list.Find(Elem,Start=1,End=0) -**Returns:** -+ The first position of elem in list, or 0 if not found. - -**Args:** +**Arguments:** + Elem: The element to find. + Start: The list position in which to begin the search. + End: The list position immediately following the end of the search. -Find the first position of Elem in the list. Elements between -Start and End are searched. The default end position of 0 stands for the -position immediately after the end of the list, so by default the entire -list is searched. \ No newline at end of file +**Returns:** ++ The first position of elem in list, or 0 if not found. +*** +Find the first position of Elem in the list. Elements between Start and End are searched. The default end position of 0 stands for the position immediately after the end of the list, so by default the entire list is searched. +*** \ No newline at end of file diff --git a/ref/list/proc/Insert.md b/ref/list/proc/Insert.md index c2e7a496..5ca0afbc 100644 --- a/ref/list/proc/Insert.md +++ b/ref/list/proc/Insert.md @@ -1,29 +1,26 @@ -## Insert proc (list) + +## Insert (proc) **Format:** + list.Insert(Index,Item1,Item2...) -**Returns:** -+ The index following the inserted items. - -**Args:** +**Arguments:** + Index: The index where the new item will be inserted. Any value - already at that index will be pushed forward. + already at that index will be pushed forward. + Item1: A value or list of values to insert. -+ Item2...: (optional) Additional items to insert, immediately after - the previous item(s). ++ Item2...: (optional) Additional items to insert, immediately after the + previous item(s). -Insert values into a list at a specific point. Using Index=0 or -Index=list.len+1 is the same as adding to the list. - -If any of the items you insert is itself a list, its elements will be inserted -instead of the list itself. +**Returns:** ++ The index following the inserted items. +*** +Insert values into a list at a specific point. Using Index=0 or Index=list.len+1 is the same as adding to the list. -Note: This proc doesn\'t work with -many special lists such as `contents` or `overlays`. +If any of the items you insert is itself a list, its elements will be inserted instead of the list itself. -> [!TIP] -> **See also:** -> + [Cut proc (list)](/ref/list/proc/Cut.md) -> + [Copy proc (list)](/ref/list/proc/Copy.md) -> + [Swap proc (list)](/ref/list/proc/Swap.md) \ No newline at end of file +Note: This proc doesn't work with many special lists such as contents or overlays. +*** +**Related Pages:** ++ [Cut proc (list)](/ref/list/proc/Cut) ++ [Copy proc (list)](/ref/list/proc/Copy) ++ [Swap proc (list)](/ref/list/proc/Swap) diff --git a/ref/list/proc/Join.md b/ref/list/proc/Join.md index 45e02b50..611a2128 100644 --- a/ref/list/proc/Join.md +++ b/ref/list/proc/Join.md @@ -1,21 +1,18 @@ -## Join proc (list) -###### BYOND Version 510 + +## Join (proc) **Format:** + list.Join(Glue,Start=1,End=0) -**Returns:** -+ A text string made up of the items in this list, joined together by - Glue. - -**Args:** +**Arguments:** + Glue: The text that will go between each item. + Start: The list item on which to begin. + End: The list item immediately following the last item to be joined. -This is exactly the same as calling -jointext(List,Glue,Start,End), and is provided for convenience. - -> [!TIP] -> **See also:** -> + [jointext proc](/ref/proc/jointext.md) \ No newline at end of file +**Returns:** ++ A text string made up of the items in this list, joined together by Glue. +*** +This is exactly the same as calling jointext(List,Glue,Start,End), and is provided for convenience. +*** +**Related Pages:** ++ [jointext proc](/ref/proc/jointext) diff --git a/ref/list/proc/Remove.md b/ref/list/proc/Remove.md index b9b44bfb..7c841ada 100644 --- a/ref/list/proc/Remove.md +++ b/ref/list/proc/Remove.md @@ -1,21 +1,18 @@ -## Remove proc (list) + +## Remove (proc) **Format:** + list.Remove(Item1,Item2,...) -**Returns:** -+ 1 if any items removed, 0 if not. - -**Args:** +**Arguments:** + One or more items to remove from the list. -Removes the specified items from the list. If an argument is -itself a list, each item contained in it will be removed. Removal starts -at the end of the list (highest index) so that this operation is an -exact reversal of Add(). - -> [!TIP] -> **See also:** -> + [- operator](/ref/operator/-.md) -> + [Add proc (list)](/ref/list/proc/Add.md) -> + [RemoveAll proc (list)](/ref/list/proc/RemoveAll.md) \ No newline at end of file +**Returns:** ++ 1 if any items removed, 0 if not. +*** +Removes the specified items from the list. If an argument is itself a list, each item contained in it will be removed. Removal starts at the end of the list (highest index) so that this operation is an exact reversal of Add(). +*** +**Related Pages:** ++ [- operator](/ref/operator/-) ++ [Add proc (list)](/ref/list/proc/Add) ++ [RemoveAll proc (list)](/ref/list/proc/RemoveAll) diff --git a/ref/list/proc/RemoveAll.md b/ref/list/proc/RemoveAll.md index 084f542b..b7b42f92 100644 --- a/ref/list/proc/RemoveAll.md +++ b/ref/list/proc/RemoveAll.md @@ -1,24 +1,19 @@ -## RemoveAll proc (list) -###### BYOND Version 515 + +## RemoveAll (proc) **Format:** + list.RemoveAll(Item1,Item2,...) -**Returns:** -+ Number of items removed. - -**Args:** +**Arguments:** + One or more items to remove entirely from the list. -Removes all copies of the specified items from the list. If an -argument is itself a list, each item contained in it will be removed. - -This is basically a faster version of the statement -`while(list.Remove(Item1,Item2,...))` with an empty code block. For -large lists this might be a big improvement because the list doesn\'t -have to be traversed every time. +**Returns:** ++ Number of items removed. +*** +Removes all copies of the specified items from the list. If an argument is itself a list, each item contained in it will be removed. -> [!TIP] -> **See also:** -> + [Add proc (list)](/ref/list/proc/Add.md) -> + [Remove proc (list)](/ref/list/proc/Remove.md) \ No newline at end of file +This is basically a faster version of the statement `while(list.Remove(Item1,Item2,...))` with an empty code block. For large lists this might be a big improvement because the list doesn't have to be traversed every time. +*** +**Related Pages:** ++ [Add proc (list)](/ref/list/proc/Add) ++ [Remove proc (list)](/ref/list/proc/Remove) diff --git a/ref/list/proc/Splice.md b/ref/list/proc/Splice.md index bfbeccfd..a0880a40 100644 --- a/ref/list/proc/Splice.md +++ b/ref/list/proc/Splice.md @@ -1,26 +1,19 @@ -## Splice proc (list) -###### BYOND Version 514 + +## Splice (proc) **Format:** + list.Splice(Start=1,End=0,Item1,Item2...) -**Args:** +**Arguments:** + Start: The list index where the splice will begin. -+ End: The index immediately following the last item to be cut from - the list. 0 is the end of the list. ++ End: The index immediately following the last item to be cut from the list. 0 is the end of the list. + Item1, Item2...: Items to be inserted. +*** +Cuts out items from a list, and inserts new items in their place. This is basically equivalent to calling `list.Cut(Start,End)` and then calling `list.Insert(Start,Item1,Item2...)`, but faster. -Cuts out items from a list, and inserts new items in their -place. This is basically equivalent to calling `list.Cut(Start,End)` and -then calling `list.Insert(Start,Item1,Item2...)`, but faster. - -> [!NOTE] -> This proc doesn\'t work with many special lists such as -`contents` or `overlays`. - -### Example: ```dm + var/list/L = list("apple","banana","orange","pear") // cuts "banana" and "orange" and inserts four new items @@ -29,20 +22,18 @@ L.Splice(2,4,"firetruck","camel","joystick","balloon") // prints apple, firetruck, camel, joystick, balloon, pear for(var/item in L) usr << item + ``` -As with `Insert()`, any items that are -lists will insert their contents instead of themselves. -The `Start` and `End` index values can be negative, which count backwards -from the end of the list. If the index values are out of range, there -will be no error; they will simply be clamped to the beginning or end of -the list. If `End` comes before `Start`, the two values are swapped. +As with `Insert()`, any items that are lists will insert their contents instead of themselves. +The `Start` and `End` index values can be negative, which count backwards from the end of the list. If the index values are out of range, there will be no error; they will simply be clamped to the beginning or end of the list. If `End` comes before `Start`, the two values are swapped. -> [!TIP] -> **See also:** -> + [Copy proc (list)](/ref/list/proc/Copy.md) -> + [Cut proc (list)](/ref/list/proc/Cut.md) -> + [Insert proc (list)](/ref/list/proc/Insert.md) -> + [splicetext proc](/ref/proc/splicetext.md) \ No newline at end of file +Note: This proc doesn't work with many special lists such as contents or overlays. +*** +**Related Pages:** ++ [Copy proc (list)](/ref/list/proc/Copy) ++ [Cut proc (list)](/ref/list/proc/Cut) ++ [Insert proc (list)](/ref/list/proc/Insert) ++ [splicetext proc](/ref/proc/splicetext) diff --git a/ref/list/proc/Swap.md b/ref/list/proc/Swap.md index 4bfcf326..47ecdbe9 100644 --- a/ref/list/proc/Swap.md +++ b/ref/list/proc/Swap.md @@ -1,37 +1,34 @@ -## Swap proc (list) + +## Swap (proc) **Format:** + list.Swap(Index1,Index2) -**Returns:** -+ Nothing. - -**Args:** +**Arguments:** + Index1: The index (1 to list.len) of one of the items to swap. + Index2: The index of the other item. -Swap two items in a list. If the list has associated values, -they will be preserved. This is most useful for user-defined sorting -routines. - -> [!NOTE] -> This proc doesn\'t work with many -special lists such as `contents` or `overlays`. +**Returns:** ++ Nothing. +*** +Swap two items in a list. If the list has associated values, they will be preserved. This is most useful for user-defined sorting routines. -### Example: ```dm + var/item var/list/L = list("orange" = 3, "green" = 2, "blue" = 5) for(item in L) world << "[item] -> [L[item]]" world << "" L.Swap(1, 3) for(item in L) world << "[item] -> [L[item]]" + ``` -### Result: + ```dm + orange -> 3 green -> 2 blue -> 5 @@ -39,10 +36,13 @@ blue -> 5 blue -> 5 green -> 2 orange -> 3 + ``` -> [!TIP] -> **See also:** -> + [Cut proc (list)](/ref/list/proc/Cut.md) -> + [Copy proc (list)](/ref/list/proc/Copy.md) -> + [Insert proc (list)](/ref/list/proc/Insert.md) \ No newline at end of file + +Note: This proc doesn't work with many special lists such as contents or overlays. +*** +**Related Pages:** ++ [Cut proc (list)](/ref/list/proc/Cut) ++ [Copy proc (list)](/ref/list/proc/Copy) ++ [Insert proc (list)](/ref/list/proc/Insert) diff --git a/ref/list/proc/index.md b/ref/list/proc/index.md new file mode 100644 index 00000000..2a8f6999 --- /dev/null +++ b/ref/list/proc/index.md @@ -0,0 +1,8 @@ + +## proc (proc) +*** +Built-in list procs: +*** +**Related Pages:** ++ [list](/ref/list) ++ [list operators](/ref/list/operators) diff --git a/ref/list/var.md b/ref/list/var.md deleted file mode 100644 index e85842dc..00000000 --- a/ref/list/var.md +++ /dev/null @@ -1,5 +0,0 @@ -## vars (list) - -Built-in list vars: -list/var -+ [len](/ref/list/var/len.md) \ No newline at end of file diff --git a/ref/list/var/index.md b/ref/list/var/index.md new file mode 100644 index 00000000..137694f7 --- /dev/null +++ b/ref/list/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in list vars: +*** \ No newline at end of file diff --git a/ref/list/var/len.md b/ref/list/var/len.md index 3c2e2aa5..a17a6d63 100644 --- a/ref/list/var/len.md +++ b/ref/list/var/len.md @@ -1,12 +1,10 @@ -## len var (list) -This is the length of the list. Increasing it expands the list, -initializing all new elements with null. Decreasing it contracts the -list, making old elements inaccessible. - -> [!TIP] -> **See also:** -> + [+ operator](/ref/operator/+.md) -> + [+= operator](/ref/operator/+=.md) -> + [- operator](/ref/operator/-.md) -> + [-= operator](/ref/operator/-=.md) \ No newline at end of file +## len (var) +*** +This is the length of the list. Increasing it expands the list, initializing all new elements with null. Decreasing it contracts the list, making old elements inaccessible. +*** +**Related Pages:** ++ [+ operator](/ref/operator/+) ++ [+= operator](/ref/operator/+=) ++ [- operator](/ref/operator/-) ++ [-= operator](/ref/operator/-=) diff --git a/ref/map.md b/ref/map.md new file mode 100644 index 00000000..e6af08d5 --- /dev/null +++ b/ref/map.md @@ -0,0 +1,25 @@ + +## map (info) + +**Format:** ++ #include "mapname.dmm" +*** +One or more map files may be loaded into the world's map. These are loaded into successive z-levels. If no map files are specified, the default project map file will be used. This file has the same name as the project but has the extension .dmm. + +If no map files are loaded, the world's map size is determined by the world variables maxx, maxy, and maxz. The default content of this map is determined by the world variables turf and area. + + +```dm + +#include "level1.dmm" +#include "level2.dmm" +#include "level3.dmm" + +``` + +*** +**Related Pages:** ++ [#include directive](/ref/DM/preprocessor/include) ++ [area var (world)](/ref/world/var/area) ++ [maxx var (world)](/ref/world/var/maxx) ++ [turf var (world)](/ref/world/var/turf) diff --git a/ref/map/map.md b/ref/map/map.md deleted file mode 100644 index 9ab53f89..00000000 --- a/ref/map/map.md +++ /dev/null @@ -1,32 +0,0 @@ -## map - -**Format:** -+ #include "mapname.dmm" - -One or more map files may be loaded into the world\'s map. -These are loaded into successive z-levels. If no map files are -specified, the default project map file will be used. This file has the -same name as the project but has the extension .dmm. - -If no map -files are loaded, the world\'s map size is determined by the world -variables maxx, maxy, and maxz. The default content of this map is -determined by the world variables turf and area. -### Example: - -```dm -#include "level1.dmm" -#include "level2.dmm" -#include "level3.dmm" -``` - -Map files, like code files, do not need to be explicitly included in code. -They can be included by clicking the tick box beside the file in the -file tree in Dream Maker. - -> [!TIP] -> **See also:** -> + [#include directive](/ref/DM/preprocessor/include.md) -> + [area var (world)](/ref/world/var/area.md) -> + [maxx var (world)](/ref/world/var/maxx.md) -> + [turf var (world)](/ref/world/var/turf.md) \ No newline at end of file diff --git a/ref/matrix/index.md b/ref/matrix/index.md new file mode 100644 index 00000000..c17d983e --- /dev/null +++ b/ref/matrix/index.md @@ -0,0 +1,23 @@ + +## matrix (info) +*** +To display rotation, scaling, and other transformations on atoms, DM uses 2D matrices. The /matrix datum is a convenient way of handling the numbers involved, as it can be easily manipulated. There are six vars, a through f, laid out like so: + +When an x,y point is multiplied by the matrix, it becomes the new point x',y'. This is equivalent to: + +The default matrix is: + +Matrices are created with the matrix() proc, or by calling new/matrix(). (See the matrix() proc for examples.) They are also created as needed whenever you read from atom.transform or use certain operators. + +Manipulation of matrices can be done with operators, or with procs. You can do the following with them: + +When you've built your matrix, you can assign it to atom.transform to change the way that atom is displayed. + +The matrices supported by this datum are **not** the same kind used to transform colors, as in the atom.color var and icon.MapColors() proc. For color matrices, see color matrix. +*** +**Related Pages:** ++ [New](/ref/proc/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [transform var (atom)](/ref/atom/var/transform) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/matrix/matrix.md b/ref/matrix/matrix.md deleted file mode 100644 index 6e671e6a..00000000 --- a/ref/matrix/matrix.md +++ /dev/null @@ -1,64 +0,0 @@ -## matrix -###### BYOND Version 500 - -> [!TIP] -> Click [here](https://tracealter.com/matrices.html) to check out Crazah's matrix visualizer - -To display rotation, scaling, and other transformations on -atoms, DM uses 2D matrices. The /matrix datum is a convenient way of -handling the numbers involved, as it can be easily manipulated. There -are six vars, a through f, laid out like so: -``` - a d 0 - x y 1 * b e 0 = x' y' 1 - c f 1 -``` - -When an x,y point is multiplied by the matrix, it becomes the -new point x\',y\'. This is equivalent to: -``` - x' = a*x + b*y + c - y' = d*x + e*y + f -``` - -The default matrix is: -``` - 1 0 0 - 0 1 0 - 0 0 1 -``` - -Matrices are created with the matrix() proc, or by calling -new/matrix(). (See the matrix() proc for examples.) They are also -created as needed whenever you read from atom.transform or use certain -operators. - -Manipulation of matrices can be done with operators, -or with procs. You can do the following with them: -- **Multiply:** Multiplying two matrices together will chain together - the transformations they represent. For instance, a scaling matrix - multiplied by a rotation matrix says: Scale, then rotate. - Multiplication of two matrices is sensitive to the order you use. -- **Scale:** A simple scale matrix uses only the a and e values, to - scale x and y by a certain amount. -- **Rotate:** A rotation matrix can rotate an atom by whatever amount - you like. -- **Translate:** Translation is like a pixel offset, changing the - atom\'s position. -- **Interpolate:** You can calculate a matrix that lies somewhere - between two other matrices, which can be helpful for animation. - -When you\'ve built your matrix, you can assign it to -atom.transform to change the way that atom is displayed. - -The matrices supported by this datum are **not** the same kind used to -transform colors, as in the atom.color var and icon.MapColors() proc. -For color matrices, see [color matrix](/ref/notes/color-matrix.md) - -> [!TIP] -> **See also:** -> + [matrix proc](/ref/proc/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [transform var (atom)](/ref/atom/var/transform.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) diff --git a/ref/matrix/operators.md b/ref/matrix/operators.md index 598e8395..bf23ad00 100644 --- a/ref/matrix/operators.md +++ b/ref/matrix/operators.md @@ -1,26 +1,17 @@ -## matrix operators -###### BYOND Version 500 +## operators (info) +*** +The operators listed above have special meaning when applied to matrices. -**See also:** -+ [+ operator](/ref/operator/+.md) -+ [+= operator](/ref/operator/+=.md) -+ [- operator](/ref/operator/-.md) -+ [-= operator](/ref/operator/-=.md) -+ [* operator](/ref/operator/*.md) -+ [*= operator](/ref/operator/*=.md) -+ [/ operator](/ref/operator//.md) -+ [/= operator](/ref/operator//=.md) -+ [\~ operator](/ref/operator/~.md) - -The operators listed above have special meaning when applied to -matrices. - -The assignment operators will modify an existing -matrix, and can also be used directly with atom.transform. Other -operators will create a new matrix. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix procs](/ref/matrix/proc.md) \ No newline at end of file +The assignment operators will modify an existing matrix, and can also be used directly with atom.transform. Other operators will create a new matrix. +*** +**Related Pages:** ++ [+ operator](/ref/operator/+) ++ [+= operator](/ref/operator/+=) ++ [- operator](/ref/operator/-) ++ [-= operator](/ref/operator/-=) ++ [* operator (pointers)](/ref/operator/*) ++ [*= operator](/ref/operator/*=) ++ [/ operator](/ref/operator//) ++ [/= operator](/ref/operator//=) ++ [~ operator](/ref/operator/~) diff --git a/ref/matrix/proc.md b/ref/matrix/proc.md deleted file mode 100644 index 06f25a77..00000000 --- a/ref/matrix/proc.md +++ /dev/null @@ -1,20 +0,0 @@ -## matrix procs -###### BYOND Version 500 - - -matrix/proc -+ [New](/ref/proc/matrix.md) -+ [Add](/ref/matrix/proc/Add.md) -+ [Interpolate](/ref/matrix/proc/Interpolate.md) -+ [Invert](/ref/matrix/proc/Invert.md) -+ [Multiply](/ref/matrix/proc/Multiply.md) -+ [Scale](/ref/matrix/proc/Scale.md) -+ [Subtract](/ref/matrix/proc/Subtract.md) -+ [Translate](/ref/matrix/proc/Translate.md) -+ [Turn](/ref/matrix/proc/Turn.md) - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [turn proc (applied to a matrix)](/ref/proc/turn/matrix.md) \ No newline at end of file diff --git a/ref/matrix/proc/Add.md b/ref/matrix/proc/Add.md index 8e31b638..be911139 100644 --- a/ref/matrix/proc/Add.md +++ b/ref/matrix/proc/Add.md @@ -1,19 +1,19 @@ -## Add proc (matrix) + +## Add (proc) **Format:** + Add(Matrix2) -**Args:** +**Arguments:** + Matrix2: another matrix **Returns:** + src - +*** This adds Matrix2 to the current matrix. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [+= operator](/ref/operator/+=.md) \ No newline at end of file +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [+= operator](/ref/operator/+=) diff --git a/ref/matrix/proc/Interpolate.md b/ref/matrix/proc/Interpolate.md index 3ca87dda..4c4258a2 100644 --- a/ref/matrix/proc/Interpolate.md +++ b/ref/matrix/proc/Interpolate.md @@ -1,28 +1,20 @@ -## Interpolate proc (matrix) + +## Interpolate (proc) **Format:** + Interpolate(Matrix2, t) -**Args:** +**Arguments:** + Matrix2: Another matrix -+ t: The interpolation factor: from 0 (src) to 1 (Matrix2). Usually - this is a value between 0 and 1. - -Calculates and returns a new matrix between src and Matrix2. If -t is 0.5, then the result will be exactly halfway between both matrices. - -There are many ways to interpolate matrices. Whenever possible, -DM will interpolate by doing scaling and/or shearing first, then -rotation, then translation. This is done by trying to find the angle of -rotation of each matrix first; a rotation of 180° is counted as a flip -rather than a rotation. ++ t: The interpolation factor: from 0 (src) to 1 (Matrix2). Usually this is a value between 0 and 1. +*** +Calculates and returns a new matrix between src and Matrix2. If t is 0.5, then the result will be exactly halfway between both matrices. -It is not strictly necessary for t to -be between 0 and 1. Using a value out of bounds will extrapolate a -matrix, continuing the change as far as t. +There are many ways to interpolate matrices. Whenever possible, DM will interpolate by doing scaling and/or shearing first, then rotation, then translation. This is done by trying to find the angle of rotation of each matrix first; a rotation of 180° is counted as a flip rather than a rotation. -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) \ No newline at end of file +It is not strictly necessary for t to be between 0 and 1. Using a value out of bounds will extrapolate a matrix, continuing the change as far as t. +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) diff --git a/ref/matrix/proc/Invert.md b/ref/matrix/proc/Invert.md index 9ef96bf1..b45ddc76 100644 --- a/ref/matrix/proc/Invert.md +++ b/ref/matrix/proc/Invert.md @@ -1,21 +1,18 @@ -## Invert proc (matrix) + +## Invert (proc) **Format:** + Invert() **Returns:** + src +*** +This inverts the current matrix, if possible. -This inverts the current matrix, if possible. - -Not all -matrices can be inverted. If it\'s not possible, the matrix is said to -be degenerate. This happens if, for example, all of the values in the -matrix are zero. A degenerate matrix will not be changed by this proc. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [\~ operator](/ref/operator/~.md) \ No newline at end of file +Not all matrices can be inverted. If it's not possible, the matrix is said to be degenerate. This happens if, for example, all of the values in the matrix are zero. A degenerate matrix will not be changed by this proc. +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [~ operator](/ref/operator/~) diff --git a/ref/matrix/proc/Multiply.md b/ref/matrix/proc/Multiply.md index 2c9de4dd..58d6d821 100644 --- a/ref/matrix/proc/Multiply.md +++ b/ref/matrix/proc/Multiply.md @@ -1,29 +1,23 @@ -## Multiply proc (matrix) + +## Multiply (proc) **Format:** -+ Multiply(Matrix2)\ - *or* ++ Multiply(Matrix2) + Multiply(n) -**Args:** +**Arguments:** + Matrix2: another matrix + n: a number **Returns:** + src +*** +This multiplies the current matrix by Matrix2 or n. If the n format is used, this is just like scaling the whole matrix. If another matrix is multiplied, then it is like doing the two transformations in order: src, then Matrix2. -This multiplies the current matrix by Matrix2 or n. If the n -format is used, this is just like scaling the whole matrix. If another -matrix is multiplied, then it is like doing the two transformations in -order: src, then Matrix2. - -Multiplication of one matrix by -another depends on the order. You may get a different result multiplying -A * B vs. B * A. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [*= operator](/ref/operator/*.md) \ No newline at end of file +Multiplication of one matrix by another depends on the order. You may get a different result multiplying A * B vs. B * A. +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [* operator (pointers)](/ref/operator/*) diff --git a/ref/matrix/proc/Scale.md b/ref/matrix/proc/Scale.md index 3d1d5577..bfb49e1d 100644 --- a/ref/matrix/proc/Scale.md +++ b/ref/matrix/proc/Scale.md @@ -1,22 +1,21 @@ -## Scale proc (matrix) + +## Scale (proc) **Format:** -+ Scale(x, y) ++ Scale(x,y) -**Args:** +**Arguments:** + x: The amount of scaling to do in the x direction + y: The amount of scaling to do in the y direction **Returns:** + src +*** +The matrix is scaled by the appropriate amounts. -The matrix is scaled by the appropriate amounts. - -If y is omitted, x is used for both. E.g., Scale(2) is equivalent to -Scale(2,2). - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) \ No newline at end of file +If y is omitted, x is used for both. E.g., Scale(2) is equivalent to Scale(2,2). +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) diff --git a/ref/matrix/proc/Subtract.md b/ref/matrix/proc/Subtract.md index 41869288..464cc6ab 100644 --- a/ref/matrix/proc/Subtract.md +++ b/ref/matrix/proc/Subtract.md @@ -1,19 +1,19 @@ -## Subtract proc (matrix) + +## Subtract (proc) **Format:** + Subtract(Matrix2) -**Args:** +**Arguments:** + Matrix2: another matrix **Returns:** + src - +*** This subtracts Matrix2 from the current matrix. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [-= operator](/ref/operator/+=.md) \ No newline at end of file +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [+= operator](/ref/operator/+=) diff --git a/ref/matrix/proc/Translate.md b/ref/matrix/proc/Translate.md index 8a096d7c..c22474ba 100644 --- a/ref/matrix/proc/Translate.md +++ b/ref/matrix/proc/Translate.md @@ -1,23 +1,21 @@ -## Translate proc (matrix) + +## Translate (proc) **Format:** -+ Translate(x, y) ++ Translate(x,y) -**Args:** -+ x: The amount of translation to do in the x direction -+ y: The amount of translation to do in the y direction +**Arguments:** ++ x: The amount of scaling to do in the x direction ++ y: The amount of scaling to do in the y direction **Returns:** + src +*** +The matrix is translated (moved) by the appropriate amounts. The x and y offsets applied by translation are in pixels. -The matrix is translated (moved) by the appropriate amounts. -The x and y offsets applied by translation are in pixels. - -If y is omitted, x is used for both. E.g., Translate(2) is equivalent to -Translate(2,2). - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) \ No newline at end of file +If y is omitted, x is used for both. E.g., Translate(2) is equivalent to Translate(2,2). +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) diff --git a/ref/matrix/proc/Turn.md b/ref/matrix/proc/Turn.md index 93e0f889..9f5e4412 100644 --- a/ref/matrix/proc/Turn.md +++ b/ref/matrix/proc/Turn.md @@ -1,19 +1,19 @@ -## Turn proc (matrix) + +## Turn (proc) **Format:** + Turn(angle) -**Args:** +**Arguments:** + angle: The angle of clockwise rotation, in degrees **Returns:** + src - +*** The matrix is rotated clockwise, by the angle given. - -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [matrix operators](/ref/matrix/operators.md) -> + [matrix procs](/ref/matrix/proc.md) -> + [turn proc (applied to a matrix)](/ref/proc/turn/matrix.md) \ No newline at end of file +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [matrix procs](/ref/matrix/proc) ++ [turn proc (applied to a matrix)](/ref/proc/turn/matrix) diff --git a/ref/matrix/proc/index.md b/ref/matrix/proc/index.md new file mode 100644 index 00000000..793b7074 --- /dev/null +++ b/ref/matrix/proc/index.md @@ -0,0 +1,7 @@ + +## proc (proc) +****** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [matrix operators](/ref/matrix/operators) ++ [turn proc (applied to a matrix)](/ref/proc/turn/matrix) diff --git a/ref/mob/index.md b/ref/mob/index.md new file mode 100644 index 00000000..e414f447 --- /dev/null +++ b/ref/mob/index.md @@ -0,0 +1,23 @@ + +## mob (info) +*** +Mobs are "mobile objects" derived from `/mob`, which derives from `/atom/movable`. Human players are associated with a mob when they log on. Mobs are typically used for other "creature" types as well such as NPCs. This type is slightly more complex than objs since it can be attached to a client. + +This example defines the mob type `/mob/guzzler`. + + +```dm + +mob + guzzler + desc = "Mean, mad, and wicked bad." + +``` + +*** +**Related Pages:** ++ [atom](/ref/atom) ++ [atom/movable](/ref/atom/movable) ++ [procs (mob)](/ref/mob/proc) ++ [vars (mob)](/ref/mob/var) ++ [client](/ref/client) diff --git a/ref/mob/mob.md b/ref/mob/mob.md deleted file mode 100644 index 9a490156..00000000 --- a/ref/mob/mob.md +++ /dev/null @@ -1,26 +0,0 @@ -## mob - - -Mobs are "mobile objects" derived from `/mob`, which derives -from `/atom/movable`. Human players are associated with a mob when they -log on. Mobs are typically used for other "creature" types as well -such as NPCs. This type is slightly more complex than objs since it can -be attached to a client. - -This example defines the mob type -`/mob/guzzler`. -### Example: - -```dm -mob - guzzler - desc = "Mean, mad, and wicked bad." -``` - -> [!TIP] -> **See also:** -> + [atom](/ref/atom.md) -> + [movable atoms](/ref/atom/movable.md) -> + [procs (mob)](/ref/mob/proc.md) -> + [vars (mob)](/ref/mob/var.md) -> + [client](/ref/client.md) \ No newline at end of file diff --git a/ref/mob/proc.md b/ref/mob/proc.md deleted file mode 100644 index 482cca48..00000000 --- a/ref/mob/proc.md +++ /dev/null @@ -1,33 +0,0 @@ -## procs (mob) - - -Built-in mob procs: -mob/proc -+ [Bump](/ref/atom/movable/proc/Bump.md) -+ [Click](/ref/atom/proc/Click.md) -+ [Cross proc](/ref/atom/proc/Cross.md) -+ [Crossed proc](/ref/atom/proc/Crossed.md) -+ [DblClick](/ref/atom/proc/DblClick.md) -+ [Del](/ref/datum/proc/Del.md) -+ [Enter](/ref/atom/proc/Enter.md) -+ [Entered](/ref/atom/proc/Entered.md) -+ [Exit](/ref/atom/proc/Exit.md) -+ [Exited](/ref/atom/proc/Exited.md) -+ [Login](/ref/mob/proc/Login.md) -+ [Logout](/ref/mob/proc/Logout.md) -+ [MouseDown](/ref/atom/proc/MouseDown.md) -+ [MouseDrag](/ref/atom/proc/MouseDrag.md) -+ [MouseDrop](/ref/atom/proc/MouseDrop.md) -+ [MouseEntered](/ref/atom/proc/MouseEntered.md) -+ [MouseExited](/ref/atom/proc/MouseExited.md) -+ [MouseMove](/ref/atom/proc/MouseMove.md) -+ [MouseUp](/ref/atom/proc/MouseUp.md) -+ [MouseWheel](/ref/atom/proc/MouseWheel.md) -+ [Move](/ref/atom/movable/proc/Move.md) -+ [New](/ref/atom/proc/New.md) -+ [Read](/ref/datum/proc/Read.md) -+ [Stat](/ref/atom/proc/Stat.md) -+ [Topic](/ref/datum/proc/Topic.md) -+ [Uncross proc](/ref/atom/proc/Uncross.md) -+ [Uncrossed proc](/ref/atom/proc/Uncrossed.md) -+ [Write](/ref/datum/proc/Write.md) \ No newline at end of file diff --git a/ref/mob/proc/Login.md b/ref/mob/proc/Login.md index 50406fa7..31241335 100644 --- a/ref/mob/proc/Login.md +++ b/ref/mob/proc/Login.md @@ -1,22 +1,19 @@ -## Login proc (mob) + +## Login (proc) **Format:** + Login() -**When:** -+ Called when a player\'s client tries to connect to a mob. This is - called by default from client.New(), when the player logs into the - world. - -**Default action:** -+ If the mob has no location, place it near (1,1,1) if possible. - Change the player\'s stat object (client.statobj) to the mob. - -One can typically tell if a player is connecting to a fresh mob -versus reconnecting to an existing one by testing if the mob\'s location -is null. +**Called When:** ++ Called when a player's client tries to connect to a mob. This is called + by default from client.New(), when the player logs into the world. -> [!TIP] -> **See also:** -> + [Logout proc (mob)](/ref/mob/proc/Logout.md) -> + [client var (mob)](/ref/mob/var/client.md) \ No newline at end of file +**Default Action:** ++ If the mob has no location, place it near (1,1,1) if possible. Change + the player's stat object (client.statobj) to the mob. +*** +One can typically tell if a player is connecting to a fresh mob versus reconnecting to an existing one by testing if the mob's location is null. +*** +**Related Pages:** ++ [Logout proc (mob)](/ref/mob/proc/Logout) ++ [client](/ref/mob/var/client) diff --git a/ref/mob/proc/Logout.md b/ref/mob/proc/Logout.md index f9aaf27f..fd9f276c 100644 --- a/ref/mob/proc/Logout.md +++ b/ref/mob/proc/Logout.md @@ -1,25 +1,20 @@ -## Logout proc (mob) + +## Logout (proc) **Format:** + Logout() -**When:** -+ Called when a player\'s client has disconnected from a mob. This - happens in client.Del() when the player logs out of the world. It - may also happen when the player switches from one mob to another. +**Called When:** ++ Called when a player's client has disconnected from a mob. This happens + in client.Del() when the player logs out of the world. It may also + happen when the player switches from one mob to another. -**Default action:** +**Default Action:** + None. - -One may wish to distinguish between a player who has -disconnected from the game and one who is simply switching from one mob -to another. In the case of a player switching to another mob, by the -time `Logout()` is called, the original mob\'s key will be null, whereas -the key will still be non-null in the case of a player disconnecting -from the game. - -> [!TIP] -> **See also:** -> + [Login proc (mob)](/ref/mob/proc/Login.md) -> + [client var (mob)](/ref/mob/var/client.md) -> + [key var (mob)](/ref/mob/var/key.md) \ No newline at end of file +*** +One may wish to distinguish between a player who has disconnected from the game and one who is simply switching from one mob to another. In the case of a player switching to another mob, by the time Logout() is called, the original mob's key will be null, whereas the key will still be non-null in the case of a player disconnecting from the game. +*** +**Related Pages:** ++ [Login proc (mob)](/ref/mob/proc/Login) ++ [client](/ref/mob/var/client) ++ [key var (mob)](/ref/mob/var/key) diff --git a/ref/mob/proc/index.md b/ref/mob/proc/index.md new file mode 100644 index 00000000..0f40be4d --- /dev/null +++ b/ref/mob/proc/index.md @@ -0,0 +1,5 @@ + +## proc (proc) +*** +Built-in mob procs: +*** \ No newline at end of file diff --git a/ref/mob/var.md b/ref/mob/var.md deleted file mode 100644 index 1dca3f6f..00000000 --- a/ref/mob/var.md +++ /dev/null @@ -1,67 +0,0 @@ -## vars (mob) - -Built-in mob vars: -mob/var -+ [alpha](/ref/atom/var/alpha.md) -+ [appearance](/ref/atom/var/appearance.md) -+ [appearance_flags](/ref/atom/var/appearance_flags.md) -+ [blend_mode](/ref/atom/var/blend_mode.md) -+ [ckey](/ref/mob/var/ckey.md) -+ [client](/ref/mob/var/client.md) -+ [color](/ref/atom/var/color.md) -+ [contents](/ref/atom/var/contents.md) -+ [density](/ref/atom/var/density.md) -+ [desc](/ref/atom/var/desc.md) -+ [dir](/ref/atom/var/dir.md) -+ [filters](/ref/atom/var/filters.md) -+ [gender](/ref/atom/var/gender.md) -+ [group](/ref/mob/var/group.md) -+ [icon](/ref/atom/var/icon.md) -+ [icon_state](/ref/atom/var/icon_state.md) -+ [icon_w](/ref/atom/var/icon_w.md) -+ [icon_z](/ref/atom/var/icon_z.md) -+ [invisibility](/ref/atom/var/invisibility.md) -+ [underlays](/ref/atom/var/underlays.md) -+ [overlays](/ref/atom/var/overlays.md) -+ [key](/ref/mob/var/key.md) -+ [layer](/ref/atom/var/layer.md) -+ [luminosity](/ref/atom/var/luminosity.md) -+ [maptext](/ref/atom/var/maptext.md) -+ [maptext_width](/ref/atom/var/maptext_width.md) -+ [maptext_height](/ref/atom/var/maptext_height.md) -+ [maptext_x](/ref/atom/var/maptext_x.md) -+ [maptext_y](/ref/atom/var/maptext_y.md) -+ [animate_movement](/ref/atom/movable/var/animate_movement.md) -+ [loc](/ref/atom/var/loc.md) -+ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -+ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -+ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) -+ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) -+ [mouse_opacity var](/ref/atom/var/mouse_opacity.md) -+ [name](/ref/atom/var/name.md) -+ [opacity](/ref/atom/var/opacity.md) -+ [parent_type](/ref/mob/var/parent_type.md) -+ [pixel_x](/ref/atom/var/pixel_x.md) -+ [pixel_y](/ref/atom/var/pixel_y.md) -+ [pixel_w](/ref/atom/var/pixel_w.md) -+ [pixel_z](/ref/atom/var/pixel_z.md) -+ [plane](/ref/atom/var/plane.md) -+ [render_source](/ref/atom/var/render_source.md) -+ [render_target](/ref/atom/var/render_target.md) -+ [see_infrared](/ref/mob/var/see_infrared.md) -+ [see_invisible](/ref/mob/var/see_invisible.md) -+ [see_in_dark](/ref/mob/var/see_in_dark.md) -+ [sight](/ref/mob/var/sight.md) -+ [suffix](/ref/atom/var/suffix.md) -+ [tag](/ref/datum/var/tag.md) -+ [text](/ref/atom/var/text.md) -+ [transform](/ref/atom/var/transform.md) -+ [type](/ref/datum/var/type.md) -+ [vars](/ref/datum/var/vars.md) -+ [verbs](/ref/atom/var/verbs.md) -+ [vis_contents](/ref/atom/var/vis_contents.md) -+ [vis_flags](/ref/atom/var/vis_flags.md) -+ [vis_locs](/ref/atom/var/vis_locs.md) -+ [x](/ref/atom/var/x.md) -+ [y](/ref/atom/var/y.md) -+ [z](/ref/atom/var/z.md) \ No newline at end of file diff --git a/ref/mob/var/ckey.md b/ref/mob/var/ckey.md index 5388c582..c9aacb0e 100644 --- a/ref/mob/var/ckey.md +++ b/ref/mob/var/ckey.md @@ -1,14 +1,11 @@ -## ckey var (mob) -**Default value:** -+ null - -This is the value of `mob.key` converted to canonical form (ie -the form returned by the ckey() proc). Among other things, this could be -used as a unique directory name in a server-side save file for storing -player information. See the [`ckey` proc](/ref/proc/ckey.md) for an example. +## ckey (var) -> [!TIP] -> **See also:** -> + [ckey proc](/ref/proc/ckey.md) -> + [key var (mob)](/ref/mob/var/key.md) \ No newline at end of file +**Default Value:** ++ null +*** +This is the value of mob.key converted to canonical form (ie the form returned by the ckey() proc). Among other things, this could be used as a unique directory name in a server-side save file for storing player information. See the ckey() proc for an example. +*** +**Related Pages:** ++ [ckey proc](/ref/proc/ckey) ++ [key var (mob)](/ref/mob/var/key) diff --git a/ref/mob/var/client.md b/ref/mob/var/client.md index 22183f64..4a8ec71c 100644 --- a/ref/mob/var/client.md +++ b/ref/mob/var/client.md @@ -1,15 +1,12 @@ -## client var (mob) -**Default value:** -+ null - -This is a reference to a set of properties specific to the -player. Therefore non-player mobs (NPCs) do not have a client (`client = -null`). +## client (var) -Setting a mob\'s client connects that player\'s client -to the mob. +**Default Value:** ++ null +*** +This is a reference to a set of properties specific to the player. Therefore non-player mobs (NPCs) do not have a client (client = null). -> [!TIP] -> **See also:** -> + [client](/ref/client.md) \ No newline at end of file +Setting a mob's client connects that player's client to the mob. +*** +**Related Pages:** ++ [client](/ref/client) diff --git a/ref/mob/var/group.md b/ref/mob/var/group.md index 9f2794eb..767c6313 100644 --- a/ref/mob/var/group.md +++ b/ref/mob/var/group.md @@ -1,43 +1,41 @@ -## group list var (mob) -**Default value:** -+ (empty list) +## group (var) -This is a list of mobs in the same group. By default, a mob -will swap positions with another mob in its group if bumped. It is also -possible to make verbs that are accessible only to members of the group. +**Default Value:** ++ (empty list) +*** +This is a list of mobs in the same group. By default, a mob will swap positions with another mob in its group if bumped. It is also possible to make verbs that are accessible only to members of the group. -The following example handles addition of somebody else to your -group. +The following example handles addition of somebody else to your group. -### Example: ```dm + mob/verb/join(mob/M) usr.group.Add(M) // add M to usr's group view() << "[usr] joins [M]." mob/verb/disband(mob/M) usr.group.Remove(M) // remove M from group view() << "[usr] disbands [M]." + ``` - -Note that group lists may be -asymmetric. Mob A may have mob B in his group list, but mob B may or may -not. It is up to you to define whether mobs are added into both lists or -not. + + +Note that group lists may be asymmetric. Mob A may have mob B in his group list, but mob B may or may not. It is up to you to define whether mobs are added into both lists or not. Here is an example of a verb accessible to a group: -### Example: + ```dm + mob/verb/summon() set src in usr.group loc = usr.loc view() << "[usr] summons [src]." -``` +``` -> [!TIP] -> **See also:** -> + [Bump proc (movable atom)](/ref/atom/movable/proc/Bump.md) -> + [list](/ref/list.md) \ No newline at end of file +*** +**Related Pages:** ++ [Bump](/ref/atom/movable/proc/Bump) ++ [list](/ref/list) diff --git a/ref/mob/var/index.md b/ref/mob/var/index.md new file mode 100644 index 00000000..41fbd5ca --- /dev/null +++ b/ref/mob/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in mob vars: +*** \ No newline at end of file diff --git a/ref/mob/var/key.md b/ref/mob/var/key.md index 5a3893ee..171175d8 100644 --- a/ref/mob/var/key.md +++ b/ref/mob/var/key.md @@ -1,22 +1,16 @@ -## key var (mob) -**Default value:** -+ null - -For player mobs (PCs) this is the value of the player\'s key. -For non-player mobs (NPCs), this is the value of the "desired" key. -This means that if a player with that key logs into the world, he will -be connected to that mob (as opposed to a new one of type world.mob). +## key (var) -Setting the mob\'s key will cause a client with the same key to -connect to the mob. Any other mob with the same key will lose it. +**Default Value:** ++ null +*** +For player mobs (PCs) this is the value of the player's key. For non-player mobs (NPCs), this is the value of the "desired" key. This means that if a player with that key logs into the world, he will be connected to that mob (as opposed to a new one of type world.mob). -Key values are always compared in canonical form (ie the form -returned by ckey()) so setting a mob\'s key to "Dan", "dan" are -equivalent as far as controlling player linkage. +Setting the mob's key will cause a client with the same key to connect to the mob. Any other mob with the same key will lose it. -> [!TIP] -> **See also:** -> + [ckey var (mob)](/ref/mob/var/ckey.md) -> + [client](/ref/client.md) -> + [key var (client)](/ref/client/var/key.md) \ No newline at end of file +Key values are always compared in canonical form (ie the form returned by ckey()) so setting a mob's key to "Dan", "dan" are equivalent as far as controlling player linkage. +*** +**Related Pages:** ++ [ckey](/ref/mob/var/ckey) ++ [client](/ref/client) ++ [key var (client)](/ref/client/var/key) diff --git a/ref/mob/var/parent_type.md b/ref/mob/var/parent_type.md index 7b9b3b8a..e8dfedb7 100644 --- a/ref/mob/var/parent_type.md +++ b/ref/mob/var/parent_type.md @@ -1,8 +1,7 @@ -## parent_type var (mob) -The default parent_type of [/mob](/ref/mob.md) is -[/atom/movable](/ref/atom/movable.md) - -> [!TIP] -> **See also:** -> + [parent_type var](/ref/datum/var/parent_type.md) \ No newline at end of file +## parent_type (var) +*** +The default parent_type of /mob is /atom/movable. +*** +**Related Pages:** ++ [parent_type](/ref/datum/var/parent_type) diff --git a/ref/mob/var/see_in_dark.md b/ref/mob/var/see_in_dark.md index d95fe808..5ff94502 100644 --- a/ref/mob/var/see_in_dark.md +++ b/ref/mob/var/see_in_dark.md @@ -1,16 +1,14 @@ -## see_in_dark var (mob) -**Default value:** -+ 2 - -This determines how far the mob can see in the dark. The scale -is just like luminosity: a value of 1 illuminates the mob and its -location; 2 illuminates the immediate surrounds; and so on. +## see_in_dark (var) -> [!TIP] -> **See also:** -> + [luminosity var (atom)](/ref/atom/var/luminosity.md) -> + [see_infrared var (mob)](/ref/mob/var/see_infrared.md) -> + [see_invisible var (mob)](/ref/mob/var/see_invisible.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +**Default Value:** ++ 2 +*** +This determines how far the mob can see in the dark. The scale is just like luminosity: a value of 1 illuminates the mob and its location; 2 illuminates the immediate surrounds; and so on. +*** +**Related Pages:** ++ [luminosity](/ref/atom/var/luminosity) ++ [see_infrared var (mob)](/ref/mob/var/see_infrared) ++ [see_invisible var (mob)](/ref/mob/var/see_invisible) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view proc](/ref/proc/view) diff --git a/ref/mob/var/see_infrared.md b/ref/mob/var/see_infrared.md index 296b8ec0..05438a8b 100644 --- a/ref/mob/var/see_infrared.md +++ b/ref/mob/var/see_infrared.md @@ -1,15 +1,14 @@ -## see_infrared var (mob) -**Default value:** -+ 0 - -Setting this to 1 enables infravision, allowing the mob to see -infrared objects in the dark. +## see_infrared (var) -> [!TIP] -> **See also:** -> + [infra_luminosity var (atom)](/ref/atom/var/infra_luminosity.md) -> + [see_in_dark var (mob)](/ref/mob/var/see_in_dark.md) -> + [see_invisible var (mob)](/ref/mob/var/see_invisible.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +Setting this to 1 enables infravision, allowing the mob to see infrared objects in the dark. +*** +**Related Pages:** ++ [infra_luminosity var (atom)](/ref/atom/var/infra_luminosity) ++ [see_in_dark var (mob)](/ref/mob/var/see_in_dark) ++ [see_invisible var (mob)](/ref/mob/var/see_invisible) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view proc](/ref/proc/view) diff --git a/ref/mob/var/see_invisible.md b/ref/mob/var/see_invisible.md index c3ba2477..7ba9aa8c 100644 --- a/ref/mob/var/see_invisible.md +++ b/ref/mob/var/see_invisible.md @@ -1,14 +1,14 @@ -## see_invisible var (mob) -**Default value:** -+ 0 +## see_invisible (var) +**Default Value:** ++ 0 +*** This is the maximum level of invisibility that the mob can see. - -> [!TIP] -> **See also:** -> + [invisibility var (atom)](/ref/atom/var/invisibility.md) -> + [see_in_dark var (mob)](/ref/mob/var/see_in_dark.md) -> + [see_infrared var (mob)](/ref/mob/var/see_infrared.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +*** +**Related Pages:** ++ [invisibility var (atom)](/ref/atom/var/invisibility) ++ [see_in_dark var (mob)](/ref/mob/var/see_in_dark) ++ [see_infrared var (mob)](/ref/mob/var/see_infrared) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view proc](/ref/proc/view) diff --git a/ref/mob/var/sight.md b/ref/mob/var/sight.md index 33421874..be40a453 100644 --- a/ref/mob/var/sight.md +++ b/ref/mob/var/sight.md @@ -1,16 +1,16 @@ -## sight var (mob) -**Default value:** +## sight (var) + +**Default Value:** + 0 +*** +This controls which objects on the map the mob can see. The default value of 0 means that the mob can see all objects that are visible and lit. Different flags in this var can be set to extend or limit this range. + +The following bit flags are encoded in mob.sight: -This controls which objects on the map the mob can see. The -default value of 0 means that the mob can see all objects that are -visible and lit. Different flags in this var can be set to extend or -limit this range. -The following bit flags are encoded in -mob.sight: ```dm + SEE_INFRA // can see infra-red objects SEE_SELF // can see self, no matter what SEE_MOBS // can see all mobs, no matter what @@ -21,32 +21,29 @@ SEE_PIXELS// if an object is located on an unlit area, but some of its pixels ar SEE_THRU // can see through opaque objects SEE_BLACKNESS // render dark tiles as blackness BLIND // can't see anything + ``` -### Example: + + ```dm + usr.sight |= BLIND // turn on the blind bit usr.sight &= ~BLIND // turn off the blind bit usr.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS) // turn on several bits at once usr.sight &= ~(SEE_MOBS|SEE_OBJS|SEE_TURFS) // turn off several bits at once + ``` -`SEE_PIXELS` draws everything and then -covers hidden turfs with blackness. It is supported in topdown maps -only, not in other map formats. It does not mix well with other flags. -In practice, `SEE_PIXELS` acts as if `SEE_BLACKNESS`, `SEE_TURFS`, -`SEE_OBJS`, and `SEE_MOBS` are all turned on. That is, all atoms are -drawn even on hidden tiles, and black squares are also drawn to cover -them. - -The black tiles rendered by `SEE_BLACKNESS` and -`SEE_PIXELS` are drawn on the default plane 0. - -> [!TIP] -> **See also:** -> + [invisibility setting (verb)](/ref/verb/set/invisibility.md) -> + [invisibility var (atom)](/ref/atom/var/invisibility.md) -> + [see_in_dark var (mob)](/ref/mob/var/see_in_dark.md) -> + [see_infrared var (mob)](/ref/mob/var/see_infrared.md) -> + [see_invisible var (mob)](/ref/mob/var/see_invisible.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file + +`SEE_PIXELS` draws everything and then covers hidden turfs with blackness. It is supported in topdown maps only, not in other map formats. It does not mix well with other flags. In practice, `SEE_PIXELS` acts as if `SEE_BLACKNESS`, `SEE_TURFS`, `SEE_OBJS`, and `SEE_MOBS` are all turned on. That is, all atoms are drawn even on hidden tiles, and black squares are also drawn to cover them. + +The black tiles rendered by `SEE_BLACKNESS` and `SEE_PIXELS` are drawn on the default plane 0. +*** +**Related Pages:** ++ [invisibility setting (verb)](/ref/verb/set/invisibility) ++ [invisibility var (atom)](/ref/atom/var/invisibility) ++ [see_in_dark var (mob)](/ref/mob/var/see_in_dark) ++ [see_infrared var (mob)](/ref/mob/var/see_infrared) ++ [see_invisible var (mob)](/ref/mob/var/see_invisible) ++ [view proc](/ref/proc/view) diff --git a/ref/mutable_appearance/index.md b/ref/mutable_appearance/index.md new file mode 100644 index 00000000..6bcf7210 --- /dev/null +++ b/ref/mutable_appearance/index.md @@ -0,0 +1,27 @@ + +## mutable_appearance (info) +*** +All atoms and images have an appearance, which is an immutable object that can be shared by many atoms. Making changes to an object's appearance generates new appearances, many of which may be temporary. For high-performance games, this can be a drawback. The `/mutable_appearance` type exists so that you can make multiple changes to an appearance without creating all the temporary objects, then turn it into a regular immutable appearance when finished. + +A new mutable appearance is created via `new/mutable_appearance`, and giving it an atom, image, or appearance as a source object. Assigning it to an object's appearance var will create a new immutable appearance. + + +```dm + +mob/proc/GetAngry() + var/mutable_appearance/ma = new(src) + ma.color = rgb(51,255,51) // green + ma.transform = matrix(2,0,0,0,2,0) // scale x2 + appearance = ma + +``` + + +Reading certain vars, such as `overlays`, will create a temporary list object that can be modified easily. With regular appearances, making many changes to the `overlays` list results in a lot of churn. + +The `/mutable_appearance` datum is technically a descendant of `/image`, but this is only for convenience, and should not be relied on for any other purpose as it is subject to change in future versions. +*** +**Related Pages:** ++ [appearance](/ref/atom/var/appearance) ++ [image objects](/ref/image) ++ [vars (mutable appearance)](/ref/mutable_appearance/var) diff --git a/ref/mutable_appearance/mutable_appearance.md b/ref/mutable_appearance/mutable_appearance.md deleted file mode 100644 index 41acbac5..00000000 --- a/ref/mutable_appearance/mutable_appearance.md +++ /dev/null @@ -1,42 +0,0 @@ -## mutable appearance -###### BYOND Version 511 - - -All atoms and images have an appearance, which is an immutable -object that can be shared by many atoms. Making changes to an object\'s -appearance generates new appearances, many of which may be temporary. -For high-performance games, this can be a drawback. The -`/mutable_appearance` type exists so that you can make multiple changes -to an appearance without creating all the temporary objects, then turn -it into a regular immutable appearance when finished. - -A new -mutable appearance is created via `new/mutable_appearance`, and giving -it an atom, image, or appearance as a source object. Assigning it to an -object\'s appearance var will create a new immutable appearance. -### Example: - -```dm -mob/proc/GetAngry() - var/mutable_appearance/ma = new(src) - ma.color = rgb(51,255,51) // green - ma.transform = matrix(2,0,0,0,2,0) // scale x2 - appearance = ma -``` - - -Reading certain vars, such -as `overlays`, will create a temporary list object that can be modified -easily. With regular appearances, making many changes to the `overlays` -list results in a lot of churn. - -The `/mutable_appearance` datum -is technically a descendant of `/image`, but this is only for -convenience, and should not be relied on for any other purpose as it is -subject to change in future versions. - -> [!TIP] -> **See also:** -> + [appearance var (atom)](/ref/atom/var/appearance.md) -> + [image objects](/ref/image.md) -> + [vars (mutable appearance)](/ref/mutable_appearance/var.md) \ No newline at end of file diff --git a/ref/mutable_appearance/var.md b/ref/mutable_appearance/var.md index b7e92e91..b86bd2dc 100644 --- a/ref/mutable_appearance/var.md +++ b/ref/mutable_appearance/var.md @@ -1,50 +1,5 @@ -## vars (mutable appearance) -###### BYOND Version 511 -Built-in mutable appearance vars:\ -mob/var -+ [alpha](/ref/atom/var/alpha.md) -+ [appearance](/ref/atom/var/appearance.md) -+ [appearance_flags](/ref/atom/var/appearance_flags.md) -+ [blend_mode](/ref/atom/var/blend_mode.md) -+ [color](/ref/atom/var/color.md) -+ [density](/ref/atom/var/density.md) -+ [desc](/ref/atom/var/desc.md) -+ [dir](/ref/atom/var/dir.md) -+ [filters](/ref/atom/var/filters.md) -+ [gender](/ref/atom/var/gender.md) -+ [icon](/ref/atom/var/icon.md) -+ [icon_state](/ref/atom/var/icon_state.md) -+ [icon_w](/ref/atom/var/icon_w.md) -+ [icon_z](/ref/atom/var/icon_z.md) -+ [invisibility](/ref/atom/var/invisibility.md) -+ [underlays](/ref/atom/var/underlays.md) -+ [overlays](/ref/atom/var/overlays.md) -+ [layer](/ref/atom/var/layer.md) -+ [luminosity](/ref/atom/var/luminosity.md) -+ [maptext](/ref/atom/var/maptext.md) -+ [maptext_width](/ref/atom/var/maptext_width.md) -+ [maptext_height](/ref/atom/var/maptext_height.md) -+ [maptext_x](/ref/atom/var/maptext_x.md) -+ [maptext_y](/ref/atom/var/maptext_y.md) -+ [animate_movement](/ref/atom/movable/var/animate_movement.md) -+ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -+ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -+ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) -+ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) -+ [mouse_opacity var](/ref/atom/var/mouse_opacity.md) -+ [name](/ref/atom/var/name.md) -+ [opacity](/ref/atom/var/opacity.md) -+ [pixel_x](/ref/atom/var/pixel_x.md) -+ [pixel_y](/ref/atom/var/pixel_y.md) -+ [pixel_w](/ref/atom/var/pixel_w.md) -+ [pixel_z](/ref/atom/var/pixel_z.md) -+ [plane](/ref/atom/var/plane.md) -+ [render_source](/ref/atom/var/render_source.md) -+ [render_target](/ref/atom/var/render_target.md) -+ [screen_loc](/ref/atom/movable/var/screen_loc.md) -+ [suffix](/ref/atom/var/suffix.md) -+ [text](/ref/atom/var/text.md) -+ [transform](/ref/atom/var/transform.md) -+ [verbs](/ref/atom/var/verbs.md) -+ [vis_flags](/ref/atom/var/vis_flags.md) \ No newline at end of file +## var (var) +*** +Built-in mutable appearance vars: +*** \ No newline at end of file diff --git a/ref/notes/BACKGROUND_LAYER.md b/ref/notes/BACKGROUND_LAYER.md index d145a53f..bb5467d5 100644 --- a/ref/notes/BACKGROUND_LAYER.md +++ b/ref/notes/BACKGROUND_LAYER.md @@ -1,40 +1,15 @@ -## BACKGROUND_LAYER -This is mostly no longer needed. A negative value for plane is -the preferred way to do show objects in the background. It can still be -used however when you want to rearrange objects in the same plane when -using [PLANE_MASTER](/ref/atom/var/appearance_flags.md) for visual -effects. +## BACKGROUND_LAYER (info) +*** +This is mostly no longer needed. A negative value for plane is the preferred way to do show objects in the background. It can still be used however when you want to rearrange objects in the same plane when using PLANE_MASTER for visual effects. -`BACKGROUND_LAYER` is a special high value that can be -added to the regular layer of any atom. +`BACKGROUND_LAYER` is a special high value that can be added to the regular layer of any atom. -The purpose of this -value is to make an atom appear below any regular atoms, even if they -share the same plane. In an isometric map for instance, HUD objects will -always appear above the map, but makeing a HUD object appear behind the -map was basically impossible without this feature until `plane` was -implemented. +The purpose of this value is to make an atom appear below any regular atoms, even if they share the same plane. In an isometric map for instance, HUD objects will always appear above the map, but makeing a HUD object appear behind the map was basically impossible without this feature until `plane` was implemented. -When using this special layer, it should be added -to the layer an atom normally uses. For instance an obj should have a -layer of `BACKGROUND_LAYER + OBJ_LAYER`. +When using this special layer, it should be added to the layer an atom normally uses. For instance an obj should have a layer of `BACKGROUND_LAYER + OBJ_LAYER`. -This can be mixed with -`TOPDOWN_LAYER` and `EFFECTS_LAYER`, but it will take precedence over -both. Anything with `BACKGROUND_LAYER` will always appear below anything -without it on the same plane. +This can be mixed with `TOPDOWN_LAYER` and `EFFECTS_LAYER`, but it will take precedence over both. Anything with `BACKGROUND_LAYER` will always appear below anything without it on the same plane. -Images or overlays with -`FLOAT_LAYER` can be left alone. They will automatically have the same -layer as whatever atom they are attached to. - -> [!TIP] -> **See also:** -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [plane var (atom)](/ref/atom/var/plane.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -> + [TOPDOWN_LAYER](/ref/notes/TOPDOWN_LAYER.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +Images or overlays with `FLOAT_LAYER` can be left alone. They will automatically have the same layer as whatever atom they are attached to. +*** \ No newline at end of file diff --git a/ref/notes/EFFECTS_LAYER.md b/ref/notes/EFFECTS_LAYER.md index bf1bc8a2..231b863c 100644 --- a/ref/notes/EFFECTS_LAYER.md +++ b/ref/notes/EFFECTS_LAYER.md @@ -1,44 +1,17 @@ -## EFFECTS_LAYER -This is mostly no longer needed. A negative value for plane is -the preferred way to do show objects in the background. It can still be -used however when you want to rearrange objects in the same plane when -using [PLANE_MASTER](/ref/atom/var/appearance_flags.md) for visual -effects. +## EFFECTS_LAYER (info) +*** +This is mostly no longer needed. A negative value for plane is the preferred way to do show objects in the background. It can still be used however when you want to rearrange objects in the same plane when using PLANE_MASTER for visual effects. -`EFFECTS_LAYER` is a special high value that can be -added to the regular layer of any atom. +`EFFECTS_LAYER` is a special high value that can be added to the regular layer of any atom. -The purpose of this -value is to make an atom appear above any regular atoms. For instance, -in an isometric map if you want to display a character\'s name below -them, it does not make much sense to have nearer objects cover up that -name, so you can tell the name overlay to use -`EFFECTS_LAYER + MOB_LAYER` and it will show up on top of all the normal -icons on the map. This has been somewhat obviated by `plane` but may -still be useful in some cases. +The purpose of this value is to make an atom appear above any regular atoms. For instance, in an isometric map if you want to display a character's name below them, it does not make much sense to have nearer objects cover up that name, so you can tell the name overlay to use `EFFECTS_LAYER + MOB_LAYER` and it will show up on top of all the normal icons on the map. This has been somewhat obviated by `plane` but may still be useful in some cases. -When using this special layer, -it should be added to the layer an atom normally uses. For instance an -obj should have a layer of `EFFECTS_LAYER + OBJ_LAYER`. +When using this special layer, it should be added to the layer an atom normally uses. For instance an obj should have a layer of `EFFECTS_LAYER + OBJ_LAYER`. -This can be mixed with `TOPDOWN_LAYER`, in non-topdown map formats. Anything -in `TOPDOWN_LAYER` will display on top of `EFFECTS_LAYER`, and -`TOPDOWN_LAYER + EFFECTS_LAYER` will be above both. +This can be mixed with `TOPDOWN_LAYER`, in non-topdown map formats. Anything in `TOPDOWN_LAYER` will display on top of `EFFECTS_LAYER`, and `TOPDOWN_LAYER + EFFECTS_LAYER` will be above both. -This can also be mixed with `BACKGROUND_LAYER`, which takes priority over -everything else. +This can also be mixed with `BACKGROUND_LAYER`, which takes priority over everything else. -Images or overlays with `FLOAT_LAYER` can be -left alone. They will automatically have the same layer as whatever atom -they are attached to. - -> [!TIP] -> **See also:** -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [plane var (atom)](/ref/atom/var/plane.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -> + [TOPDOWN_LAYER](/ref/notes/TOPDOWN_LAYER.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +Images or overlays with `FLOAT_LAYER` can be left alone. They will automatically have the same layer as whatever atom they are attached to. +*** \ No newline at end of file diff --git a/ref/notes/HUD.md b/ref/notes/HUD.md new file mode 100644 index 00000000..ebabfd9f --- /dev/null +++ b/ref/notes/HUD.md @@ -0,0 +1,17 @@ + +## HUD (info) +*** +HUD stands for Heads-Up Display, and refers to any atoms that appear on the screen but don't move when the player moves. These are also called screen objects. Any movable atom can be added to the HUD by setting its `screen_loc` var, and adding it to `client.screen` for each user who is supposed to see it. This can be used to display a character's vital stats, scores, etc. + +If you want to have something like a health meter or name attached to a moving atom, use overlays or `/image` objects instead. An `/image` object is similar to a screen object in that it can be shown to only certain players instead of being shown to everyone. + +The size of the screen depends on `client.view` (or `world.view`), `world.map_format`, and `world.icon_size`. In a normal topdown map format, `client.view` is the same as the screen size; in other map formats the screen might be a different size. + +The `screen_loc` var can be set to a value like `"1,1"` (the southwest tile of the screen), `"4,NORTH"` (fourth tile from the west, along the north side of the screen), `"SOUTHEAST"`, and so on. You can also include pixel offsets, percentages, and specify two corners to tile an icon repeatedly from one end to the other. See screen_loc for more details. + +`screen_loc` can also be used to stretch the bounds of the HUD. A value of `"0,0"` will cause the atom to appear to the southwest of the southwest-most tile on the visible map, outside of the regular map bounds. Using HUDs in this way, you can provide a nice decorative "frame" for your map. + +More complex + +You can use HUDs in other map controls as well, by preceding screen_loc with the name of the map you will use followed by a colon. For instance, `screen_loc="map2:1,1"` will show an icon in the southwest corner of the `map2` control. The actual size of a secondary HUD is based on how far out the icons in it extend in any direction. If you have one icon at `"map2:1,1"` and another at `"map2:4,3"`, then that HUD will be four tiles wide and three high. +*** \ No newline at end of file diff --git a/ref/notes/TOPDOWN_LAYER.md b/ref/notes/TOPDOWN_LAYER.md index 85923c8b..ac4fa7d1 100644 --- a/ref/notes/TOPDOWN_LAYER.md +++ b/ref/notes/TOPDOWN_LAYER.md @@ -1,37 +1,15 @@ -## TOPDOWN_LAYER -TOPDOWN_LAYER is a special high value that can be added to the -regular layer of any atom. This is only available when using a -non-topdown world.map_format, such as isometric mapping. +## TOPDOWN_LAYER (info) +*** +TOPDOWN_LAYER is a special high value that can be added to the regular layer of any atom. This is only available when using a non-topdown world.map_format, such as isometric mapping. -The purpose of this value is to make an atom appear as if it belongs in a -top-down map, when using a map_format other than TOPDOWN_MAP or -TILED_ICON_MAP. This can be handy for title screens, or for special -battle maps or the inside of a building in an RPG. +The purpose of this value is to make an atom appear as if it belongs in a top-down map, when using a map_format other than TOPDOWN_MAP or TILED_ICON_MAP. This can be handy for title screens, or for special battle maps or the inside of a building in an RPG. -When using this special layer, it should be added to the layer an atom normally -uses. For instance a turf should have a layer of TOPDOWN_LAYER + -TURF_LAYER. Usually you will want one part of the map to have -TOPDOWN_LAYER, and for players to be unable to walk to there from the -regular map. Mixing topdown icons and icons in the normal map_format in -view of each other could look very strange. For safety\'s sake, the -easiest thing to do is to keep them on separate z layers. +When using this special layer, it should be added to the layer an atom normally uses. For instance a turf should have a layer of TOPDOWN_LAYER + TURF_LAYER. Usually you will want one part of the map to have TOPDOWN_LAYER, and for players to be unable to walk to there from the regular map. Mixing topdown icons and icons in the normal map_format in view of each other could look very strange. For safety's sake, the easiest thing to do is to keep them on separate z layers. -This can be mixed with EFFECTS_LAYER. Anything in TOPDOWN_LAYER will display -on top of EFFECTS_LAYER, and TOPDOWN_LAYER + EFFECTS_LAYER will be above -both. +This can be mixed with EFFECTS_LAYER. Anything in TOPDOWN_LAYER will display on top of EFFECTS_LAYER, and TOPDOWN_LAYER + EFFECTS_LAYER will be above both. -This can also be mixed with BACKGROUND_LAYER, which takes -priority over everything else. +This can also be mixed with BACKGROUND_LAYER, which takes priority over everything else. -Images or overlays with -FLOAT_LAYER can be left alone. They will automatically have the same -layer as whatever atom they are attached to. - -> [!TIP] -> **See also:** -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -> + [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file +Images or overlays with FLOAT_LAYER can be left alone. They will automatically have the same layer as whatever atom they are attached to. +*** \ No newline at end of file diff --git a/ref/notes/Unicode.md b/ref/notes/Unicode.md index 316b1f09..56d6ecbf 100644 --- a/ref/notes/Unicode.md +++ b/ref/notes/Unicode.md @@ -1,76 +1,9 @@ -## Unicode -###### BYOND Version 513 +## Unicode (info) +*** +BYOND was originally written to handle 8-bit ("ANSI") characters only. However as time has marched on, Unicode has become ubiquitous for supporting multiple languages, special characters, and emojis. To adapt to this, BYOND now supports Unicode. -BYOND was originally written to handle 8-bit ("ANSI") -characters only. However as time has marched on, Unicode has become -ubiquitous for supporting multiple languages, special characters, and -emojis. To adapt to this, BYOND now supports Unicode. +When ANSI was king, every character was exactly one byte in width, because the only valid characters were between 1 and 255. (And technically, BYOND reserved 255 for its own use.) Now, BYOND uses an encoding called UTF-8 to store characters that can't fit in one byte. -When ANSI -was king, every character was exactly one byte in width, because the -only valid characters were between 1 and 255. (And technically, BYOND -reserved 255 for its own use.) Now, BYOND uses an encoding called UTF-8 -to store characters that can\'t fit in one byte. - -UTF-8 breaks -up characters with codes of 128 or higher into multiple bytes, like so: -| Character code | Size in bytes | -| --- | --- | -| 0 - 0x7F | 1 | -| 0x80 - 0x7FF | 2 | -| 0x800 - 0xFFFF | 3 | -| 0x10000 - 0x10FFFF | 4 | - -### Text handling - -Importantly, BYOND\'s text procs are based on the byte -position, not the character position which may be lower. In other words, -`length("abcdéfg")` is greater than 7; it\'s 8, because `é` takes up 2 -bytes in UTF-8. That also means `f` is at position 7, not position 6. - - -Why do the text procs work with byte position instead of -character position? Because ultimately, it\'s faster. Going by character -position would require counting every byte in a string (at least when it -uses UTF-8) until the right character position was found. This would be -detrimental to performance in most cases. - -For the most part, -this distinction should be fairly invisible to you. Most code isn\'t -going to encounter problems, but if you do a lot of text processing you -should be aware of it. - -In particular, [text2ascii()](/ref/proc/text2ascii.md) returns the Unicode value at a -specific position, which may cover several bytes. If you loop through a -string calling this proc for each character, you\'ll have to make -adjustments for cases when multiple bytes have been read. - -The read-only `[]` index operator also uses byte positions. - -If you read a byte or cut text at an inappropriate point, any broken characters -resulting from the cut will be turned into the Unicode replacement -character � which is 0xFFFD. - -### `_char` procs - -Most of the text handling procs have slower `_char` versions -(e.g., `copytext_char`) that use character positions instead of byte -positions. - -These should be used sparingly if at all; whenever -it\'s possible to use byte positions, you should. When you do use a -`_char` version of a proc, prefer using `-offset` instead of -`length_char(text)-offset` for positions near the end of the string. -Most text procs allow negative position values that count backwards from -the end, and counting a small number of characters backward is faster -than counting a lot of characters going forward. - -### Old code - -Code written in ANSI will be up-converted to UTF-8 by Dream -Maker, based on your current locale when the code is loaded. - -> [!TIP] -> **See also:** -> + [text](/ref/DM/text.md) \ No newline at end of file +UTF-8 breaks up characters with codes of 128 or higher into multiple bytes, like so: +*** \ No newline at end of file diff --git a/ref/notes/alpha (filters).md b/ref/notes/alpha (filters).md deleted file mode 100644 index cc2ff46a..00000000 --- a/ref/notes/alpha (filters).md +++ /dev/null @@ -1,35 +0,0 @@ -## Alpha mask filter -###### BYOND Version 513 - -Format: -+ filter(type="alpha", ...) - -Args: -+ x: Horizontal offset of mask (defaults to 0) -+ y: Vertical offset of mask (defaults to 0) -+ icon: Icon to use as a mask -+ render_source: `render_target` to use as a mask -+ flags: Defaults to 0; use see below for other flags - -> [!NOTE] -> Unlike many other filters, this filter **is** - -taken into account for mouse-hit purposes. -Uses an icon or render target as a mask over this image. Every -pixel that is transparent in either the image or the mask, is -transparent in the result. - -The `x` and `y` values can move the -mask from its normal position. By default, the mask is centered over the -center of the image. - -The `MASK_INVERSE` flag will invert the -alpha mask so that opaque areas in the mask become transparent, and -vice-versa. There is also a `MASK_SWAP` flag which treats the source -image as the mask and vice-versa, which might be useful for some -effects. - -> [!TIP] -> **See also:** -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [render_target var (atom)](/ref/atom/var/render_target.md) diff --git a/ref/notes/angular_blur (filters).md b/ref/notes/angular_blur (filters).md deleted file mode 100644 index 853c062a..00000000 --- a/ref/notes/angular_blur (filters).md +++ /dev/null @@ -1,33 +0,0 @@ -## Angular blur filter -###### BYOND Version 513 - -Format: -+ filter(type="angular_blur", ...) - -Args: -+ x: Horizontal center of effect, in pixels, relative to image center -+ y: Vertical center of effect, in pixels, relative to image center -+ size: Amount of blur (defaults to 1) - -Blurs the image by a certain amount in a circular formation, as -if the image is spinning. The size of the blur can roughly be thought of -in "degrees" worth of blur. As the distance from the center increases, -the blur becomes more noticeable since the same amount of angular motion -has to travel farther along a circle. - -> [!NOTE] -> Large blurs will look -worse toward the edges due to limited sampling. Loss of accuracy will -appear where `size` × distance is greater than about 300. You can -increase accuracy by breaking up large sizes into multiple filter passes -with differing sizes. The blur used is Gaussian, so combining blur sizes -A and B will give a total size of sqrt(A^2^+B^2^). - -Typically this blur is used with an entire plane, but it could be used to give a sense of -motion blur to a spinning object. - -> [!TIP] -> **See also:** -> + [Gaussian blur (filters)](/ref/notes/filters/blur.md) -> + [Radial blur (filters)](/ref/notes/filters/radial_blur.md) -> + [Motion blur (filters)](/ref/notes/filters/motion_blur.md) diff --git a/ref/notes/big-icons.md b/ref/notes/big-icons.md index 0333cedf..0a792520 100644 --- a/ref/notes/big-icons.md +++ b/ref/notes/big-icons.md @@ -1,66 +1,17 @@ -## Big icons -BYOND allows you to use icons that are not the same size as the -tile size defined in world.icon_size. These icons can be manipulated -with the /icon datum using their raw, native size, and shown on the map -in full size. To use the old behavior where an atom can display only an -icon of the normal tile size, use the TILED_ICON_MAP value for -map_format instead. +## big-icons (info) +*** +BYOND allows you to use icons that are not the same size as the tile size defined in world.icon_size. These icons can be manipulated with the /icon datum using their raw, native size, and shown on the map in full size. To use the old behavior where an atom can display only an icon of the normal tile size, use the TILED_ICON_MAP value for map_format instead. -When you use an icon of non-standard size -on an atom, the icon is "anchored" to the southwest corner of the -atom. If you are using a top-down view (world.map_format=TOPDOWN_MAP), -the icon will appear to spread out further to the east and north. In an -isometric map (world.map_format=ISOMETRIC_MAP), the icon will cover -additional tiles north and east as well. The "footprint" of an -isometric icon\--the actual map tiles it covers\--is always square, so -if your tile size is 64x64 and you use a 128x64 icon, the 128-pixel -width means the icon will cover a 2x2 section of map tiles. +When you use an icon of non-standard size on an atom, the icon is "anchored" to the southwest corner of the atom. If you are using a top-down view (world.map_format=TOPDOWN_MAP), the icon will appear to spread out further to the east and north. In an isometric map (world.map_format=ISOMETRIC_MAP), the icon will cover additional tiles north and east as well. The "footprint" of an isometric icon--the actual map tiles it covers--is always square, so if your tile size is 64x64 and you use a 128x64 icon, the 128-pixel width means the icon will cover a 2x2 section of map tiles. -It is important to remember that using a big icon is a visual effect -*only*. It will not affect how the atom bumps into other atoms or -vice-versa. +It is important to remember that using a big icon is a visual effect *only*. It will not affect how the atom bumps into other atoms or vice-versa. -Big icons will affect layering\--the order in which -icons are drawn. In general, because a big icon is covering more than -one tile of the map, it will try to draw above any other tiles in that -space that are on the same layer. This way, you can set a turf to use a -big icon without having to change the turfs to the north and east. If an -atom has a big icon, any overlays and underlays attached to it will be -pulled forward as well, so they will draw in front of anything on their -same layer. In isometric mode this is about the same, except that the -layer isn\'t that important\--anything in the way will just be moved -back behind the big icon. +Big icons will affect layering--the order in which icons are drawn. In general, because a big icon is covering more than one tile of the map, it will try to draw above any other tiles in that space that are on the same layer. This way, you can set a turf to use a big icon without having to change the turfs to the north and east. If an atom has a big icon, any overlays and underlays attached to it will be pulled forward as well, so they will draw in front of anything on their same layer. In isometric mode this is about the same, except that the layer isn't that important--anything in the way will just be moved back behind the big icon. -Note: Big overlays will not "pull -forward" on their own. If the main atom uses a single-tile icon, a big -overlay attached to it will not try to draw in front of other icons on -the same layer. This is so that name labels, health bar overlays, etc. -will not cause any odd behavior. To be safe, you should always specify a -layer when adding an overlay. +Note: Big overlays will not "pull forward" on their own. If the main atom uses a single-tile icon, a big overlay attached to it will not try to draw in front of other icons on the same layer. This is so that name labels, health bar overlays, etc. will not cause any odd behavior. To be safe, you should always specify a layer when adding an overlay. -In isometric mode, layering is -affected by the "distance" between the atom and the viewer, so putting -a regular-sized icon and part of a big icon on the same tile could cause -layering oddities. Tiles that are covered by a big icon will tend to be -drawn behind the big icon as mentioned above. For this reason, any atoms -whose icons cover more than one tile (the extra height of an isometric -icon doesn\'t count) should always be dense, and you should block -movement onto any tile covered by them. +In isometric mode, layering is affected by the "distance" between the atom and the viewer, so putting a regular-sized icon and part of a big icon on the same tile could cause layering oddities. Tiles that are covered by a big icon will tend to be drawn behind the big icon as mentioned above. For this reason, any atoms whose icons cover more than one tile (the extra height of an isometric icon doesn't count) should always be dense, and you should block movement onto any tile covered by them. -When manipulating icons -with the /icon datum, you can still use Blend() to combine icons of -different sizes. By default, the icons will be lined up at their -southwest corners. You can change the position at which the second icon -is blended. - -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [Blend proc (icon)](/ref/icon/proc/Blend.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) -> + [Isometric maps](/ref/notes/isometric.md) -> + [Side-view maps](/ref/notes/side.md) \ No newline at end of file +When manipulating icons with the /icon datum, you can still use Blend() to combine icons of different sizes. By default, the icons will be lined up at their southwest corners. You can change the position at which the second icon is blended. +*** \ No newline at end of file diff --git a/ref/notes/bloom (filters).md b/ref/notes/bloom (filters).md deleted file mode 100644 index 33d3d072..00000000 --- a/ref/notes/bloom (filters).md +++ /dev/null @@ -1,40 +0,0 @@ -## Bloom filter -###### BYOND Version 514 - -Format: -+ filter(type="bloom", ...) - -Args: -+ threshold: Color threshold for bloom -+ size: Blur radius of bloom effect (see Gaussian blur) -+ offset: Growth/outline radius of bloom effect before blur -+ alpha: Opacity of effect (default is 255, max opacity) - -Post-processing effect that makes bright colors look like -they\'re a strong light source, spreading their light additively to -other nearby pixels. This is a complex effect that involves multiple -shader passes. For both performance and visual reasons, it is usually -best applied to an entire plane rather than to individual objects. - -The color `threshold` determines which pixels this effect -applies to. If any of the red, green, or blue components of the pixel -are greater than the same component for the threshold, that pixel will -bloom. The blooming pixels then have their colors spread outward to -create a glow that gets added to the original image. - -The `offset` and `size` parameters are used to control the glow effect. They -work the same as they do in the drop shadow filter: `offset` causes the -light to grow outwards, and a blur of `size` is then applied to soften -it. Often just using a blur alone will produce a pleasing effect. By -playing with these two values you can make the bloom effect appear -differently. - -The `alpha` value is applied to any light -contributions from bloomed pixels that get added to the original image, -so values lower than 255 can make the effect less pronounced. This can -be very useful if you choose to animate the filter. - -> [!TIP] -> **See also:** -> + [Gaussian blur (filters)](/ref/notes/filters/blur.md) -> + [Drop shadow (filters)](/ref/notes/filters/drop_shadow.md) \ No newline at end of file diff --git a/ref/notes/blur (filters).md b/ref/notes/blur (filters).md deleted file mode 100644 index 3b91579d..00000000 --- a/ref/notes/blur (filters).md +++ /dev/null @@ -1,22 +0,0 @@ -## Gaussian blur filter -###### BYOND Version 512 - -Format: -+ filter(type="blur", ...) - -Args: -+ size: Amount of blur (defaults to 1) - -Blurs the image by a certain amount. The size of the blur can -roughly be thought of in "pixels" worth of blur. -Note: Large blurs will result in reduced performance. The highest size -that can be handled easily in this filter is 6. Higher sizes require -multiple passes, although the filter will "cheat" and use low-quality -passes for much higher sizes. - -> [!TIP] -> **See also:** -> + [Motion blur (filters)](/ref/notes/filters/motion_blur.md) -> + [Radial blur (filters)](/ref/notes/filters/radial_blur.md) -> + [Angular blur (filters)](/ref/notes/filters/angular_blur.md) -> + [Drop shadow (filters)](/ref/notes/filters/drop_shadow.md) \ No newline at end of file diff --git a/ref/notes/color (filters).md b/ref/notes/color (filters).md deleted file mode 100644 index d8d771d4..00000000 --- a/ref/notes/color (filters).md +++ /dev/null @@ -1,20 +0,0 @@ -## Color matrix filter -###### BYOND Version 513 - -Format: -+ filter(type="color", ...) - -Args: -+ color: A color matrix -+ space: Value indicating color space: defaults to `FILTER_COLOR_RGB` - -Applies a color matrix to this image. Unlike with the -atom.color var, you can apply color conversions other than the regular -RGBA color space, depending on the value of `space`. See [Color -space](/ref/appendix/color-space.md) for more information. - -> [!TIP] -> **See also:** -> + [color var (atom)](/ref/atom/var/color.md) -> + [Color matrix](/ref/notes/color-matrix.md) -> + [Color space](/ref/appendix/color-space.md) \ No newline at end of file diff --git a/ref/notes/color-gradient.md b/ref/notes/color-gradient.md index 8e746457..620137ed 100644 --- a/ref/notes/color-gradient.md +++ b/ref/notes/color-gradient.md @@ -1,44 +1,31 @@ -## Color gradient -###### BYOND Version 514 -A color gradient is a special list that defines a range of -colors that you can smoothly interpolate between. A simple example is a -gradient from red to white: -### Example: +## color-gradient (info) +*** +A color gradient is a special list that defines a range of colors that you can smoothly interpolate between. A simple example is a gradient from red to white: + ```dm + list("red", "white") // OR list(0, "red", 1, "white") + ``` -Applying a number like 0.2 to this -gradient would give you a color that\'s 20% of the way from red to -white. More complex gradients however are also possible. -The format of a gradient is a list that contains a number (the position -along the gradient, from 0 to 1 unless you use values outside that -range) followed by a color. You can have as complex a gradient as you -like. If you reuse the same number twice in a row, the gradient will -have a sudden color change at that point. +Applying a number like 0.2 to this gradient would give you a color that's 20% of the way from red to white. More complex gradients however are also possible. -It is also possible to skip numbers or colors, and they will be filled in automatically with -the previous number or color. The exceptions are at the beginning and -ends of the list; at the end of the gradient, the last color is assigned -a number 1 by default, and the first is assigned 0. If you skip colors -at the beginning, they will be filled in with the first color you use. +The format of a gradient is a list that contains a number (the position along the gradient, from 0 to 1 unless you use values outside that range) followed by a color. You can have as complex a gradient as you like. If you reuse the same number twice in a row, the gradient will have a sudden color change at that point. +It is also possible to skip numbers or colors, and they will be filled in automatically with the previous number or color. The exceptions are at the beginning and ends of the list; at the end of the gradient, the last color is assigned a number 1 by default, and the first is assigned 0. If you skip colors at the beginning, they will be filled in with the first color you use. -Include "loop" anywhere in the list to make this a looped -gradient. If you don\'t, any numbers outside the gradient\'s range will -be clamped to that range. E.g., in a normal gradient ranging from 0 to -1, a number of 1.2 is interpreted as 1 without a loop and 0.2 with a -loop. +Include "loop" anywhere in the list to make this a looped gradient. If you don't, any numbers outside the gradient's range will be clamped to that range. E.g., in a normal gradient ranging from 0 to 1, a number of 1.2 is interpreted as 1 without a loop and 0.2 with a loop. Here are some more examples: -### Example: + ```dm + // color wheel; ranges 0 to 6 and loops list(0, "#f00", 1, "#ff0", 2, "#0f0", 3, "#0ff", 4, "#00f", 5, "#f0f", 6, "#f00", "loop") @@ -48,31 +35,20 @@ list(0.1, "#f00", 0.3, "#ff0", 0.4, 0.6, "#008000", 0.7, 0.9, "#00f") // green and black stripes list(0.5, "#008000", 0.5, "#000000", "loop") + ``` - -You can -also include "space" in the list, and give it an associated value that -describes the color space this gradient uses to interpolate between -colors. For instance, `"space"=COLORSPACE_HSL` will use HSL -interpolation instead of the default RGB. See [Color -space](/ref/appendix/color-space.md) for more information. -### Example: + +You can also include "space" in the list, and give it an associated value that describes the color space this gradient uses to interpolate between colors. For instance, `"space"=COLORSPACE_HSL` will use HSL interpolation instead of the default RGB. See Color space for more information. + ```dm + // color wheel with a different color space list(0, "#f00", 3, "#0ff", 6, "#f00", "loop", "space"=COLORSPACE_HSLA) + ``` - -Currently, color gradients are only used by particle -effects and the [`gradient` proc](/ref/proc/gradient.md) With particles, if -you use a gradient the particle\'s color is given as a number, and that -number is used to look up its real color from the gradient. The number -can change over time, thus changing the particle\'s color. - -> [!TIP] -> **See also:** -> + [gradient proc](/ref/proc/gradient.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [Particle effects](/ref/notes/particles.md) -> + [Color space](/ref/appendix/color-space.md) \ No newline at end of file + + +Currently, color gradients are only used by particle effects and the `gradient` proc. With particles, if you use a gradient the particle's color is given as a number, and that number is used to look up its real color from the gradient. The number can change over time, thus changing the particle's color. +*** \ No newline at end of file diff --git a/ref/notes/color-matrix.md b/ref/notes/color-matrix.md index 9a07f608..1793d303 100644 --- a/ref/notes/color-matrix.md +++ b/ref/notes/color-matrix.md @@ -1,84 +1,32 @@ -## Color matrix -###### BYOND Version 509 -A color matrix is used to transform colors, in the same way -that a matrix represented by the `/matrix` datum is used to transform 2D -coordinates. A transformation matrix is 3x3, of which only 6 values are -needed because the last column is always the same. A color matrix, -because it transforms four different numbers instead of two, is 5x5. -``` - |rr rg rb ra 0| - |gr gg gb ga 0| - [r g b a 255] x |br bg bb ba 0| = [r' g' b' a' 255] - |ar ag ab aa 0| - |cr cg cb ca 1| -``` +## color-matrix (info) +*** +A color matrix is used to transform colors, in the same way that a matrix represented by the `/matrix` datum is used to transform 2D coordinates. A transformation matrix is 3x3, of which only 6 values are needed because the last column is always the same. A color matrix, because it transforms four different numbers instead of two, is 5x5. + +In that formula, values like `rg` mean "red to green", meaning that's the ratio of red in of green out. (The "c" is for "constant".) In an identity matrix, which just produces the original color, the values `rr`, `gg`, `bb`, and `aa` are all 1 and everything else is 0. + +In easier-to-understand terms, this is how the result is calculated: + -In easier-to-understand terms, this is how the result is -calculated: ```dm + new_red = red * rr + green * gr + blue * br + alpha * ar + 255 * cr new_green = red * rg + green * gg + blue * bg + alpha * ag + 255 * cg new_blue = red * rb + green * gb + blue * bb + alpha * ab + 255 * cb new_alpha = red * ra + green * ga + blue * ba + alpha * aa + 255 * ca + ``` - -It is helpful to think of each row in the matrix as what each component of the -original color will become. The first row of the matrix is the rgba -value you\'ll get for each unit of red; the second is what each green -becomes, and so on. -Because the fifth column of the matrix is -always the same, only 20 of the values need to be provided. You can use -a color matrix with atom.color or client.color in any of the following -ways: -+ **RGB-only (9 to 12 values)**: `list(rr,rg,rb, gr,gg,gb, br,bg,bb, cr,cg,cb)` -+ **RGBA (16 to 20 values)**: `list(rr,rg,rb,ra, gr,gg,gb,ga, br,bg,bb,ba, ar,ag,ab,aa, - cr,cg,cb,ca)` -+ **Row-by-row (3 to 5 `rgb()` values, or null to use the default row)**: `list(red_row, green_row, blue_row, alpha_row, constant_row)` -It can be easier to visualize colour matrices by spacing them outs: -```dm -var/list/c_matrix = list( - rr,rg,rb, - gr,gg,gb, - br,bg,bb) -``` +It is helpful to think of each row in the matrix as what each component of the original color will become. The first row of the matrix is the rgba value you'll get for each unit of red; the second is what each green becomes, and so on. -## Example -Here are simple colour matrices that can be used to set the colour of an atom. -```dm -var/list/red_color_matrix = list( 255, 0, 0, - 255, 0, 0, - 255, 0, 0 ) +Because the fifth column of the matrix is always the same, only 20 of the values need to be provided. You can use a color matrix with atom.color or client.color in any of the following ways: -var/list/green_color_matrix = list( 0, 255, 0, - 0, 255, 0, - 0, 255, 0 ) +Reading a color var that has been set to a matrix will return the full 20-item list, where every 4 items represent a row in the matrix (without the fifth column). -var/list/blue_color_matrix = list( 0, 0, 255, - 0, 0, 255, - 0, 0, 255 ) -``` -We can use the colours above to change the colour of any atom as follows: -```dm -mob/proc/SetColor(new_color) - switch(new_color) - if("red") - color = red_color_matrix - if("green") - color = green_color_matrix - if("blue") - color = blue_color_matrix -``` +In the `MapColors()` icon proc, the values are sent as arguments, not as a list. -Reading a color var that has been set to a matrix will return -the full 20-item list, where every 4 items represent a row in the matrix -(without the fifth column). +The color filter allows the use of other color spaces for a matrix. In those other color spaces, the matrix calculations work the same but instead of red, green, and blue, they'll be whatever values that color space uses. For instance an HSL color matrix uses hue in place of red, saturation in place of green, and luminance in place of blue. (Alpha is always alpha.) -> [!TIP] -> **See also:** -> + [color var (atom)](/ref/atom/var/color.md) -> + [color var (client)](/ref/client/var/color.md) -> + [MapColors proc (icon)](/ref/icon/proc/MapColors.md) -> + [Rainmeter ColorMatrix Guide (external link)](https://docs.rainmeter.net/tips/colormatrix-guide) +The way that works internally is that the shader will convert a color from RGB to the color space used by the matrix, then apply the matrix, then convert back to RGB. +*** \ No newline at end of file diff --git a/ref/notes/composite (filters).md b/ref/notes/composite (filters).md deleted file mode 100644 index 559a6010..00000000 --- a/ref/notes/composite (filters).md +++ /dev/null @@ -1,44 +0,0 @@ -## Layering (composite) filter -###### BYOND Version 513 - -Format: -+ filter(type="layer", ...) - -Args: -+ x: Horizontal offset of second image (defaults to 0) -+ y: Vertical offset of second image (defaults to 0) -+ icon: Icon to use as a second image -+ render_source: `render_target` to use as a second image -+ flags: `FILTER_OVERLAY` (default) or `FILTER_UNDERLAY` -+ color: [Color](/ref/atom/var/color.md) or color matrix to apply to second - image -+ transform: [Transform](/ref/atom/var/transform.md) to apply to second - image -+ blend_mode: [Blend mode](/ref/atom/var/blend_mode.md) to apply to the top - image - -Composites another image over or under this image. Using the -`FILTER_OVERLAY` flag, which is the default, puts the second image on -top of what\'s already here. `FILTER_UNDERLAY` puts it underneath. - -The `x` and `y` values can move the mask from its normal -position. By default, the second image is centered over the center of -the first. - -The `color`, `transform`, and `blend_mode` vars are -available for convenience. Because the bottom image is drawn over a -blank background, `blend_mode` is always applied to the top image. All -of the other vars apply to the second image being drawn. - -Note: -Transforms use default bilinear scaling, since -[PIXEL_SCALE](/ref/atom/var/appearance_flags.md) is not available here. - -Note: Like most other filters, this filter is **not** taken -into account for mouse-hit purposes. Any layered icons will be strictly -visual. - -> [!TIP] -> **See also:** -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [render_target var (atom)](/ref/atom/var/render_target.md) \ No newline at end of file diff --git a/ref/notes/displace (filters).md b/ref/notes/displace (filters).md deleted file mode 100644 index 5f07cb3f..00000000 --- a/ref/notes/displace (filters).md +++ /dev/null @@ -1,42 +0,0 @@ -## Displacement map filter -###### BYOND Version 513 - -Format: -+ filter(type="displace", ...) - -Args: -+ x: Horizontal offset of map (defaults to 0) -+ y: Vertical offset of map (defaults to 0) -+ size: Maximum distortion, in pixels -+ icon: Icon to use as a displacement map -+ render_source: `render_target` to use as a displacement map -+ flags: Defaults to 0; use see below for other flags - -> [!TIP] -> Amylizzle made a tool to create and test displacement maps. -> You can check it out and download it [Here](https://github.com/amylizzle/displacemaptester) - -Uses an icon or render target as a template for various warping -effects on the main image. Think of displacement as "pulling" a pixel from an offset -location. - -In the displacement map, pixels that -have a higher red component will make the image appear to warp to the -left, lower reds warp it to the right, and gray (r=128) will cause no -horizontal warping. The green component affects the vertical: higher to -warp upward, lower to warp downward. Transparent pixels in the -displacement map will have no effect. - -This can be used for very complex distortion, -unlike other distortion filters such as wave and -ripple that are confined to specific equations. - -The optional `FILTER_OVERLAY` flag is supported for the -`flags` argument, which will overlay the displaced image onto the -original. - -> [!TIP] -> **See also:** -> + [Alpha mask (filters)](/ref/notes/filters/alpha.md) -> + [icon var (atom)](/ref/atom/var/icon.md) -> + [render_target var (atom)](/ref/atom/var/render_target.md) diff --git a/ref/notes/drop_shadow (filters).md b/ref/notes/drop_shadow (filters).md deleted file mode 100644 index e9efdd63..00000000 --- a/ref/notes/drop_shadow (filters).md +++ /dev/null @@ -1,29 +0,0 @@ -## Drop shadow filter -###### BYOND Version 512 - -Format: -+ filter(type="drop_shadow", ...) - -Args: -+ **x**: Shadow horizontal offset (defaults to 1) -+ **y**: Shadow horizontal offset (defaults to -1) -+ **size**: Blur amount (defaults to 1; negative values create inset - shadows) -+ **offset**: Size increase before blur (defaults to 0) -+ **color**: Shadow color (defaults to 50% transparent black) - -Applies a drop shadow to this image. This is a combination of -multiple filters, since it will apply an outline if `offset` is -included, a Gaussian blur to the shadow, and will underlay the shadow -beneath the image. - -You can also think of this filter as an outer glow. - -If you use a `size` less than 0, the shadow will -appear inside the image instead. This would be an inset shadow, or inner -glow. - -> [!TIP] -> **See also:** -> + [Gaussian blur (filters)](/ref/notes/filters/blur.md) -> + [Outline (filters)](/ref/notes/filters/outline.md) \ No newline at end of file diff --git a/ref/notes/filters.md b/ref/notes/filters.md deleted file mode 100644 index ae716e43..00000000 --- a/ref/notes/filters.md +++ /dev/null @@ -1,41 +0,0 @@ -## Filter effects -###### BYOND Version 512 - -Filters are a way of adding special effects to an icon, or a -group of icons (see `KEEP_TOGETHER` in -[appearance_flags](/ref/atom/var/appearance_flags.md) ), by -post-processing the image. A filter object describes a specific form of -image processing, like for instance a blur or a drop shadow. Filters can -be added or removed at will, and can even be animated. - -A filter is created by using the [filter proc](/ref/proc/filter.md) like so: - -```dm -// halo effect -mob.filters += filter(type="drop_shadow", x=0, y=0,\ - size=5, offset=2, color=rgb(255,255,170)) -``` - -These are the filters currently supported: -- [Alpha mask](/ref/notes/filters/alpha.md) 513 -- [Angular blur](/ref/notes/filters/angular_blur.md) 513 -- [Bloom](/ref/notes/filters/bloom.md) 514 -- [Color matrix](/ref/notes/filters/color.md) 513 -- [Displacement map](/ref/notes/filters/displace.md) 513 -- [Drop shadow](/ref/notes/filters/drop_shadow.md) -- [Gaussian blur](/ref/notes/filters/blur.md) -- [Layering (composite)](/ref/notes/filters/layer.md) 513 -- [Motion blur](/ref/notes/filters/motion_blur.md) -- [Outline](/ref/notes/filters/outline.md) -- [Radial blur](/ref/notes/filters/radial_blur.md) 513 -- [Rays](/ref/notes/filters/rays.md) 513 -- [Ripple](/ref/notes/filters/ripple.md) 513 -- [Wave](/ref/notes/filters/wave.md) - -> [!TIP] -> **See also:** -> + [filters var (atom)](/ref/atom/var/filters.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [filter proc](/ref/proc/filter.md) -> + [animate proc](/ref/proc/animate.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file diff --git a/ref/notes/filters/alpha.md b/ref/notes/filters/alpha.md new file mode 100644 index 00000000..932a42d2 --- /dev/null +++ b/ref/notes/filters/alpha.md @@ -0,0 +1,11 @@ + +## alpha (info) +*** +Uses an icon or render target as a mask over this image. Every pixel that is transparent in either the image or the mask, is transparent in the result. + +The `x` and `y` values can move the mask from its normal position. By default, the mask is centered over the center of the image. + +The `MASK_INVERSE` flag will invert the alpha mask so that opaque areas in the mask become transparent, and vice-versa. There is also a `MASK_SWAP` flag which treats the source image as the mask and vice-versa, which might be useful for some effects. + +Note: Unlike many other filters, this filter **is** taken into account for mouse-hit purposes. +*** \ No newline at end of file diff --git a/ref/notes/filters/angular_blur.md b/ref/notes/filters/angular_blur.md new file mode 100644 index 00000000..54e34b83 --- /dev/null +++ b/ref/notes/filters/angular_blur.md @@ -0,0 +1,11 @@ + +## angular_blur (info) +*** +Blurs the image by a certain amount in a circular formation, as if the image is spinning. The size of the blur can roughly be thought of in "degrees" worth of blur. As the distance from the center increases, the blur becomes more noticeable since the same amount of angular motion has to travel farther along a circle. + +Typically this blur is used with an entire plane, but it could be used to give a sense of motion blur to a spinning object. + +Note: Large blurs will look worse toward the edges due to limited sampling. Loss of accuracy will appear where `size` × distance is greater than about 300. You can increase accuracy by breaking up large sizes into multiple filter passes with differing sizes. The blur used is Gaussian, so combining blur sizes A and B will give a total size of sqrt(A2+B2). + +The `offset` parameter, if used, is effectively subtracted from the pixel distance to the center. Pixels within that radius won't blur. Anything outside that radius will act as if it's `offset` pixels closer to the center. +*** \ No newline at end of file diff --git a/ref/notes/filters/bloom.md b/ref/notes/filters/bloom.md new file mode 100644 index 00000000..1ae19f16 --- /dev/null +++ b/ref/notes/filters/bloom.md @@ -0,0 +1,11 @@ + +## bloom (info) +*** +Post-processing effect that makes bright colors look like they're a strong light source, spreading their light additively to other nearby pixels. This is a complex effect that involves multiple shader passes. For both performance and visual reasons, it is usually best applied to an entire plane rather than to individual objects. + +The color `threshold` determines which pixels this effect applies to. If any of the red, green, or blue components of the pixel are greater than the same component for the threshold, that pixel will bloom. The blooming pixels then have their colors spread outward to create a glow that gets added to the original image. + +The `offset` and `size` parameters are used to control the glow effect. They work the same as they do in the drop shadow filter: `offset` causes the light to grow outwards, and a blur of `size` is then applied to soften it. Often just using a blur alone will produce a pleasing effect. By playing with these two values you can make the bloom effect appear differently. + +The `alpha` value is applied to any light contributions from bloomed pixels that get added to the original image, so values lower than 255 can make the effect less pronounced. This can be very useful if you choose to animate the filter. +*** \ No newline at end of file diff --git a/ref/notes/filters/blur.md b/ref/notes/filters/blur.md new file mode 100644 index 00000000..ee734147 --- /dev/null +++ b/ref/notes/filters/blur.md @@ -0,0 +1,9 @@ + +## blur (info) +*** +Blurs the image by a certain amount. The size of the blur can roughly be thought of in "pixels" worth of blur. + + +> [!TIP] +> Note: Large blurs will result in reduced performance. The highest size that can be handled easily in this filter is 6. Higher sizes require multiple passes, although the filter will "cheat" and use low-quality passes for much higher sizes. +*** \ No newline at end of file diff --git a/ref/notes/filters/color.md b/ref/notes/filters/color.md new file mode 100644 index 00000000..54ace666 --- /dev/null +++ b/ref/notes/filters/color.md @@ -0,0 +1,5 @@ + +## color (info) +*** +Applies a color matrix to this image. Unlike with the atom.color var, you can apply color conversions other than the regular RGBA color space, depending on the value of `space`. See Color space for more information. +*** \ No newline at end of file diff --git a/ref/notes/filters/displace.md b/ref/notes/filters/displace.md new file mode 100644 index 00000000..b23048fb --- /dev/null +++ b/ref/notes/filters/displace.md @@ -0,0 +1,11 @@ + +## displace (info) +*** +Uses an icon or render target as a template for various warping effects on the main image. Think of displacement as "pulling" a pixel from an offset location. + +In the displacement map, pixels that have a higher red component will make the image appear to warp to the left, lower reds warp it to the right, and gray (r=128) will cause no horizontal warping. The green component affects the vertical: higher to warp upward, lower to warp downward. Transparent pixels in the displacement map will have no effect. + +This can be used for very complex distortion, unlike other distortion filters such as wave and ripple that are confined to specific equations. + +The optional `FILTER_OVERLAY` flag is supported for the `flags` argument, which will overlay the displaced image onto the original. +*** \ No newline at end of file diff --git a/ref/notes/filters/drop_shadow.md b/ref/notes/filters/drop_shadow.md new file mode 100644 index 00000000..30a2eaba --- /dev/null +++ b/ref/notes/filters/drop_shadow.md @@ -0,0 +1,9 @@ + +## drop_shadow (info) +*** +Applies a drop shadow to this image. This is a combination of multiple filters, since it will apply an outline if `offset` is included, a Gaussian blur to the shadow, and will underlay the shadow beneath the image. + +You can also think of this filter as an outer glow. + +If you use a `size` less than 0, the shadow will appear inside the image instead. This would be an inset shadow, or inner glow. +*** \ No newline at end of file diff --git a/ref/notes/filters/index.md b/ref/notes/filters/index.md new file mode 100644 index 00000000..593399e7 --- /dev/null +++ b/ref/notes/filters/index.md @@ -0,0 +1,19 @@ + +## filters (info) +*** +Filters are a way of adding special effects to an icon, or a group of icons (see `KEEP_TOGETHER` in appearance_flags), by post-processing the image. A filter object describes a specific form of image processing, like for instance a blur or a drop shadow. Filters can be added or removed at will, and can even be animated. + +A filter is created by using the filter proc like so: + + +```dm + +// halo effect +mob.filters += filter(type="drop_shadow", x=0, y=0,\ + size=5, offset=2, color=rgb(255,255,170)) + +``` + + +These are the filters currently supported: +*** \ No newline at end of file diff --git a/ref/notes/filters/layer.md b/ref/notes/filters/layer.md new file mode 100644 index 00000000..ba0ebdb3 --- /dev/null +++ b/ref/notes/filters/layer.md @@ -0,0 +1,13 @@ + +## layer (info) +*** +Composites another image over or under this image. Using the `FILTER_OVERLAY` flag, which is the default, puts the second image on top of what's already here. `FILTER_UNDERLAY` puts it underneath. + +The `x` and `y` values can move the mask from its normal position. By default, the second image is centered over the center of the first. + +The `color`, `transform`, and `blend_mode` vars are available for convenience. Because the bottom image is drawn over a blank background, `blend_mode` is always applied to the top image. All of the other vars apply to the second image being drawn. + +Note: Transforms use default bilinear scaling, since PIXEL_SCALE is not available here. + +Note: Like most other filters, this filter is **not** taken into account for mouse-hit purposes. Any layered icons will be strictly visual. +*** \ No newline at end of file diff --git a/ref/notes/filters/motion_blur.md b/ref/notes/filters/motion_blur.md new file mode 100644 index 00000000..4b814bb6 --- /dev/null +++ b/ref/notes/filters/motion_blur.md @@ -0,0 +1,7 @@ + +## motion_blur (info) +*** +Applies Gaussian blur in one direction only. The amount and direction are both specified by `x` and `y`. The size of the blur is equal to `sqrt(x*x + y*y)`. + +See Gaussian blur for more information. +*** \ No newline at end of file diff --git a/ref/notes/filters/outline.md b/ref/notes/filters/outline.md new file mode 100644 index 00000000..e9dd9aca --- /dev/null +++ b/ref/notes/filters/outline.md @@ -0,0 +1,9 @@ + +## outline (info) +*** +Applies an outline to this image. + +At larger sizes, the outline is less accurate and will take more passes to produce. Performance and appearance are best at sizes close to 1 or less. + +`flags` can be a combination of the following values: +*** \ No newline at end of file diff --git a/ref/notes/filters/radial_blur.md b/ref/notes/filters/radial_blur.md new file mode 100644 index 00000000..203fc587 --- /dev/null +++ b/ref/notes/filters/radial_blur.md @@ -0,0 +1,11 @@ + +## radial_blur (info) +*** +Blurs the image by a certain amount outward from the center, as if the image is zooming in or out. As the distance from the center increases, the amount of blurring increases, and near the center the blur is hardly visible at all. The `size` value is smaller by default for this filter than it is for other filters, since it's typically used with an entire plane where the distance from the center can easily be several hundred pixels. + +Typically this blur is used with an entire plane. + +Note: Large blurs will look worse toward the edges due to limited sampling. Loss of accuracy will begin when `size` × distance is greather than 6. You can increase accuracy by breaking up large sizes into multiple filter passes. The blur used is Gaussian, so combining blur sizes A and B will give a total size of sqrt(A2+B2). + +The `offset` parameter, if used, is effectively subtracted from the pixel distance to the center. Pixels within that radius won't blur. Anything outside that radius will act as if it's `offset` pixels closer to the center. +*** \ No newline at end of file diff --git a/ref/notes/filters/rays.md b/ref/notes/filters/rays.md new file mode 100644 index 00000000..39638195 --- /dev/null +++ b/ref/notes/filters/rays.md @@ -0,0 +1,13 @@ + +## rays (info) +*** +Draws random rays that radiate outward from a center point. (That point may be outside of the image.) As they move outward, their alpha value diminishes linearly. These are meant to be animated. The `offset` value determines the "time", where every jump of +1 can be a very different set of rays, and every 1000 units this filter will repeat. + +The `threshold` value can be thought of as a way of culling lower-strength rays. Ray strength is anywhere from 0 to 1 at any given angle, but values below `threshold` may as well be 0. Values above that are re-scaled into a range of 0 to 1. + +The `factor` parameter allows you to tie the ray's length to its strength. At 0, the length of every ray is the same. At 1, the length ranges from 0 to `size`. Generally speaking, the higher `factor` is, the more the rays will appear to move outward as they strengthen and inward as they weaken. + +Ray `color` can be provided as a matrix. Only the diagonal values of the color matrix will be used, but using a matrix will allow you to set values outside of the normal color range. + +`flags` can have the following values: +*** \ No newline at end of file diff --git a/ref/notes/filters/ripple.md b/ref/notes/filters/ripple.md new file mode 100644 index 00000000..c02ee0c0 --- /dev/null +++ b/ref/notes/filters/ripple.md @@ -0,0 +1,13 @@ + +## ripple (info) +*** +Applies a ripple distortion effect to this image. + +This filter is meant to be animated. A good animation will typically start at a `radius` of 0 and animate to a larger value, with `size` decreasing to 0. + +The `falloff` parameter can be tweaked to your liking. A value of 1 should look reasonably like ripples in water, with the inner ripples losing strength. A value of 0 will cause no reduction in strength. + +The equation governing the ripple distortion is size × sin(2πr') ÷ (2.5 × falloff × r'2 + 1), where r' = (radius - distance) ÷ repeat. + +Up to 10 ripples can be stacked together in a single pass of the filter, as long as they have the same `repeat`, `falloff`, and `flags` values. (See the wave filter for the `WAVE_BOUNDED` flag.) +*** \ No newline at end of file diff --git a/ref/notes/wave (filters).md b/ref/notes/filters/wave.md similarity index 51% rename from ref/notes/wave (filters).md rename to ref/notes/filters/wave.md index 1813103d..b0f29616 100644 --- a/ref/notes/wave (filters).md +++ b/ref/notes/filters/wave.md @@ -1,27 +1,15 @@ -## Wave filter -###### BYOND Version 512 -Format: -+ filter(type="wave", ...) +## wave (info) +*** +Applies a wave distortion effect to this image. -Args: -+ x: Horiztonal direction and period of wave -+ y: Vertical direction and period of wave -+ size: Maximum distortion in pixels (defaults to 1) -+ offset: Phase of wave, in periods (e.g., 0 to 1) -+ flags: Defaults to 0; see below for other flags +The `x` and `y` parameters specify both the direction and period of the wave; the period is `sqrt(x*x + y*y)`. -Applies a wave distortion effect to this image. +This filter is meant to be animated, from whatever `offset` you want to `offset+1`, and then repeating. With multiple waves, you can produce a very convincing water effect. -The `x` and `y` parameters specify both the direction and period of the -wave; the period is `sqrt(x*x + y*y)`. - -This filter is meant to be animated, from whatever `offset` you want to `offset+1`, and then -repeating. With multiple waves, you can produce a very convincing water -effect. -### Example ```dm + #define WAVE_COUNT 7 atom/proc/WaterEffect() var/start = filters.len @@ -42,21 +30,13 @@ atom/proc/WaterEffect() f = filters[start+i] animate(f, offset=f:offset, time=0, loop=-1, flags=ANIMATION_PARALLEL) animate(offset=f:offset-1, time=rand()*20+10) + ``` - -The equation governing the wave distortion is size × -sin(2π(d - offset)), where d is the number of wave periods\' distance -from the center along the x, y direction. - -The `WAVE_SIDEWAYS` flag will cause the distortion to be transverse (perpendicular) to the -wave instead of in the same direction as the wave. The `WAVE_BOUNDED` -flag limits the distortion to the confines of this image, instead of -lettings its pixels spill out a little further from the distortion (and -likewise, transparent pixels spill inward). - -Up to 10 waves can be stacked together in a single pass of the filter, as long as they have -the same `WAVE_BOUNDED` flags. - -> [!TIP] -> **See also:** -> + [Ripple (filters)](/ref/notes/filters/ripple.md) \ No newline at end of file + + +The equation governing the wave distortion is size × sin(2π(d - offset)), where d is the number of wave periods' distance from the center along the x, y direction. + +The `WAVE_SIDEWAYS` flag will cause the distortion to be transverse (perpendicular) to the wave instead of in the same direction as the wave. The `WAVE_BOUNDED` flag limits the distortion to the confines of this image, instead of lettings its pixels spill out a little further from the distortion (and likewise, transparent pixels spill inward). + +Up to 10 waves can be stacked together in a single pass of the filter, as long as they have the same `WAVE_BOUNDED` flags. +*** \ No newline at end of file diff --git a/ref/notes/generators.md b/ref/notes/generators.md index 167b3b18..ff7f2c24 100644 --- a/ref/notes/generators.md +++ b/ref/notes/generators.md @@ -1,34 +1,9 @@ -## Generators -###### BYOND Version 514 - -A generator is an object that can produce a random number, -vector (list of 3 numbers), color (as a text string), or color matrix -(list of 20 numbers) in a specified range according to rules you set -down. It is used primarily for particle effects, since it can run on the -client. +## generators (info) +*** +A generator is an object that can produce a random number, vector (list of 3 numbers), color (as a text string), or color matrix (list of 20 numbers) in a specified range according to rules you set down. It is used primarily for particle effects, since it can run on the client. There are several types of generators: -- **Numbers:** Generate a random real number. -- **Vectors:** Generate a random vector. -- **Shapes:** Generate a random vector within a specific shaped - region. -- **Colors:** Generate a random color or color matrix. - - -Generators can also be chained together with math operators and -some procs. The second value can be a regular value instead of a -generator, so for instance you can multiply a vector by 2, or by a -matrix to transform it. - | Operators | Action | - | --- | --- | - | \+ - * / | Arithmetic operators. You can multiply a 3D vector by a color matrix (where red,green,blue in the matrix correspond to x,y,z) to do a 3D transform, or by a 2D matrix for a 2D transform. | - | \- (unary) | Negate the value, same as multiplying by -1. | - | turn(),\ generator.Turn() | Rotate a vector clockwise in the XY plane. | -> [!TIP] -> **See also:** -> + [Particle effects](/ref/notes/particles.md) -> + [generator proc](/ref/proc/generator.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [Color matrix](/ref/notes/color-matrix.md) \ No newline at end of file +Generators can also be chained together with math operators and some procs. The second value can be a regular value instead of a generator, so for instance you can multiply a vector by 2, or by a matrix to transform it. +*** \ No newline at end of file diff --git a/ref/notes/gliding.md b/ref/notes/gliding.md index 02f6d858..f8c89ffa 100644 --- a/ref/notes/gliding.md +++ b/ref/notes/gliding.md @@ -1,68 +1,17 @@ -## Gliding -+ [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -+ [glide_size var (movable atom)](/ref/atom/movable/var/glide_size.md) -+ [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) -+ [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) -+ [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) -+ [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) -+ [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) -+ [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) -+ [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) -+ [movement_mode var (world)](/ref/world/var/movement_mode.md) -+ [fps var (client)](/ref/client/var/fps.md) +## gliding (info) +*** +Gliding is a "glitz" effect applied by BYOND to cover up the visual sins of tile-based movement, by making objects and the map appear to move smoothly from one tile to another instead of immediately jumping. It is also available to smooth over small jumps in pixel movement that might occur, for instance if the client FPS is set higher than the server's. -Gliding is a "glitz" effect applied by BYOND to cover up the -visual sins of tile-based movement, by making objects and the map appear -to move smoothly from one tile to another instead of immediately -jumping. It is also available to smooth over small jumps in pixel -movement that might occur, for instance if the client FPS is set higher -than the server\'s. +To control the gliding speed of an atom, set glide_size to the value of your choice. If this is not set, the client will attempt to adjust the speed manually. glide_size is measured in server ticks, so if client.fps is set to a value greater than world.fps, it will be scaled appropriately. -To control the gliding speed of an atom, -set `glide_size` to the value of your choice. If this is not set, the -client will attempt to adjust the speed manually. `glide_size` is -measured in server ticks, so if `client.fps` is set to a value greater -than `world.fps`, it will be scaled appropriately. +Whether an object glides or jumps is based on how far it moves relative to its `step_size` value, which by default is a full tile width. If the movement goes too far past `step_size` in the X or Y directions, it's no longer a glide. -Whether an object glides or jumps is based on how far it moves relative to its -`step_size` value, which by default is a full tile width. If the -movement goes too far past `step_size` in the X or Y directions, it\'s -no longer a glide. +The `animate_movement` var can be used to control the way in which an object glides, or suppress gliding altogether. -To achieve smooth gliding, glide_size should be set to `step_size / ticks`, -where ticks is the number of world ticks that the movement should be gliding for. -This can be calculated `max(ceil(step_time / world.tick_lag),1)`. To achieve smooth -gliding in both pixel movement or tile movement modes, you can create a simple wrapper -around step() to set up your glide_size: +By using the `LONG_GLIDE` flag in `appearance_flags`, a diagonal glide will take just as long as a cardinal-direction glide by moving a fullt `glide_size` pixels in the dominant X or Y direction. Otherwise, gliding tries to move by that many pixels in strict Euclidean distance (a straight line) and diagonal glides take longer. -```dm -atom/movable - proc - Step(Dir=src.dir, Dist=src.step_size, Delay=world.tick_lag) - step_size = Dist - glide_size = step_size / max( ceil( Delay / world.tick_lag ) , 1 ) - return step(src,Dir) -``` - -The `animate_movement` var can be used to -control the way in which an object glides, or suppress gliding -altogether. - -By using the `LONG_GLIDE` flag in -`appearance_flags`, a diagonal glide will take just as long as a -cardinal-direction glide by moving a fullt `glide_size` pixels in the -dominant X or Y direction. Otherwise, gliding tries to move by that many -pixels in strict Euclidean distance (a straight line) and diagonal -glides take longer. > [!NOTE] -> In [LEGACY_MOVEMENT_MODE](/ref/world/var/movement_mode.md), gliding is -turned off if you set any of the bound or step vars for an atom to a -non-default value. The only gliding that occurs in this case is when -client.fps is higher than world.fps. All other movement modes base -gliding on an atom\'s `glide_size` value. - -> [!TIP] -> **See also:** -> + [Pixel movement](/ref/notes/pixel-movement.md) +> In LEGACY_MOVEMENT_MODE, gliding is turned off if you set any of the bound or step vars for an atom to a non-default value. The only gliding that occurs in this case is when client.fps is higher than world.fps. All other movement modes base gliding on an atom's `glide_size` value. +*** \ No newline at end of file diff --git a/ref/notes/index.md b/ref/notes/index.md new file mode 100644 index 00000000..8808051f --- /dev/null +++ b/ref/notes/index.md @@ -0,0 +1,5 @@ + +## {notes} (info) +*** +This section of the reference should help explain some concepts that may be harder to understand or that can use more clarification. +*** \ No newline at end of file diff --git a/ref/notes/isometric.md b/ref/notes/isometric.md index ba73e256..9e2d0636 100644 --- a/ref/notes/isometric.md +++ b/ref/notes/isometric.md @@ -1,126 +1,43 @@ -## Isometric maps - -![](data:image/png;charset=utf-8;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAAB4CAAAAACidfMWAAAGcklEQVR4XtzGoQ2AMBQE0BO/vpuwQi2qsiEoBsHWd4cuwQisg0OQ4ycsAOYETz3wd0CBmvIydYoYBMb1AgpU+MIxuP158578ZosIM1XsbubuY6qs4gCO/y4koFSmU7IxHdWYY8iI0cocLE3KJEsqyLDYBYKKEWkEEqSc+yAvYjfCjBmBehm+oZjELGeZL9HKuZI9KXPWLKpZrZxComR4721jc7/F5d77POece875/el2xj7z+sj3ueccI2ynDgC5J0MAAH7TAVxgZg6RK9qq8CYQNUFgdPpqgWaOJBe/3vtqqmOyMJKJf0u16XNMg46RCyTdArB5Cij4twQjLzhNgnoeKij4LsMCAChSiPQowIlGU6CvHs7PO70Mf4BypIVPA1SeMw46vijb2rccQQqShpumwtV8t0HQidSs5WeeDwZQmeS8vRHgSKsh0LdLMjPOWBGkKAkg6zGA0vP+F/Q+kZ52Nmfso1TXFXyIQ3Ps4GBhoh+Qbuut2DthLPNnGIA2sCpHirTnw0cXfYJO2b4p7wjxBPUDQBSilCFBXsch6PEB6tO+fmNH6PggQJRKJGiJG/IOOqN9WdbuHYQopUhRdUXeQGerjpY6wnyCEKUQCQp3j//B+6Hq85LWiX5BiFKHZNkcP+wJOrf2YHHzJC8g4SiLG1jnx+oDK18JNwbC6QerqqT+6v0rim42BUKUiqRfarqKVtxCAUKUWqRfaz8sXHkrFQhRKpHO1+0ueO02ahCiVCH9XrfrpeIpjCBEySf9Ub89r2QqMwhRskl/1rfnlkyjAAlBUbxt/Wt9m7VvukdUIICKpEO8LNIF+5as0xHj9VA/3AMDVKCjkA39mB5iP3gX7a3Plc3wkg+IogDhx08o6VJD87Pld3gBIYoOhChxpIF3Nj1THukDhCgaEKJEkf5ubHqqYqYfEKJoQIgSQbq8YWPam7MMgBBFA0JUoElDGzcsWR1lEIQoGhCiAkm68l7j4tV3mQAhigaEqECRrjY1LFpzt0kQouhAiOJPGt5kX1gZTQFCFA0IUbxJ/7z/1vzK2ZQgRNGAEMWTdO2D+iQSwwBCFA0IUbxI11rXPUBiGUGIogMhip3075a6e21xHECIQhANipU0srU2wRbPt4cA5rP1FEtcXHfUxO1L4N1DaTAgpKeQhKD26pjOxAD0EI+eookL57bqaNt93HtIVE95kpw7q+7U5nLvIcE9hSRw7aqaqc3j3kOiewpJrj3aDC2Zew+J7ikkuTu1adqD3HtIdE8hyb3PNrlqAfceEt5TSOqyhWsp3HtIeE8hqdsWqj3CvYck9pQlMdi2mHsPSe0pS08S9x6S3FMWN+8ektZTSOLbQxJ7Ckmce0h+TyGJvYcU6SmMC8aeSZO73ltc6Kw9JG098SAhSmYPIYoShCQ6FIIk9xTx/1+tztpDQtcTY78Q6aw9JGw9Mf5rq87aQ0LWE3NxoQvoIbb1xHwC6gJ6iH49oQt1XUAP0a0n9K9TdA49xH89YXrphSgESe4pwvRqElEIktxThM8LZF1WDyEKQWZI+JpfS/RAyeohRCHIDAm/jNESxqLaJPcQgJXzV2aYHpT5kAbAtJ7w/WJTfk8Rvl8/y+8pwnmTgPSeIvy3csjtKSJgw43QniICtkUJ7SkiYPOa0J4iArYYCu0pImYjqLieIuK264rpKSJ3UzX/niJyt77z7ymixgEFnWcPiSThMZKyiAD0FIJEkvCwz6rp/HvKKv9IFt+eImodnGPvKaLW8Ub2niJqHUJl7ymi3lFhtp4iah7opu8pou6xewoUgpS/HAFRNCD5JLzConCSQRSCVCXhRSMFEw2gEKQyCa+DeTnMHwpB8kmNjhuA7lk+Lu15MdQ3CkHySaX2G4Dvo31erZTnBSUAhNui+E3s7lO29eW5If8nxY+iEKQSyR4LABDpCxW3V7etq8iZMA4KQYEet7EpAYAv3Ibm5ONRLSMef+pwuAVNEHCfhO7Ortlbr49ZYLVKvPKPfRL379wT0+akAEh54qV+bIx1nPxUmRks8WJG/jP3oKMtdodLJon/zPuspXVOB6JUvGuy634ACDOBSj58jKwdvTD4Eia9Yg9xijmcFLfX5X6y2y1sgiDAs6Cn4e2Edz/JHlTygzc0mgphYSZRKSmfLrvmKtymIil1FFBRA2Yn4jKMbM9YKuyJJ2AOJC/NyRwS98ETMOXlIHD+A3oxNU80orubAAAAAElFTkSuQmCC) - -Isometric projection is a form of pseudo-3D in which the 2D -icons used by BYOND can be arranged in a way to give the appearance of -three dimensions. If you look at a map top-down, each tile on the map is -a square. The map is rotated 45° clockwise and then tilted at an angle -(30°) so that each square now looks like a foreshortened diamond from -the viewer\'s perspective. What was once north now points to the -northeast end of the viewer\'s screen; what was once east now points -southeast to the viewer. Tiles that are more to the south or east are -"nearer" to the viewer, and tiles that are north or west are -"farther". The actual direction the map faces can be changed by using -`client.dir`. - -It is important to remember that this is an -illusion of 3D, not real 3D. - -To use isometric mapping, set -`world.map_format` to `ISOMETRIC_MAP`. You should set `world.icon_size` -so the tile width is a multiple of 4 pixels. The width of the tile is -highly important. The height of your tiles should be at least half that -value. BYOND uses a 2:1 isometric format, meaning that the diamond base -of each tile is half as high as its width. For example if you have a -64x64 tile size, every diamond in the map will be 64 pixels wide by 32 -high, and you have an extra 32 pixels at the top of your icon for -vertical projections like buildings. If you set the tile size to 64x80, -the base is still a 64x32 diamond and you have 48 pixels left over for -vertical structures. - -In this mode `pixel_x` and `pixel_y` will -offset icons along the "ground". To adjust horizontal and vertical -positions, use the `pixel_w` and `pixel_z` vars. - -### Layers - -The `layer` var behaves differently in isometric mode. Because -some tiles are nearer to the viewer than others, the tiles that are -farther back need to be drawn first so they are behind any tiles that -should go in front of them. So in isometric mode, the back row of tiles -(a diagonal line of them) is drawn first, followed by the next row -forward, and so on. The `layer` var only matters when icons overlap each -other in the "physical" space, like an obj sitting on a turf. - - -When pixel or step offsets, or gliding, place an object on -multiple turfs, it is drawn on top of the nearer turf (assuming its -layer is higher). - -Using icons wider than the regular tile size -can have an impact on layering as well. See [Big -icons](/ref/notes/big-icons.md) for more information. - -Because of the order in which icons are drawn, you may want to limit the ability -of an atom to cut diagonally around corners. While moving northeast -behind a dense wall, for instance, a mob might temporarily appear in -front of the wall because its pixel offsets (from gliding) temporarily -put it on the same tile as the wall. If you do not want to limit -corner-cutting, a simple workaround for this case is to give the wall a -higher layer than the mob. - -Screen objects (in `client.screen`) -are always drawn on top of all isometric tiles, as is the case in other -map modes as well. - -Since it may be desirable in some games to -use a topdown map for some situations (like a special battle map), you -can add `TOPDOWN_LAYER` to any atom\'s layer---e.g., -`TOPDOWN_LAYER+TURF_LAYER`---to make it appear in topdown mode. Topdown -and isometric tiles really aren\'t meant to be mixed, but if they do mix -you\'ll see topdown tiles always display above isometric tiles, just -like screen objects do. The best way to use this is to apply -`TOPDOWN_LAYER` to every tile in a certain part of the map that the -players can\'t walk to. - -If you want to use an overlay that -should not be covered by other "nearer" icons on the map, such as a -name or health meter, you can add `EFFECTS_LAYER` to the overlay\'s -layer. Icons with `EFFECTS_LAYER` will draw above regular icons. Then -objects with `TOPDOWN_LAYER` will draw on top of everything else. -However, be aware that `EFFECTS_LAYER` has largely been superseded by -the `plane` var. - -### Screen size - -In this mode, `world.view` or `client.view` is used to define -the minimum number of map tiles you will see, *not* the screen/HUD size -which is calculated from client.view. Extra map tiles are shown to fill -out the screen size. HUD objects use screen coordinates, so 1,1 is still -the lower left. - -The actual HUD size is always a full number of -tiles, whose size is defined by `world.icon_size`. If you have a tile -size of `64x64`, and `world.view=6` (a 13x13 map), a full 13x13 diamond -of map tiles will be shown. The width of this diamond is 13 tiles. The -height is only half that, plus whatever vertical space is needed to show -the icons in that area. Then everything is rounded up to a full tile -size, so the result is a 13x7-tile screen. This is the formula you need -if you want to calculate the screen size: + +## isometric (info) +*** +Isometric projection is a form of pseudo-3D in which the 2D icons used by BYOND can be arranged in a way to give the appearance of three dimensions. If you look at a map top-down, each tile on the map is a square. The map is rotated 45° clockwise and then tilted at an angle (30°) so that each square now looks like a foreshortened diamond from the viewer's perspective. What was once north now points to the northeast end of the viewer's screen; what was once east now points southeast to the viewer. Tiles that are more to the south or east are "nearer" to the viewer, and tiles that are north or west are "farther". The actual direction the map faces can be changed by using `client.dir`. + +It is important to remember that this is an illusion of 3D, not real 3D. + +To use isometric mapping, set `world.map_format` to `ISOMETRIC_MAP`. You should set `world.icon_size` so the tile width is a multiple of 4 pixels. The width of the tile is highly important. The height of your tiles should be at least half that value. BYOND uses a 2:1 isometric format, meaning that the diamond base of each tile is half as high as its width. For example if you have a 64x64 tile size, every diamond in the map will be 64 pixels wide by 32 high, and you have an extra 32 pixels at the top of your icon for vertical projections like buildings. If you set the tile size to 64x80, the base is still a 64x32 diamond and you have 48 pixels left over for vertical structures. + +In this mode `pixel_x` and `pixel_y` will offset icons along the "ground". To adjust horizontal and vertical positions, use the `pixel_w` and `pixel_z` vars. + +The `layer` var behaves differently in isometric mode. Because some tiles are nearer to the viewer than others, the tiles that are farther back need to be drawn first so they are behind any tiles that should go in front of them. So in isometric mode, the back row of tiles (a diagonal line of them) is drawn first, followed by the next row forward, and so on. The `layer` var only matters when icons overlap each other in the "physical" space, like an obj sitting on a turf. + +When pixel or step offsets, or gliding, place an object on multiple turfs, it is drawn on top of the nearer turf (assuming its layer is higher). + +Using icons wider than the regular tile size can have an impact on layering as well. See Big icons for more information. + +Because of the order in which icons are drawn, you may want to limit the ability of an atom to cut diagonally around corners. While moving northeast behind a dense wall, for instance, a mob might temporarily appear in front of the wall because its pixel offsets (from gliding) temporarily put it on the same tile as the wall. If you do not want to limit corner-cutting, a simple workaround for this case is to give the wall a higher layer than the mob. + +Screen objects (in `client.screen`) are always drawn on top of all isometric tiles, as is the case in other map modes as well. + +Since it may be desirable in some games to use a topdown map for some situations (like a special battle map), you can add `TOPDOWN_LAYER` to any atom's layer—e.g., `TOPDOWN_LAYER+TURF_LAYER`—to make it appear in topdown mode. Topdown and isometric tiles really aren't meant to be mixed, but if they do mix you'll see topdown tiles always display above isometric tiles, just like screen objects do. The best way to use this is to apply `TOPDOWN_LAYER` to every tile in a certain part of the map that the players can't walk to. + +If you want to use an overlay that should not be covered by other "nearer" icons on the map, such as a name or health meter, you can add `EFFECTS_LAYER` to the overlay's layer. Icons with `EFFECTS_LAYER` will draw above regular icons. Then objects with `TOPDOWN_LAYER` will draw on top of everything else. However, be aware that `EFFECTS_LAYER` has largely been superseded by the `plane` var. + +In this mode, `world.view` or `client.view` is used to define the minimum number of map tiles you will see, *not* the screen/HUD size which is calculated from client.view. Extra map tiles are shown to fill out the screen size. HUD objects use screen coordinates, so 1,1 is still the lower left. + +The actual HUD size is always a full number of tiles, whose size is defined by `world.icon_size`. If you have a tile size of `64x64`, and `world.view=6` (a 13x13 map), a full 13x13 diamond of map tiles will be shown. The width of this diamond is 13 tiles. The height is only half that, plus whatever vertical space is needed to show the icons in that area. Then everything is rounded up to a full tile size, so the result is a 13x7-tile screen. This is the formula you need if you want to calculate the screen size: + + ```dm + pixel_width = round(icon_width * (view_width + view_height) / 2) pixel_height = round(icon_width * (view_width + view_height - 2) / 4) + icon_height screen_width = round((pixel_width + icon_width - 1) / icon_width) screen_height = round((pixel_height + icon_height - 1) / icon_height) + ``` -If you use `TOPDOWN_LAYER`, any topdown sections of -the map will be limited to this same view. - -> [!TIP] -> **See also:** -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [dir var (client)](/ref/client/var/dir.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Side-view maps](/ref/notes/side.md) -> + [Topdown maps](/ref/notes/topdown.md) -> + [HUD](/ref/notes/HUD.md) -> + [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -> + [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -> + [TOPDOWN_LAYER](/ref/notes/topdown_layer.md) \ No newline at end of file + +If you use `TOPDOWN_LAYER`, any topdown sections of the map will be limited to this same view. +*** \ No newline at end of file diff --git a/ref/notes/motion_blur (filters).md b/ref/notes/motion_blur (filters).md deleted file mode 100644 index 0a221945..00000000 --- a/ref/notes/motion_blur (filters).md +++ /dev/null @@ -1,22 +0,0 @@ -## Motion blur filter -###### BYOND Version 512 - - -Format: -+ filter(type="motion_blur", ...) - -Args: -+ x: Blur vector on the X axis (defaults to 0) -+ y: Blur vector on the Y axis (defaults to 0) - - -Applies Gaussian blur in one direction only. The amount and -direction are both specified by `x` and `y`. The size of the blur is -equal to `sqrt(x*x + y*y)`. - -See [Gaussian blur](/ref/notes/filters/blur.md) for more information. - -> [!TIP] -> **See also:** -> + [filters var (atom)](/ref/atom/var/filters.md) -> + [Gaussian blur (filters)](/ref/notes/filters/blur.md) \ No newline at end of file diff --git a/ref/notes/notes.md b/ref/notes/notes.md deleted file mode 100644 index 4f22bace..00000000 --- a/ref/notes/notes.md +++ /dev/null @@ -1,36 +0,0 @@ -## Special notes - - -This section of the reference should help explain some concepts -that may be harder to understand or that can use more clarification. - -**Language features** -+ [Numbers](/ref/notes/numbers.md) -+ [Regular expressions](/ref/notes/regex.md) -+ [Unicode](/ref/notes/Unicode.md) - -**Icons** -+ [Big icons](/ref/notes/big-icons.md) -+ [Tiled icons](/ref/notes/tiled-icons.md) - -**Map formats** -+ [Topdown maps](/ref/notes/topdown.md) -+ [Isometric maps](/ref/notes/isometric.md) -+ [Side-view maps](/ref/notes/side.md) - -**Movement** -+ [Gliding](/ref/notes/gliding.md) -+ [Pixel movement](/ref/notes/pixel-movement.md) - -**Display** -+ [Understanding the renderer](/ref/notes/renderer.md) -+ [HUD / screen objects](/ref/notes/HUD.md) -+ [Color matrix](/ref/notes/color-matrix.md) -+ [Filter effects](/ref/notes/filters.md) -+ [Particle effects](/ref/notes/particles.md) -+ [Color gradient](/ref/notes/color-gradient.md) -+ [Generators](/ref/notes/generators.md) -+ [Projection matrix](/ref/notes/projection-matrix.md) -+ [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -+ [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -+ [TOPDOWN_LAYER](/ref/notes/TOPDOWN_LAYER.md) \ No newline at end of file diff --git a/ref/notes/numbers.md b/ref/notes/numbers.md index d32cfd19..29c4ef68 100644 --- a/ref/notes/numbers.md +++ b/ref/notes/numbers.md @@ -1,73 +1,41 @@ -## Numbers +## numbers (info) +*** +In DM, all numbers are stored in floating point format. Specifically, single-precision (32-bit) floating point. This is important to know if you think you will be working with large numbers or decimal values a lot, because the accuracy of the numbers is limited. -In DM, all numbers are stored in floating point format. -Specifically, single-precision (32-bit) floating point. This is -important to know if you think you will be working with large numbers or -decimal values a lot, because the accuracy of the numbers is limited. +32-bit floating point numbers can represent integers from -16777216 to 16777216 (224). Non-integer values can get about as small as 2-126 and as large as 2127. +Floating point numbers do not handle most decimal values precisely. For instance, 0.1 is not exactly 0.1, because floating point numbers are stored in a binary format and in binary, 1/10 is a fraction that repeats forever—the same way 1/3 repeats as 0.33333... in decimal numbers. It ends up being rounded off, either a little higher or a littler lower than its true value. This means that the following loop won't work like you might expect: -32-bit floating point numbers can represent integers from --16777216 to 16777216 (2^24^). Non-integer values can get about as small -as 2^-126^ and as large as 2^127^. - -Floating point numbers do -not handle most decimal values precisely. For instance, 0.1 is not -exactly 0.1, because floating point numbers are stored in a binary -format and in binary, 1/10 is a fraction that repeats forever---the same -way 1/3 repeats as 0.33333... in decimal numbers. It ends up being -rounded off, either a little higher or a littler lower than its true -value. This means that the following loop won\'t work like you might -expect: -### Example: ```dm + for(i = 0, i < 100, i += 0.1) world << i + ``` -You might expect that code to loop exactly 1000 times, with `i` -going from 0 up to 99.9 before stopping. The truth is more complicated, -because 0.1 stored in floating point is actually greater than the exact -value of 0.1. Other values might be more or less than their exact -numbers, and as you add these numbers together repeatedly you\'ll -introduce more and more rounding error. - -Even more insidious, if -you add 0.1 a bunch of times starting from 0, and then subtract it out -again the same number of times, the result you get may not be 0. This is -counterintuitive, because you might expect rounding errors to reverse -themselves in the same order they crept in. Unfortunately it doesn\'t -work that way. - -You can correct for rounding error somewhat by -using the [`round` proc](/ref/proc/round.md) to adjust the loop var each time, -although for performance reasons it might be preferable to find another -alternative. + +You might expect that code to loop exactly 1000 times, with `i` going from 0 up to 99.9 before stopping. The truth is more complicated, because 0.1 stored in floating point is actually greater than the exact value of 0.1. Other values might be more or less than their exact numbers, and as you add these numbers together repeatedly you'll introduce more and more rounding error. + +Even more insidious, if you add 0.1 a bunch of times starting from 0, and then subtract it out again the same number of times, the result you get may not be 0. This is counterintuitive, because you might expect rounding errors to reverse themselves in the same order they crept in. Unfortunately it doesn't work that way. + +You can correct for rounding error somewhat by using the `round` proc to adjust the loop var each time, although for performance reasons it might be preferable to find another alternative. + + ```dm + for(i = 0, i < 100, i = round(i + 0.1, 0.1)) world << i + ``` -Only fractions whose denominators are -powers of 2 are immune to this rounding error, so 0.5 is in fact stored -as an exact value. -Another place floating point may lose -accuracy is when you try to add numbers of very different sizes. For -instance as stated above, the upper limit for accurate integers is -16777216. If you try to use a number such as 100 million it will only be -approximate, so adding 1 to that number won\'t actually change it -because the 1 is so much smaller, it will be gobbled up by rounding -error. +Only fractions whose denominators are powers of 2 are immune to this rounding error, so 0.5 is in fact stored as an exact value. -Also for the same reasons stated above, division will -cost you accuracy. Again you can divide by powers of 2 easily enough, -and you can divide an integer by any of its factors (like dividing 9 by -3) without a problem, but a fraction like 1/3 will repeat forever so it -gets rounded to as much precision as floating point can manage. +Another place floating point may lose accuracy is when you try to add numbers of very different sizes. For instance as stated above, the upper limit for accurate integers is 16777216. If you try to use a number such as 100 million it will only be approximate, so adding 1 to that number won't actually change it because the 1 is so much smaller, it will be gobbled up by rounding error. +Also for the same reasons stated above, division will cost you accuracy. Again you can divide by powers of 2 easily enough, and you can divide an integer by any of its factors (like dividing 9 by 3) without a problem, but a fraction like 1/3 will repeat forever so it gets rounded to as much precision as floating point can manage. -In decimal, floating point numbers have at least six decimal -digits of precision. Since they\'re actually stored in binary, their -true precision is exactly 24 bits. \ No newline at end of file +In decimal, floating point numbers have at least six decimal digits of precision. Since they're actually stored in binary, their true precision is exactly 24 bits. +*** \ No newline at end of file diff --git a/ref/notes/outline (filters).md b/ref/notes/outline (filters).md deleted file mode 100644 index 67e149ec..00000000 --- a/ref/notes/outline (filters).md +++ /dev/null @@ -1,29 +0,0 @@ -## Outline filter -###### BYOND Version 512 - -Format: -+ filter(type="outline", ...) - -Args: -+ size: Width in pixels (defaults to 1) -+ color: Outline color (defaults to black) -+ flags: Defaults to 0 (see below) - -Applies an outline to this image. - -At larger sizes, the -outline is less accurate and will take more passes to produce. -Performance and appearance are best at sizes close to 1 or less. - -`flags` can be a combination of the following values: -0 -+ Ordinary outline -OUTLINE_SHARP -+ Avoid antialiasing in the outline -OUTLINE_SQUARE -+ Extend the outline sharply from corner pixels; for a box this will - maintain a box shape without rounded corners - -> [!TIP] -> **See also:** -> + [Drop shadow (filters)](/ref/notes/filters/drop_shadow.md) \ No newline at end of file diff --git a/ref/notes/particles.md b/ref/notes/particles.md index 597d9fff..2d5a8065 100644 --- a/ref/notes/particles.md +++ b/ref/notes/particles.md @@ -1,37 +1,17 @@ -## Particle effects -###### BYOND Version 514 +## particles (info) +*** +A particle set is a special effect, whose computations are handled entirely on the client, that spawns and tracks multiple pixels or icons with a temporary lifespan. Examples of this might be confetti, sparks, rocket exhaust, or rain or snow. Particles are rendered on a special surface and that gets attached to an obj or a mob like an overlay. +Particles can exist in 3 dimensions instead of the usual 2, so a particle's position, velocity, and other values may have a z coordinate. To make use of this z coordinate, you can use a projection matrix. (The value of the z coordinate must be between -100 and 100 after projection. Otherwise it's not guaranteed the particle will be displayed.) -A particle set is a special effect, whose computations are -handled entirely on the client, that spawns and tracks multiple pixels -or icons with a temporary lifespan. Examples of this might be confetti, -sparks, rocket exhaust, or rain or snow. Particles are rendered on a -special surface and that gets attached to an obj or a mob like an -overlay. +To create a particle set, use `new` to create a new `/particles` datum, and then you can set the datum's vars. The vars can be set to constant values, or generator functions that will allow the client to choose from a range of values when spawning those particles. (The easiest way to handle this is to create your own type that inherits from `/particles`, and set up the parameters you'll want at compile-time.) -Particles can exist in 3 dimensions instead of the -usual 2, so a particle\'s position, velocity, and other values may have -a z coordinate. To make use of this z coordinate, you can use a -[projection matrix](/ref/notes/projection-matrix.md) . (The value of the -z coordinate must be between -100 and 100 after projection. Otherwise -it\'s not guaranteed the particle will be displayed.) +After the datum is created, it can be assigned to an obj or mob using their `particles` var. The particles will appear on the map wherever that obj or mob appears. -To create -a particle set, use `new` to create a new `/particles` datum, and then -you can set the datum\'s vars. The vars can be set to constant values, -or generator functions that will allow the client to choose from a range -of values when spawning those particles. (The easiest way to handle this -is to create your own type that inherits from `/particles`, and set up -the parameters you\'ll want at compile-time.) - -After the datum -is created, it can be assigned to an obj or mob using their `particles` -var. The particles will appear on the map wherever that obj or mob -appears. -### Example: ```dm + particles/snow width = 500 // 500 x 500 image to cover a moderately sized map height = 500 @@ -53,82 +33,9 @@ obj/snow mob proc/CreateSnow() client?.screen += new/obj/snow -``` - - -> [!IMPORTANT] -> These are the vars -that can be used in a particle set.\ -> "Tick" refers to a BYOND standard -tick of 0.1s.\ -> -> The following vars are ignored if no `icon` is specified: -> - grow -> - spin - - ### Particle vars that affect the entire set (generators are not allowed for these) - | Var | Type | Description | - | --- | --- | --- | - | width | num | Size of particle canvas in pixels. Particles will not render outside this canvas | - | height | num | Size of particle canvas in pixels. Particles will not render outside this canvas | - | count | num | Maximum particle count | - | spawning | num | Number of particles to spawn per tick (can be fractional) | - | bound1 | vector | Minimum particle position in x,y,z space; defaults to list(-1000,-1000,-1000) | - | bound2 | vector | Maximum particle position in x,y,z space; defaults to list(1000,1000,1000) | - | gravity | vector | Constant acceleration applied to all particles in this set (pixels per squared tick) | - | gradient | [color gradient](/ref/notes/color-gradient.md) | Color gradient used, if any | - | transform | [matrix](/ref/notes/projection-matrix.md) | Transform done to all particles, if any (can be higher than 2D) | - ### Vars that apply when a particle spawns - | Var | Type | Description | - | --- | --- | --- | - | lifespan | num | Maximum life of the particle, in ticks | - | fade | num | Fade-out time at end of lifespan, in ticks | - | fadein | num | Fade-in time, in ticks | - | icon | icon | Icon to use, if any; no icon means this particle will be a dot
Can be assigned a weighted list of icon files, to choose an icon at random | - | icon_state | text | Icon state to use, if any
Can be assigned a weighted list of strings, to choose an icon at random | - | color | num or color | Particle color (not a color matrix); can be a number if a gradient is | - | color_change | num | Color change per tick; only applies if gradient is used | - | position | num | x,y,z position, from center in pixels | - | velocity | num | x,y,z velocity, in pixels | - | scale | vector (2D) | Scale applied to icon, if used; defaults to list(1,1) | - | grow | num | Change in scale per tick; defaults to list(0,0) | - | rotation | num | Angle of rotation (clockwise); applies only if using an icon | - | spin | num | Change in rotation per tick | - | friction | num | Amount of velocity to shed (0 to 1) per tick, also applied to acceleration from drift | - - ### Vars that are evalulated every tick - | Var | Type | Description | - | --- | --- | --- | - | drift | vector | Added acceleration every tick; e.g. a circle or sphere generator can be applied to produce snow or ember effects | - -The `icon` and `icon_state` values are special in that they -can\'t be assigned a generator, but they can be assigned a constant icon -or string, respectively, or a list of possible values to choose from -like so: -```dm -icon = list('confetti.dmi'=5, 'coin.dmi'=1) ``` -The list used can either be a simple -list, or it can contain weights as shown above. - -Changing a var -on a particle datum will make changes to future particles. For instance, -you can set the datum\'s `spawning` var to 0 to make it stop creating -new particles. (Note: If you are changing a vector or color matrix, such -as `gravity`, you need to assign a new value. You can\'t for instance -set `particles.gravity[2] = 0` because it won\'t do anything to update -the particle stream.) - -The same particle datum can be assigned -to more than one movable atom. However the particles displayed by each -atom will be different. -> [!TIP] -> **See also:** -> + [particles (movable atom var)](/ref/atom/movable/var/particles.md) -> + [Generators](/ref/notes/generators.md) -> + [generator proc](/ref/proc/generator.md) -> + [Projection matrix](/ref/notes/projection-matrix.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) +These are the vars that can be used in a particle set. "Tick" refers to a BYOND standard tick of 0.1s. +*** \ No newline at end of file diff --git a/ref/notes/pixel-movement.md b/ref/notes/pixel-movement.md index 1d7118b0..d1e169c0 100644 --- a/ref/notes/pixel-movement.md +++ b/ref/notes/pixel-movement.md @@ -1,159 +1,43 @@ -## Pixel movement -###### BYOND Version 490 +## pixel-movement (info) +*** +Pixel movement is a concept that allows atoms to escape the constraints of BYOND's historically tile-based movement, and move in smaller steps. In the past this had to be done with soft code, but that was sometimes inconvenient and it did not perform as well in projects with many objects moving. +The key to understanding pixel movement is to use the bound and step vars. You use the bound family of vars to define a bounding box for a movable atom, instead of just making it one full tile in size. The step vars can give it a movement speed and offset it from the corner of the tile it's standing on. -Pixel movement is a concept that allows atoms to escape the -constraints of BYOND\'s historically tile-based movement, and move in -smaller steps. In the past this had to be done with soft code, but that -was sometimes inconvenient and it did not perform as well in projects -with many objects moving. +Those are for movable atoms only; they do not apply to turfs. -The key to understanding pixel -movement is to use the bound and step vars. You use the bound family of -vars to define a bounding box for a movable atom, instead of just making -it one full tile in size. The step vars can give it a movement speed and -offset it from the corner of the tile it\'s standing on. -- bound_x: The left edge of the bounding box -- bound_y: The bottom edge of the bounding box -- bound_width: Width of the bounding box -- bound_height: Height of the bounding box -- step_size: default movement speed -- step_x: x offset from the corner of loc -- step_y: y offset from the corner of loc +If world.movement_mode is set to `TILED_MOVEMENT_MODE`, all movable atoms must be aligned to the tile grid: their step_x/y/size values must be multiples of the icon size, and their bounds must also land on tile boundaries although the atom can be bigger than one tile. In other movement modes you can specify that only specific atoms use this behavior, by giving them the TILE_MOVER appearance flag. +**Left:** The bounding box (blue) is the only part of the mob that actually collides with anything. By default, it would cover the whole turf (brown). Any turfs covered by the bounding box are in the mob's locs var. **Right:** The atom's true position (shaded) is offset from the turf by step_x and step_y. -Those are for movable atoms only; they do not apply to turfs. +As an example, if your players' mobs have icons that only cover the center 24×24 pixels of a regular 32×32 icon, then you would set the mobs' bound_x and bound_y to 4--because there are 4 pixels unused to the left and bottom--and bound_width and bound_height to 24. + +The mob's physical location on the map depends on four things: Its loc, its step_x/y values, its bound_x/y values, and its bound_width/height. The lower left corner of the bounding box, relative to the turf the mob is actually standing on, begins at step_x+bound_x on the left and step_y+bound_y on the bottom. + +The physical position of the bounding box is **not affected** by the pixel_x/y/z vars. Those are still strictly visual offsets. + +The turfs the mob is covering can be read from the read-only locs var. The mob will also appear in the contents of those turfs. + +Note: This means if an atom is in a turf's contents, its loc is *not necessarily* that turf. The contents list is made to include "overhangers" from another tile for ease of use. + +All of the step and walk procs have been upgraded to take an additional argument, which is the speed at which the atom should move. If that argument is left out, the atom's own step_size is used by default. The step_size determines how fast the step_x and step_y values will change when moving. + +Move() has two new arguments that handle the position change gracefully. These are the step_x and step_y values for the target location. + +Pixel movement changes the behavior of the Move() proc, because a lot of things are possible that were not possible when BYOND only supported moving one tile at a time. For starters, a Move() is either a "slide" or a "jump" depending on the distance. A slide is when the move can be stopped partway; a jump is strictly pass/fail. Anything greater than one tile *and* the mover's regular step_size is considered a jump. Changing z levels is also a jump, as is moving to/from a non-turf. + +If step_x and step_y aren't within a good range, the new loc and the step_x/y values may be changed so that the southwest corner of the mover's bounding box is standing on its actual loc, or as close to it as possible. + +Enter() and Exit() can be called for several turfs and/or areas, not just one at a time. It is also possible for them not to be called at all, if the moving atom moves within a turf but doesn't cross a new turf boundary. Enter() and Exit() are only called when first attempting to enter or fully exit. The behavior of these procs depends on world.movement_mode; in legacy mode, they look at some of the contents of the turfs as well as the turfs themselves, to preserve behavior found in older BYOND versions. + +Cross() and Uncross() are the equivalent of Enter() and Exit() but apply to objects the mover will either overlap or stop overlapping. (For turfs, Enter() and Exit() call these procs by default, since the mover is both stepping *into* and *onto* a turf.) Likewise Crossed() and Uncrossed() are the equivalents of Entered() and Exited(). + +If an atom is sliding, its movement can be halted if it encounters an obstacle partway along its route. Bump() will still be called for any obstacles the atom runs into, but Move() will return the number of pixels moved (the most in any direction). When sliding at a speed so fast that the distance is bigger than the atom itself, the move will be split up into several smaller slides to avoid skipping over any obstacles. + +Gliding, which is used to show smooth movement between atoms in tile movement, is mostly not used in pixel movement. It only applies when the client uses a higher fps than the server. +The bounds() and obounds() procs have been added to grab a list of atoms within a given bounding box. That box can be relative to an atom, or in absolute coordinates. -If [world.movement_mode](/ref/world/var/movement_mode.md) is -set to `TILED_MOVEMENT_MODE`, all movable atoms must be aligned to the -tile grid: their step_x/y/size values must be multiples of the icon -size, and their bounds must also land on tile boundaries although the -atom can be bigger than one tile. In other movement modes you can -specify that only specific atoms use this behavior, by giving them the -[TILE_MOVER](/ref/atom/var/appearance_flags.md) appearance flag. - -### Bounding boxes - -As an example, if your players\' mobs have icons that only -cover the center 24×24 pixels of a regular 32×32 icon, then you would -set the mobs\' bound_x and bound_y to 4\--because there are 4 pixels -unused to the left and bottom\--and bound_width and bound_height to 24. - -The mob\'s physical location on the map depends on four things: -Its loc, its step_x/y values, its bound_x/y values, and its -bound_width/height. The lower left corner of the bounding box, relative -to the turf the mob is actually standing on, begins at step_x+bound_x on -the left and step_y+bound_y on the bottom. - -The physical -position of the bounding box is **not affected** by the pixel_x/y/z -vars. Those are still strictly visual offsets. - -The turfs the -mob is covering can be read from the read-only locs var. The mob will -also appear in the contents of those turfs. - -Note: This means if -an atom is in a turf\'s contents, its loc is *not necessarily* that -turf. The contents list is made to include "overhangers" from another -tile for ease of use. - -### Movement - -All of the step and walk procs have been upgraded to take an -additional argument, which is the speed at which the atom should move. -If that argument is left out, the atom\'s own step_size is used by -default. The step_size determines how fast the step_x and step_y values -will change when moving. - -Move() has two new arguments that -handle the position change gracefully. These are the step_x and step_y -values for the target location. - -Pixel movement changes the -behavior of the Move() proc, because a lot of things are possible that -were not possible when BYOND only supported moving one tile at a time. -For starters, a Move() is either a "slide" or a "jump" depending on -the distance. A slide is when the move can be stopped partway; a jump is -strictly pass/fail. Anything greater than one tile *and* the mover\'s -regular step_size is considered a jump. Changing z levels is also a -jump, as is moving to/from a non-turf. - -If step_x and step_y -aren\'t within a good range, the new loc and the step_x/y values may be -changed so that the southwest corner of the mover\'s bounding box is -standing on its actual loc, or as close to it as possible. - -Enter() and Exit() can be called for several turfs and/or -areas, not just one at a time. It is also possible for them not to be -called at all, if the moving atom moves within a turf but doesn\'t cross -a new turf boundary. Enter() and Exit() are only called when first -attempting to enter or fully exit. The behavior of these procs depends -on [world.movement_mode](/ref/world/var/movement_mode.md) ; in legacy -mode, they look at some of the contents of the turfs as well as the -turfs themselves, to preserve behavior found in older BYOND versions. - -Cross() and Uncross() are the equivalent of Enter() and Exit() -but apply to objects the mover will either overlap or stop overlapping. -(For turfs, Enter() and Exit() call these procs by default, since the -mover is both stepping *into* and *onto* a turf.) Likewise Crossed() and -Uncrossed() are the equivalents of Entered() and Exited(). - -If an atom is sliding, its movement can be halted if it encounters an -obstacle partway along its route. Bump() will still be called for any -obstacles the atom runs into, but Move() will return the number of -pixels moved (the most in any direction). When sliding at a speed so -fast that the distance is bigger than the atom itself, the move will be -split up into several smaller slides to avoid skipping over any -obstacles. - -Gliding, which is used to show smooth movement -between atoms in tile movement, is mostly not used in pixel movement. It -only applies when the client uses a higher -[fps](/ref/client/var/fps.md) than the server. - -### Pixel procs - -The bounds() and obounds() procs have been added to grab a list -of atoms within a given bounding box. That box can be relative to an -atom, or in absolute coordinates. - -bounds_dist() tells the -distance between two atoms, in pixels. If it is positive, that is the -minimum distance the atoms would have to traverse to be touching. At 0, -they are touching but not in collision. A negative value means the two -atoms are in collision. - -> [!TIP] -> **See also:** -> *Bounding boxes* -> + [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) -> + [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) -> + [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) -> + [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) -> + [icon_w var (atom)](/ref/atom/var/icon_w.md) -> + [icon_z var (atom)](/ref/atom/var/icon_z.md) - -> *Speed and position* -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) -> + [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) -> + [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) -> + [locs list var (movable atom)](/ref/atom/movable/var/locs.md) -> + [contents list var (atom)](/ref/atom/var/contents.md) -> + [fps var (world)](/ref/world/var/fps.md) - -> *Movement* -> + [Move proc (movable atom)](/ref/atom/movable/proc/Move.md) -> + [Cross proc (atom)](/ref/atom/proc/Cross.md) -> + [Crossed proc (atom)](/ref/atom/proc/Crossed.md) -> + [Uncross proc (atom)](/ref/atom/proc/Uncross.md) -> + [Uncrossed proc (atom)](/ref/atom/proc/Uncrossed.md) -> + [movement_mode var (world)](/ref/world/var/movement_mode.md) -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) - -> *Other topics* -> + [bounds proc](/ref/proc/bounds.md) -> + [bounds_dist proc](/ref/proc/bounds_dist.md) -> + [Gliding](/ref/notes/gliding.md) \ No newline at end of file +bounds_dist() tells the distance between two atoms, in pixels. If it is positive, that is the minimum distance the atoms would have to traverse to be touching. At 0, they are touching but not in collision. A negative value means the two atoms are in collision. +*** \ No newline at end of file diff --git a/ref/notes/projection-matrix.md b/ref/notes/projection-matrix.md index 93981a04..6e9d4d97 100644 --- a/ref/notes/projection-matrix.md +++ b/ref/notes/projection-matrix.md @@ -1,113 +1,41 @@ -## Projection matrix -###### BYOND Version 514 -Note: Currently this feature applies only to particle effects, -using the `transform` var. +## projection-matrix (info) +*** +Note: Currently this feature applies only to particle effects, using the `transform` var. -Normally icons in BYOND can only be -transformed in 2D, using a simple 3x3 matrix. This is represented by the -`/matrix` object, which cuts off the last column because it isn\'t used. -However particles can have coordinates in x, y, and z, and the whole -particle set can be given a transformation matrix that handles all three -dimensions. +Normally icons in BYOND can only be transformed in 2D, using a simple 3x3 matrix. This is represented by the `/matrix` object, which cuts off the last column because it isn't used. However particles can have coordinates in x, y, and z, and the whole particle set can be given a transformation matrix that handles all three dimensions. -### Simple 2D transforms +The easiest transformation for particles is a simple 2D one, which you can do by setting the particle datum's `transform` var to a `/matrix` object. -The easiest transformation for particles is a simple 2D one, -which you can do by setting the particle datum\'s `transform` var to a -`/matrix` object. -``` - a d 0 - x y 1 * b e 0 = x' y' 1 - c f 1 -``` +When an x,y point is multiplied by the matrix, it becomes the new point x',y'. This is equivalent to: -When an x,y point is multiplied by the matrix, it becomes the -new point x\',y\'. This is equivalent to: -``` - x' = a*x + b*y + c - y' = d*x + e*y + f -``` +This is called an **affine transform** because all the operations are "linear" in math terms. (That is, every term in the formula above has a single variable, not raised to a higher power than 1.) -This is called an **affine transform** because all the -operations are "linear" in math terms. (That is, every term in the -formula above has a single variable, not raised to a higher power than -1.) +3D affine transforms of this type are also affine transformations. There is no special object for this so a list is used (see below). -### 3x4 matrix (x,y,z with translation) +The way to read the vars above is that the first letter says what input component is being transformed (x,y,z, or c for "constant"), and the second letter is the output component. -3D affine transforms of this type are also affine -transformations. There is no special object for this so a list is used -(see below). -``` - xx xy xz 0 - x y z 1 * yx yy yz 0 = x' y' z' 1 - zx zy zz 0 - cx cy cz 1 -``` +To use this kind of matrix, you can cut off the 4th column and provide the values in a list form, in row-major order: -The way to read the vars above is that the first letter says -what input component is being transformed (x,y,z, or c for -"constant"), and the second letter is the output component. -``` - x' = xx*x + yx*y + zx*z + cx - y' = xy*x + yy*y + zy*z + cy - z' = xz*x + yz*y + zz*z + cz -``` - -To use this kind of matrix, you can cut off the 4th column and -provide the values in a list form, in row-major order: ```dm list(xx,xy,xz, yx,yy,yz, zx,zy,zz, cx,cy,cz) ``` + Note the 4th row is also optional. -### 4x4 matrix (x,y,z,w with projection) +This is the most interesting matrix, since if you use all 4 columns you're actually altering an "axis" called w. This isn't a real axis, but is just a number that the resulting vector will be divided by. -This is the most interesting matrix, since if you use all 4 -columns you\'re actually altering an "axis" called w. This isn\'t a -real axis, but is just a number that the resulting vector will be -divided by. -``` - xx xy xz xw - x y z 1 * yx yy yz yw = x'w' y'w' z'w' w' - zx zy zz zw - wx wy wz ww - - w' = xw*x + yw*y + zw*z + ww - x' = (xx*x + yx*y + zx*z + wx) / w' - y' = (xy*x + yy*y + zy*z + wy) / w' - z' = (xz*x + yz*y + zz*z + wz) / w' -``` +In a regular affine transform, w always stays at 1. In projection you can think of w as a distance from the "camera". 1 is where objects are their "normal" size. If you make the z value affect w' by setting zw, you basically make an object look smaller at higher z values. -In a regular affine transform, w always stays at 1. In -projection you can think of w as a distance from the "camera". 1 is -where objects are their "normal" size. If you make the z value affect -w\' by setting zw, you basically make an object look smaller at higher z -values. +This is a simple projection matrix where x,y,z are left untouched, but there's a projection effect. The "D" value is how far away the "camera" is from z=0, so a point at z=D looks like it's twice as far away. + +This 4x4 matrix is handled as a list just like the 3x4 affine matrix: -This is a simple projection matrix where x,y,z are left -untouched, but there\'s a projection effect. The "D" value is how far -away the "camera" is from z=0, so a point at z=D looks like it\'s -twice as far away. -``` - 1 0 0 0 - 0 1 0 0 - 0 0 1 1/D - 0 0 0 1 -``` -This 4x4 matrix is handled as a list just like the 3x4 affine -matrix: ```dm list(xx,xy,xz,xw, yx,yy,yz,yw, zx,zy,zz,zw, wx,wy,wz,ww) ``` -> [!TIP] -> **See also:** -> + [Particle effects](/ref/notes/particles.md) -> + [transform var (atom)](/ref/atom/var/transform.md) -> + [matrix](/ref/matrix.md) -> + [Color matrix](/ref/notes/color-matrix.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/notes/radial_blur (filters).md b/ref/notes/radial_blur (filters).md deleted file mode 100644 index 68f878da..00000000 --- a/ref/notes/radial_blur (filters).md +++ /dev/null @@ -1,33 +0,0 @@ -## Radial blur filter -###### BYOND Version 513 - -Format: -+ filter(type="radial_blur", ...) - -Args: -+ x: Horizontal center of effect, in pixels, relative to image center -+ y: Vertical center of effect, in pixels, relative to image center -+ size: Amount of blur per pixel of distance (defaults to 0.01) - -Blurs the image by a certain amount outward from the center, as -if the image is zooming in or out. As the distance from the center -increases, the amount of blurring increases, and near the center the -blur is hardly visible at all. The `size` value is smaller by default -for this filter than it is for other filters, since it\'s typically used -with an entire plane where the distance from the center can easily be -several hundred pixels. - -Typically this blur is used with an -entire plane. - -Note: Large blurs will look worse toward the -edges due to limited sampling. Loss of accuracy will begin when `size` × -distance is greather than 6. You can increase accuracy by breaking up -large sizes into multiple filter passes. The blur used is Gaussian, so -combining blur sizes A and B will give a total size of sqrt(A^2^+B^2^). - -> [!TIP] -> **See also:** -> + [Gaussian blur (filters)](/ref/notes/filters/blur.md) -> + [Angular blur (filters)](/ref/notes/filters/angular_blur.md) -> + [Motion blur (filters)](/ref/notes/filters/motion_blur.md) \ No newline at end of file diff --git a/ref/notes/rays (filters).md b/ref/notes/rays (filters).md deleted file mode 100644 index 4b6b34b9..00000000 --- a/ref/notes/rays (filters).md +++ /dev/null @@ -1,49 +0,0 @@ -# Rays filter -###### BYOND Version 513 -Format: -+ filter(type="rays", ...) - -Args: -+ x: Horiztonal position of ray center, relative to image center - (defaults to 0) -+ y: Vertical position of ray center, relative to image center - (defaults to 0) -+ size: Maximum length of rays (defaults to 1/2 tile width) -+ color: Ray color (defaults to white) -+ offset: "Time" offset of rays (defaults to 0, repeats after 1000) -+ density: Higher values mean more, narrower rays (defaults to 10, - must be whole number) -+ threshold: Low-end cutoff for ray strength (defaults to 0.5, can be - 0 to 1) -+ factor: How much ray strength is related to ray length (defaults to - 0, can be 0 to 1) -+ flags: Defaults to `FILTER_OVERLAY | FILTER_UNDERLAY` (see below) - -Draws random rays that radiate outward from a center point. -(That point may be outside of the image.) As they move outward, their -alpha value diminishes linearly. These are meant to be animated. The -`offset` value determines the "time", where every jump of +1 can be a -very different set of rays, and every 1000 units this filter will -repeat. - -The `threshold` value can be thought of as a way of -culling lower-strength rays. Ray strength is anywhere from 0 to 1 at any -given angle, but values below `threshold` may as well be 0. Values above -that are re-scaled into a range of 0 to 1. - -The `factor` -parameter allows you to tie the ray\'s length to its strength. At 0, the -length of every ray is the same. At 1, the length ranges from 0 to -`size`. Generally speaking, the higher `factor` is, the more the rays -will appear to move outward as they strengthen and inward as they -weaken. - -Ray `color` can be provided as a matrix. Only the -diagonal values of the color matrix will be used, but using a matrix -will allow you to set values outside of the normal color range. - -`flags` can have the following values: -+ `0`: The rays are drawn alone, erasing the existing image (useful for some effects). -+ `FILTER_OVERLAY`: The rays are overlaid on top of the existing image. -+ `FILTER_UNDERLAY`: The rays are drawn underneath the existing image. -+ `FILTER_OVERLAY \| FILTER_UNDERLAY`: Default. For plane masters, this will use the `FILTER_OVERLAY` behavior and draw the rays over the plane, and for all other images it will default to `FILTER_UNDERLAY` to draw the rays beneath them. \ No newline at end of file diff --git a/ref/notes/regex.md b/ref/notes/regex.md index d69b353b..60a16c34 100644 --- a/ref/notes/regex.md +++ b/ref/notes/regex.md @@ -1,101 +1,7 @@ -## Regular expressions -Regular expressions are patterns that can be searched for -within a text string, instead of searching for an exact match to a known -piece of text. They are much more versatile for find and replace -operations, and therefore useful for parsing, filtering, etc. +## regex (info) +*** +Regular expressions are patterns that can be searched for within a text string, instead of searching for an exact match to a known piece of text. They are much more versatile for find and replace operations, and therefore useful for parsing, filtering, etc. Some example regular expressions are: - -| Pattern | Code | Meaning | -| --- | --- | --- | -| B.*D | regex("B.*D") | Find `B`, followed by any number of characters (including none), followed by a `D`. | -| [0-3] | regex(@"[0-3]") | Find any digit from 0 to 3 | -| foo\|bar | regex("foo\|bar","i") | Find `foo` or `bar`, case-insensitive | -| \\d+ | regex(@"\\d+","g") | Find all sequences of digits | - -These are some of the patterns you can use. If you want to use -any of the operators as an actual character, it must be escaped with a -backslash. - -It is highly recommended that you use [raw strings](/ref/DM/text.md) like `@"..."` for your regular expression patterns, -because with a regular DM string you have to escape all backslash `\` -and open bracket `[` characters, which will make your regular expression -much harder for you to read. It\'s easier to write `@"[\d]\n"` than -`"[\\d]\\n"`. - -|Pattern | Matches | -| --- | --- | -| a\b | *a* or *b* | -| . | Any character (except a line break) | -| \^ | Beginning of text; or line if `m` flag is used | -| \$ | End of text; or line if `m` flag is used | -| \\A | Beginning of text | -| \\Z | End of text | -| [*chars*] | Any character between the brackets. Ranges can be specified with a hyphen, like 0-9. Character classes like `\d` and `\s` can also be used (see below). | -| [\^*chars*] | Any character NOT matching the ones between the brackets. | -| \\b | Word break | -| \\B | Word non-break | -| (*pattern*) | Capturing group: the pattern must match, and its contents will be captured in the group list. | -| (?:*pattern*) | Non-capturing group: Match the pattern, but do not capture its contents. | -| \\1 *through* \\9 | Backreference; `\`*`N`* is whatever was captured in the *N*th capturing group. | - -### Modifiers - Modifiers are "greedy" by default, looking for the longest match possible. When following a word, they only apply to the last character.\ - ||| - | --- | --- | - | *a** | Match *a* zero or more times | - | *a*+ | Match *a* one or more times | - | *a*? | Match *a* zero or one time | - | *a*{*n*} | Match *a*, exactly *n* times | - | *a*{*n*,} | Match *a*, *n* or more times | - | *a*{*n*,*m*} | Match *a*, *n* to *m* times - |*modifier*? | Make the previous modifier non-greedy (match as little as possible) | - -### Escape codes and character classes - ||| - | --- | --- | - | \\x*NN* | Escape code for a single character, where *NN* is its hexadecimal ASCII value | - | \\u*NNNN* | Escape code for a single 16-bit Unicode character, where *NNNN* is its hexadecimal value | - | \\U*NNNNNN* | Escape code for a single 21-bit Unicode character, where *NNNNNN* is its hexadecimal value | - | \\d | Any digit 0 through 9 | - |\\D | Any character except a digit or line break | - |\\l | Any letter A through Z, case-insensitive | - |\\L | Any character except a letter or line break| - |\\w | Any identifier character: digits, letters, or underscore | - |\\W | Any character except an identifier character or line break | - |\\s | Any space character | - |\\S | Any character except a space or line break | - -### Assertions - ||| - | --- | --- | - | (?=*pattern*) | Look-ahead: Require this pattern to come next, but don\'t include it in the match | - | (?!*pattern*) | Look-ahead: Require this pattern NOT to come next | - | (?<=*pattern*) | Look-behind: Require this pattern to come before, but don\'t include it in the match (must be a fixed byte length) | - |(? [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [regex proc](/ref/proc/regex.md) -> + [findtext proc](/ref/proc/findtext.md) -> + [replacetext proc](/ref/proc/replacetext.md) -> + [splittext proc](/ref/proc/splittext.md) -> + [REGEX_QUOTE proc](/ref/proc/REGEX_QUOTE.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/notes/renderer.md b/ref/notes/renderer.md new file mode 100644 index 00000000..86513384 --- /dev/null +++ b/ref/notes/renderer.md @@ -0,0 +1,61 @@ + +## renderer (info) +*** +To get the most out of BYOND's visual effects, it helps to understand how the map is displayed. + +Every atom has an appearance that holds all of its visual info (and sometimes a little non-visual info). This appearance has to be turned into sprites in order to be rendered. + +Although many atoms need little more than a simple icon and icon_state and produce only a single sprite, some are more complex with overlays, underlays, maptext, etc. Also there may be image objects and visual contents involved, although they're not part of the atom's appearance. + +For a simple `icon` and `icon_state`, just one sprite is generated. The client looks up the icon it's given. Then it looks up an icon state, which may be influenced by whether the atom is moving or not since you can have moving and non-moving icon states. Then it determines which direction to draw and which frame of the icon's animation (if any) to use. + +So with several simple icons, and not worrying about layers for now, a list of sprites lays out like this: + +Now let's consider what happens when an appearance has overlays. + +The underlays list is processed first, then overlays. These lists contain appearances themselves, rather than actual atoms. This means that overlays are recursive: an overlay can have overlays itself. To picture how that works, just replace one of the overlays above with another list. + +Any atom can have an image object attached, which can be shown to only specific players. Most atoms, and image objects, can have visual contents that display other atoms as if they're overlays. + +As you see this is very similar to overlays. Just like overlays, image objects and visual contents have appearances of their own (and may also have their own images or visual contents), so this may be recursive as they add new overlays, etc. + +A couple of things to keep in mind: + +Any appearance may have maptext attached. That maptext draws above the icon but is grouped with it. That grouping will be discussed further below. + +Particle effects also get grouped with the main icon in a similar way to maptext. + +For simplicity, from this point forward the diagram will just treat underlays, overlays, image objects, and visual contents as overlays. + +An appearance's color and alpha vars (from here forwarded they'll just be referred to by `color`) and transform are inherited by any overlays, which also includes images and visual contents. You can avoid that inheritance by giving those overlays special appearance_flags: `RESET_COLOR`, `RESET_ALPHA`, and `RESET_TRANSFORM`. + +The appearance's filters are only applied to the main icon. + +When `color` and `transform` are inherited, they "stack". The inherited color and transform values are applied after those of the overlays. + +There are times it's desirable for an appearance and all its overlays to be treated as a single unit so any colors or filters can be applied all at once. One simple example is if the appearance has an `alpha` of 128 to make it translucent, you probably want to draw the whole atom faded instead of drawing each sprite faded, one on top of the other. + +By using the `KEEP_TOGETHER` value in appearance_flags (called KT for short), an appearance will group all of its underlays and overlays together. If this is an atom with image objects and visual contents, those will be grouped with it as well. + +With `KEEP_TOGETHER` all of these sprites are rendered to a temporary drawing surface, and then the main appearance's `color`, `transform`, and `filters` are all applied to the combined drawing. This comes with a trade-off, since you can no longer use flags such as `RESET_COLOR` to opt out of inheritance. + +If an overlay doesn't want to be part of a KT group, it can use the `KEEP_APART` flag (KA for short). If there are multiple nested KT groups, KA will only escape the innermost group. + +If an overlay inside a KT group has a different plane than the group's owner, it will be separated as if it defined `KEEP_APART`, except it can escape multiple nested groups. + +Any appearance can have a layer or plane, and these influence how it gets sorted. (There's also a concept called a "sub-plane" that's influenced by whether an atom is a HUD/screen object or special layers like BACKGROUND_LAYER.) + +If a sprite is created with `FLOAT_LAYER` (any negative value counts as a floating layer) its layer has to be resolved, or "unfloated". The main sprite for an atom can never float; it has to have a real layer. Its overlays and underlays with floating layers will reorder themselves in numerical order, then look for the next closest sprites in the rendering list that has a non-negative layer. + +A similar process happens with `FLOAT_PLANE`. Planes can have negative values but `FLOAT_PLANE` and the values close to it are special. Sprites with floating planes have to resolve those as well. + +Once all atoms that will appear on the map are assembled into a rendering list of sprites, the order in which they're rendered on the map is determined in this order: + +In a typical topdown map, `layer` is basically all that matters after the plane and subplane are taken into account. There is a legacy concept called micro-layers that helps break ties between sprites with the same layer; for instance if an atom is moving it's usually desirable to draw it above other atoms with the same layer; this applies only to topdown maps. + +Sometimes it's helpful to group multiple sprites on one plane as if the plane itself were a KT group. For this, appearance_flags has a value called `PLANE_MASTER`. An object with this flag will act as a "parent" for everything else on the plane. All other sprites on the plane will be grouped together and rendered on a temporary drawing surface, and then the plane master's `color`, `transform`, and `filters` will be applied. + +A plane master does not, however, get an icon or maptext of its own; they're simply ignored. It can have overlays added to the group. + +There are other topics not covered in this article, such as render targets and special map formats. Any details on how those features impact rendering are discussed in their own articles. +*** \ No newline at end of file diff --git a/ref/notes/rendering/SIDE_MAP sort.md b/ref/notes/rendering/SIDE_MAP sort.md deleted file mode 100644 index c2dd2bd2..00000000 --- a/ref/notes/rendering/SIDE_MAP sort.md +++ /dev/null @@ -1,19 +0,0 @@ -## SIDE_MAP Topological Sorting - -The topological sort for SIDE_MAP is determined in the following order: - -- If two icons don't overlap visually, they don't care about their relative order. -- If one icon is physically completely in front of the other, draw it later. -- If one has a higher layer, draw it later. -- If one's physical near-Y (edge toward the bottom of the screen) is nearer, draw it later. -- If both icons have the exact same physical bounds, use their original order to determine which draws first. -- If one icon's virual center X is further left, draw it first. -- Break all remaining ties with the original order. - -> [!NOTE] -> The first condition that is met determines the drawing order - -> [!TIP] -> **See Also:** -> - [Understanding the Rendereer](ref/notes/rendering/overview.md) -> - [map_format var (world)](/ref/world/var/map_format.md) \ No newline at end of file diff --git a/ref/notes/rendering/overview.md b/ref/notes/rendering/overview.md deleted file mode 100644 index 6dedd24c..00000000 --- a/ref/notes/rendering/overview.md +++ /dev/null @@ -1,325 +0,0 @@ -## Understanding the renderer - - -To get the most out of BYOND\'s visual effects, it helps to -understand how the map is displayed. - -Every atom has an -[appearance](/ref/atom/var/appearance.md) that holds all of its visual info -(and sometimes a little non-visual info). This appearance has to be -turned into sprites in order to be rendered. - -Although many -atoms need little more than a simple [icon](/ref/atom/var/icon.md) and -[icon_state](/ref/atom/var/icon_state.md) and produce only a single -sprite, some are more complex with overlays, underlays, maptext, etc. -Also there may be [image objects](/ref/image.md) and [visual -contents](/ref/atom/var/vis_contents.md) involved, although they\'re not part -of the atom\'s appearance. - -For a simple `icon` and -`icon_state`, just one sprite is generated. The client looks up the icon -it\'s given. Then it looks up an icon state, which may be influenced by -whether the atom is moving or not since you can have moving and -non-moving icon states. Then it determines which -[direction](/ref/atom/var/dir.md) to draw and which frame of the icon\'s -animation (if any) to use. - -So with several simple icons, and -not worrying about layers for now, a list of sprites lays out like this: -::::::: renderlist -::: renderlist-box -Atom #1 -::: -::: renderlist-box -Atom #2 -::: -::: renderlist-label -⋮ -::: -::: renderlist-box -Atom #N -::: -::::::: -### Overlays and underlays - - -Now let\'s consider what happens when an appearance has -overlays. -:::::::::: renderlist -::: renderlist-box -Underlay #1 -::: -::: renderlist-label -⋮ -::: -::: renderlist-box -Underlay #N -::: -::: renderlist-box -Main icon -::: -::: renderlist-box -Overlay #1 -::: -::: renderlist-label -⋮ -::: -::: renderlist-box -Overlay #N -::: -:::::::::: - - -The [underlays](/ref/atom/var/underlays.md) list is processed -first, then [overlays](/ref/atom/var/overlays.md) . These lists contain -appearances themselves, rather than actual atoms. This means that -overlays are recursive: an overlay can have overlays itself. To picture -how that works, just replace one of the overlays above with another -list. -:::::::::: renderlist -::: renderlist-box -Underlay #1 -::: -::: renderlist-box -Underlay #2 -::: -::: renderlist-box -Main icon -::: -::: renderlist-box -Underlays of overlay #1 -::: -::: renderlist-box -Overlay #1 icon -::: -::: renderlist-box -Overlays of overlay #1 -::: -::: renderlist-box -Overlay #2 -::: -:::::::::: -### Image objects and visual contents - - -Any atom can have an [image object](/ref/image.md) attached, which -can be shown to only specific players. Most atoms, and image objects, -can have [visual contents](/ref/atom/var/vis_contents.md) that display other -atoms as if they\'re overlays. -:::::::: renderlist -::: renderlist-box -Underlays -::: -::: renderlist-box -Main icon -::: -::: renderlist-box -Overlays -::: -::: renderlist-box -Image objects -::: -::: renderlist-box -Visual contents -::: -:::::::: - - -As you see this is very similar to overlays. Just like -overlays, image objects and visual contents have appearances of their -own (and may also have their own images or visual contents), so this may -be recursive as they add new overlays, etc. - -A couple of things -to keep in mind: -- If an image object uses the [override](/ref/atom/var/override.md) - var, it will replace the main appearance\'s icon and overlays, - although it won\'t replace other images or visual contents. -- An object in visual contents can use - [vis_flags](/ref/atom/var/vis_flags.md) to set `VIS_UNDERLAY` and - move itself before the parent\'s underlays. -### Maptext and particles - - -Any appearance may have [maptext](/ref/atom/var/maptext.md) -attached. That maptext draws above the icon but is grouped with it. That -grouping will be discussed further below. - -Particle effects also -get grouped with the main icon in a similar way to maptext. - -For -simplicity, from this point forward the diagram will just treat -underlays, overlays, image objects, and visual contents as overlays. -:::::::: renderlist -:::::: renderlist-box -::: renderlist-box -Main icon -::: -::: renderlist-box -Maptext -::: -::: renderlist-box -Particles -::: -:::::: -::: renderlist-box -Overlays -::: -:::::::: -### Color, transform, and filters - - -An appearance\'s [color](/ref/atom/var/color.md) and -[alpha](/ref/atom/var/alpha.md) vars (from here forwarded they\'ll just -be referred to by `color`) and [transform](/ref/atom/var/transform.md) -are inherited by any overlays, which also includes images and visual -contents. You can avoid that inheritance by giving those overlays -special [appearance_flags](/ref/var/appearance_flags.md) : -`RESET_COLOR`, `RESET_ALPHA`, and `RESET_TRANSFORM`. - -The -appearance\'s filters are only applied to the main icon. -:::::::::: renderlist -:::::: renderlist-box -::: renderlist-box -Main icon -::: -::: renderlist-box -Maptext -::: -::: renderlist-note -Main `color`, `transform`, and `filters` apply -::: -:::::: -::::: renderlist-box -::: renderlist-label -Overlays -::: -::: renderlist-note -`color` and `transform` are inherited from Main\ -`filters` are not inherited from Main -::: -::::: -:::::::::: - - -When `color` and `transform` are inherited, they "stack". The -inherited color and transform values are applied after those of the -overlays. -### `KEEP_TOGETHER` and `KEEP_APART` - - -There are times it\'s desirable for an appearance and all its -overlays to be treated as a single unit so any colors or filters can be -applied all at once. One simple example is if the appearance has an -`alpha` of 128 to make it translucent, you probably want to draw the -whole atom faded instead of drawing each sprite faded, one on top of the -other. - -By using the `KEEP_TOGETHER` value in -[appearance_flags](/ref/var/appearance_flags.md) (called KT for short), -an appearance will group all of its underlays and overlays together. If -this is an atom with image objects and visual contents, those will be -grouped with it as well. -:::::::::: renderlist -::::::::: renderlist-box -::: renderlist-label -KT group -::: -::: renderlist-note -Main `color`, `transform`, and `filters` apply -::: -::::: renderlist-box -::: renderlist-box -Main icon -::: -::: renderlist-box -Maptext -::: -::::: -::: renderlist-box -Overlays -::: -::::::::: -:::::::::: - - -With `KEEP_TOGETHER` all of these sprites are rendered to a -temporary drawing surface, and then the main appearance\'s `color`, -`transform`, and `filters` are all applied to the combined drawing. This -comes with a trade-off, since you can no longer use flags such as -`RESET_COLOR` to opt out of inheritance. - -If an overlay doesn\'t -want to be part of a KT group, it can use the `KEEP_APART` flag (KA for -short). If there are multiple nested KT groups, KA will only escape the -innermost group. - -If an overlay inside a KT group has a -different [plane](/ref/atom/var/plane.md) than the group\'s owner, it -will be separated as if it defined `KEEP_APART`, except it can escape -multiple nested groups. -### Layers and planes - - -Any appearance can have a [layer](/ref/atom/var/layer.md) or -[plane](/ref/atom/var/layer.md) , and these influence how it gets -sorted. (There\'s also a concept called a "sub-plane" that\'s -influenced by whether an atom is a [HUD/screen -object](/ref/notes/HUD.md) or special layers like -[BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) .) - -If -a sprite is created with `FLOAT_LAYER` (any negative value counts as a -floating layer) its layer has to be resolved, or "unfloated". The main -sprite for an atom can never float; it has to have a real layer. Its -overlays and underlays with floating layers will reorder themselves in -numerical order, then look for the next closest sprites in the rendering -list that has a non-negative layer. - -A similar process happens -with `FLOAT_PLANE`. Planes can have negative values but `FLOAT_PLANE` -and the values close to it are special. Sprites with floating planes -have to resolve those as well. - -Once all atoms that will appear -on the map are assembled into a rendering list of sprites, the order in -which they\'re rendered on the map is determined in this order: -1. The `plane` var matters most. -2. Subplane is counted next. E.g., HUD objects render above non-HUD - objects. -3. Depending on [world.map_format](/ref/world/var/map_format.md) , - `layer` or physical position determine the drawing order from here. -4. After everything else has been checked, the order the sprites were - generated in is the final tie-breaker. - - -In a typical topdown map, `layer` is basically all that matters -after the plane and subplane are taken into account. There is a legacy -concept called micro-layers that helps break ties between sprites with -the same layer; for instance if an atom is moving it\'s usually -desirable to draw it above other atoms with the same layer; this applies -only to topdown maps. -### Plane masters - - -Sometimes it\'s helpful to group multiple sprites on one plane -as if the plane itself were a KT group. For this, -[appearance_flags](/ref/var/appearance_flags.md) has a value called -`PLANE_MASTER`. An object with this flag will act as a "parent" for -everything else on the plane. All other sprites on the plane will be -grouped together and rendered on a temporary drawing surface, and then -the plane master\'s `color`, `transform`, and `filters` will be applied. - - -A plane master does not, however, get an icon or maptext of its -own; they\'re simply ignored. It can have overlays added to the group. -### Advanced topics - - -There are other topics not covered in this article, such as -[render targets](/ref/atom/var/render_target.md) and special map formats. Any -details on how those features impact rendering are discussed in their -own articles. \ No newline at end of file diff --git a/ref/notes/ripple (filters).md b/ref/notes/ripple (filters).md deleted file mode 100644 index d70674a3..00000000 --- a/ref/notes/ripple (filters).md +++ /dev/null @@ -1,42 +0,0 @@ -## Ripple filter -###### BYOND Version 513 - -Format: -+ filter(type="ripple", ...) - -Args: -+ x: Horiztonal position of ripple center, relative to image center - (defaults to 0) -+ y: Vertical position of ripple center, relative to image center - (defaults to 0) -+ size: Maximum distortion in pixels (defaults to 1) -+ repeat: Wave period, in pixels (defaults to 2) -+ radius: Outer radius of ripple, in pixels (defaults to 0) -+ falloff: How quickly ripples lose strength away from the outer edge - (defaults to 1) -+ flags: Defaults to 0; use `WAVE_BOUNDED` to keep distortion within - the image - -Applies a ripple distortion effect to this image. - -This filter is meant to be animated. A good animation will typically start at -a `radius` of 0 and animate to a larger value, with `size` decreasing to -0. - -The `falloff` parameter can be tweaked to your liking. A -value of 1 should look reasonably like ripples in water, with the inner -ripples losing strength. A value of 0 will cause no reduction in -strength. - -The equation governing the ripple distortion is size -× sin(2πr\') ÷ (2.5 × falloff × r\'^2^ + 1), where r\' = (radius - -distance) ÷ repeat. - -Up to 10 ripples can be stacked together in -a single pass of the filter, as long as they have the same `repeat`, -`falloff`, and `flags` values. (See the wave filter for the -`WAVE_BOUNDED` flag.) - -> [!TIP] -> **See also:** -> + [Wave (filters)](/ref/notes/filters/wave.md) \ No newline at end of file diff --git a/ref/notes/scheduling/sendmaps.md b/ref/notes/scheduling/sendmaps.md deleted file mode 100644 index 6a2b13fc..00000000 --- a/ref/notes/scheduling/sendmaps.md +++ /dev/null @@ -1,74 +0,0 @@ -## Understanding SendMaps - -To efficiently build multiplayer games in BYOND, it helps to understand how -map updates are sent to clients. - -Every server tick, SendMaps determines what visual information needs to be sent to -each client. It interfaces with BYOND's appearance system to track changes to -icon, icon_state, overlays, underlays, vis_contents, and other visual properties. -It doesn't send the entire map every tick - instead, it tracks what has changed -and only sends updates for those changes. - -The update process happens in several stages, each building on the previous one: - -### Client Movement and Bounds -When a client's mob moves or map boundaries change, that information is sent immediately. This includes changes to: -- view range. -- screen_loc. -- map boundaries. -- current position. - -### Turf Updates -The server then looks at turfs in the client's view range: -- Full list (if the client hasn't moved). -- Partial list (if the client has moved). -- No update (if nothing has changed). -- Individual turf appearances changes including vis_contents and overlays / underlays. - -### Movable Processing -After turfs are handled, the system processes all movable atoms in view range: -- New movables that entered view. -- Old movables that left view. -- Movement changes. -- Appearance changes (icon, overlays, vis_contents, etc.). -- Invisibility changes. - -### Visual Content Resolution -Finally, the system does a recursive scan of: -- vis_contents for all visible objects. -- overlays and underlays. -- screen objects (HUD elements). -- maptext and filters. -- image objects. - -> [!Note] -> With a typical update cycle, the data sent might look like this: -> + Movement data. -> + Changed turfs and their appearances. -> + Changed movables and their visual states. -> + Visual contents updates including nested vis_contents. -> -> This can get more complex when dealing with nested contents. -> For example, if a movable contains other objects: -> + Movement data -> + Changed turfs -> + Movable #1 -> + vis children of movable -> + overlays and visual effects -> + Movable #2 -> + vis children of movable -> + overlays and visual effects -> + Visual contents updates - -### Threading -The scanning process used to be entirely serial, but now it can be broken into threads using cfg/daemon.txt. -This dramatically reduces the performance impact of these regular scans. - -> [!TIP] -> **See also:** -> + [view var (client)](/ref/client/var/view.md) -> + [screen var (client)](/ref/client/var/screen.md) -> + [appearance var (atom)](/ref/atom/var/appearance.md) -> + [vis_contents var (atom)](/ref/atom/var/vis_contents.md) -> + [Server Ticks](/ref/notes/server-ticks.dm) -> + [Understanding the renderer](/ref/notes/renderer.md) diff --git a/ref/notes/scheduling/server-ticks.md b/ref/notes/scheduling/server-ticks.md deleted file mode 100644 index c47be516..00000000 --- a/ref/notes/scheduling/server-ticks.md +++ /dev/null @@ -1,67 +0,0 @@ -## Server Ticks - -A server tick represents the period between one TimeLib_TickServer() call and the next. -To make it easier to understand how BYOND works, this breakdown is provided to help you -understand the work the server does every tick. The following is in the same order as these -events occur each tick. - -### TimeLib_TickServer() Begins - -The core server tick function is called by BYOND's time library. This process is single-threaded. - -### Tick Operations (In Order) -1. **Time Update** - + world.time increases by world.tick_lag milliseconds. - + Internal time tracking is updated. - -2. **TickProc() Execution** - + Runs background procs (i.e. procs with set background=1). - + Clears finished server-side animation records. - + Processes sleeping/spawned scheduled procs. - + Checks for thread-scheduled tasks from BYONDapi. - -3. **Verbs** - + Enqueued verbs are processed. - + At this time, verb queueing is bypassed, so verbs occur between ticks, not during TimeLib_TickServer() calls. - -4. **System Tasks** - + Performs unique cell ID garbage collection. - + Executes external system callbacks (Steamapi, etc.) - + Processes additional thread callbacks. - -5. **SendMaps()** - + Performs sequential (non-threaded) client processing. - + Spawns worker threads for parallel client processing. - + Waits for all worker threads to complete. - + Performs sequential (non-threaded) cleanup tasks. - -6. **Final Tasks** - + Processes remaining thread callbacks. - + Prunes unneeded .rsc file batches. - + Cleans temporary BYONDapi references. - + Adjusts timing for the next tick. - -### TimeLib_TickServer() Ends - -However, this is still considered the same tick until the next time TimeLib_TickServer() is called for the purposes of any verbs called after the tick has completed. - -### Between Ticks -Until the next TimeLib_TickServer() call: - + Network traffic processing occurs. - + Client verbs are received and executed. - + Local Dream Seeker connections are handled. - -### Next Tick Begins - -The cycle repeats when TimeLib_TickServer() is called again. - -> [!TIP] -> **See Also:** -> - [tick_lag var (world)](/ref/world/var/tick_lag.md) -> - [animate proc](/ref/proc/animate.md) -> - [background setting (proc)](/ref/proc/set_background.md) -> - [Understanding the Renderer](ref/notes/rendering/overview.md) -> - [SendMaps](ref/notes/sendmaps.md) -> - [Garbage Collection](/ref/DM/garbage.md) -> - [BYONDapi](/ref/appendix/Byondapi.md) -> - [GetAPI proc (client)](/ref/client/proc/GetAPI.md) diff --git a/ref/notes/screen objects.md b/ref/notes/screen objects.md deleted file mode 100644 index 0561c2d5..00000000 --- a/ref/notes/screen objects.md +++ /dev/null @@ -1,54 +0,0 @@ -# HUD / screen objects - -HUD stands for Heads-Up Display, and refers to any atoms that -appear on the screen but don\'t move when the player moves. These are -also called screen objects. Any movable atom can be added to the HUD by -setting its `screen_loc` var, and adding it to `client.screen` for each -user who is supposed to see it. This can be used to display a -character\'s vital stats, scores, etc. - -If you want to have -something like a health meter or name attached to a moving atom, use -overlays or `/image` objects instead. An `/image` object is similar to a -screen object in that it can be shown to only certain players instead of -being shown to everyone. - -The size of the screen depends on -`client.view` (or `world.view`), `world.map_format`, and -`world.icon_size`. In a normal topdown map format, `client.view` is the -same as the screen size; in other map formats the screen might be a -different size. - -The `screen_loc` var can be set to a value like -`"1,1"` (the southwest tile of the screen), `"4,NORTH"` (fourth tile -from the west, along the north side of the screen), `"SOUTHEAST"`, and -so on. You can also include pixel offsets, percentages, and specify two -corners to tile an icon repeatedly from one end to the other. See -[screen_loc](/ref/atom/movable/var/screen_loc.md) for more details. - -`screen_loc` can also be used to stretch the bounds of the HUD. -A value of `"0,0"` will cause the atom to appear to the southwest of the -southwest-most tile on the visible map, outside of the regular map -bounds. Using HUDs in this way, you can provide a nice decorative -"frame" for your map. - -## More complex - -You can use HUDs -in other map controls as well, by preceding screen_loc with the name of -the map you will use followed by a colon. For instance, -`screen_loc="map2:1,1"` will show an icon in the southwest corner of the -`map2` control. The actual size of a secondary HUD is based on how far -out the icons in it extend in any direction. If you have one icon at -`"map2:1,1"` and another at `"map2:4,3"`, then that HUD will be four -tiles wide and three high. - -> [!TIP] -> **See also:** -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) -> + [screen var (client)](/ref/client/var/screen.md) -> + [view var (client)](/ref/client/var/view.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [image objects](/ref/image.md) \ No newline at end of file diff --git a/ref/notes/side.md b/ref/notes/side.md index 83f51857..5171378a 100644 --- a/ref/notes/side.md +++ b/ref/notes/side.md @@ -1,44 +1,11 @@ -## Side-view maps -###### BYOND Version 482 -The side-view map format is used for 3/4 perspective, where the -map is basically similar to a top-down view but is usually -foreshortened. Just like with isometric projection, tiles that are -closer to the bottom of the screen are considered to be closer to the -viewer. This is a form of pseudo-3D in which the 2D icons used by BYOND -can be arranged in a way to give the appearance of three dimensions. +## side (info) +*** +The side-view map format is used for 3/4 perspective, where the map is basically similar to a top-down view but is usually foreshortened. Just like with isometric projection, tiles that are closer to the bottom of the screen are considered to be closer to the viewer. This is a form of pseudo-3D in which the 2D icons used by BYOND can be arranged in a way to give the appearance of three dimensions. -It is important to remember that this is an illusion of 3D, not -real 3D. +It is important to remember that this is an illusion of 3D, not real 3D. -The `layer` var behaves much the same way it does in -`ISOMETRIC_MAP` mode.See [isometric maps](/ref/notes/isometric.md) for -more information. +The `layer` var behaves much the same way it does in `ISOMETRIC_MAP` mode.See isometric maps for more information. -When using this mode you may want to use a -foreshortened `world.icon_size`, like a 32x24 format instead of 32x32 -for example, and use taller icons for any vertical structures like walls -or buildings. If you set `world.icon_size` to use foreshortening, then -`pixel_y` (or `pixel_x`, depending on the orientation of client.dir) -will be adjusted for you; the same applies to `step_x` and `step_y`. For -example, with `world.icon_size` set to `"64x32"`, the *physical* -tile---what you would see if you were to look at it straight down from -above--- is considered to be 64x64, so you would need `pixel_y=64` or -`step_y=64` to offset by a whole tile. This adjustment does not apply to -screen objects, `pixel_w`, or `pixel_z`. - -> [!TIP] -> **See also:** -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [dir var (client)](/ref/client/var/dir.md) -> + [pixel_w var (atom)](/ref/atom/var/pixel_w.md) -> + [pixel_z var (atom)](/ref/atom/var/pixel_z.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Isometric maps](/ref/notes/isometric.md) -> + [Topdown maps](/ref/notes/topdown.md) -> + [HUD](/ref/notes/HUD.md) -> + [BACKGROUND_LAYER](/ref/notes/BACKGROUND_LAYER.md) -> + [EFFECTS_LAYER](/ref/notes/EFFECTS_LAYER.md) -> + [TOPDOWN_LAYER](/ref/notes/topdown_layer.md) \ No newline at end of file +When using this mode you may want to use a foreshortened `world.icon_size`, like a 32x24 format instead of 32x32 for example, and use taller icons for any vertical structures like walls or buildings. If you set `world.icon_size` to use foreshortening, then `pixel_y` (or `pixel_x`, depending on the orientation of client.dir) will be adjusted for you; the same applies to `step_x` and `step_y`. For example, with `world.icon_size` set to `"64x32"`, the *physical* tile—what you would see if you were to look at it straight down from above— is considered to be 64x64, so you would need `pixel_y=64` or `step_y=64` to offset by a whole tile. This adjustment does not apply to screen objects, `pixel_w`, or `pixel_z`. +*** \ No newline at end of file diff --git a/ref/notes/tiled-icons.md b/ref/notes/tiled-icons.md index f5ac5974..3efe445b 100644 --- a/ref/notes/tiled-icons.md +++ b/ref/notes/tiled-icons.md @@ -1,58 +1,19 @@ -## Tiled icons -In BYOND 3.0, any file like a large .bmp would be treated like -a regular icon that had been broken up into several tile-sized icon -states. All tiles then were 32x32 pixels. An image that was 100x100 -would therefore take at least 4x4 tiles to display. The icon was padded -to the right and the top with blank space to become an even multiple of -32x32, and then broken up into sections. The lower left section was -given an icon_state of `"0,0"`, the next to the right was `"1,0"`, and -so on, up to the upper right which was `"3,3"`. Another icon state, a -32x32 thumbnail of the big image, was also included. +## tiled-icons (info) +*** +In BYOND 3.0, any file like a large .bmp would be treated like a regular icon that had been broken up into several tile-sized icon states. All tiles then were 32x32 pixels. An image that was 100x100 would therefore take at least 4x4 tiles to display. The icon was padded to the right and the top with blank space to become an even multiple of 32x32, and then broken up into sections. The lower left section was given an icon_state of `"0,0"`, the next to the right was `"1,0"`, and so on, up to the upper right which was `"3,3"`. Another icon state, a 32x32 thumbnail of the big image, was also included. -BYOND 4.0 -expanded on this concept by allowing icons to be defined that had -individual graphics bigger than 32x32, and it would break each one up -into tiles just like 3.0 did. If an icon had a state called `"open"` -then it might break down into `"open 0,0"`, `"open 1,0"`, and so on, -while the actual `"open"` state would be a thumbnail image. To show the -whole image, you would have to have a separate atom or overlay for each -individual tile. +BYOND 4.0 expanded on this concept by allowing icons to be defined that had individual graphics bigger than 32x32, and it would break each one up into tiles just like 3.0 did. If an icon had a state called `"open"` then it might break down into `"open 0,0"`, `"open 1,0"`, and so on, while the actual `"open"` state would be a thumbnail image. To show the whole image, you would have to have a separate atom or overlay for each individual tile. -In newer versions, breaking big icons into -tiles is no longer done by default. Instead, icons are shown and -manipulated in their [native size](/ref/notes/big-icons.md) To use the -old method of breaking icons into tiles, set `world.map_format` to -`TILED_ICON_MAP`. This is the default for all projects compiled before -version 455. +In newer versions, breaking big icons into tiles is no longer done by default. Instead, icons are shown and manipulated in their native size. To use the old method of breaking icons into tiles, set `world.map_format` to `TILED_ICON_MAP`. This is the default for all projects compiled before version 455. -When using tiled icons, there are some important -things to note: -- You need to use extra atoms or overlays to show any icon bigger than - a single tile, where each atom/overlay shows an individual - tile-sized piece of the big icon. -- The icon_state names of each tile are always the original name - followed by a space, followed by x,y tile coordinates such as 0,0 or - 2,1, so the northeast corner of `"flag"` might for instance be - `"flag 3,2"`. If the original icon_state had no name, the space is - left out and only the x,y coordinates are used. -- Every icon\'s size is a multiple of world.icon_size. If an icon of - an incompatible size is used, it will be padded to the nearest full - tile size. -- `Crop()` and `Scale()` always pad their results to the nearest full - tile size. -- `icon.Insert()` can insert a single-tile icon into a multi-tiled big - icon using the appropriate icon_state; e.g., inserting into - `"door 0,0"` will replace the southwest corner of the `"door"` - state. -- Using the `icon()` proc, you can extract a single tile from a - multi-tiled big icon. +When using tiled icons, there are some important things to note: + +This example shows a big icon being applied to an atom in tiled mode, as overlays: -This example shows a big icon being applied to an atom in tiled -mode, as overlays: -### Example: ```dm + // icon is 3 tiles wide by 2 high icon_state = "0,0" @@ -68,12 +29,7 @@ for(var/tile_y=0, tile_y<2, ++tile_y) O.pixel_y = tile_y * 32 O.icon_state = "[tile_x],[tile_y]" overlays += O + ``` -> [!TIP] -> **See also:** -> + [icon](/ref/icon.md) -> + [procs (icon)](/ref/icon/proc.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [Big icons](/ref/notes/big-icons.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/notes/topdown.md b/ref/notes/topdown.md index 25201fb8..24216ae4 100644 --- a/ref/notes/topdown.md +++ b/ref/notes/topdown.md @@ -1,40 +1,13 @@ -## Topdown maps -By default, BYOND displays all maps in top-down format, so -`world.map_format` is set to `TOPDOWN_MAP` unless you say otherwise. -This view means players are looking down on the map, and "north" -corresponds to the top of their screen. (This can be changed by setting -`client.dir`.) +## topdown (info) +*** +By default, BYOND displays all maps in top-down format, so `world.map_format` is set to `TOPDOWN_MAP` unless you say otherwise. This view means players are looking down on the map, and "north" corresponds to the top of their screen. (This can be changed by setting `client.dir`.) -A related map_format, used by older games, is -`TILED_ICON_MAP`. This is also topdown but it handles icons differently. +A related map_format, used by older games, is `TILED_ICON_MAP`. This is also topdown but it handles icons differently. -In this form, the `layer` var behaves exactly as you would -expect: Icons with a lower layer are drawn beneath icons with a higher -layer. The only exception is when you use [big -icons](/ref/notes/big-icons.md) which will be drawn above any other -icons on the same layer. Also an atom\'s underlays will be drawn behind -it unless their layer is changed, and its overlays will draw in front of -it unless otherwise stated. +In this form, the `layer` var behaves exactly as you would expect: Icons with a lower layer are drawn beneath icons with a higher layer. The only exception is when you use big icons, which will be drawn above any other icons on the same layer. Also an atom's underlays will be drawn behind it unless their layer is changed, and its overlays will draw in front of it unless otherwise stated. -Topdown mode also guarantees that -`world.view` or `client.view` will set the exact screen size used by the -HUD, except for HUD objects that appear outside of the normal bounds. +Topdown mode also guarantees that `world.view` or `client.view` will set the exact screen size used by the HUD, except for HUD objects that appear outside of the normal bounds. -Screen objects (also called the HUD) cannot be intermixed with -topdown icons. They will appear on top of other icons, unless using a -lower plane or a special layer like `BACKGROUND_LAYER`. - -> [!TIP] -> **See also:** -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [dir var (client)](/ref/client/var/dir.md) -> + [layer var (atom)](/ref/atom/var/layer.md) -> + [plane var (atom)](/ref/atom/var/plane.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [HUD](/ref/notes/HUD.md) -> + [Isometric maps](/ref/notes/isometric.md) -> + [Side-view maps](/ref/notes/side.md) -> + [Understanding the renderer](/ref/notes/renderer.md) \ No newline at end of file +Screen objects (also called the HUD) cannot be intermixed with topdown icons. They will appear on top of other icons, unless using a lower plane or a special layer like `BACKGROUND_LAYER`. +*** \ No newline at end of file diff --git a/ref/obj/index.md b/ref/obj/index.md new file mode 100644 index 00000000..e55cec9c --- /dev/null +++ b/ref/obj/index.md @@ -0,0 +1,24 @@ + +## obj (info) +*** +There are two types of movable atoms: objs and mobs. The difference between them is that a mob can be attached to a human player, and is also typically used for NPCs and creatures. The obj type is a little bit simpler and is typically used for objects in the environment, items in inventory, etc. + +Objects are derived from `/obj`, which derives from `/atom/movable`. + +The following example defines the obj type `/obj/scooper`. + + +```dm + +obj + scooper + desc = "Super pooper scooper." + +``` + +*** +**Related Pages:** ++ [atom](/ref/atom) ++ [atom/movable](/ref/atom/movable) ++ [procs (obj)](/ref/obj/proc) ++ [vars (obj)](/ref/obj/var) diff --git a/ref/obj/obj.md b/ref/obj/obj.md deleted file mode 100644 index 590b31cb..00000000 --- a/ref/obj/obj.md +++ /dev/null @@ -1,27 +0,0 @@ -## obj - - -There are two types of movable atoms: objs and mobs. The -difference between them is that a mob can be attached to a human player, -and is also typically used for NPCs and creatures. The obj type is a -little bit simpler and is typically used for objects in the environment, -items in inventory, etc. - -Objects are derived from `/obj`, which -derives from `/atom/movable`. - -The following example defines the -obj type `/obj/scooper`. -### Example: - -```dm - obj scooper desc = "Super pooper scooper." -``` - - -> [!TIP] -> **See also:** -> + [atom](/ref/atom.md) -> + [movable atoms](/ref/atom/movable.md) -> + [procs (obj)](/ref/obj/proc.md) -> + [vars (obj)](/ref/obj/var.md) \ No newline at end of file diff --git a/ref/obj/proc.md b/ref/obj/proc.md index 0366d243..ea87dc18 100644 --- a/ref/obj/proc.md +++ b/ref/obj/proc.md @@ -1,31 +1,5 @@ -## procs (obj) - +## proc (proc) +*** Built-in obj procs: -obj/proc -+ [Bump](/ref/atom/movable/proc/Bump.md) -+ [Click](/ref/atom/proc/Click.md) -+ [Cross proc](/ref/atom/proc/Cross.md) -+ [Crossed proc](/ref/atom/proc/Crossed.md) -+ [DblClick](/ref/atom/proc/DblClick.md) -+ [Del](/ref/datum/proc/Del.md) -+ [Enter](/ref/atom/proc/Enter.md) -+ [Entered](/ref/atom/proc/Entered.md) -+ [Exit](/ref/atom/proc/Exit.md) -+ [Exited](/ref/atom/proc/Exited.md) -+ [MouseDown](/ref/atom/proc/MouseDown.md) -+ [MouseDrag](/ref/atom/proc/MouseDrag.md) -+ [MouseDrop](/ref/atom/proc/MouseDrop.md) -+ [MouseEntered](/ref/atom/proc/MouseEntered.md) -+ [MouseExited](/ref/atom/proc/MouseExited.md) -+ [MouseMove](/ref/atom/proc/MouseMove.md) -+ [MouseUp](/ref/atom/proc/MouseUp.md) -+ [MouseWheel](/ref/atom/proc/MouseWheel.md) -+ [Move](/ref/atom/movable/proc/Move.md) -+ [New](/ref/atom/proc/New.md) -+ [Read](/ref/datum/proc/Read.md) -+ [Stat](/ref/atom/proc/Stat.md) -+ [Topic](/ref/datum/proc/Topic.md) -+ [Uncross proc](/ref/atom/proc/Uncross.md) -+ [Uncrossed proc](/ref/atom/proc/Uncrossed.md) -+ [Write](/ref/datum/proc/Write.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/obj/var.md b/ref/obj/var.md deleted file mode 100644 index 5dd93e35..00000000 --- a/ref/obj/var.md +++ /dev/null @@ -1,60 +0,0 @@ -## vars (obj) - - -Built-in obj vars: -obj/var -+ [alpha](/ref/atom/var/alpha.md) -+ [appearance](/ref/atom/var/appearance.md) -+ [appearance_flags](/ref/atom/var/appearance_flags.md) -+ [blend_mode](/ref/atom/var/blend_mode.md) -+ [color](/ref/atom/var/color.md) -+ [contents](/ref/atom/var/contents.md) -+ [density](/ref/atom/var/density.md) -+ [desc](/ref/atom/var/desc.md) -+ [dir](/ref/atom/var/dir.md) -+ [filters](/ref/atom/var/filters.md) -+ [gender](/ref/atom/var/gender.md) -+ [icon](/ref/atom/var/icon.md) -+ [icon_state](/ref/atom/var/icon_state.md) -+ [icon_w](/ref/atom/var/icon_w.md) -+ [icon_z](/ref/atom/var/icon_z.md) -+ [invisibility](/ref/atom/var/invisibility.md) -+ [underlays](/ref/atom/var/underlays.md) -+ [overlays](/ref/atom/var/overlays.md) -+ [layer](/ref/atom/var/layer.md) -+ [luminosity](/ref/atom/var/luminosity.md) -+ [maptext](/ref/atom/var/maptext.md) -+ [maptext_width](/ref/atom/var/maptext_width.md) -+ [maptext_height](/ref/atom/var/maptext_height.md) -+ [maptext_x](/ref/atom/var/maptext_x.md) -+ [maptext_y](/ref/atom/var/maptext_y.md) -+ [animate_movement](/ref/atom/movable/var/animate_movement.md) -+ [loc](/ref/atom/var/loc.md) -+ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -+ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -+ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) -+ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) -+ [mouse_opacity var](/ref/atom/var/mouse_opacity.md) -+ [name](/ref/atom/var/name.md) -+ [opacity](/ref/atom/var/opacity.md) -+ [parent_type](/ref/obj/var/parent_type.md) -+ [pixel_x](/ref/atom/var/pixel_x.md) -+ [pixel_y](/ref/atom/var/pixel_y.md) -+ [pixel_w](/ref/atom/var/pixel_w.md) -+ [pixel_z](/ref/atom/var/pixel_z.md) -+ [plane](/ref/atom/var/plane.md) -+ [render_source](/ref/atom/var/render_source.md) -+ [render_target](/ref/atom/var/render_target.md) -+ [suffix](/ref/atom/var/suffix.md) -+ [tag](/ref/datum/var/tag.md) -+ [text](/ref/atom/var/text.md) -+ [transform](/ref/atom/var/transform.md) -+ [type](/ref/datum/var/type.md) -+ [vars](/ref/datum/var/vars.md) -+ [verbs](/ref/atom/var/verbs.md) -+ [vis_contents](/ref/atom/var/vis_contents.md) -+ [vis_flags](/ref/atom/var/vis_flags.md) -+ [vis_locs](/ref/atom/var/vis_locs.md) -+ [x](/ref/atom/var/x.md) -+ [y](/ref/atom/var/y.md) -+ [z](/ref/atom/var/z.md) \ No newline at end of file diff --git a/ref/obj/var/index.md b/ref/obj/var/index.md new file mode 100644 index 00000000..a2d1535c --- /dev/null +++ b/ref/obj/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in obj vars: +*** \ No newline at end of file diff --git a/ref/obj/var/parent_type.md b/ref/obj/var/parent_type.md index 3c3ae588..3e4c1dfb 100644 --- a/ref/obj/var/parent_type.md +++ b/ref/obj/var/parent_type.md @@ -1,10 +1,7 @@ -## parent_type var (obj) - - -The default parent_type of [/obj](/ref/obj.md) is -[/atom/movable](/ref/atom/movable.md) - -> [!TIP] -> **See also:** -> + [parent_type var](/ref/datum/var/parent_type.md) \ No newline at end of file +## parent_type (var) +*** +The default parent_type of /obj is /atom/movable. +*** +**Related Pages:** ++ [parent_type](/ref/datum/var/parent_type) diff --git a/ref/operator/!.md b/ref/operator/!.md index 4e2ad48c..adee1839 100644 --- a/ref/operator/!.md +++ b/ref/operator/!.md @@ -1,21 +1,17 @@ -## ! operator + +## ! (info) **Format:** + !A **Returns:** -+ 1 if A is a false value (zero, an empty string, or null); 0 - otherwise. - - ++ 1 if A is a false value (zero, an empty string, or null); 0 otherwise. +*** This operator inverts the truthiness of the value after it. - -The number 0, an empty string, or null are all false values. -Everything else is true. - -> [!TIP] -> **See also:** -> + [&& operator](/ref/operator/&&.md) -> + [operators](/ref/operator.md) -> + [\|\| operator](/ref/operator/%7C%7C.md) \ No newline at end of file +The number 0, an empty string, or null are all false values. Everything else is true. +*** +**Related Pages:** ++ [&& operator](/ref/operator/&&) ++ [operators](/ref/operator) ++ [|| operator](/ref/operator/||) diff --git a/ref/operator/!=.md b/ref/operator/!=.md index 91638391..138cea4c 100644 --- a/ref/operator/!=.md +++ b/ref/operator/!=.md @@ -1,23 +1,21 @@ -## != operator + +## != (info) **Format:** + A != B **Returns:** + 1 if A is not equal to B; 0 otherwise +*** +This is identical to the <> operator. - -This is identical to the <> operator. - -To check if A -and B are not equivalent, use the \~! operator. - -> [!TIP] -> **See also:** -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [<> operator](/ref/operator/%3c%3e.md) -> + [== operator](/ref/operator/==.md) -> + [\~= operator](/ref/operator/~=.md) -> + [\~! operator](/ref/operator/~!.md) -> + [operators](/ref/operator.md) \ No newline at end of file +To check if A and B are not equivalent, use the ~! operator. +*** +**Related Pages:** ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [<> operator](/ref/operator/%3c%3e) ++ [== operator](/ref/operator/==) ++ [~= operator](/ref/operator/~=) ++ [~! operator](/ref/operator/~!) ++ [operators](/ref/operator) diff --git a/ref/operator/&&.md b/ref/operator/&&.md index 7b1597c2..3894fb7d 100644 --- a/ref/operator/&&.md +++ b/ref/operator/&&.md @@ -1,44 +1,42 @@ -## && operator + +## && (info) **Format:** + A && B **Returns:** + First false value of either A or B; last true value otherwise -The only false values in DM are the number 0, an empty text string, or -null. All other values are considered true. +*** + +> [!TIP] +> The only false values in DM are the number 0, an empty text string, or null. All other values are considered true. + +The first false value from left to right completes the evaluation (a practice known as short-circuiting), meaning that any expressions after the first false value are skipped. The return value is equal to the last operand to be evaluated. -The first false -value from left to right completes the evaluation (a practice known as -short-circuiting), meaning that any expressions after the first false -value are skipped. The return value is equal to the last operand to be -evaluated. -### Example: ```dm -if(jumping && CanDoubleJump()) DoubleJump() +if(jumping && CanDoubleJump()) + DoubleJump() + ``` +In this example, the `CanDoubleJump()` call is not performed if `jumping` is false. -In this example, the `CanDoubleJump()` call is not performed if -`jumping` is false. +Although logical short-circuit operators are used most often in blocks such as `if` or `while`, they can be used elsewhere. -Although logical short-circuit operators -are used most often in blocks such as `if` or `while`, they can be used -elsewhere. -### Example: ```dm - // check if current target is valid, if it exists at all -// but don\'t call the proc if we don\'t have to var/target = -current_target && TargetIsValid(current_target) -``` +// check if current target is valid, if it exists at all +// but don't call the proc if we don't have to +var/target = current_target && TargetIsValid(current_target) + +``` -> [!TIP] -> **See also:** -> + [! operator](/ref/operator/!.md) -> + [operators](/ref/operator.md) -> + [\|\| operator](/ref/operator/%7C%7C.md) -> + [&&= operator](/ref/operator/&&=.md) \ No newline at end of file +*** +**Related Pages:** ++ [! operator](/ref/operator/!) ++ [operators](/ref/operator) ++ [|| operator](/ref/operator/||) ++ [&&= operator](/ref/operator/&&=) diff --git a/ref/operator/&&=.md b/ref/operator/&&=.md index 430671d3..bf81dfd0 100644 --- a/ref/operator/&&=.md +++ b/ref/operator/&&=.md @@ -1,29 +1,22 @@ -## &&= operator -###### BYOND Version 514 + +## &&= (info) **Format:** + A &&= B **Returns:** -+ Value of `(A && B)` after it has been assigned to A. This expression - can stand by itself; its result does not need to be assigned to - anything else. - - -First A is evaluated. If its value is true, B will be evaluated -and assigned to A. If A is false, B will not be evaluated and A will -remain unchanged. - -Note that this is slightly different from -`if(A) A = B` if A is a complex expression such as `list[index++]`, -because the expression is only evaluated once. ++ Value of after it has been assigned to A. This +expression can stand by itself; its result does not need to be assigned to +anything else. +*** +First A is evaluated. If its value is true, B will be evaluated and assigned to A. If A is false, B will not be evaluated and A will remain unchanged. -This operator -cannot be overloaded. +Note that this is slightly different from `if(A) A = B` if A is a complex expression such as `list[index++]`, because the expression is only evaluated once. -> [!TIP] -> **See also:** -> + [&& operator](/ref/operator/&&.md) -> + [\|\| operator](/ref/operator/%7C%7C.md) -> + [\|\|= operator](/ref/operator/%7C%7C=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +This operator cannot be overloaded. +*** +**Related Pages:** ++ [&& operator](/ref/operator/&&) ++ [|| operator](/ref/operator/||) ++ [||= operator](/ref/operator/||=) ++ [operators](/ref/operator) diff --git a/ref/operator/&.md b/ref/operator/&.md deleted file mode 100644 index fdc3a606..00000000 --- a/ref/operator/&.md +++ /dev/null @@ -1,26 +0,0 @@ -## & operator - -**Format:** -+ A & B - -**Returns:** -+ The binary "and" of A and B. - - -A and B must be between 0 and 2**24 - 1, giving an effective -width of 24 bits. - -If A and B are lists, the result is a list -that contains only items that were in both lists, in the order of list -A. - -If A is an icon or /icon datum, it is blended with B which -can be either a color or another icon. This is identical to the + -operator. Transparent areas in either icon will be transparent in the -result. - -> [!TIP] -> **See also:** -> + [&= operator](/ref/operator/&=.md) -> + [operators](/ref/operator.md) -> + [\| operator](/ref/operator/%7C.md) \ No newline at end of file diff --git a/ref/operator/&/index.md b/ref/operator/&/index.md new file mode 100644 index 00000000..689a3311 --- /dev/null +++ b/ref/operator/&/index.md @@ -0,0 +1,19 @@ + +## & (info) + +**Format:** ++ A & B + +**Returns:** ++ The binary "and" of A and B. +*** +A and B must be between 0 and 2**24 - 1, giving an effective width of 24 bits. + +If A and B are lists, the result is a list that contains only items that were in both lists, in the order of list A. + +If A is an icon or /icon datum, it is blended with B which can be either a color or another icon. This is identical to the + operator. Transparent areas in either icon will be transparent in the result. +*** +**Related Pages:** ++ [&= operator](/ref/operator/&=) ++ [operators](/ref/operator) ++ [| operator](/ref/operator/|) diff --git a/ref/operator/&/pointer =& operator (pointers).md b/ref/operator/&/pointer =& operator (pointers).md deleted file mode 100644 index 3173a6a3..00000000 --- a/ref/operator/&/pointer =& operator (pointers).md +++ /dev/null @@ -1,64 +0,0 @@ -## & pointer operator -###### BYOND Version 515 - - -**Format:** -+ &A - -**Returns:** -+ A pointer to the var or list item A. -This operator is also called the reference operator, since it creates a -reference to a var that you can use elsewhere.) - -Sometimes it is -desirable to have easy access to a var without knowing its name, or send -multiple items back from a proc. To do this, you can create a pointer to -that var. Then you can use the `*` operator to refer to the value inside -the pointer, or even to assign a value to it. -### Example: - -```dm - var/a=3, b=4 var/p = &a world << *p // same as world -<< a *p = 5 // same as a = 5 var/list/L = list(1, 2, 3) var/list/pl = -&L[2] *pl *= 10 // same as L[2] *= 10 -``` - - -If you -want the compiler to recognize that the item in your pointer var should -be a certain type, you can give the pointer var that same type. Hence in -the example above, `pl` is defined as a `/list`. - -You can also -call procs this way. You can either wrap the pointer and the `*` -operator in paretheses, like `(*p).MyProc()`, or you can skip the -operator and just call `p.MyProc()` directly. - -The same also -applies to the list index operator `[]`. If `p = &list` then you can use -`(*p)[index]` or `p[index]` interchangeably. - -Pointers can be -made for any of these kinds of vars: -- Vars belonging to an object -- Local vars in a proc, including `src`, `usr`, and the `.` var -- Arguments in a proc -- Global vars -- An item in a list, including values in [associative - lists](/ref/list/associations.md) - - -One advantage of pointers is that you can use them to alter a -value in a suspended (sleeping) proc. - -Note: When -[spawn()](/ref/proc/spawn.md) is used, the current proc is forked, -where one keeps running and a copy is scheduled to run later. If any -pointers to proc vars were created, they belong to the original proc -(the one that keeps running), not to the fork. - -> [!TIP] -> **See also:** -> + [* operator (pointers)](/ref/operator/*/prefix.md) -> + [operators](/ref/operator.md) -> + [ispointer proc](/ref/proc/ispointer.md) \ No newline at end of file diff --git a/ref/operator/&/pointer.md b/ref/operator/&/pointer.md new file mode 100644 index 00000000..09c8ca2d --- /dev/null +++ b/ref/operator/&/pointer.md @@ -0,0 +1,48 @@ + +## pointer (info) + +**Format:** ++ &A + +**Returns:** ++ A pointer to the var or list item A. +*** + +> [!TIP] +> This operator is also called the reference operator, since it creates a reference to a var that you can use elsewhere.) + +Sometimes it is desirable to have easy access to a var without knowing its name, or send multiple items back from a proc. To do this, you can create a pointer to that var. A pointer is basically a way to look up and access a var without needing to know anything else about it, like its name or which object it might belong to. You can pass the pointer like any other piece of data, and use the `*` operator to read or write the var's value. + + +```dm + +var/a=3, b=4 +var/p = &a +world << *p // same as world << a +*p = 5 // same as a = 5 + +var/list/L = list(1, 2, 3) +var/list/pl = &L[2] +*pl *= 10 // same as L[2] *= 10 + +``` + + +If you want the compiler to recognize that the item in your pointer var should be a certain type, you can give the pointer var that same type. Hence in the example above, `pl` is defined as a `/list`. + +Unlike in some languages, pointers in DM are *not* literal memory addresses. Instead, a pointer is a shortcut indicating the type of var (e.g., global, object var, list index), and information needed to look it up. A pointer is an object, which is reference counted. It also holds references to the objects it needs, so for instance `&thing.name` has a reference to `thing`, or `&mylist[quest]` has references to `mylist` and `quest`. + +You can also call procs this way. You can either wrap the pointer and the `*` operator in paretheses, like `(*p).MyProc()`, or you can skip the operator and just call `p.MyProc()` directly. + +The same also applies to the list index operator `[]`. If `p = &list` then you can use `(*p)[index]` or `p[index]` interchangeably. + +Pointers can be made for any of these kinds of vars: + +One advantage of pointers is that you can use them to alter a value in a suspended (sleeping) proc. + +Note: When spawn() is used, the current proc is forked, where one keeps running and a copy is scheduled to run later. If any pointers to proc vars were created, they belong to the original proc (the one that keeps running), not to the fork. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*/pointer) ++ [operators](/ref/operator) ++ [ispointer proc](/ref/proc/ispointer) diff --git a/ref/operator/&=.md b/ref/operator/&=.md index 9821f6ef..fefbefd2 100644 --- a/ref/operator/&=.md +++ b/ref/operator/&=.md @@ -1,29 +1,26 @@ -## &= operator + +## &= (info) **Format:** + A &= B +*** +Set A equal to A & B. It is shorthand for A = A & B. +This is commonly used to turn off certain bitfields in a word. -Set A equal to A & B. It is shorthand for A = A & B. +```dm -This is commonly used to turn off certain bitfields in a word. -### Example: +usr.sight &= ~BLIND // turn off the blind bit -```dm - usr.sight &= \~BLIND // turn off the blind bit ``` - If A and B are lists, items in A that are not in B are removed. - -If A is an /icon or /matrix datum, the datum will be changed -rather than creating a new one and re-assigning it to A. - -> [!TIP] -> **See also:** -> + [& operator](/ref/operator/&.md) -> + [operators](/ref/operator.md) -> + [\|= operator](/ref/operator/%7C=.md) \ No newline at end of file +If A is an /icon or /matrix datum, the datum will be changed rather than creating a new one and re-assigning it to A. +*** +**Related Pages:** ++ [& operator (pointers)](/ref/operator/&) ++ [operators](/ref/operator) ++ [|= operator](/ref/operator/|=) diff --git a/ref/operator/().md b/ref/operator/().md index bfe4953f..0e96dcb8 100644 --- a/ref/operator/().md +++ b/ref/operator/().md @@ -1,34 +1,31 @@ -## () operator +## () (info) +*** +Parentheses may be used in expressions to change the order of operations. Whatever is inside a pair of parentheses will be evaluated first. -Parentheses may be used in expressions to change the order of -operations. Whatever is inside a pair of parentheses will be evaluated -first. -### Example: ```dm - usr << 2 + 3 * 2 // 8 usr << (2 + 3) * 2 // 10 + +usr << 2 + 3 * 2 // 8 +usr << (2 + 3) * 2 // 10 ``` - -They are also used for calling procs or verbs, by -placing the parentheses after the name of the proc. Any arguments that -will be sent to the proc go inside the parentheses; multiple arguments -are separated by commas, or the parentheses can be left empty if no -arguments are sent. For the same reason, parentheses are also used when -defining a new proc or verb and the arguments (if any) that will be -used. -### Example: + +They are also used for calling procs or verbs, by placing the parentheses after the name of the proc. Any arguments that will be sent to the proc go inside the parentheses; multiple arguments are separated by commas, or the parentheses can be left empty if no arguments are sent. For the same reason, parentheses are also used when defining a new proc or verb and the arguments (if any) that will be used. + ```dm - // Defining a new proc proc/Distance(x, y) // return -straight-line distance from 0,0 return sqrt(x*x + y*y) -``` +// Defining a new proc +proc/Distance(x, y) + // return straight-line distance from 0,0 + return sqrt(x*x + y*y) + +``` -> [!TIP] -> **See also:** -> + [operators](/ref/operator.md) -> + [procs](/ref/proc.md) -> + [verbs](/ref/verb.md) \ No newline at end of file +*** +**Related Pages:** ++ [operators](/ref/operator) ++ [procs](/ref/proc) ++ [verbs](/ref/verb) diff --git a/ref/operator/++.md b/ref/operator/++.md index d91f6378..19088170 100644 --- a/ref/operator/++.md +++ b/ref/operator/++.md @@ -1,26 +1,26 @@ -## ++ operator -**Format:** -+ ++A // pre-increment -+ A++ // post-increment +## ++ (info) +**Format:** ++ ++A // pre-increment ++ A++ // post-increment +*** +The pre-increment has the value (A+1) and the effect of adding 1 to A. -The pre-increment has the value (A+1) and the effect of adding -1 to A. +The post-increment has the value (A) and has the effect of adding 1 to A. -The post-increment has the value (A) and has the effect -of adding 1 to A. -### Example: ```dm - var/A = 0 world << "A++ = [A++]" // outputs "A++ = -0" world << "++A = [++A]" // outputs "++A = 2" -``` +var/A = 0 +world << "A++ = [A++]" // outputs "A++ = 0" +world << "++A = [++A]" // outputs "++A = 2" + +``` -> [!TIP] -> **See also:** -> + [+ operator](/ref/operator/+.md) -> + [+= operator](/ref/operator/+=.md) -> + [\-- operator](/ref/operator/--.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [+ operator](/ref/operator/+) ++ [+= operator](/ref/operator/+=) ++ [-- operator](/ref/operator/--) ++ [operators](/ref/operator) diff --git a/ref/operator/+.md b/ref/operator/+.md index 03bb1867..4d308f6e 100644 --- a/ref/operator/+.md +++ b/ref/operator/+.md @@ -1,33 +1,22 @@ -## + operator + +## + (info) **Format:** + A + B **Returns:** + The sum of A and B. - - -Adds A and B. The result of the operation depends on the types -of values being added, mostly on A. - A type B type Result - ----------------- ----------------- -------------------------------------------- - num or null (0) num or null (0) Numeric sum - text text New string concatenating A and B, in order - icon or /icon icon or color New blended icon via ICON_ADD - matrix matrix New matrix with components added together - turf or pixloc vector New pixloc offset by B - vector vector New vector with components added together - turf or pixloc New pixloc offset by A - -> [!TIP] -> **See also:** -> + [* operator](/ref/operator/*.md) -> + [+= operator](/ref/operator/+=.md) -> + [- operator](/ref/operator/-.md) -> + [/ operator](/ref/operator//.md) -> + [Add proc (list)](/ref/list/proc/Add.md) -> + [operators](/ref/operator.md) -> + [icon](/ref/icon.md) -> + [matrix](/ref/matrix.md) -> + [pixloc](/ref/pixloc.md) -> + [vector](/ref/vector.md) \ No newline at end of file +*** +Adds A and B. The result of the operation depends on the types of values being added, mostly on A. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*) ++ [+= operator](/ref/operator/+=) ++ [- operator](/ref/operator/-) ++ [/ operator](/ref/operator//) ++ [Add proc (list)](/ref/list/proc/Add) ++ [operators](/ref/operator) ++ [icon](/ref/icon) ++ [matrix](/ref/matrix) ++ [pixloc](/ref/pixloc) ++ [vector](/ref/vector) diff --git a/ref/operator/+=.md b/ref/operator/+=.md index b5cdb53d..ef242111 100644 --- a/ref/operator/+=.md +++ b/ref/operator/+=.md @@ -1,20 +1,17 @@ -## += operator + +## += (info) **Format:** + A += B - - +*** Set A equal to A + B. It is shorthand for A = A + B. - -If A is an /icon, /matrix, pixloc, or vector, it will be -changed rather than creating a new value and re-assigning it to A. - -> [!TIP] -> **See also:** -> + [*= operator](/ref/operator/*=.md) -> + [+ operator](/ref/operator/+.md) -> + [-= operator](/ref/operator/-=.md) -> + [/= operator](/ref/operator//=.md) -> + [= operator](/ref/operator/=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is an /icon, /matrix, pixloc, or vector, it will be changed rather than creating a new value and re-assigning it to A. +*** +**Related Pages:** ++ [*= operator](/ref/operator/*=) ++ [+ operator](/ref/operator/+) ++ [-= operator](/ref/operator/-=) ++ [/= operator](/ref/operator//=) ++ [= operator](/ref/operator/=) ++ [operators](/ref/operator) diff --git a/ref/operator/--.md b/ref/operator/--.md index 19af4b14..013b4948 100644 --- a/ref/operator/--.md +++ b/ref/operator/--.md @@ -1,26 +1,26 @@ -## \-- operator -**Format:** -+ \--A // pre-decrement -+ A\-- // post-decrement +## -- (info) +**Format:** ++ --A // pre-decrement ++ A-- // post-decrement +*** +The pre-decrement has the value (A-1) and the effect of subtracting 1 from A. -The pre-decrement has the value (A-1) and the effect of -subtracting 1 from A. +The post-decrement has the value (A) and has the effect of subtracting 1 from A. -The post-decrement has the value (A) and -has the effect of subtracting 1 from A. -### Example: ```dm - var/A = 0 world << "A\-- = [A\--]" // outputs "A = -0" world << "\--A = [\--A]" // outputs "A = -2" -``` +var/A = 0 +world << "A-- = [A--]" // outputs "A = 0" +world << "--A = [--A]" // outputs "A = -2" + +``` -> [!TIP] -> **See also:** -> + [++ operator](/ref/operator/++.md) -> + [- operator](/ref/operator/-.md) -> + [-= operator](/ref/operator/-=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [++ operator](/ref/operator/++) ++ [- operator](/ref/operator/-) ++ [-= operator](/ref/operator/-=) ++ [operators](/ref/operator) diff --git a/ref/operator/-.md b/ref/operator/-.md index 5efff64c..5f902697 100644 --- a/ref/operator/-.md +++ b/ref/operator/-.md @@ -1,4 +1,5 @@ -## - operator + +## - (info) **Format:** + A - B @@ -6,28 +7,17 @@ **Returns:** + The subtraction of B from A. - - -Subtracts B from A. The result of the operation depends on the -types of values being subtracted, mostly on A. - A type B type Result - ----------------- ----------------- --------------------------------------- - num or null (0) num or null (0) Numeric subtraction - icon or /icon icon or color New blended icon via ICON_SUBTRACT - matrix matrix New matrix with components subtracted - turf or pixloc vector New pixloc offset by -B - pixloc turf or pixloc New vector from A to B - vector vector New vector with components subtracted - -> [!TIP] -> **See also:** -> + [* operator](/ref/operator/*.md) -> + [+ operator](/ref/operator/+.md) -> + [-= operator](/ref/operator/-=.md) -> + [/ operator](/ref/operator//.md) -> + [Remove proc (list)](/ref/list/proc/Remove.md) -> + [operators](/ref/operator.md) -> + [icon](/ref/icon.md) -> + [matrix](/ref/matrix.md) -> + [pixloc](/ref/pixloc.md) -> + [vector](/ref/vector.md) \ No newline at end of file +*** +Subtracts B from A. The result of the operation depends on the types of values being subtracted, mostly on A. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*) ++ [+ operator](/ref/operator/+) ++ [-= operator](/ref/operator/-=) ++ [/ operator](/ref/operator//) ++ [Remove proc (list)](/ref/list/proc/Remove) ++ [operators](/ref/operator) ++ [icon](/ref/icon) ++ [matrix](/ref/matrix) ++ [pixloc](/ref/pixloc) ++ [vector](/ref/vector) diff --git a/ref/operator/-=.md b/ref/operator/-=.md index 250c59db..987e1296 100644 --- a/ref/operator/-=.md +++ b/ref/operator/-=.md @@ -1,20 +1,17 @@ -## -= operator + +## -= (info) **Format:** + A -= B - - +*** Set A equal to A - B. It is shorthand for A = A - B. - -If A is an /icon, /matrix, pixloc, or vector, it will be -changed rather than creating a new value and re-assigning it to A. - -> [!TIP] -> **See also:** -> + [*= operator](/ref/operator/*=.md) -> + [+= operator](/ref/operator/+=.md) -> + [- operator](/ref/operator/-.md) -> + [/= operator](/ref/operator//=.md) -> + [= operator](/ref/operator/=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is an /icon, /matrix, pixloc, or vector, it will be changed rather than creating a new value and re-assigning it to A. +*** +**Related Pages:** ++ [*= operator](/ref/operator/*=) ++ [+= operator](/ref/operator/+=) ++ [- operator](/ref/operator/-) ++ [/= operator](/ref/operator//=) ++ [= operator](/ref/operator/=) ++ [operators](/ref/operator) diff --git a/ref/operator/..md b/ref/operator/..md index efdf312d..0438eff8 100644 --- a/ref/operator/..md +++ b/ref/operator/..md @@ -1,31 +1,24 @@ -## . operator +## %2e (info) +*** +This is used to access the procs and vars of a prototyped object. The variable need not actually contain a value with the specified type, but must at least be a type with the specified variable or a runtime error will occur, causing the proc to crash. -This is used to access the procs and vars of a prototyped -object. The variable need not actually contain a value with the -specified type, but must at least be a type with the specified variable -or a runtime error will occur, causing the proc to crash. -### Example: ```dm - var/mob/M = new M.name = "futz" // assign \'name\' mob -var M.Move(0) // call \'Move()\' mob proc + +var/mob/M = new +M.name = "futz" // assign 'name' mob var +M.Move(0) // call 'Move()' mob proc + ``` - - -This is -the same as the `:` operator, except that the compiler checks to see if -the var type has this property, and throws a compiler error if not. It -is good practice to use the `.` operator whenever possible, so more -potential problems can be caught during compilation. - -If `.` -follows a proc call, a list lookup, or a complex expression where the -type can\'t be known, it will act like `:` instead. - -> [!TIP] -> **See also:** -> + [: operator](/ref/operator/:.md) -> + [?. operator](/ref/operator/%3f%2e.md) -> + [?: operator](/ref/operator/%3f:.md) -> + [operators](/ref/operator.md) \ No newline at end of file + + +This is the same as the `:` operator, except that the compiler checks to see if the var type has this property, and throws a compiler error if not. It is good practice to use the `.` operator whenever possible, so more potential problems can be caught during compilation. + +If `.` follows a proc call, a list lookup, or a complex expression where the type can't be known, it will act like `:` instead. +*** +**Related Pages:** ++ [: operator](/ref/operator/:) ++ [?. operator](/ref/operator/%3f%2e) ++ [?: operator](/ref/operator/%3f:) ++ [operators](/ref/operator) diff --git a/ref/operator/.md b/ref/operator/.md new file mode 100644 index 00000000..a0191196 --- /dev/null +++ b/ref/operator/.md @@ -0,0 +1,18 @@ + +## (info) + +**Format:** ++ A / B + +**Returns:** ++ A divided by B. +*** +Divides A and B. The result of the operation depends on the types of values being multiplied, mostly on A. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*) ++ [+ operator](/ref/operator/+) ++ [- operator](/ref/operator/-) ++ [/ path operator](/ref/operator/path//) ++ [/= operator](/ref/operator//=) ++ [operators](/ref/operator) diff --git a/ref/operator/=.md b/ref/operator/=.md index e2de243b..66e2eb62 100644 --- a/ref/operator/=.md +++ b/ref/operator/=.md @@ -1,35 +1,27 @@ -## = operator + +## = (info) **Format:** + A = B +*** +Set A equal to B. +Note that this is not the same as the equality test (==), which tests if A is equal to B. -Set A equal to B. - -Note that this is not the same as -the equality test (==), which tests if A is equal to B. - -All -assignment operators, including calculate-and-assign (such as the += -operator), can be chained together, and they are evaluated in -right-to-left order. Therefore, a = b += c is a legal statement. It is -equivalent to adding b and c, storing the result in b, then setting a to -use the new value of b. (a = b) += c will, on the other hand, set a to -equal b, then add c to a and store the result in a; b is never changed. - -> [!TIP] -> **See also:** -> + [*= operator](/ref/operator/*=.md) -> + [+= operator](/ref/operator/+=.md) -> + [-= operator](/ref/operator/-=.md) -> + [/= operator](/ref/operator//=.md) -> + [%= operator](/ref/operator/%=.md) -> + [\|= operator](/ref/operator/%7C=.md) -> + [&= operator](/ref/operator/&=.md) -> + [\^= operator](/ref/operator/%5E=.md) -> + [<<= operator](/ref/operator/%3c%3c=.md) -> + [>>= operator](/ref/operator/%3e%3e=.md) -> + [:= operator](/ref/operator/:=.md) -> + [\|\|= operator](/ref/operator/%7C%7C=.md) -> + [&&= operator](/ref/operator/&&=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +All assignment operators, including calculate-and-assign (such as the += operator), can be chained together, and they are evaluated in right-to-left order. Therefore, a = b += c is a legal statement. It is equivalent to adding b and c, storing the result in b, then setting a to use the new value of b. (a = b) += c will, on the other hand, set a to equal b, then add c to a and store the result in a; b is never changed. +*** +**Related Pages:** ++ [*= operator](/ref/operator/*=) ++ [+= operator](/ref/operator/+=) ++ [-= operator](/ref/operator/-=) ++ [/= operator](/ref/operator//=) ++ [%= operator](/ref/operator/%=) ++ [|= operator](/ref/operator/|=) ++ [&= operator](/ref/operator/&=) ++ [^= operator](/ref/operator/^=) ++ [<<= operator](/ref/operator/%3c%3c=) ++ [>>= operator](/ref/operator/%3e%3e=) ++ [:= operator](/ref/operator/:=) ++ [||= operator](/ref/operator/||=) ++ [&&= operator](/ref/operator/&&=) ++ [operators](/ref/operator) diff --git a/ref/operator/==.md b/ref/operator/==.md index a595202a..b37ed811 100644 --- a/ref/operator/==.md +++ b/ref/operator/==.md @@ -1,24 +1,21 @@ -## == operator + +## == (info) **Format:** + A == B **Returns:** + 1 if A and B are equal; 0 otherwise +*** +Note that this is not the same as the assignment operator (=), which sets A equal to B. - -Note that this is not the same as the assignment operator (=), -which sets A equal to B. - -To check if A and B are equivalent, -use the \~= operator. - -> [!TIP] -> **See also:** -> + [!= operator](/ref/operator/!=.md) -> + [>= operator](/ref/operator/%3e=.md) -> + [<= operator](/ref/operator/%3c=.md) -> + [<=> operator](/ref/operator/%3c=%3e.md) -> + [\~= operator](/ref/operator/~=.md) -> + [\~! operator](/ref/operator/~!.md) -> + [operators](/ref/operator.md) \ No newline at end of file +To check if A and B are equivalent, use the ~= operator. +*** +**Related Pages:** ++ [!= operator](/ref/operator/!=) ++ [>= operator](/ref/operator/%3e=) ++ [<= operator](/ref/operator/%3c=) ++ [<=> operator](/ref/operator/%3c=%3e) ++ [~= operator](/ref/operator/~=) ++ [~! operator](/ref/operator/~!) ++ [operators](/ref/operator) diff --git a/ref/operator/COLON.md b/ref/operator/COLON.md index 76a14803..a5727190 100644 --- a/ref/operator/COLON.md +++ b/ref/operator/COLON.md @@ -1,29 +1,27 @@ -## : operator +## : (info) +*** +This is the runtime search operator. It is used to access a property (var or proc) of a var that is not explicitly prototyped. If the variable doesn't have the specified variable or proc, a runtime error occurs. -This is the runtime search operator. It is used to access a -property (var or proc) of a var that is not explicitly prototyped. If -the variable doesn\'t have the specified variable or proc, a runtime -error occurs. -### Example: ```dm - var/M M = usr M:name = "futz" // access a mob property -from a non-mob var + +var/M +M = usr +M:name = "futz" // access a mob property from a non-mob var + ``` - - -The `.` operator behaves the same -way, but it checks at compile time whether the property is available. If -the var is assigned a value that isn\'t the correct type and doesn\'t -have this property, a runtime error will still occur. -Note: You should prefer the `.` operator in most situations, because -it\'s better to catch a problem in the compiler instead of at runtime. - -> [!TIP] -> **See also:** -> + [. operator](/ref/operator/%2e.md) -> + [?. operator](/ref/operator/%3f%2e.md) -> + [?: operator](/ref/operator/%3f:.md) -> + [: path operator](/ref/operator/path/:.md) -> + [operators](/ref/operator.md) \ No newline at end of file + + +The `.` operator behaves the same way, but it checks at compile time whether the property is available. If the var is assigned a value that isn't the correct type and doesn't have this property, a runtime error will still occur. + + +> [!TIP] +> Note: You should prefer the `.` operator in most situations, because it's better to catch a problem in the compiler instead of at runtime. +*** +**Related Pages:** ++ [. operator](/ref/operator/%2e) ++ [?. operator](/ref/operator/%3f%2e) ++ [?: operator](/ref/operator/%3f:) ++ [: path operator](/ref/operator/path/:) ++ [operators](/ref/operator) diff --git a/ref/operator/COLON=.md b/ref/operator/COLON=.md index aa0a0f07..c966ae48 100644 --- a/ref/operator/COLON=.md +++ b/ref/operator/COLON=.md @@ -1,26 +1,15 @@ -## := operator -###### BYOND Version 514 + +## := (info) **Format:** + A := B +*** +This is the "assign into" operator. The value of B is evaluated, then A. If A is a datum that has an `operator:=` proc overloading this operator, then that proc will be called with A as its src and B as its only argument. The return value of the proc (which defaults to its src, the old value of A) is assigned into the var that holds A. +If A was not a datum, then B is assigned into the var as if this were an ordinary A = B assignment. -This is the "assign into" operator. The value of B is -evaluated, then A. If A is a datum that has an `operator:=` proc -overloading this operator, then that proc will be called with A as its -src and B as its only argument. The return value of the proc (which -defaults to its src, the old value of A) is assigned into the var that -holds A. - -If A was not a datum, then B is assigned into the var -as if this were an ordinary A = B assignment. - -A common use of -this operator might be to copy another datum. This is basically just -"syntactic sugar" to make certain datums easier to work with, and is -intended mainly for situations where you\'ve overloaded the operator. - -> [!TIP] -> **See also:** -> + [= operator](/ref/operator/=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +A common use of this operator might be to copy another datum. This is basically just "syntactic sugar" to make certain datums easier to work with, and is intended mainly for situations where you've overloaded the operator. +*** +**Related Pages:** ++ [= operator](/ref/operator/=) ++ [operators](/ref/operator) diff --git a/ref/operator/COLONCOLON.md b/ref/operator/COLONCOLON.md index e2727aca..d0b13ea2 100644 --- a/ref/operator/COLONCOLON.md +++ b/ref/operator/COLONCOLON.md @@ -1,77 +1,64 @@ -## :: operator -###### BYOND Version 515 + +## :: (info) **Format:** + ::A + ::A() + A::B + A::B() (proc reference, not a call; see below) - - +*** This is the scope operator. It has multiple uses. -### Global var and proc disambiguation +`::A` is a shorthand for `global.A`, so if you have a local or object var with the same name this disambiguates to the global var. The same is true of `:A()` which will call `global.A()` with the arguments you give it. -`::A` is a shorthand for `global.A`, so if you have a local or -object var with the same name this disambiguates to the global var. The -same is true of `:A()` which will call `global.A()` with the arguments -you give it. -### Static var disambiguation +If `A` is a constant type and `B` is a static var, `A::B` refers to the static var. If you have a local var with the same name, this disambiguates to the static var. This is also the only case where `A::B` can be used as an Lvalue (modifiable expression). +The most common use of the scope operator is to get the initial value for a var. If `A::B` isn't a static var, then it's equivalent to `initial(A:B)`. If `A` is a constant type path, the compiler will go even further by compiling this expression as the actual initial value instead of doing a runtime lookup. -If `A` is a constant type and `B` is a static var, `A::B` -refers to the static var. If you have a local var with the same name, -this disambiguates to the static var. This is also the only case where -`A::B` can be used as an Lvalue (modifiable expression). -### Initial value +This can also be used when defining a var that overrides its parent, by using the `parent_type` keyword for `A`. Multiple `parent_type` levels can be chained together. Similarly, in a static var definition, `type` can be used for `A` the same way. -The most common use of the scope operator is to get the initial -value for a var. If `A::B` isn\'t a static var, then it\'s equivalent to -`initial(A:B)`. If `A` is a constant type path, the compiler will go -even further by compiling this expression as the actual initial value -instead of doing a runtime lookup. +```dm -This can also be used when -defining a var that overrides its parent, by using the `parent_type` -keyword for `A`. Multiple `parent_type` levels can be chained together. -Similarly, in a static var definition, `type` can be used for `A` the -same way. -### Example: +thing + var/price = 60 + better + price = parent_type::price + 40 -```dm - thing var/price = 60 better price = parent_type::price + -40 ``` -### Proc reference +If `B` is a proc, then `A::B()` is a reference to the proc for type `A`, which can be used in `call()`. In this case the parentheses are just a cue for the compiler to know this is a proc reference; it doesn't actually call the proc. Currently, `A` must be a constant type for this usage. -If `B` is a proc, then `A::B()` is a reference to the proc for -type `A`, which can be used in `call()`. In this case the parentheses -are just a cue for the compiler to know this is a proc reference; it -doesn\'t actually call the proc. Currently, `A` must be a constant type -for this usage. -### Example: ```dm - thing proc/DoSomething() world << "Did a thing" better -DoSomething() world << "Did a better thing" proc/Downgrade() -var/thing/better/T = new // will print "Did a better thing" because T -is /thing/better T.DoSomething() // deliberately calls /thing\'s -original version; will print "Did a thing" call(T, -/thing::DoSomething())() -``` +thing + proc/DoSomething() + world << "Did a thing" + better + DoSomething() + world << "Did a better thing" + +proc/Downgrade() + var/thing/better/T = new + + // will print "Did a better thing" because T is /thing/better + T.DoSomething() + + // deliberately calls /thing's original version; will print "Did a thing" + call(T, /thing::DoSomething())() + +``` -> [!TIP] -> **See also:** -> + [. path operator](/ref/operator/path/%2e.md) -> + [/ path operator](/ref/operator/path//.md) -> + [: path operator](/ref/operator/path/:.md) -> + [operators](/ref/operator.md) -> + [call proc](/ref/proc/call.md) -> + [initial proc](/ref/proc/initial.md) -> + [nameof proc](/ref/proc/nameof.md) -> + [istype proc](/ref/proc/istype.md) -> + [astype proc](/ref/proc/astype.md) \ No newline at end of file +*** +**Related Pages:** ++ [. path operator](/ref/operator/path/%2e) ++ [/ path operator](/ref/operator/path//) ++ [: path operator](/ref/operator/path/:) ++ [operators](/ref/operator) ++ [call proc](/ref/proc/call) ++ [initial proc](/ref/proc/initial) ++ [nameof proc](/ref/proc/nameof) ++ [istype proc](/ref/proc/istype) ++ [istype proc](/ref/proc/istype) diff --git a/ref/operator/LEFT.md b/ref/operator/LEFT.md index be188acc..54ad01af 100644 --- a/ref/operator/LEFT.md +++ b/ref/operator/LEFT.md @@ -1,20 +1,18 @@ -## < operator + +## %3c (info) **Format:** + A < B **Returns:** + 1 if A is less than B; 0 otherwise. - - -If A and B are text strings, a case sensitive comparison is -performed (like sorttextEx()). - -> [!TIP] -> **See also:** -> + [<= operator](/ref/operator/%3c=.md) -> + [> operator](/ref/operator/%3e.md) -> + [== operator](/ref/operator/==.md) -> + [<=> operator](/ref/operator/%3c=%3e.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +*** +If A and B are text strings, a case sensitive comparison is performed (like sorttextEx()). +*** +**Related Pages:** ++ [<= operator](/ref/operator/%3c=) ++ [> operator](/ref/operator/%3e) ++ [== operator](/ref/operator/==) ++ [<=> operator](/ref/operator/%3c=%3e) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/LEFT=.md b/ref/operator/LEFT=.md index c38f69f0..08d743ae 100644 --- a/ref/operator/LEFT=.md +++ b/ref/operator/LEFT=.md @@ -1,20 +1,18 @@ -## <= operator + +## %3c= (info) **Format:** + A <= B **Returns:** + 1 if A is less than or equal to B; 0 otherwise. - - -If A and B are text strings, a case sensitive comparison is -performed (like sorttextEx()). - -> [!TIP] -> **See also:** -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [<=> operator](/ref/operator/%3c=%3e.md) -> + [== operator](/ref/operator/==.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +*** +If A and B are text strings, a case sensitive comparison is performed (like sorttextEx()). +*** +**Related Pages:** ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [<=> operator](/ref/operator/%3c=%3e) ++ [== operator](/ref/operator/==) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/LEFT=RIGHT.md b/ref/operator/LEFT=RIGHT.md index e94a9e8c..bfff6984 100644 --- a/ref/operator/LEFT=RIGHT.md +++ b/ref/operator/LEFT=RIGHT.md @@ -1,26 +1,21 @@ -## <=> operator -###### BYOND Version 516 + +## %3c=%3e (info) **Format:** + A <=> B **Returns:** + -1 if A is less B; 1 if A is greater than B; 0 otherwise. +*** +If A and B are text strings, a case sensitive comparison is performed (like sorttextEx()). - -If A and B are text strings, a case sensitive comparison is -performed (like sorttextEx()). - -If either value is the special -number NaN (not a number), the result is currently 0 but should be -considered ambiguous. - -> [!TIP] -> **See also:** -> + [< operator](/ref/operator/%3c.md) -> + [> operator](/ref/operator/%3e.md) -> + [<= operator](/ref/operator/%3c=.md) -> + [>= operator](/ref/operator/%3e=.md) -> + [== operator](/ref/operator/==.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +If either value is the special number NaN (not a number), the result is currently 0 but should be considered ambiguous. +*** +**Related Pages:** ++ [< operator](/ref/operator/%3c) ++ [> operator](/ref/operator/%3e) ++ [<= operator](/ref/operator/%3c=) ++ [>= operator](/ref/operator/%3e=) ++ [== operator](/ref/operator/==) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/LEFTLEFT.md b/ref/operator/LEFTLEFT.md deleted file mode 100644 index 29764a5d..00000000 --- a/ref/operator/LEFTLEFT.md +++ /dev/null @@ -1,5 +0,0 @@ -## << operator -**See also:** -+ [<< operator (savefile)](/ref/savefile/operator/LEFTLEFT.md) -+ [<< output operator](/ref/operator/LEFTLEFT/output.md) -+ [<< shift operator](/ref/operator/LEFTLEFT/shift.md) diff --git a/ref/operator/LEFTLEFT/index.md b/ref/operator/LEFTLEFT/index.md new file mode 100644 index 00000000..47a2672d --- /dev/null +++ b/ref/operator/LEFTLEFT/index.md @@ -0,0 +1,7 @@ + +## %3c%3c (info) +****** +**Related Pages:** ++ [<< operator (savefile)](/ref/savefile/operator/%3c%3c) ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [<< shift operator](/ref/operator/%3c%3c/shift) diff --git a/ref/operator/LEFTLEFT/output.md b/ref/operator/LEFTLEFT/output.md index 7a7a3083..1ba84a78 100644 --- a/ref/operator/LEFTLEFT/output.md +++ b/ref/operator/LEFTLEFT/output.md @@ -1,33 +1,35 @@ -## << output operator + +## output (info) **Format:** + A << B +*** +Cause the value B to be output to any players connected to mobs specified in A. +B may be an image, sound, or text. A may be a mob, the whole world, or any list containing mobs. -Cause the value B to be output to any players connected to mobs -specified in A. - -B may be an image, sound, or text. A may be a -mob, the whole world, or any list containing mobs. -### Example: ```dm - usr << "Hi, [usr.name]" view() << "To all in -view" world << "Hi everybody!" usr << \'giggle.wav\' view() << -image(/obj/Fireball,usr) -``` +usr << "Hi, [usr.name]" +view() << "To all in view" +world << "Hi everybody!" + +usr << 'giggle.wav' +view() << image(/obj/Fireball,usr) + +``` -> [!TIP] -> **See also:** -> + [<< operator (savefile)](/ref/savefile/operator/LEFTLEFT.md) -> + [output proc](/ref/proc/output.md) -> + [browse proc](/ref/proc/browse.md) -> + [browse_rsc proc](/ref/proc/browse_rsc.md) -> + [file proc](/ref/proc/file.md) -> + [ftp proc](/ref/proc/ftp.md) -> + [image proc](/ref/proc/image.md) -> + [link proc](/ref/proc/link.md) -> + [load_resource proc](/ref/proc/load_resource.md) -> + [run proc](/ref/proc/run.md) -> + [sound proc](/ref/proc/sound.md) +*** +**Related Pages:** ++ [<< operator (savefile)](/ref/savefile/operator/%3c%3c) ++ [output proc](/ref/proc/output) ++ [browse proc](/ref/proc/browse) ++ [browse_rsc](/ref/proc/browse_rsc) ++ [file proc](/ref/proc/file) ++ [ftp proc](/ref/proc/ftp) ++ [image proc](/ref/proc/image) ++ [link proc](/ref/proc/link) ++ [load_resource proc](/ref/proc/load_resource) ++ [run proc](/ref/proc/run) ++ [sound proc](/ref/proc/sound) diff --git a/ref/operator/LEFTLEFT/shift.md b/ref/operator/LEFTLEFT/shift.md index be0a8d9f..03583e17 100644 --- a/ref/operator/LEFTLEFT/shift.md +++ b/ref/operator/LEFTLEFT/shift.md @@ -1,19 +1,17 @@ -## << shift operator + +## shift (info) **Format:** + A << B **Returns:** + The bits of A shifted left B times. - - -A and B must be between 0 and 2**24 - 1, giving an effective -width of 24 bits. +*** +A and B must be between 0 and 2**24 - 1, giving an effective width of 24 bits. Bits shifted beyond the 24 low bits are lost. - -> [!TIP] -> **See also:** -> + [>> operator](/ref/operator/%3e%3e.md) -> + [<<= operator](/ref/operator/%3c%3c=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [>> operator](/ref/operator/%3e%3e) ++ [<<= operator](/ref/operator/%3c%3c=) ++ [operators](/ref/operator) diff --git a/ref/operator/LEFTLEFT=.md b/ref/operator/LEFTLEFT=.md index 08751f81..da1c6c70 100644 --- a/ref/operator/LEFTLEFT=.md +++ b/ref/operator/LEFTLEFT=.md @@ -1,13 +1,12 @@ -## <<= operator + +## %3c%3c= (info) **Format:** + A <<= B - - -Set A equal to A << B. It is shorthand for A = A << B. - -> [!TIP] -> **See also:** -> + [>>= operator](/ref/operator/%3e%3e=.md) -> + [<< shift operator](/ref/operator/%3c%3c/shift.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +Set A equal to A << B. It is shorthand for A = A << B. +*** +**Related Pages:** ++ [>>= operator](/ref/operator/%3e%3e=) ++ [<< shift operator](/ref/operator/%3c%3c/shift) ++ [operators](/ref/operator) diff --git a/ref/operator/LEFTRIGHT.md b/ref/operator/LEFTRIGHT.md index 10ca3938..0ed079a8 100644 --- a/ref/operator/LEFTRIGHT.md +++ b/ref/operator/LEFTRIGHT.md @@ -1,19 +1,18 @@ -## <> operator + +## %3c%3e (info) **Format:** + A <> B **Returns:** + 1 if A is not equal to B; 0 otherwise - - +*** This is identical to the != operator. - -> [!TIP] -> **See also:** -> + [!= operator](/ref/operator/!=.md) -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [== operator](/ref/operator/==.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +*** +**Related Pages:** ++ [!= operator](/ref/operator/!=) ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [== operator](/ref/operator/==) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/PERCENT.md b/ref/operator/PERCENT.md index 55b4a1ca..7496fab5 100644 --- a/ref/operator/PERCENT.md +++ b/ref/operator/PERCENT.md @@ -1,31 +1,21 @@ -## % operator + +## % (info) **Format:** + A % B **Returns:** + The remainder of A / B, where both A and B are integers. +*** +`A % B` is read "A modulo B", which stands for the remainder of A divided by B. +This operator only works with integer values, for legacy reasons. A and B are truncated to integers before the modulo operation. There are uses for the integer truncation, but if you don't want that and want the fractional modulo instead, you can now use the `%%` operator. -`A % B` is read "A modulo B", which stands for the remainder -of A divided by B. - -This operator only works with integer -values, for legacy reasons. A and B are truncated to integers before the -modulo operation. There are uses for the integer truncation, but if you -don\'t want that and want the fractional modulo instead, you can now use -the `%%` operator. - -If A is a vector, its components are treated -as integers; B can also be a vector in this case, and its components are -also treated as integers. The result is a new vector. - -If A is a -pixloc, it\'s treated like a 2D vector and the modulo operation is done -with that instead. +If A is a vector, its components are treated as integers; B can also be a vector in this case, and its components are also treated as integers. The result is a new vector. -> [!TIP] -> **See also:** -> + [%= operator](/ref/operator/%=.md) -> + [%% operator](/ref/operator/%25%25.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is a pixloc, it's treated like a 2D vector and the modulo operation is done with that instead. +*** +**Related Pages:** ++ [%= operator](/ref/operator/%=) ++ [%% operator](/ref/operator/%25%25) ++ [operators](/ref/operator) diff --git a/ref/operator/PERCENT=.md b/ref/operator/PERCENT=.md index 46f3d04e..89dddd7e 100644 --- a/ref/operator/PERCENT=.md +++ b/ref/operator/PERCENT=.md @@ -1,20 +1,15 @@ -## %= operator + +## %= (info) **Format:** + A %= B - - +*** Set A equal to `A % B`. It is shorthand for `A = A % B`. +`A % B` is read "A modulo B", which stands for the remainder of A divided by B. A and B are truncated to integers before the modulo; use `%%=` instead to work with fractional values. -`A % B` is read "A modulo B", which stands for the remainder -of A divided by B. A and B are truncated to integers before the modulo; -use `%%=` instead to work with fractional values. - -If A is a -vector, it will be modified by this operation. - -> [!TIP] -> **See also:** -> + [% operator](/ref/operator/%.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is a vector, it will be modified by this operation. +*** +**Related Pages:** ++ [% operator](/ref/operator/%) ++ [operators](/ref/operator) diff --git a/ref/operator/PERCENTPERCENT.md b/ref/operator/PERCENTPERCENT.md index fb06439e..2c5c5eb9 100644 --- a/ref/operator/PERCENTPERCENT.md +++ b/ref/operator/PERCENTPERCENT.md @@ -1,30 +1,21 @@ -## %% operator -###### BYOND Version 515 + +## %25%25 (info) **Format:** + A %% B **Returns:** + The remainder of A / B. +*** +`A %% B` is read "A modulo B", which stands for the remainder of A divided by B. +This is a newer version of the `%` operator that supports all numbers, not just integers. It is equivalent to `B * fract(A / B)`. The `%` operator does the same thing, but truncates A and B to integers first. -`A %% B` is read "A modulo B", which stands for the remainder -of A divided by B. - -This is a newer version of the `%` operator -that supports all numbers, not just integers. It is equivalent to -`B * fract(A / B)`. The `%` operator does the same thing, but truncates -A and B to integers first. - -A can be a vector instead of a -number; B can also be a vector in this case. - -If A is a pixloc, -it\'s treated like a 2D vector and the modulo operation is done with -that instead. +A can be a vector instead of a number; B can also be a vector in this case. -> [!TIP] -> **See also:** -> + [% operator](/ref/operator/%.md) -> + [%%= operator](/ref/operator/%25%25=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is a pixloc, it's treated like a 2D vector and the modulo operation is done with that instead. +*** +**Related Pages:** ++ [% operator](/ref/operator/%) ++ [%%= operator](/ref/operator/%25%25=) ++ [operators](/ref/operator) diff --git a/ref/operator/PERCENTPERCENT=.md b/ref/operator/PERCENTPERCENT=.md index 9f89fc50..4712e360 100644 --- a/ref/operator/PERCENTPERCENT=.md +++ b/ref/operator/PERCENTPERCENT=.md @@ -1,21 +1,15 @@ -## %%= operator -###### BYOND Version 515 + +## %25%25= (info) **Format:** + A %%= B - - +*** Set A equal to `A %% B`. It is shorthand for `A = A %% B`. +`A %% B` is read "A modulo B", which stands for the remainder of A divided by B. This version of the operator works with fractional values for A and B. -`A %% B` is read "A modulo B", which stands for the remainder -of A divided by B. This version of the operator works with fractional -values for A and B. - -If A is a vector, it will be modified by -this operation. - -> [!TIP] -> **See also:** -> + [%% operator](/ref/operator/%25%25.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is a vector, it will be modified by this operation. +*** +**Related Pages:** ++ [%% operator](/ref/operator/%25%25) ++ [operators](/ref/operator) diff --git a/ref/operator/PIPE.md b/ref/operator/PIPE.md index 428c8e69..00013c1f 100644 --- a/ref/operator/PIPE.md +++ b/ref/operator/PIPE.md @@ -1,27 +1,19 @@ -## \| operator + +## | (info) **Format:** -+ A \| B ++ A | B **Returns:** + The binary "or" of A and B. +*** +A and B must be between 0 and 2**24 - 1, giving an effective width of 24 bits. +If A and B are lists, the result is a list containing items that are in either list. list(1,2) | list(2,3) is equivalent to list(1,2,3). The items from A come first in the result, followed by any extra items from B. -A and B must be between 0 and 2**24 - 1, giving an effective -width of 24 bits. - -If A and B are lists, the result is a list -containing items that are in either list. list(1,2) \| list(2,3) is -equivalent to list(1,2,3). The items from A come first in the result, -followed by any extra items from B. - -If A is an icon or /icon -datum, it is blended with B which can be either a color or another icon. -Unlike the + or & operation, the result is transparent only in places -where both icons were transparent. - -> [!TIP] -> **See also:** -> + [& operator](/ref/operator/&.md) -> + [operators](/ref/operator.md) -> + [\|= operator](/ref/operator/%7C=.md) \ No newline at end of file +If A is an icon or /icon datum, it is blended with B which can be either a color or another icon. Unlike the + or & operation, the result is transparent only in places where both icons were transparent. +*** +**Related Pages:** ++ [& operator (pointers)](/ref/operator/&) ++ [operators](/ref/operator) ++ [|= operator](/ref/operator/|=) diff --git a/ref/operator/PIPE=.md b/ref/operator/PIPE=.md index 89792218..27762c57 100644 --- a/ref/operator/PIPE=.md +++ b/ref/operator/PIPE=.md @@ -1,29 +1,26 @@ -## \|= operator - -**Format:** -+ A \|= B +## |= (info) -Set A equal to A \| B. It is shorthand for A = A \| B. - +**Format:** ++ A |= B +*** +Set A equal to A | B. It is shorthand for A = A | B. This is commonly used to turn on certain bitfields in a word. -### Example: + ```dm - usr.sight \|= BLIND // turn on the blind bit -``` +usr.sight |= BLIND // turn on the blind bit +``` -If A and B are lists, any items in B that are not already in A -are added to A. -If A is an /icon or /matrix datum, the datum -will be changed rather than creating a new one and re-assigning it to A. +If A and B are lists, any items in B that are not already in A are added to A. -> [!TIP] -> **See also:** -> + [&= operator](/ref/operator/&=.md) -> + [operators](/ref/operator.md) -> + [\| operator](/ref/operator/%7C.md) \ No newline at end of file +If A is an /icon or /matrix datum, the datum will be changed rather than creating a new one and re-assigning it to A. +*** +**Related Pages:** ++ [&= operator](/ref/operator/&=) ++ [operators](/ref/operator) ++ [| operator](/ref/operator/|) diff --git a/ref/operator/PIPEPIPE.md b/ref/operator/PIPEPIPE.md index 0424ca13..7a61fd6d 100644 --- a/ref/operator/PIPEPIPE.md +++ b/ref/operator/PIPEPIPE.md @@ -1,43 +1,43 @@ -## \|\| operator + +## || (info) **Format:** -+ A \|\| B ++ A || B **Returns:** + First true value of either A or B; last false value otherwise -The only false values in DM are the number 0, an empty text string, or -null. All other values are considered true. +*** + +> [!TIP] +> The only false values in DM are the number 0, an empty text string, or null. All other values are considered true. + +The first true value from left to right completes the evaluation (a practice known as short-circuiting)), meaning that any expressions after the first true value are skipped. The return value is equal to the last operand to be evaluated. -The first true -value from left to right completes the evaluation (a practice known as -short-circuiting)), meaning that any expressions after the first true -value are skipped. The return value is equal to the last operand to be -evaluated. -### Example: ```dm -mob/verb/Fly() if(swimming \|\| IsStuck()) src << "You -can\'t fly right now!" return +mob/verb/Fly() + if(swimming || IsStuck()) + src << "You can't fly right now!" + return + ``` - -In this example, the -`IsStuck()` call is not performed if `swimming` is true. +In this example, the `IsStuck()` call is not performed if `swimming` is true. + +Although logical short-circuit operators are used most often in blocks such as `if` or `while`, they can be used elsewhere. -Although logical short-circuit operators are used most often in -blocks such as `if` or `while`, they can be used elsewhere. -### Example: ```dm - // if current_target is null, pick a new one var/target = -current_target \|\| PickTarget() -``` +// if current_target is null, pick a new one +var/target = current_target || PickTarget() + +``` -> [!TIP] -> **See also:** -> + [! operator](/ref/operator/!.md) -> + [&& operator](/ref/operator/&&.md) -> + [\|\|= operator](/ref/operator/%7C%7C=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [! operator](/ref/operator/!) ++ [&& operator](/ref/operator/&&) ++ [||= operator](/ref/operator/||=) ++ [operators](/ref/operator) diff --git a/ref/operator/PIPEPIPE=.md b/ref/operator/PIPEPIPE=.md index 8e3f4f73..809ae6cb 100644 --- a/ref/operator/PIPEPIPE=.md +++ b/ref/operator/PIPEPIPE=.md @@ -1,29 +1,22 @@ -## \|\|= operator -###### BYOND Version 514 + +## ||= (info) **Format:** -+ A \|\|= B ++ A ||= B **Returns:** -+ Value of `(A || B)` after it has been assigned to A. This expression - can stand by itself; its result does not need to be assigned to - anything else. - - -First A is evaluated. If its value is false, B will be -evaluated and assigned to A. If A is true, B will not be evaluated and A -will remain unchanged. - -Note that this is slightly different -from `if(!A) A = B` if A is a complex expression such as -`list[index++]`, because the expression is only evaluated once. ++ Value of after it has been assigned to A. This +expression can stand by itself; its result does not need to be assigned to +anything else. +*** +First A is evaluated. If its value is false, B will be evaluated and assigned to A. If A is true, B will not be evaluated and A will remain unchanged. +Note that this is slightly different from `if(!A) A = B` if A is a complex expression such as `list[index++]`, because the expression is only evaluated once. This operator cannot be overloaded. - -> [!TIP] -> **See also:** -> + [\|\| operator](/ref/operator/%7C%7C.md) -> + [&& operator](/ref/operator/&&.md) -> + [&&= operator](/ref/operator/&&=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [|| operator](/ref/operator/||) ++ [&& operator](/ref/operator/&&) ++ [&&= operator](/ref/operator/&&=) ++ [operators](/ref/operator) diff --git a/ref/operator/QMARK..md b/ref/operator/QMARK..md index 7792cd53..fb3bd9fd 100644 --- a/ref/operator/QMARK..md +++ b/ref/operator/QMARK..md @@ -1,47 +1,34 @@ -## ?. operator -###### BYOND Version 512 +## %3f%2e (info) +*** +This is used to access the procs and vars of a prototyped object. It is just like the . operator, but if the object is null, the access does not happen and there will be no runtime error. (A runtime error can still happen if the object is valid but is a different type that doesn't have the property available.) -This is used to access the procs and vars of a prototyped -object. It is just like the . operator, but if the object is null, the -access does not happen and there will be no runtime error. (A runtime -error can still happen if the object is valid but is a different type -that doesn\'t have the property available.) +When used in an expression to read a value or call a proc from a null object, the result of the expression is null. When used for assignment, the assignment will not happen, and the expression being assigned will not be evaluated, if the object is null. -When used in an -expression to read a value or call a proc from a null object, the result -of the expression is null. When used for assignment, the assignment will -not happen, and the expression being assigned will not be evaluated, if -the object is null. -### Example: ```dm - var/mob/M // M is null by default M?.name = "futz" // -assignment is skipped because M is null world << M?.name // M?.name -reads as null because M is null M?.Move(loc) // call Move() mob proc; -again nothing happens M = new M?.name = "futz" // assignment is made -because M is valid now world << M?.name // outputs "futz" -M?.Move(loc) // call Move() mob proc for M -``` - -When -reading `A?.B`, it\'s roughly equivalent to `A && A.B` except that `A` -is only evalulated once, even if it\'s a complex expression like a proc -call. Making an assignment to `A?.B` is the same: A is evalulated only -once, and if it\'s not null then an assignment is made to its B var. +var/mob/M // M is null by default +M?.name = "futz" // assignment is skipped because M is null +world << M?.name // M?.name reads as null because M is null +M?.Move(loc) // call Move() mob proc; again nothing happens + +M = new +M?.name = "futz" // assignment is made because M is valid now +world << M?.name // outputs "futz" +M?.Move(loc) // call Move() mob proc for M +``` -For a version of this operator that doesn\'t check at compile -time if the property is available, use the ?: operator instead. +When reading A?.B, it's roughly equivalent to A && A.B except that A is only evalulated once, even if it's a complex expression like a proc call. Making an assignment to A?.B is the same: A is evalulated only once, and if it's not null then an assignment is made to its B var. -If ?. is used after a proc call, a list lookup, or a complex -expression where the type can\'t be known, it will act like ?: instead. +For a version of this operator that doesn't check at compile time if the property is available, use the ?: operator instead. -> [!TIP] -> **See also:** -> + [. operator](/ref/operator/%2e.md) -> + [: operator](/ref/operator/:.md) -> + [?: operator](/ref/operator/%3f:.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If ?. is used after a proc call, a list lookup, or a complex expression where the type can't be known, it will act like ?: instead. +*** +**Related Pages:** ++ [. operator](/ref/operator/%2e) ++ [: operator](/ref/operator/:) ++ [?: operator](/ref/operator/%3f:) ++ [operators](/ref/operator) diff --git a/ref/operator/QMARK.md b/ref/operator/QMARK.md index 87357c64..329559e2 100644 --- a/ref/operator/QMARK.md +++ b/ref/operator/QMARK.md @@ -1,12 +1,10 @@ -## ? operator + +## %3f (info) **Format:** + Expr ? TrueExpr : FalseExpr - - -If Expr is true, this evaluates and returns TrueExpr. -Otherwise, it evaluates and returns FalseExpr. - -> [!TIP] -> **See also:** -> + [operators](/ref/operator.md) \ No newline at end of file +*** +If Expr is true, this evaluates and returns TrueExpr. Otherwise, it evaluates and returns FalseExpr. +*** +**Related Pages:** ++ [operators](/ref/operator) diff --git a/ref/operator/QMARKCOLON.md b/ref/operator/QMARKCOLON.md index 97e097ce..50b34e92 100644 --- a/ref/operator/QMARKCOLON.md +++ b/ref/operator/QMARKCOLON.md @@ -1,43 +1,32 @@ -## ?: operator -###### BYOND Version 512 +## %3f: (info) +*** +This is used to access the procs and vars of an object. It is just like the : operator, but if the object is null, the access does not happen and there will be no runtime error. (A runtime error can still happen if the object is valid but the property is not available.) -This is used to access the procs and vars of an object. It is -just like the : operator, but if the object is null, the access does not -happen and there will be no runtime error. (A runtime error can still -happen if the object is valid but the property is not available.) +When used in an expression to read a value or call a proc from a null object, the result of the expression is null. When used for assignment, the assignment will not happen, and the expression being assigned will not be evaluated, if the object is null. -When used in an expression to read a value or call a proc from -a null object, the result of the expression is null. When used for -assignment, the assignment will not happen, and the expression being -assigned will not be evaluated, if the object is null. -### Example: - ```dm - var/mob/M // M is null by default M?:name = "futz" // -assignment is skipped because M is null world << M?:name // M?:name -reads as null because M is null M?:Move(loc) // call Move() mob proc; -again nothing happens M = new M?:name = "futz" // assignment is made -because M is valid now world << M?:name // outputs "futz" -M?:Move(loc) // call Move() mob proc for M -``` - -When -reading `A?:B`, it\'s roughly equivalent to `A && A:B` except that `A` -is only evalulated once, even if it\'s a complex expression like a proc -call. Making an assignment to `A?:B` is the same: A is evalulated only -once, and if it\'s not null then an assignment is made to its B var. +var/mob/M // M is null by default +M?:name = "futz" // assignment is skipped because M is null +world << M?:name // M?:name reads as null because M is null +M?:Move(loc) // call Move() mob proc; again nothing happens + +M = new +M?:name = "futz" // assignment is made because M is valid now +world << M?:name // outputs "futz" +M?:Move(loc) // call Move() mob proc for M + +``` -This is identical to the ?. operator, except that ?. will check -at compile time if the property is valid for the object type (if known). -For this reason ?. is usually safer. +When reading A?:B, it's roughly equivalent to A && A:B except that A is only evalulated once, even if it's a complex expression like a proc call. Making an assignment to A?:B is the same: A is evalulated only once, and if it's not null then an assignment is made to its B var. -> [!TIP] -> **See also:** -> + [. operator](/ref/operator/%2e.md) -> + [: operator](/ref/operator/:.md) -> + [?. operator](/ref/operator/%3f%2e.md) -> + [operators](/ref/operator.md) \ No newline at end of file +This is identical to the ?. operator, except that ?. will check at compile time if the property is valid for the object type (if known). For this reason ?. is usually safer. +*** +**Related Pages:** ++ [. operator](/ref/operator/%2e) ++ [: operator](/ref/operator/:) ++ [?. operator](/ref/operator/%3f%2e) ++ [operators](/ref/operator) diff --git a/ref/operator/QMARK[].md b/ref/operator/QMARK[].md index d6d8ce88..73370366 100644 --- a/ref/operator/QMARK[].md +++ b/ref/operator/QMARK[].md @@ -1,36 +1,35 @@ -## ?[] operator -###### BYOND Version 514 +## %3f[] (info) +*** +This is the null-conditional list index operator. It is used to access an element of a list, IF that list is not null. If the list is null, then the access will not happen and the index expression inside the brackets won't be evaluated. If this is the left-hand side of an assignment operator, such as `list?[index] = rhs`, then `rhs` is also not evaluated when the list is null. -This is the null-conditional list index operator. It is used to -access an element of a list, IF that list is not null. If the list is -null, then the access will not happen and the index expression inside -the brackets won\'t be evaluated. If this is the left-hand side of an -assignment operator, such as `list?[index] = rhs`, then `rhs` is also -not evaluated when the list is null. -### Example: ```dm - var/list/good = list(5,6,7) var/list/bad var/idx = 1 // -prints null because bad is null; idx is not changed world << -json_encode(bad?[idx++]) // prints 5 because good is not null, and -good[1] is 5; idx changes to 2 world << json_encode(good?[1]) idx -= 1 // reset idx // bad is null, so idx does not advance and myproc() is -not called bad?[idx++] = myproc() // good is not null, so idx advances -after read, and myproc() is called good?[idx++] = myproc() -``` +var/list/good = list(5,6,7) +var/list/bad +var/idx = 1 + +// prints null because bad is null; idx is not changed +world << json_encode(bad?[idx++]) +// prints 5 because good is not null, and good[1] is 5; idx changes to 2 +world << json_encode(good?[1]) +idx = 1 // reset idx -This operator cannot be overloaded, but overloads to the `[]` -operator will apply to this operator as well. +// bad is null, so idx does not advance and myproc() is not called +bad?[idx++] = myproc() +// good is not null, so idx advances after read, and myproc() is called +good?[idx++] = myproc() +``` -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [operators](/ref/operator.md) -> + [[] operator](/ref/operator/%5B%5D.md) -> + [?. operator](/ref/operator/%3f%2e.md) -> + [?: operator](/ref/operator/%3f:.md) \ No newline at end of file +This operator cannot be overloaded, but overloads to the `[]` operator will apply to this operator as well. +*** +**Related Pages:** ++ [list](/ref/list) ++ [operators](/ref/operator) ++ [[] operator](/ref/operator/[]) ++ [?. operator](/ref/operator/%3f%2e) ++ [?: operator](/ref/operator/%3f:) diff --git a/ref/operator/RIGHT.md b/ref/operator/RIGHT.md index 946b8fc3..37806c8e 100644 --- a/ref/operator/RIGHT.md +++ b/ref/operator/RIGHT.md @@ -1,20 +1,18 @@ -## > operator + +## %3e (info) **Format:** + A > B **Returns:** + 1 if A is greater than B; 0 otherwise. - - -If A and B are text strings, a case sensitive comparison is -performed (like sorttextEx()). - -> [!TIP] -> **See also:** -> + [>= operator](/ref/operator/%3e=.md) -> + [< operator](/ref/operator/%3c.md) -> + [<=> operator](/ref/operator/%3c=%3e.md) -> + [== operator](/ref/operator/==.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +*** +If A and B are text strings, a case sensitive comparison is performed (like sorttextEx()). +*** +**Related Pages:** ++ [>= operator](/ref/operator/%3e=) ++ [< operator](/ref/operator/%3c) ++ [<=> operator](/ref/operator/%3c=%3e) ++ [== operator](/ref/operator/==) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/RIGHT=.md b/ref/operator/RIGHT=.md index 00ae6785..e18e017f 100644 --- a/ref/operator/RIGHT=.md +++ b/ref/operator/RIGHT=.md @@ -1,20 +1,18 @@ -## >= operator + +## %3e= (info) **Format:** + A >= B **Returns:** + 1 if A is greater or equal to B; 0 otherwise. - - -If A and B are text strings, a case sensitive comparison is -performed (like sorttextEx()). - -> [!TIP] -> **See also:** -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [<=> operator](/ref/operator/%3c=%3e.md) -> + [== operator](/ref/operator/==.md) -> + [operators](/ref/operator.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +*** +If A and B are text strings, a case sensitive comparison is performed (like sorttextEx()). +*** +**Related Pages:** ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [<=> operator](/ref/operator/%3c=%3e) ++ [== operator](/ref/operator/==) ++ [operators](/ref/operator) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/operator/RIGHTRIGHT.md b/ref/operator/RIGHTRIGHT.md deleted file mode 100644 index b96db2dd..00000000 --- a/ref/operator/RIGHTRIGHT.md +++ /dev/null @@ -1,5 +0,0 @@ -## >> operator -**See also:** -+ [>> input operator](/ref/operator/%3e%3e/input.md) -+ [>> operator (savefile)](/ref/savefile/operator/%3e%3e.md) -+ [>> shift operator](/ref/operator/%3e%3e/shift.md) \ No newline at end of file diff --git a/ref/operator/RIGHTRIGHT/index.md b/ref/operator/RIGHTRIGHT/index.md new file mode 100644 index 00000000..006e23ef --- /dev/null +++ b/ref/operator/RIGHTRIGHT/index.md @@ -0,0 +1,7 @@ + +## %3e%3e (info) +****** +**Related Pages:** ++ [>> input operator](/ref/operator/%3e%3e/input) ++ [>> operator (savefile)](/ref/savefile/operator/%3e%3e) ++ [>> shift operator](/ref/operator/%3e%3e/shift) diff --git a/ref/operator/RIGHTRIGHT/input.md b/ref/operator/RIGHTRIGHT/input.md index 5dfd9628..605dd3f9 100644 --- a/ref/operator/RIGHTRIGHT/input.md +++ b/ref/operator/RIGHTRIGHT/input.md @@ -1,13 +1,11 @@ -## >> input operator + +## input (info) **Format:** + F >> Var - - -Cause input to be read from a file into a variable. The file -may be a savefile or a file object corresponding to a text file. - -> [!TIP] -> **See also:** -> + [>> operator (savefile)](/ref/savefile/operator/%3e%3e.md) -> + [file proc](/ref/proc/file.md) \ No newline at end of file +*** +Cause input to be read from a file into a variable. The file may be a savefile or a file object corresponding to a text file. +*** +**Related Pages:** ++ [>> operator (savefile)](/ref/savefile/operator/%3e%3e) ++ [file proc](/ref/proc/file) diff --git a/ref/operator/RIGHTRIGHT/shift.md b/ref/operator/RIGHTRIGHT/shift.md index dbc84985..ed30361f 100644 --- a/ref/operator/RIGHTRIGHT/shift.md +++ b/ref/operator/RIGHTRIGHT/shift.md @@ -1,19 +1,17 @@ -## >> shift operator + +## shift (info) **Format:** + A >> B **Returns:** + The bits of A shifted right B times. - - -A and B must be between 0 and 2**24 - 1, giving an effective -width of 24 bits. +*** +A and B must be between 0 and 2**24 - 1, giving an effective width of 24 bits. Bits shifted below the 24 low bits are lost. - -> [!TIP] -> **See also:** -> + [>>= operator](/ref/operator/%3e%3e=.md) -> + [<< shift operator](/ref/operator/%3c%3c/shift.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [>>= operator](/ref/operator/%3e%3e=) ++ [<< shift operator](/ref/operator/%3c%3c/shift) ++ [operators](/ref/operator) diff --git a/ref/operator/RIGHTRIGHT=.md b/ref/operator/RIGHTRIGHT=.md index 9a527764..33d48c9e 100644 --- a/ref/operator/RIGHTRIGHT=.md +++ b/ref/operator/RIGHTRIGHT=.md @@ -1,12 +1,12 @@ -## >>= operator + +## %3e%3e= (info) **Format:** + A >>= B - -Set A equal to A >> B. It is shorthand for A = A >> B. - -> [!TIP] -> **See also:** -> + [>> shift operator](/ref/operator/%3e%3e/shift.md) -> + [<<= operator](/ref/operator/%3c%3c=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +Set A equal to A >> B. It is shorthand for A = A >> B. +*** +**Related Pages:** ++ [>> shift operator](/ref/operator/%3e%3e/shift) ++ [<<= operator](/ref/operator/%3c%3c=) ++ [operators](/ref/operator) diff --git a/ref/operator/SLASH.md b/ref/operator/SLASH.md deleted file mode 100644 index 8771585c..00000000 --- a/ref/operator/SLASH.md +++ /dev/null @@ -1,32 +0,0 @@ -## / operator - -**Format:** -+ A / B - -**Returns:** -+ A divided by B. - - -Divides A and B. The result of the operation depends on the -types of values being multiplied, mostly on A. - A type B type Result - ----------------- --------------------------------------------------------- ---------------------------------------------------------------------------- - num or null (0) num or null (0) Numeric division; crashes if B is equivalent to 0 - icon or /icon num or color New icon dividing RGB components by color - matrix matrix New matrix, product of A and the inverse of B - num New matrix scaling A by 1/B - vector New matrix scaling A by 1/B.x and 1/B.y - pixloc num or vector Creates a 2D vector from pixloc\'s x,y and divides that by the rules below - vector 2D vector dividing x,y components by the divisor\'s x,y - vector vector New vector with components divided - matrix New vector with 2D transformation applied in reverse - num New vector scaling A by 1/B - -> [!TIP] -> **See also:** -> + [* operator](/ref/operator/*.md) -> + [+ operator](/ref/operator/+.md) -> + [- operator](/ref/operator/-.md) -> + [/ path operator](/ref/operator/path//.md) -> + [/= operator](/ref/operator//=.md) -> + [operators](/ref/operator.md) \ No newline at end of file diff --git a/ref/operator/SLASH=.md b/ref/operator/SLASH=.md deleted file mode 100644 index 7ea886e4..00000000 --- a/ref/operator/SLASH=.md +++ /dev/null @@ -1,20 +0,0 @@ -## /= operator - -**Format:** -+ A /= B - - -Set A equal to A / B. It is shorthand for A = A / B. - - -If A is an /icon, /matrix, or vector, it will be changed rather -than creating a new value and re-assigning it to A. - -> [!TIP] -> **See also:** -> + [* operator](/ref/operator/STAR.md) -> + [+= operator](/ref/operator/+=.md) -> + [-= operator](/ref/operator/-=.md) -> + [/= operator](/ref/operator//=.md) -> + [= operator](/ref/operator/=.md) -> + [operators](/ref/operator.md) \ No newline at end of file diff --git a/ref/operator/STAR.md b/ref/operator/STAR.md deleted file mode 100644 index ac16c26b..00000000 --- a/ref/operator/STAR.md +++ /dev/null @@ -1,28 +0,0 @@ -## \* operator - -**Format:** -+ A * B - -**Returns:** -+ The product of A and B. - -Multiplies A and B. The result of the operation depends on the -types of values being multiplied, mostly on A. - A type B type Result - ----------------- ---------------------- ------------------------------------------------ - num or null (0) num or null (0) Numeric product - icon or /icon icon or num or color New blended icon via ICON_MULTIPLY - matrix matrix New matrix, product of A and B - num New matrix scaling A by B - vector New matrix scaling A by B.x and B.y - vector vector New vector with components multiplied together - matrix New vector with 2D transformation applied - num New vector scaling A by B - -> [!TIP] -> **See also:** -> + [*= operator](/ref/operator/*=.md) -> + [+ operator](/ref/operator/+.md) -> + [- operator](/ref/operator/-.md) -> + [/ operator](/ref/operator//.md) -> + [operators](/ref/operator.md) \ No newline at end of file diff --git a/ref/operator/STAR/index.md b/ref/operator/STAR/index.md new file mode 100644 index 00000000..2a775c71 --- /dev/null +++ b/ref/operator/STAR/index.md @@ -0,0 +1,17 @@ + +## * (info) + +**Format:** ++ A * B + +**Returns:** ++ The product of A and B. +*** +Multiplies A and B. The result of the operation depends on the types of values being multiplied, mostly on A. +*** +**Related Pages:** ++ [*= operator](/ref/operator/*=) ++ [+ operator](/ref/operator/+) ++ [- operator](/ref/operator/-) ++ [/ operator](/ref/operator//) ++ [operators](/ref/operator) diff --git a/ref/operator/STAR/pointer =STAR operator (pointers).md b/ref/operator/STAR/pointer =STAR operator (pointers).md deleted file mode 100644 index d25a6848..00000000 --- a/ref/operator/STAR/pointer =STAR operator (pointers).md +++ /dev/null @@ -1,40 +0,0 @@ -## * pointer operator -###### BYOND Version 515 - -**Format:** -+ *A - -**Returns:** -+ The value pointed at by a pointer stored in A -This operator is also called the dereference operator, since it takes a -pointer reference and gives you the value within.) - -When using -the `&` operator to get a reference pointer, you can access the value it -points to with this version of the `*` operator. This can also be used -on the left-hand side of assignment operations, for instance `*A = B` or -`*X += Y`, to store the result in the place the pointer indicates. -### Example: - -```dm - atom/proc/PixelPos(px, py) // get an exact step position -*px = (x-1) * 32 // this code assumes a 32x32 icon size *py = (y-1) -* 32 atom/movable/PixelPos(px, py) // get an exact step position ..() -*px += step_x // this code assumes a 32x32 icon size *py += step_y -mob/verb/WhereAmI() var/X, Y PixelPos(&X, &Y) usr << "You are at -[X],[Y] on level [z]" -``` - - -Note: If you try to -read to or write from a pointer reference that is no longer valid, such -as to a var inside a proc that has ended, the read or write will fail -silently; reading will return a null value. (An exception is pointers to -list items. If the index is out of bounds, you will get the expected -error.) - -> [!TIP] -> **See also:** -> + [& pointer operator](/ref/operator/&/pointer.md) -> + [operators](/ref/operator.md) -> + [ispointer proc](/ref/proc/ispointer.md) \ No newline at end of file diff --git a/ref/operator/STAR/pointer.md b/ref/operator/STAR/pointer.md new file mode 100644 index 00000000..b34f88d6 --- /dev/null +++ b/ref/operator/STAR/pointer.md @@ -0,0 +1,41 @@ + +## pointer (info) + +**Format:** ++ *A + +**Returns:** ++ The value pointed at by a pointer stored in A +*** + +> [!TIP] +> This operator is also called the dereference operator, since it takes a pointer reference and gives you the value within.) + +When using the `&` operator to get a reference pointer, you can access the value it points to with this version of the `*` operator. This can also be used on the left-hand side of assignment operations, for instance `*A = B` or `*X += Y`, to store the result in the place the pointer indicates. + + +```dm + +atom/proc/PixelPos(px, py) // get an exact step position + *px = (x-1) * 32 // this code assumes a 32x32 icon size + *py = (y-1) * 32 + +atom/movable/PixelPos(px, py) // get an exact step position + ..() + *px += step_x // this code assumes a 32x32 icon size + *py += step_y + +mob/verb/WhereAmI() + var/X, Y + PixelPos(&X, &Y) + usr << "You are at [X],[Y] on level [z]" + +``` + + +Note: If you try to read to or write from a pointer reference that is no longer valid, such as to a var inside a proc that has ended, the read or write will fail silently; reading will return a null value. (An exception is pointers to list items. If the index is out of bounds, you will get the expected error.) +*** +**Related Pages:** ++ [& pointer operator](/ref/operator/&/pointer) ++ [operators](/ref/operator) ++ [ispointer proc](/ref/proc/ispointer) diff --git a/ref/operator/STAR=.md b/ref/operator/STAR=.md index 45ee4aef..823f83ac 100644 --- a/ref/operator/STAR=.md +++ b/ref/operator/STAR=.md @@ -1,20 +1,17 @@ -## *= operator + +## *= (info) **Format:** + A *= B - - +*** Set A equal to A * B. It is shorthand for A = A * B. - -If A is an /icon, /matrix, or vector, it will be changed rather -than creating a new value and re-assigning it to A. - -> [!TIP] -> **See also:** -> + [* operator](/ref/operator/*.md) -> + [+= operator](/ref/operator/+=.md) -> + [-= operator](/ref/operator/-=.md) -> + [/= operator](/ref/operator//=.md) -> + [= operator](/ref/operator/=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A is an /icon, /matrix, or vector, it will be changed rather than creating a new value and re-assigning it to A. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*) ++ [+= operator](/ref/operator/+=) ++ [-= operator](/ref/operator/-=) ++ [/= operator](/ref/operator//=) ++ [= operator](/ref/operator/=) ++ [operators](/ref/operator) diff --git a/ref/operator/STARSTAR.md b/ref/operator/STARSTAR.md index dfe630be..d42e5e9d 100644 --- a/ref/operator/STARSTAR.md +++ b/ref/operator/STARSTAR.md @@ -1,18 +1,20 @@ -## ** operator + +## ** (info) **Format:** + A ** B **Returns:** + A to the power of B. -### Example: +*** ```dm - usr << 2 ** 3 // outputs 8 -``` +usr << 2 ** 3 // outputs 8 + +``` -> [!TIP] -> **See also:** -> + [log proc](/ref/proc/log.md) -> + [operators](/ref/operator.md) \ No newline at end of file +*** +**Related Pages:** ++ [log proc](/ref/proc/log) ++ [operators](/ref/operator) diff --git a/ref/operator/[].md b/ref/operator/[].md index 76192081..1887282c 100644 --- a/ref/operator/[].md +++ b/ref/operator/[].md @@ -1,24 +1,20 @@ -## [] operator - - +## [] (info) +*** This is used to access an element of a list. -### Example: + ```dm - var/L[2] // declares list of size 2 L[1] = 10 // -assign first element + +var/L[2] // declares list of size 2 +L[1] = 10 // assign first element + ``` - -If you want to use a datum like -a list, you can [overload](/ref/operator/overload.md) the operator by defining -an `operator[]` proc for reading a value, and `operator[]=` for writing -a value. Those overloads also apply if you use the null-conditional -`?[]` operator. -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [operators](/ref/operator.md) -> + [?[] operator](/ref/operator/%3f%5B%5D.md) \ No newline at end of file +If you want to use a datum like a list, you can overload the operator by defining an `operator[]` proc for reading a value, and `operator[]=` for writing a value. Those overloads also apply if you use the null-conditional `?[]` operator. +*** +**Related Pages:** ++ [list](/ref/list) ++ [operators](/ref/operator) ++ [?[] operator](/ref/operator/%3f[]) diff --git a/ref/operator/^.md b/ref/operator/^.md index 6a580fae..9260c632 100644 --- a/ref/operator/^.md +++ b/ref/operator/^.md @@ -1,21 +1,16 @@ -## \^ operator + +## ^ (info) **Format:** -+ A \^ B ++ A ^ B **Returns:** + The binary "xor" of A and B. +*** +A and B must be between 0 and 2**24 - 1, giving an effective width of 24 bits. - -A and B must be between 0 and 2**24 - 1, giving an effective -width of 24 bits. - -If A and B are lists, the result is a list -containing items that are in either list but not both. list(1,2) \^ -list(2,3) is equivalent to list(1,3). The items found only in A come -first in the result, followed by any items found only in B. - -> [!TIP] -> **See also:** -> + [\^= operator](/ref/operator/%5E=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +If A and B are lists, the result is a list containing items that are in either list but not both. list(1,2) ^ list(2,3) is equivalent to list(1,3). The items found only in A come first in the result, followed by any items found only in B. +*** +**Related Pages:** ++ [^= operator](/ref/operator/^=) ++ [operators](/ref/operator) diff --git a/ref/operator/^=.md b/ref/operator/^=.md index ac101b3a..df91a476 100644 --- a/ref/operator/^=.md +++ b/ref/operator/^=.md @@ -1,16 +1,13 @@ -## \^= operator -**Format:** -+ A \^= B - - -Set A equal to A \^ B. It is shorthand for A = A \^ B. +## ^= (info) - -If A and B are lists, any items that are found in both lists -are removed from A, and then any items found only in B are added to A. - -> [!TIP] -> **See also:** -> + [\^ operator](/ref/operator/%5E.md) -> + [operators](/ref/operator.md) \ No newline at end of file +**Format:** ++ A ^= B +*** +Set A equal to A ^ B. It is shorthand for A = A ^ B. + +If A and B are lists, any items that are found in both lists are removed from A, and then any items found only in B are added to A. +*** +**Related Pages:** ++ [^ operator](/ref/operator/^) ++ [operators](/ref/operator) diff --git a/ref/operator/in.md b/ref/operator/in.md index fad72710..42a715e0 100644 --- a/ref/operator/in.md +++ b/ref/operator/in.md @@ -1,50 +1,26 @@ -## in operator +## in (info) **Format:** + A in List -**Returns:** -**1 if A exists in List; 0 if not** - - -This is a relatively safe way to check if an item is in a list, -because the value of `List` is allowed to be a non-list value, such as -null. Compare to `List.Find(A)` which will fail if `List` is not an -actual list. - -`List` can also be an atom, in which case -`A in List` is equivalent to `A in List.contents`. -::: note - - -The `in` operator has a lower precedence than `!`, which can be -a point of confusion. If you want to check if something is *not* in a -list, it\'s a common mistake to try `if(!A in List)`. Unfortunately the -`!A` part is evaluated first and becomes 0 or 1, so you\'re really -asking if 0 or 1 is in the list. The correct way to check if something -is not in a list is to wrap the `in` operator and its operands with -parentheses, as in `if(!(A in List))`. - -Similarly, the -assignment operators also have higher precedence than `in`, so -`has_thing = thing in src` will not be interpreted as you might expect. -Again the solution is to use parentheses, e.g. -`has_thing = (thing in src)`. -::: - - -The `in` operator is also a modifier for some procs such as -[locate()](/ref/proc/locate.md) and [input()](/ref/proc/input.md) . -Note: For [associative lists](/ref/list/associations.md) there\'s a faster way -to see if an item is in that list. The lookup of `List[A]` in an -associative list is relatively fast, so if the associated value is -always expected to be true (not null, 0, or an empty string), you can -use `List[A]` instead of `A in List` in those situations. - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [operators](/ref/operator.md) -> + [! operator](/ref/operator/!.md) -> + [locate proc](/ref/proc/locate.md) -> + [input proc](/ref/proc/input.md) \ No newline at end of file +*** +This is a relatively safe way to check if an item is in a list, because the value of `List` is allowed to be a non-list value, such as null. Compare to `List.Find(A)` which will fail if `List` is not an actual list. + +`List` can also be an atom, in which case `A in List` is equivalent to `A in List.contents`. + +The `in` operator has a lower precedence than `!`, which can be a point of confusion. If you want to check if something is *not* in a list, it's a common mistake to try `if(!A in List)`. Unfortunately the `!A` part is evaluated first and becomes 0 or 1, so you're really asking if 0 or 1 is in the list. The correct way to check if something is not in a list is to wrap the `in` operator and its operands with parentheses, as in `if(!(A in List))`. + +Similarly, the assignment operators also have higher precedence than `in`, so `has_thing = thing in src` will not be interpreted as you might expect. Again the solution is to use parentheses, e.g. `has_thing = (thing in src)`. + +The `in` operator is also a modifier for some procs such as locate() and input(). + + +> [!TIP] +> Note: For associative lists there's a faster way to see if an item is in that list. The lookup of `List[A]` in an associative list is relatively fast, so if the associated value is always expected to be true (not null, 0, or an empty string), you can use `List[A]` instead of `A in List` in those situations. +*** +**Related Pages:** ++ [list](/ref/list) ++ [operators](/ref/operator) ++ [! operator](/ref/operator/!) ++ [locate proc](/ref/proc/locate) ++ [input proc](/ref/proc/input) diff --git a/ref/operator/index.md b/ref/operator/index.md new file mode 100644 index 00000000..152960d8 --- /dev/null +++ b/ref/operator/index.md @@ -0,0 +1,25 @@ + +## operator (info) +*** +Operators are used extensively in DM to compute numerical values. + +The DM operators are: + +Each line has higher order of operations than the next. Operators within a line have equal precedence and therefore are processed from left to right as they occur in an expression. (Assignment, or operate-and-assign, are processed from right to left.) + +Expressions of the form `A #= B` are shorthand for `A = A # B` except for `~=` and `:=`. + + +```dm + +var/N +N = 0 // 0 +N += 1+1*2 // 3 +if(1 + 1 == 2) N = 2 // 2 +if(N==2 && 1/2==0.5) N = 0.5 // 0.5 + +``` + +*** +**Related Pages:** ++ [operator overloading](/ref/operator/overload) diff --git a/ref/operator/operator.md b/ref/operator/operator.md deleted file mode 100644 index bbcf70ce..00000000 --- a/ref/operator/operator.md +++ /dev/null @@ -1,48 +0,0 @@ -## operators - - -Operators are used extensively in DM to compute numerical -values. - -The DM operators are: -``` dmcode -() . : / :: // here . : / are path operators -[] . : -?[] ?. ?: -~ ! - ++ -- * & // unary operators (* and & here are pointer operators) -** -* / % %% -+ - -< <= > >= <=> -<< >> -== != <> ~= ~! -& -^ -| -&& -|| -? // ternary a ? b : c -= += -= -= *= /= %= %%= &= |= ^= <<= >>= := &&= ||= -in -``` - - -Each line has higher order of operations than the next. -Operators within a line have equal precedence and therefore are -processed from left to right as they occur in an expression. -(Assignment, or operate-and-assign, are processed from right to left.) - - -Expressions of the form `A #= B` are shorthand for `A = A # B` -except for `~=` and `:=`. -### Example: - -```dm - var/N N = 0 // 0 N += 1+1*2 // 3 if(1 + 1 == 2) N = 2 // -2 if(N==2 && 1/2==0.5) N = 0.5 // 0.5 -``` - - -> [!TIP] -> **See also:** -> + [operator overloading](/ref/operator/overload.md) \ No newline at end of file diff --git a/ref/operator/overload.md b/ref/operator/overload.md index 8eed8c9f..8d7fa1dc 100644 --- a/ref/operator/overload.md +++ b/ref/operator/overload.md @@ -1,201 +1,37 @@ -## operator overloading -###### BYOND Version 512" short="overloading +## overload (info) +*** +DM allows you to overload most of the operators it uses when working with datums and other objects. This means that A + B can call a proc defined under A instead, with B as an argument, and the return value of that proc would be the result. -DM allows you to overload most of the operators it uses when -working with datums and other objects. This means that A + B can call a -proc defined under A instead, with B as an argument, and the return -value of that proc would be the result. +The proc name for an overloaded operator is "operator" followed immediately by the operator itself, such as operator* to override the multiplication operator. `A * B` will call `A.operator*(B)` if the proc is available. -The proc name for an -overloaded operator is "operator" followed immediately by the operator -itself, such as `operator*` to override the multiplication operator. -`A * B` will call `A.operator*(B)` if the proc is available. -### Example: ```dm - complex // complex number a+bi var/a as num var/b as num -New(\_a,\_b) a = \_a b = \_b proc/operator+(complex/C) if(istype(C)) -return new/complex(a+C.a, b+C.b) if(isnum(C)) return new/complex(a+C, b) -return src proc/operator+=(complex/C) if(istype(C)) a += C.a b += C.b -else if(isnum(C)) a += C -``` - - -The following operators may -be overloaded: -Operators -Proc -Notes -Arithmetic and binary (return new value) -A + B -A.operator+(B) -A - B -A.operator-(B) --A -A.operator-() -Same proc as subtraction, but has no arguments -A * B -A.operator*(B) -A / B -A.operator/(B) -A % B -A.operator%(B) -A %% B -A.operator%%(B) -A ** B -A.operator**(B) -A \| B -A.operator\|(B) -A & B -A.operator&(B) -A \^ B -A.operator\^(B) -\~A -A.operator\~() -A << B (shift) -A.operator<<(B) -A >> B (shift) -A.operator>>(B) -A << B (output) -A.operator<<(B,A,window)\ -world.operator<<(B,target,window) -Ignores return value\ -..() falls back on world proc, then default behavior -A >> B (input) -A.operator>>(null,A)\ -world.operator>>(null,source) -Return value is assigned to B\ -..() falls back on world proc, then default behavior -Comparisons (return true or false) -A \~= B -A.operator\~=(B) -A \~! B -A.operator\~!(B) -A < B -A.operator<(B) -A >= B -A.operator>=(B) -A > B -A.operator>(B) -A <= B -A.operator<=(B) -A <=> B -A.operator<=>(B) -Assignments with side effects (return value defaults to src) -A += B -A.operator+=(B) -A -= B -A.operator\--(B) -A *= B -A.operator*=(B) -A /= B -A.operator/=(B) -A %= B -A.operator%=(B) -A %%= B -A.operator%%=(B) -A \|= B -A.operator\|=(B) -A &= B -A.operator&=(B) -A \^= B -A.operator\^=(B) -A <<= B -A.operator<<=(B) -A >>= B -A.operator>>=(B) -A := B -A.operator:=(B) -++A -A.operator++() -\--A -A.operator\--() -A++ -A.operator++(1) -A\-- -A.operator\--(1) -List access -A[idx] -A.operator[](idx) -Used for reading a list value -A[idx] = B -A.operator[]=(idx, B) -Used for writing a list value; ignores return value -Other -turn(A, B) -A.operator_turn(B) -"[A]" -A.operator""() -Specifies a custom way for converting A to text (see notes below) - -Some operators cannot be overloaded. The `=` operator for -direct assignment is one. The `!` operator is another. The `==` and `!=` -operators measure equality and can\'t be overloaded, but `~=` and `~!` -for equivalence can be. It would also be meaningless to override the -ternary `? :` operator pair, and the `.` and `:` family of operators for -accessing vars and procs. +complex // complex number a+bi + var/a as num + var/b as num -Comparison operators come in opposing -pairs: `~=` vs. `~!`, `<` vs. `>=`, `>` vs. `<=`. You only need to -override one operator from each pair; DM is smart enough to know that -`!(A ~= B)` is the same as `A ~! B`. + New(_a,_b) + a = _a + b = _b -By the same logic, you -don\'t have to define the assign-with-side-effect operators like `+=` if -you don\'t want to. For instance if you override `+` but not `+=`, then -`A += B` will be handled internally as `A = A + B`, which means the -value of `A` after the statement may be a different datum than `A` was -before. The value of `A` can also change if you *do* overload `+=` but -the proc returns a value other than null; its return value will be the -new `A`. + proc/operator+(complex/C) + if(istype(C)) return new/complex(a+C.a, b+C.b) + if(isnum(C)) return new/complex(a+C, b) + return src -If an overloaded proc is not available for an operator -you try to use on a datum, a runtime error may result. + proc/operator+=(complex/C) + if(istype(C)) + a += C.a + b += C.b + else if(isnum(C)) a += C -The -output and input operators are given special treatment. If no overload -is defined for the current left-hand-side value, the overload proc is -looked up under `world` instead. The world overload proc is also a -fallback if `..()` is called, and after that `..()` does the default -behavior. These procs are always called with multiple arguments, to -distinguish them from bitwise shift operators. The output version gets a -third argument when the result `output()` is sent, since that can -include a window reference. -### Example: - -```dm - // Send an effect to a player or list of players -proc/DoEffect(target, effect/E) if(istype(target, /list)) for(var/i in -target) DoEffect(i, E) return if(target == world \|\| target == -world.contents) for(var/client/C) DoEffect(C, E) if(istype(target, -/client)) DoEffect(target:mob) if(istype(target, /mob)) -if(target:client) ... // do something here to show the effect -world/proc/operator<<(out, target) if(istype(target,/savefile)) return -..() // always save normally if(istype(out, /effect)) DoEffect(target, -out) else ..() ``` - - -The list access operators are a -special case as well, because reading to a list and writing to it are -different things, so there are two procs for the purpose. The `[]` -overload is for reading, and `[]=` is for writing. -There is -also now an overload for converting a datum to text. By having -`operator""` return a text string, that text will automatically appear -anywhere you embed the datum in a string, use `json_encode()` on the -datum, or many other situations. It won\'t work for atoms being sent -directly to output (e.g., `world << obj`) or other skin controls because -the client has special handling for these situations and the client -isn\'t given any info about the overloaded text. Likewise, the -overloaded text won\'t appear for objects in an `input()` prompt list, -which is also handled mainly on the client. Despite these limitations, -the text overload offers greater flexibility. -> [!TIP] -> **See also:** -> + [datum](/ref/datum.md) -> + [operators](/ref/operator.md) \ No newline at end of file +The following operators may be overloaded: +*** +**Related Pages:** ++ [datum](/ref/datum) ++ [operators](/ref/operator) diff --git a/ref/operator/path operators.md b/ref/operator/path operators.md deleted file mode 100644 index 08834298..00000000 --- a/ref/operator/path operators.md +++ /dev/null @@ -1,139 +0,0 @@ -## path operators - - -A "path" in DM is a constant value that identifies a -particular definition in the code tree (i.e. an object, procedure, or -variable definition). An example of this is the default mob type for new -players `/mob`. - -Paths are used in two contexts. One is to "get -to" a particular point in the code tree in order to modify the -definition. The other is to reference a particular definition made -elsewhere in the code tree. The syntax of a path is similar in both -cases. - -When you are making a definition, you simply put the -path at the beginning of a line like this: -```dm - -obj/clothes/gloves -``` - - -That automatically creates that -path in the code tree if it does not already exist. When starting at the -beginning of the line (no indentation) there is no need to begin the -path with \'/\', but that is perfectly acceptable. - -When making -definitions, DM equates the path separator \'/\' with indentation, so -the above example is really just a more compact way of writing: - -```dm - obj clothing gloves -``` - - -One generally uses -indentation when you have several things to define with a common parent -path: -```dm - obj clothing gloves sandals -``` - - -An -important element of DM is that you can get to the same path in the code -tree from multiple places in the source code. For example, given the -above definition of `gloves` and `sandals`, you could modify a property -of one of them from somewhere else using any path syntax you like: - -```dm - obj/clothing/sandals name = "Winged Sandals" -``` - - - -While that was not a useful thing to do in this case, it can be -a very powerful tool when organizing source code in large projects. Also -note that the use of "/" can save your source code from getting too -deeply indented, which may sound mundane, but which is quite important! - - -The above examples used paths to make definitions. The other -time when you use paths is when you need to refer to a particular -definition. Creation of an object is one example: -```dm - -mob/Login() if(length(contents) == 0) //poor fellow has nothing //create -sandals in his contents list new /obj/clothing/sandals (src) return ..() - -``` - - -Another common use of paths is to declare the data -type of a variable. In DM, variable types do not affect what type of -data the variable may contain---variables that you define may contain -any type of value. Instead, the variable type affects what properties of -the data you can attempt to access. - -The following example -defines variables for clothing that is occupying various positions on -the body. -```dm - mob var/clothing feet hands torso -``` - - - -Since there were several variables of the same type, they were -grouped under `var/clothing`. It can be done any number of ways, -depending on the situation. The same path syntax applies to variable -definitions as it does to anything else. This example produces the same -effect: -```dm - mob/var/clothing/feet mob/var clothing hands torso - -``` - -### Provisos - - -Just do not make a mistake like the following: -```dm - -mob/var /clothing/feet -``` - - -Beginning a path with \'/\' -effectively ignores whatever indentation may precede it. That is why it -is called an *absolute* path. The above example would therefore be the -same as the following, which is not what you want: -```dm - mob/var -//empty variable definition clothing/feet //definition of object type -/clothing/feet -``` - - -On a related note, parameter -definitions in procedures should not begin with a "/". -```dm - -mob/Move(atom/Dest) //correct src << "Moving to -[Dest.x],[Dest.y]." return ..() mob/Move(var/atom/Dest) //ok -mob/Move(/atom/Dest) //WRONG -``` - - -Essentially, "var/" -is prepended to each entry in the parameter list. - -> [!TIP] -> **See also:** -> + [. path operator](/ref/operator/path/%2e.md) -> + [/ path operator](/ref/operator/path//.md) -> + [: path operator](/ref/operator/path/:.md) -> + [procs](/ref/proc.md) -> + [vars](/ref/var.md) \ No newline at end of file diff --git a/ref/operator/path/..md b/ref/operator/path/..md index 50b6ec2c..b3c82062 100644 --- a/ref/operator/path/..md +++ b/ref/operator/path/..md @@ -1,105 +1,59 @@ -## . path operator +## %2e (info) +*** +The dot operator may be used as a short-cut when specifying a path in the DM code tree. Instead of specifying the full path, you can start a path with a dot and the compiler will search up in the code tree for the following node. This is known as a relative path with an "upward" search. -The dot operator may be used as a short-cut when specifying a -path in the DM code tree. Instead of specifying the full path, you can -start a path with a dot and the compiler will search up in the code tree -for the following node. This is known as a relative path with an -"upward" search. +Here are the beginnings of a text MUD that allows you to walk around between rooms using the arrow keys. The links between rooms are created in this example by referencing the object type of the destination room. Since there could potentially be a lot of rooms, they are grouped into sub-classes, and to avoid lengthy type paths such as /area/Village/Square, they are referenced using a relative path from the point of reference. -Here are the beginnings of a text MUD that -allows you to walk around between rooms using the arrow keys. The links -between rooms are created in this example by referencing the object type -of the destination room. Since there could potentially be a lot of -rooms, they are grouped into sub-classes, and to avoid lengthy type -paths such as /area/Village/Square, they are referenced using a relative -path from the point of reference. -### Example: ```dm -area - var/area - north_exit - south_exit - east_exit - west_exit - - Entered(O) - O << name - return ..() - Castle - Main_Gate - north_exit = .Castle_Entryway - south_exit = .Moat_Bridge - Castle_Entryway - south_exit = .Main_Gate - Moat_Bridge - north_exit = .Main_Gate - south_exit = .Village/Guard_Post - Village - Guard_Post - north_exit = .Castle/Moat_Bridge - south_exit = .Square - Square - north_exit = .Guard_Post +area + var/area + north_exit + south_exit + east_exit + west_exit + + Entered(O) + O << name + return ..() + + Castle + Main_Gate + north_exit = .Castle_Entryway + south_exit = .Moat_Bridge + Castle_Entryway + south_exit = .Main_Gate + Moat_Bridge + north_exit = .Main_Gate + south_exit = .Village/Guard_Post + Village + Guard_Post + north_exit = .Castle/Moat_Bridge + south_exit = .Square + Square + north_exit = .Guard_Post //handle movement client/Move(Dest,Dir) - var/area/room = usr.loc - if(istype(room)) //in a room - switch(Dir) - if(NORTH) Dest = room.north_exit - if(SOUTH) Dest = room.south_exit - if(EAST) Dest = room.east_exit - if(WEST) Dest = room.west_exit - return ..() + var/area/room = usr.loc + if(istype(room)) //in a room + switch(Dir) + if(NORTH) Dest = room.north_exit + if(SOUTH) Dest = room.south_exit + if(EAST) Dest = room.east_exit + if(WEST) Dest = room.west_exit + return ..() //set the starting position for new logins mob/Login() - if(!loc) Move(locate(/area/Castle/Main_Gate)) - return ..() -``` - -The dot operator can also be used to navigate the type tree at compile-time. -One (.) operator will begin at the current compile-time path node. -Two (..) will specify the parent of the current path. -Three (...) will specify the grandparent of the current path. -Each further . operator will move one level further up. - -```dm -turf - child1 - .grandchild1 //full path: /turf/child1/grandchild1 - child2 - ..child3 //full path: /turf/child3 - ...datum1 //full path: /datum1 -``` - -You can also separate these with path operators to make them more readable: + if(!loc) Move(locate(/area/Castle/Main_Gate)) + return ..() -```dm -turf - child1 - ./grandchild1 - child2 - ../child3 - ../../datum1 -``` - -The same is true for referencing paths at compile-time: - -```dm -turf - child1 - var - child_path = .grandchild1 - sibling_path = ..child2 - grandchild1 - child2 ``` -> [!TIP] -> **See also:** -> + [/ path operator](/ref/operator/path//.md) -> + [: path operator](/ref/operator/path/:.md) +*** +**Related Pages:** ++ [/ path operator](/ref/operator/path//) ++ [: path operator](/ref/operator/path/:) diff --git a/ref/operator/path/.md b/ref/operator/path/.md new file mode 100644 index 00000000..9cdd05ba --- /dev/null +++ b/ref/operator/path/.md @@ -0,0 +1,39 @@ + +## (info) +*** +This is used to delimit paths in the DM code tree. A path beginning with '/' is an absolute path (which is independent of where in the code it is used). Otherwise, a path is relative, meaning it starts from the current position in the code. + +The following example uses a path in the code tree to define the type of object to create when leaving a corpse behind. + + +```dm + +obj + var + poison + nutrition + + corpse + frog + nutrition = 10 + spider + nutrition = 6 + poison = 5 +mob + var + corpse = /obj/corpse + Die() + new corpse(src.loc) //create the corpse here + del src + + spider + corpse = /obj/corpse/spider + frog + corpse = /obj/corpse/frog + +``` + +*** +**Related Pages:** ++ [. path operator](/ref/operator/path/%2e) ++ [: path operator](/ref/operator/path/:) diff --git a/ref/operator/path/COLON.md b/ref/operator/path/COLON.md index d308255e..71aa35a5 100644 --- a/ref/operator/path/COLON.md +++ b/ref/operator/path/COLON.md @@ -1,24 +1,23 @@ -## : path operator +## : (info) +*** +The colon operator may be used as a short-cut when specifying a path in the DM code tree. Instead of specifying the full path, you can insert a colon and the compiler will search down in the tree with the node you specify. This is known as a "downward" search. You should only use it when the target node is unique. -The colon operator may be used as a short-cut when specifying a -path in the DM code tree. Instead of specifying the full path, you can -insert a colon and the compiler will search down in the tree with the -node you specify. This is known as a "downward" search. You should -only use it when the target node is unique. +The following example demonstrates the principle but it obviously doesn't save much typing! -The following -example demonstrates the principle but it obviously doesn\'t save much -typing! -### Example: ```dm - world mob = :player //short-cut to /mob/player mob/player -Login() src << "Welcome, [name]." -``` +world + mob = :player //short-cut to /mob/player + +mob/player + Login() + src << "Welcome, [name]." + +``` -> [!TIP] -> **See also:** -> + [. path operator](/ref/operator/path/%2e.md) -> + [/ path operator](/ref/operator/path//.md) \ No newline at end of file +*** +**Related Pages:** ++ [. path operator](/ref/operator/path/%2e) ++ [/ path operator](/ref/operator/path//) diff --git a/ref/operator/path/SLASH path.md b/ref/operator/path/SLASH path.md deleted file mode 100644 index 558d5e8d..00000000 --- a/ref/operator/path/SLASH path.md +++ /dev/null @@ -1,24 +0,0 @@ -## / path operator - -This is used to delimit paths in the DM code tree. A path -beginning with \'/\' is an absolute path (which is independent of where -in the code it is used). Otherwise, a path is relative, meaning it -starts from the current position in the code. - -The following -example uses a path in the code tree to define the type of object to -create when leaving a corpse behind. -### Example: - -```dm - obj var poison nutrition corpse frog nutrition = 10 spider -nutrition = 6 poison = 5 mob var corpse = /obj/corpse Die() new -corpse(src.loc) //create the corpse here del src spider corpse = -/obj/corpse/spider frog corpse = /obj/corpse/frog -``` - - -> [!TIP] -> **See also:** -> + [. path operator](/ref/operator/path/%2e.md) -> + [: path operator](/ref/operator/path/:.md) \ No newline at end of file diff --git a/ref/operator/path/index.md b/ref/operator/path/index.md new file mode 100644 index 00000000..0f476618 --- /dev/null +++ b/ref/operator/path/index.md @@ -0,0 +1,146 @@ + +## path (info) +*** +A "path" in DM is a constant value that identifies a particular definition in the code tree (i.e. an object, procedure, or variable definition). An example of this is the default mob type for new players /mob. + +Paths are used in two contexts. One is to "get to" a particular point in the code tree in order to modify the definition. The other is to reference a particular definition made elsewhere in the code tree. The syntax of a path is similar in both cases. + +When you are making a definition, you simply put the path at the beginning of a line like this: + + +```dm + +obj/clothes/gloves + +``` + + +That automatically creates that path in the code tree if it does not already exist. When starting at the beginning of the line (no indentation) there is no need to begin the path with '/', but that is perfectly acceptable. + +When making definitions, DM equates the path separator '/' with indentation, so the above example is really just a more compact way of writing: + + +```dm + +obj + clothing + gloves + +``` + + +One generally uses indentation when you have several things to define with a common parent path: + + +```dm + +obj + clothing + gloves + sandals + +``` + + +An important element of DM is that you can get to the same path in the code tree from multiple places in the source code. For example, given the above definition of gloves and sandals, you could modify a property of one of them from somewhere else using any path syntax you like: + + +```dm + +obj/clothing/sandals + name = "Winged Sandals" + +``` + + +While that was not a useful thing to do in this case, it can be a very powerful tool when organizing source code in large projects. Also note that the use of "/" can save your source code from getting too deeply indented, which may sound mundane, but which is quite important! + +The above examples used paths to make definitions. The other time when you use paths is when you need to refer to a particular definition. Creation of an object is one example: + + +```dm + +mob/Login() + if(length(contents) == 0) //poor fellow has nothing + //create sandals in his contents list + new /obj/clothing/sandals (src) + return ..() + +``` + + +Another common use of paths is to declare the data type of a variable. In DM, variable types do not affect what type of data the variable may contain—variables that you define may contain any type of value. Instead, the variable type affects what properties of the data you can attempt to access. + +The following example defines variables for clothing that is occupying various positions on the body. + + +```dm + +mob + var/clothing + feet + hands + torso + +``` + + +Since there were several variables of the same type, they were grouped under var/clothing. It can be done any number of ways, depending on the situation. The same path syntax applies to variable definitions as it does to anything else. This example produces the same effect: + + +```dm + +mob/var/clothing/feet +mob/var + clothing + hands + torso + +``` + + +Just do not make a mistake like the following: + + +```dm + +mob/var + /clothing/feet + +``` + + +Beginning a path with '/' effectively ignores whatever indentation may precede it. That is why it is called an absolute path. The above example would therefore be the same as the following, which is not what you want: + + +```dm + +mob/var //empty variable definition +clothing/feet //definition of object type /clothing/feet + +``` + + +On a related note, parameter definitions in procedures should not begin with a "/". + + +```dm + +mob/Move(atom/Dest) //correct + src << "Moving to [Dest.x],[Dest.y]." + return ..() + +mob/Move(var/atom/Dest) //ok +mob/Move(/atom/Dest) //WRONG + +``` + + +Essentially, "var/" is prepended to each entry in the parameter list. +*** +**Related Pages:** ++ [. path operator](/ref/operator/path/%2e) ++ [/ path operator](/ref/operator/path//) ++ [: path operator](/ref/operator/path/:) ++ [procs](/ref/proc) ++ [vars](/ref/var) diff --git a/ref/operator/~!.md b/ref/operator/~!.md index b7465b1f..794f1669 100644 --- a/ref/operator/~!.md +++ b/ref/operator/~!.md @@ -1,23 +1,18 @@ -## \~! operator -###### BYOND Version 512 +## ~! (info) **Format:** -+ A \~! B ++ A ~! B **Returns:** + 1 if A and B are not equivalent; 0 otherwise +*** +Equivalence is a looser version of equality. See the ~= operator for more information. - -Equivalence is a looser version of equality. See the [\~= -operator](/ref/operator/~=.md) for more information. - -To check if A -and B are not equal, use the != operator. - -> [!TIP] -> **See also:** -> + [\~= operator](/ref/operator/~=.md) -> + [== operator](/ref/operator/==.md) -> + [!= operator](/ref/operator/!=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +To check if A and B are not equal, use the != operator. +*** +**Related Pages:** ++ [~= operator](/ref/operator/~=) ++ [== operator](/ref/operator/==) ++ [!= operator](/ref/operator/!=) ++ [operators](/ref/operator) diff --git a/ref/operator/~.md b/ref/operator/~.md index 8a22e9bd..b9153702 100644 --- a/ref/operator/~.md +++ b/ref/operator/~.md @@ -1,18 +1,15 @@ -## \~ operator + +## ~ (info) **Format:** -+ \~ A ++ ~ A **Returns:** + The binary "not" of A. +*** +A must be between 0 and 2**24 - 1, giving an effective width of 24 bits. - -A must be between 0 and 2**24 - 1, giving an effective width -of 24 bits. - -If A is a /matrix datum, the result is a new matrix -which is the inverse of A. - -> [!TIP] -> **See also:** -> + [operators](/ref/operator.md) \ No newline at end of file +If A is a /matrix datum, the result is a new matrix which is the inverse of A. +*** +**Related Pages:** ++ [operators](/ref/operator) diff --git a/ref/operator/~=.md b/ref/operator/~=.md index 5232b1b5..5097cc73 100644 --- a/ref/operator/~=.md +++ b/ref/operator/~=.md @@ -1,36 +1,20 @@ -## \~= operator -###### BYOND Version 512 +## ~= (info) **Format:** -+ A \~= B ++ A ~= B **Returns:** + 1 if A and B are equivalent; 0 otherwise - - +*** Equivalence is a looser version of equality: -- Two lists are equivalent if their contents are the same. (This is a - shallow comparison, so it doesn\'t check if the Nth items are also - equivalent, only equal.) -- Two [/matrix](/ref/matrix.md) values are equivalent if their components - are the same. -- Datums A and B are equivalent if A - [overloads](/ref/operator/overload.md) the \~= operator with a proc that - returns true for B. Without an overload, they are only equivalent if - they\'re the same object. - To check if A and B are equal, use the == operator. - -Note: For code compiled in version 516 or later, [associated -values](/ref/list/assoc.md) in lists are also checked for equality. This was -not the case for older versions. - -> [!TIP] -> **See also:** -> + [\~! operator](/ref/operator/~!.md) -> + [== operator](/ref/operator/==.md) -> + [!= operator](/ref/operator/!=.md) -> + [operators](/ref/operator.md) \ No newline at end of file +Note: For code compiled in version 516 or later, associated values in lists are also checked for equality. This was not the case for older versions. +*** +**Related Pages:** ++ [~! operator](/ref/operator/~!) ++ [== operator](/ref/operator/==) ++ [!= operator](/ref/operator/!=) ++ [operators](/ref/operator) diff --git a/ref/pixloc/index.md b/ref/pixloc/index.md new file mode 100644 index 00000000..33e43c27 --- /dev/null +++ b/ref/pixloc/index.md @@ -0,0 +1,16 @@ + +## pixloc (info) +*** +A primitive type that encapsulates position information for an atom, with pixel movement included. I.e., it contains a turf (loc) and step_x and step_y offsets. Pixlocs can also be built from absolute world coordinates. + +The pixloc of an atom is taken from its loc and step_x/y vars only. If you want the pixloc of its bounds edges or its center, use the `bound_pixloc()` proc for that. + +Pixlocs support some math operations. A vector can be added or subtracted to a pixloc, and subtracting one pixloc from another will produce a vector. The % and %% operators are supported, returning a vector. + +Other supported procs for pixlocs include: +*** +**Related Pages:** ++ [vars (pixloc)](/ref/pixloc/var) ++ [pixloc](/ref/atom/var/pixloc) ++ [pixloc proc](/ref/proc/pixloc) ++ [bound_pixloc proc](/ref/proc/bound_pixloc) diff --git a/ref/pixloc/pixloc.md b/ref/pixloc/pixloc.md deleted file mode 100644 index 7e9a69a6..00000000 --- a/ref/pixloc/pixloc.md +++ /dev/null @@ -1,37 +0,0 @@ -## pixloc -###### BYOND Version 516 - - - -A primitive type that encapsulates position information for an -atom, with pixel movement included. I.e., it contains a turf (loc) and -step_x and step_y offsets. Pixlocs can also be built from absolute world -coordinates. - -The pixloc of an atom is taken from its loc and -step_x/y vars only. If you want the pixloc of its bounds edges or its -center, use the [`bound_pixloc()` proc](/ref/proc/bound_pixloc.md) for that. - - -Pixlocs support some math operations. A [vector](/ref/vector.md) can -be added or subtracted to a pixloc, and subtracting one pixloc from -another will produce a vector. The [%](/ref/operator/%.md) and -[%%](/ref/operator/%%.md) operators are supported, returning a vector. - - -Other supported procs for pixlocs include: -[min()](/ref/proc/min.md) -[max()](/ref/proc/max.md) -[clamp()](/ref/proc/clamp.md) -[round()](/ref/proc/round.md) -[floor()](/ref/proc/floor.md) -[ceil()](/ref/proc/ceil.md) -[trunc()](/ref/proc/trunc.md) -[fract()](/ref/proc/fract.md) (returns a vector) - -> [!TIP] -> **See also:** -> + [vars (pixloc)](/ref/pixloc/var.md) -> + [pixloc var (atom)](/ref/atom/var/pixloc.md) -> + [pixloc proc](/ref/proc/pixloc.md) -> + [bound_pixloc proc](/ref/proc/bound_pixloc.md) \ No newline at end of file diff --git a/ref/pixloc/var.md b/ref/pixloc/var.md deleted file mode 100644 index e70b2812..00000000 --- a/ref/pixloc/var.md +++ /dev/null @@ -1,17 +0,0 @@ -## vars (pixloc) -###### BYOND Version 516 - - - -Built-in pixloc vars: -pixloc/var -+ [loc](/ref/pixloc/var/loc.md) -+ [step_x](/ref/pixloc/var/step_x.md) -+ [step_y](/ref/pixloc/var/step_y.md) -+ [x](/ref/pixloc/var/x.md) -+ [y](/ref/pixloc/var/y.md) -+ [z](/ref/pixloc/var/z.md) - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) \ No newline at end of file diff --git a/ref/pixloc/var/index.md b/ref/pixloc/var/index.md new file mode 100644 index 00000000..f2795a02 --- /dev/null +++ b/ref/pixloc/var/index.md @@ -0,0 +1,7 @@ + +## var (var) +*** +Built-in pixloc vars: +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) diff --git a/ref/pixloc/var/loc.md b/ref/pixloc/var/loc.md index f6bfccfa..fc875cc0 100644 --- a/ref/pixloc/var/loc.md +++ b/ref/pixloc/var/loc.md @@ -1,13 +1,10 @@ -## loc var (pixloc) -###### BYOND Version 516 - -The turf that this pixloc belongs to. If the map has resized so -that this pixloc is no longer valid, this will be null. - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [step_x var (pixloc)](/ref/pixloc/var/step_x.md) -> + [step_y var (pixloc)](/ref/pixloc/var/step_y.md) -> + [loc var (atom)](/ref/atom/var/loc.md) \ No newline at end of file +## loc (var) +*** +The turf that this pixloc belongs to. If the map has resized so that this pixloc is no longer valid, this will be null. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [step_x var (pixloc)](/ref/pixloc/var/step_x) ++ [step_y var (pixloc)](/ref/pixloc/var/step_y) ++ [loc](/ref/atom/var/loc) diff --git a/ref/pixloc/var/step_x.md b/ref/pixloc/var/step_x.md index ca818810..33dd9dc0 100644 --- a/ref/pixloc/var/step_x.md +++ b/ref/pixloc/var/step_x.md @@ -1,14 +1,10 @@ -## step_x var (pixloc) -###### BYOND Version 516 - -The step_x offset of this pixloc, relative to its loc. For -instance a value of 4 means this is 4 pixels east from the southwest -corner of the turf. - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [loc var (pixloc)](/ref/pixloc/var/loc.md) -> + [step_y var (pixloc)](/ref/pixloc/var/step_y.md) -> + [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) \ No newline at end of file +## step_x (var) +*** +The step_x offset of this pixloc, relative to its loc. For instance a value of 4 means this is 4 pixels east from the southwest corner of the turf. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [loc var (pixloc)](/ref/pixloc/var/loc) ++ [step_y var (pixloc)](/ref/pixloc/var/step_y) ++ [step_x var (movable atom)](/ref/atom/movable/var/step_x) diff --git a/ref/pixloc/var/step_y.md b/ref/pixloc/var/step_y.md index fd967c86..2738fda8 100644 --- a/ref/pixloc/var/step_y.md +++ b/ref/pixloc/var/step_y.md @@ -1,14 +1,10 @@ -## step_y var (pixloc) -###### BYOND Version 516 - -The step_y offset of this pixloc, relative to its loc. For -instance a value of 4 means this is 4 pixels north from the southwest -corner of the turf. - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [loc var (pixloc)](/ref/pixloc/var/loc.md) -> + [step_x var (pixloc)](/ref/pixloc/var/step_x.md) -> + [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) \ No newline at end of file +## step_y (var) +*** +The step_y offset of this pixloc, relative to its loc. For instance a value of 4 means this is 4 pixels north from the southwest corner of the turf. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [loc var (pixloc)](/ref/pixloc/var/loc) ++ [step_x var (pixloc)](/ref/pixloc/var/step_x) ++ [step_y var (movable atom)](/ref/atom/movable/var/step_y) diff --git a/ref/pixloc/var/x.md b/ref/pixloc/var/x.md index 2cae29b0..a06a89e6 100644 --- a/ref/pixloc/var/x.md +++ b/ref/pixloc/var/x.md @@ -1,17 +1,11 @@ -## x var (pixloc) -###### BYOND Version 516 +## x (var) +*** +The x value of this pixloc in world pixel coordinates, which start at 1. A value of x=1 means this is lined up to the western edge of the map. On a 100x100 tile map with a 32x32 icon size, x=3200 would be a pixel on the eastern edge of the map. -The x value of this pixloc in world pixel coordinates, which -start at 1. A value of x=1 means this is lined up to the western edge of -the map. On a 100x100 tile map with a 32x32 icon size, x=3200 would be a -pixel on the eastern edge of the map. - -Setting x will alter the -loc and step_x values automatically. Out-of-bounds values are allowed. - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [y var (pixloc)](/ref/pixloc/var/y.md) -> + [z var (pixloc)](/ref/pixloc/var/z.md) \ No newline at end of file +Setting x will alter the loc and step_x values automatically. Out-of-bounds values are allowed. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [y var (pixloc)](/ref/pixloc/var/y) ++ [z var (pixloc)](/ref/pixloc/var/z) diff --git a/ref/pixloc/var/y.md b/ref/pixloc/var/y.md index 187ed582..6f3a1a20 100644 --- a/ref/pixloc/var/y.md +++ b/ref/pixloc/var/y.md @@ -1,18 +1,11 @@ -## y var (pixloc) -###### BYOND Version 516 +## y (var) +*** +The y value of this pixloc in world pixel coordinates, which start at 1. A value of y=1 means this is lined up to the southern edge of the map. On a 100x100 tile map with a 32x32 icon size, y=3200 would be a pixel on the northern edge of the map. -The y value of this pixloc in world pixel coordinates, which -start at 1. A value of y=1 means this is lined up to the southern edge -of the map. On a 100x100 tile map with a 32x32 icon size, y=3200 would -be a pixel on the northern edge of the map. - -Setting y will -alter the loc and step_y values automatically. Out-of-bounds values are -allowed. - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [x var (pixloc)](/ref/pixloc/var/x.md) -> + [z var (pixloc)](/ref/pixloc/var/z.md) \ No newline at end of file +Setting y will alter the loc and step_y values automatically. Out-of-bounds values are allowed. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [x var (pixloc)](/ref/pixloc/var/x) ++ [z var (pixloc)](/ref/pixloc/var/z) diff --git a/ref/pixloc/var/z.md b/ref/pixloc/var/z.md index 915c5448..a706f839 100644 --- a/ref/pixloc/var/z.md +++ b/ref/pixloc/var/z.md @@ -1,13 +1,9 @@ -## z var (pixloc) -###### BYOND Version 516 - - -The z value of this pixloc\'s turf (`loc`). It must be in the -range of 1 to [world.maxz](/ref/world/var/maxz.md). - -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [x var (pixloc)](/ref/pixloc/var/x.md) -> + [y var (pixloc)](/ref/pixloc/var/y.md) \ No newline at end of file +## z (var) +*** +The z value of this pixloc's turf (`loc`). It must be in the range of 1 to world.maxz. +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [x var (pixloc)](/ref/pixloc/var/x) ++ [y var (pixloc)](/ref/pixloc/var/y) diff --git a/ref/proc/...md b/ref/proc/...md index bbb39b77..244aa2e6 100644 --- a/ref/proc/...md +++ b/ref/proc/...md @@ -1,22 +1,21 @@ -## .. proc + +## %2e%2e (proc) **Format:** + ..(Args) +**Arguments:** ++ The arguments to pass to the parent proc. This defaults to the + arguments to the current proc. + **Returns:** + The return value of the parent proc. +*** +If object O is derived from object P, P is called the parent of O. If a proc (or verb) is defined in both O and P, O can call P's version by using ..(). -**Args:** -+ The arguments to pass to the parent proc. This defaults to the - arguments to the current proc. - - -If object O is derived from object P, P is called the parent of -O. If a proc (or verb) is defined in both O and P, O can call P\'s -version by using ..(). This is what's known as a Supercall. -### Example: ```dm + mob P verb/history() @@ -26,33 +25,27 @@ mob history() world << "O" ..() // call P.history() + ``` -Here O is derived from P. When P calls "history", his name is displayed. -When O calls "history", his name is displayed, followed by the name of his -parent, P. -If O overrides the same proc more than once, ..() -will search for the previous version and use that. For instance, you -could have two O.history() procs; the second overrides the first, but -the original could still be called via ..(). The original in turn could -call ..() to reach P.history(). Overriding the same proc more than once -in the same type should be avoided wherever possible, because it incurs -extra overhead, it makes the code harder to read, and it isn\'t always -clear which one gets called first. (Usually, the only time you\'ll want -this to happen is when using libraries.) +Here O is derived from P. When P calls "history", his name is displayed. When O calls "history", his name is displayed, followed by the name of his parent, P. + +If O overrides the same proc more than once, ..() will search for the previous version and use that. For instance, you could have two O.history() procs; the second overrides the first, but the original could still be called via ..(). The original in turn could call ..() to reach P.history(). Overriding the same proc more than once in the same type should be avoided wherever possible, because it incurs extra overhead, it makes the code harder to read, and it isn't always clear which one gets called first. (Usually, the only time you'll want this to happen is when using libraries.) ..() can also be used for predefined procs. -### Example: + ```dm + mob/Move() // override proc world << "moving..." return ..() // call default + ``` - -This proc will print "moving..." whenever the mob moves. -> [!TIP] -> **See also:** -> + [. proc](/ref/proc/..md) \ No newline at end of file + +This proc will print "moving..." whenever the mob moves. +*** +**Related Pages:** ++ [. proc](/ref/proc/%2e) diff --git a/ref/proc/..md b/ref/proc/..md index 6119bba4..1c00371c 100644 --- a/ref/proc/..md +++ b/ref/proc/..md @@ -1,28 +1,29 @@ -## . proc + +## %2e (proc) **Format:** + .(Args) +**Arguments:** ++ The arguments to pass to the new invocation of the current proc. This + defaults to current arguments. + **Returns:** + The return value of the current proc. +*** +Call the current proc. A proc that calls itself is said to be recursive. -**Args:** -+ The arguments to pass to the new invocation of the current proc. - This defaults to current arguments. - -Call the current proc. A proc that calls itself is said to be -recursive. -### Example: ```dm + proc/factorial(N as num) if(N<=0) return 1 return .(N-1)*N + ``` -This computes the factorial N! by calling -itself recursively. -> [!TIP] -> **See also:** -> + [.. proc](/ref/proc/...md) \ No newline at end of file +This computes the factorial N! by calling itself recursively. +*** +**Related Pages:** ++ [.. proc](/ref/proc/%2e%2e) diff --git a/ref/proc/ASSERT.md b/ref/proc/ASSERT.md index 7b41e4e9..5893ec22 100644 --- a/ref/proc/ASSERT.md +++ b/ref/proc/ASSERT.md @@ -1,17 +1,15 @@ -## ASSERT proc + +## ASSERT (proc) **Format:** + ASSERT(expression) -**Args:** +**Arguments:** + expression: an expression which should always be true - -This is used to make a sanity check. If the given expression is -false, the current procedure crashes, generating diagnostic debugging -output, which includes the expression, a stack dump, and so forth. - -> [!TIP] -> **See also:** -> + [CRASH proc](/ref/proc/CRASH.md) -> + [DEBUG definition](/ref/DM/preprocessor/define/DEBUG.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file +*** +This is used to make a sanity check. If the given expression is false, the current procedure crashes, generating diagnostic debugging output, which includes the expression, a stack dump, and so forth. +*** +**Related Pages:** ++ [CRASH proc](/ref/proc/CRASH) ++ [DEBUG definition](/ref/DM/preprocessor/define/DEBUG) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/proc/CRASH.md b/ref/proc/CRASH.md index 4f5fc90b..e2aa88d6 100644 --- a/ref/proc/CRASH.md +++ b/ref/proc/CRASH.md @@ -1,13 +1,11 @@ -## CRASH proc + +## CRASH (proc) **Format:** + CRASH(msg) - - -Crashes the current procedure, displaying the specified message -and generating diagnostic debugging output, such as a stack dump. - -> [!TIP] -> **See also:** -> + [ASSERT proc](/ref/proc/ASSERT.md) -> + [DEBUG definition](/ref/DM/preprocessor/define/DEBUG.md) \ No newline at end of file +*** +Crashes the current procedure, displaying the specified message and generating diagnostic debugging output, such as a stack dump. +*** +**Related Pages:** ++ [ASSERT proc](/ref/proc/ASSERT) ++ [DEBUG definition](/ref/DM/preprocessor/define/DEBUG) diff --git a/ref/proc/EXCEPTION.md b/ref/proc/EXCEPTION.md index feb12811..bdaa8742 100644 --- a/ref/proc/EXCEPTION.md +++ b/ref/proc/EXCEPTION.md @@ -1,19 +1,17 @@ -## EXCEPTION proc + +## EXCEPTION (proc) **Format:** + EXCEPTION(value) -**Args:** +**Arguments:** + value: A text string (such as an error message) or other value - identifying the exception. - -This is used to create an /exception datum, and is shorthand -for calling new/exception(value, \_\_FILE\_\_, \_\_LINE\_\_). The value -you provide will be in exception.name. - -> [!TIP] -> **See also:** -> + [try and catch statements](/ref/proc/try.md) -> + [throw statement](/ref/proc/throw.md) -> + [exception](/ref/exception.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file +identifying the exception. +*** +This is used to create an /exception datum, and is shorthand for calling new/exception(value, __FILE__, __LINE__). The value you provide will be in exception.name. +*** +**Related Pages:** ++ [try and catch statements](/ref/proc/try) ++ [throw statement](/ref/proc/throw) ++ [exception](/ref/exception) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/proc/REGEX_QUOTE.md b/ref/proc/REGEX_QUOTE.md index 5f17e6f4..49ed59da 100644 --- a/ref/proc/REGEX_QUOTE.md +++ b/ref/proc/REGEX_QUOTE.md @@ -1,34 +1,33 @@ -## REGEX_QUOTE proc -###### BYOND Version 510 + +## REGEX_QUOTE (proc) **Format:** + REGEX_QUOTE(text) + REGEX_QUOTE_REPLACEMENT(text) -**Returns:** -+ REGEX_QUOTE: A version of the text with any special regular - expression characters escaped by backslashes. -+ REGEX_QUOTE_REPLACEMENT: A version of the text with \$ characters - escaped by a second \$. - -**Args:** +**Arguments:** + text: The text to escape -Quotes a piece of text so that it can be used inside a regular -expression without fear of being treated as pattern instructions. -### Example: +**Returns:** ++ REGEX_QUOTE: A version of the text with any special regular expression characters escaped by backslashes. ++ REGEX_QUOTE_REPLACEMENT: A version of the text with $ characters escaped by a second $. +*** +Quotes a piece of text so that it can be used inside a regular expression without fear of being treated as pattern instructions. + ```dm + proc/FindWord(text, word) // The \b pattern is a word break, to search for the word // on its own instead of as part of another word. var/regex/R = regex("\\b[REGEX_QUOTE(word)]\b", "i") // find the pattern in the text return R.Find(text) + ``` -> [!TIP] -> **See also:** -> + [regex proc](/ref/proc/regex.md) -> + [regex datum](/ref/regex.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file +*** +**Related Pages:** ++ [regex proc](/ref/proc/regex) ++ [regex datum](/ref/regex) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/proc/abs.md b/ref/proc/abs.md index 93f7813d..9fedb404 100644 --- a/ref/proc/abs.md +++ b/ref/proc/abs.md @@ -1,16 +1,21 @@ -# abs proc + +## abs (proc) + **Format:** + abs(A) +**Arguments:** ++ A: A number. + **Returns:** + The absolute value of A. +*** -**Args:** -+ A: A number. +```dm -This returns the unsigned, or absolute value of A. -### Example: +usr << abs(1) // outputs 1 +usr << abs(-1) // outputs 1 -```dm - usr << abs(1) // outputs 1 usr << abs(-1) // outputs 1 ``` + +*** \ No newline at end of file diff --git a/ref/proc/addtext.md b/ref/proc/addtext.md index 07b0eb57..72bbc2a7 100644 --- a/ref/proc/addtext.md +++ b/ref/proc/addtext.md @@ -1,30 +1,29 @@ -## addtext proc + +## addtext (proc) **Format:** + addtext(Arg1,Arg2,...) +**Arguments:** ++ Any number of text strings. + **Returns:** + A text string with the arguments concatenated. +*** +This instruction returns text containing the first argument followed by the second, followed by the third, etc. The arguments may be constants or variables containing text. -**Args:** -+ Any number of text strings. - -This instruction returns text containing the first argument -followed by the second, followed by the third, etc. The arguments may be -constants or variables containing text. -### Example: ```dm + var/T T = "1" T = addtext(T,"*1 = ",T) // T = "1*1 = 1" world << "The answer is: [T]" + ``` - -This instruction exists primarily for backwards-compatibility. You can -accomplish the same thing with the + operator or by using embedded -expressions. - -> [!TIP] -> **See also:** -> + [+ operator](/ref/operator/+.md) \ No newline at end of file + + +This instruction exists primarily for backwards-compatibility. You can accomplish the same thing with the + operator or by using embedded expressions. +*** +**Related Pages:** ++ [+ operator](/ref/operator/+) diff --git a/ref/proc/alert.md b/ref/proc/alert.md index 10209799..4f66318b 100644 --- a/ref/proc/alert.md +++ b/ref/proc/alert.md @@ -1,28 +1,29 @@ -## alert proc + +## alert (proc) **Format:** + alert(Usr=usr,Message,Title,Button1="Ok",Button2,Button3) **Returns:** + Selected button +*** +This sleeps the current proc until the user clicks one of the named buttons. As with input(), the first argument may be entirely left out. -This sleeps the current proc until the user clicks one of the -named buttons. As with input(), the first argument may be entirely left -out. -### Example: - ```dm + mob/verb/self_destruct() alert("Prepare to die.") del usr + ``` - -A slightly more complicated example provides the -user with a choice in the matter: -### Example: + + +A slightly more complicated example provides the user with a choice in the matter: + ```dm + mob/verb/self_destruct() switch(alert("Would you like to die?",,"Yes","No","Maybe")) if("Yes") @@ -36,8 +37,9 @@ mob/verb/self_destruct() del usr else usr << "Tails -- you win!" + ``` -> [!TIP] -> **See also:** -> + [input proc](/ref/proc/input.md) \ No newline at end of file +*** +**Related Pages:** ++ [input proc](/ref/proc/input) diff --git a/ref/proc/alist.md b/ref/proc/alist.md index 00df4758..bdb994b1 100644 --- a/ref/proc/alist.md +++ b/ref/proc/alist.md @@ -1,54 +1,37 @@ -## alist proc -###### BYOND Version 516 + +## alist (proc) **Format:** + alist(A=a,B=b,C=c,...) -**Returns:** -+ A new associative list with contents (keys) A, B, C, and associated - values a, b, c. - -**Args:** -+ Arbitrary number of elements to be inserted into the associative - list. +**Arguments:** ++ Arbitrary number of elements to be inserted into the associative list. -Similar to Dictionaries in other languages. Lovingly known as `asslist`. -The best way to utilize this feature is with the following code: -```dm -// creates a version dependent macro that allows us to call alist's by their true name: asslist -#if DM_VERSION >= 516 -#define asslist alist -#else -#define asslist list -#endif -``` - -Creates a strictly associative list with key,value pairs. This -is different from an [ordinary list](/ref/list.md) in several respects. -- "Keys" can be numbers. This means list items can\'t be accessed by - a numerical index. -- Keys can\'t be repeated in the list, and always have an associated - value (even if it\'s just null). -- The order of keys in the list is not under user control. +**Returns:** ++ A new associative list with contents (keys) A, B, C, and associated values a, b, c. +*** +Creates a strictly associative list with key,value pairs. This is different from an ordinary list in several respects. +The point of using this type over a regular list is to eke out performance gains in tight code. Operators such as `+` and `-` have improved performance because of the rules above. -The point of using this type over a regular list is to eke out -performance gains in tight code. Operators such as `+` and `-` have -improved performance because of the rules above. +In this proc the index values should be constants, and that usually means text constants. When these index values happen to be text strings that satisfy all the requirements for variable names, this may also be written in a convenient short-hand without the double quotes: -In this proc the index values should be constants, and that usually means text -constants. When these index values happen to be text strings that -satisfy all the requirements for variable names, this may also be -written in a convenient short-hand without the double quotes: ```dm + var/alist/lst = alist(player = "James Byond", score = 2000) + ``` -In other words, this is exactly the same syntax as for [named arguments](/ref/proc/arguments/named.md) -> [!TIP] -> **See also:** -> + [list associations](/ref/list/associations.md) -> + [list](/ref/list.md) -> + [list proc](/ref/proc/list.md) \ No newline at end of file +In other words, this is exactly the same syntax as for named arguments. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [list](/ref/list) ++ [list proc](/ref/proc/list) ++ [values_sum proc](/ref/proc/values_sum) ++ [values_product proc](/ref/proc/values_product) ++ [values_dot proc](/ref/proc/values_dot) ++ [values_cut_over proc](/ref/proc/values_cut_over) ++ [values_cut_under proc](/ref/proc/values_cut_under) diff --git a/ref/proc/animate.md b/ref/proc/animate.md index 03b5899f..e79622ae 100644 --- a/ref/proc/animate.md +++ b/ref/proc/animate.md @@ -1,60 +1,39 @@ -## animate proc -###### BYOND Version 500 + +## animate (proc) **Format:** -+ animate(Object, var1=new_value1, var2=new_value2, ..., time, loop, - easing, flags, delay, tag) -+ animate(Object, appearance=new_appearance, time, loop, easing, - flags, delay, tag) ++ animate(Object, var1=new_value1, var2=new_value2, ..., time, loop, easing, flags, delay, tag, command) ++ animate(Object, appearance=new_appearance, time, loop, easing, flags, delay, tag, command) + animate(Object) -**Args:** -+ `Object`: The atom, image, or client to animate; omit to add another - step to the same sequence as the last `animate()` call -+ `var1=new_value1`, `var2=new_value2`, ...: Vars to change in the - animation step -+ `var_list`: An associative list of vars to change -+ `appearance`: New appearance to use instead of multiple var changes - (**must** be a [named argument](/ref/proc/arguments/named.md) ) -+ `time`: Time of this step, in 1/10s (may be a [named argument](/ref/proc/arguments/named.md) ) -+ `loop`: Number of times to run this sequence, or -1 to loop forever - (may be a [named argument](/ref/proc/arguments/named.md)) -+ `easing`: The "curve" followed by this animation step (may be a - [named argument](/ref/proc/arguments/named.md) ) -+ `flags`: Flags that impact how the animation acts (may be a [named argument](/ref/proc/arguments/named.md) ) -+ `delay`: Delay time for starting the first step in a sequence (may be - negative; may be a [named argument](/ref/proc/arguments/named.md) ) -+ `tag` (516): Optional name for a new animation sequence (**must** be a [named argument](/ref/proc/arguments/named.md) ) - -> [!IMPORTANT] -> ### Useful terms in this article: -> + **Step:** A piece of an animation that transitions from the old -appearance to a new appearance, in a given time.
-> + **Sequence:** One or more steps in an animation. A sequence may loop a certain number -of times, but requires more than one step for the loop to be meaningful.
-> + **Parallel:** Multiple sequences can run concurrently if they -are flagged as parallel. A parallel animation animates only the relative -changes from the appearance that started the sequence.
-> + **Supersede:** If a new animation sequence is not flagged as -parallel, it will freeze the previous animation at its current point and -animate any changes from there. The previous sequences are superseded, -and will eventually be discarded. - -This proc creates an **animation step** (aka keyframe), which may be the start -of a **sequence** of multiple steps, that will be displayed to players. -Starting with an atom or image, you can change one or more vars that -affect its apprearance. This change will take place immediately, but -will be displayed to users as a gradual change over a period of time. -The actual interpolation between frames is all done on the client. - -> [!TIP] -> If the `Object` argument is left out, a new animation step will -be created for the previously used animation seqeunce.\ -> If all other arguments besides the object are left out, the animation is stopped -completely. -### Example: +**Arguments:** ++ Object: The atom, image, or client to animate; omit to add another step to the same sequence as the last call ++ var1=new_value1, var2=new_value2, ...: Vars to change in the animation step ++ var_list: An associative list of vars to change ++ appearance: New appearance to use instead of multiple var changes (must be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ time: Time of this step, in 1/10s (may be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ loop: Number of times to run this sequence, or -1 to loop forever (may be a named argument) ++ easing: The "curve" followed by this animation step (may be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ flags: Flags that impact how the animation acts (may be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ delay: Delay time for starting the first step in a sequence (may be negative; may be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ tag: Optional name for a new animation sequence (must be a ) [named arguments (proc)](/ref/proc/arguments/named) ++ command: Optional to run at the end of this step [Client commands](/ref/{skin}/commands) +*** +**Step:** A piece of an animation that transitions from the old appearance to a new appearance, in a given time. + +**Sequence:** One or more steps in an animation. A sequence may loop a certain number of times, but requires more than one step for the loop to be meaningful. + +**Parallel:** Multiple sequences can run concurrently if they are flagged as parallel. A parallel animation animates only the relative changes from the appearance that started the sequence. + +**Supersede:** If a new animation sequence is not flagged as parallel, it will freeze the previous animation at its current point and animate any changes from there. The previous sequences are superseded, and will eventually be discarded. + +This proc creates an **animation step**, which may be the start of a **sequence** of multiple steps, that will be displayed to players. Starting with an atom or image, you can change one or more vars that affect its apprearance. This change will take place immediately, but will be displayed to users as a gradual change over a period of time. The actual interpolation between frames is all done on the client. + +If the `Object` argument is left out, a new animation step will be created for the previously used animation seqeunce. If all other arguments besides the object are left out, the animation is stopped completely. + ```dm + mob/proc/GrowAndFade() // expand (scale by 2x2) and fade out over 1/2s animate(src, transform = matrix()*2, alpha = 0, time = 5) @@ -63,149 +42,60 @@ obj/spell/proc/Spin() // cast a spell on a monster: make the icon spin // this animation takes 3s total (6 ticks * 5) animate(src, transform = turn(matrix(), 120), time = 2, loop = 5) - animate(transform = turn(matrix(), 240), time = 2) animate(transform = null, time = 2) + animate(transform = turn(matrix(), 240), time = 2) + animate(transform = null, time = 2) + ``` - + The following vars will animate smoothly: -- alpha -- color -- glide_size -- infra_luminosity -- layer -- maptext_width, maptext_height, maptext_x, maptext_y -- luminosity -- pixel_x, pixel_y, pixel_w, pixel_z -- transform - -> [!NOTE] -> `pixel_x`, `pixel_y`, `pixel_w` and `pixel_z` are considered integer values by the renderer and sub-pixel values are therefore rounded off during animation calls. This means that the renderer won't trigger a redraw during these frames - -These vars can be changed, but will change immediately on each -step rather than smoothly: -- dir -- icon -- icon_state -- invisibility -- maptext -- suffix +These vars can be changed, but will change immediately on each step rather than smoothly: Other vars may apply: -- space: A named var for the [color space](/ref/appendix/color-space.md) , if animating color; only - applies to non-matrix color values. -For convenience, you can use an [associative list](/ref/list/associations.md) , -appearance, or [mutable appearance](/ref/mutable_appearance.md) in place of -the appearance vars. You can use `appearance` itself as a name for this -argument, or leave the argument unnamed. -### Easing - -An animation step doesn\'t have to be strictly linear. Some -changes look much better if they follow a curve. A cubic curve, for -instance, will start slow, accelerate very quickly in the middle, and -slow down again at the end. A sine curve could be used with a flip -transformation to make a coin appear to spin. A text bubble can jump -into place and bounce a little before it settles. The choice of curve -you use is called easing, and you have several good choices to pick -from. - -+ **LINEAR_EASING**: Default. Go from one value to another at a constant rate. -+ **SINE_EASING**: The animation follows a sine curve, so it starts off and finishes slowly, with a quicker transition in the middle. -+ **CIRCULAR_EASING**: Similar to a sine curve, but each half of the curve is shaped like a quarter circle. -+ **QUAD_EASING**: A quadratic curve, good for gravity effects. -+ **CUBIC_EASING**: A cubic curve, a little more pronounced than a sine curve. -+ **BOUNCE_EASING**: This transitions quickly like a falling object, and bounces a few times. - + Uses `EASE_OUT` unless otherwise specified. -+ **ELASTIC_EASING**: This transitions quickly and overshoots, rebounds, and finally settles down. - + Uses `EASE_OUT` unless otherwise specified. -+ **BACK_EASING**: Goes a little bit backward at first, and overshoots a little at the end. -**JUMP_EASING**: Jumps suddenly from the beginning state to the end. With the default or `EASE_OUT`, this happens at the end of the time slice. With `EASE_IN`, the jump happens at the beginning. With both flags set, the jump happens at the halfway point. - - -These can be combined with `EASE_IN` or `EASE_OUT` using the -`|` operator, to use just the first or last part of the curve. -### Example: + +For convenience, you can use an associative list, appearance, or mutable appearance in place of the appearance vars. You can use `appearance` itself as a name for this argument, or leave the argument unnamed. + +An animation step doesn't have to be strictly linear. Some changes look much better if they follow a curve. A cubic curve, for instance, will start slow, accelerate very quickly in the middle, and slow down again at the end. A sine curve could be used with a flip transformation to make a coin appear to spin. A text bubble can jump into place and bounce a little before it settles. The choice of curve you use is called easing, and you have several good choices to pick from. + +In this play area, you can test different easing functions to see how they work. + +The horizontal axis from left to right represents the time of the animation from beginning to end. The vertical axis, from bottom to top, is how the animation will be interpolated; the lower green line represents the starting appearance, and the upper blue line is the ending appearance. + +These can be combined with `EASE_IN` or `EASE_OUT` using the `|` operator, to use just the first or last part of the curve. + ```dm + obj/coin/proc/Spin() var/matrix/M = matrix() - M.Scale(-1, 1) // flip horizontally + M.Scale(-1, 1) // flip horizontally animate(src, transform = M, time = 5, loop = 5, easing = SINE_EASING) animate(transform = null, time = 5, easing = SINE_EASING) - + obj/speech_bubble/New(newloc, msg) icon = 'bubble.dmi' + var/obj/O = new O.maptext = msg O.maptext_width = width O.maptext_height = height overlays = O - + // start below final position and jump into place pixel_z = -100 - alpha = 0 animate(src, pixel_z = 0, alpha = 255, time = 10, easing = ELASTIC_EASING) + alpha = 0 + animate(src, pixel_z = 0, alpha = 255, time = 10, easing = ELASTIC_EASING) + ``` -Some easing functions may overshoot one line or the other, so it\'s fully -possible to have a `pixel_w` value, for instance, animate from 0 to 100 -but actually end up briefly outside of that range during the animation. -### Flags 509 - -Any combination of these flags may be used for animation (use -`+` or `|` to combine them): -+ `ANIMATION_END_NOW`: Normally if you interrupt another animation, it transitions from its - current state. This flag will start the new animation fresh by - bringing the old one to its conclusion immediately. It is only - meaningful on the first step of a new animation. If using the `tag` - argument, only a previous sequence with the same matching tag is - stopped. -+ `ANIMATION_LINEAR_TRANSFORM`: The transform var is interpolated in a way that preserves size - during rotation, by pulling the rotation step out. This flag forces - linear interpolation, which may be more desirable for things like - beam effects, mechanical arms, etc. -+ `ANIMATION_PARALLEL`: Start a parallel animation sequence that runs alongside the current - animation sequence. The difference between where the parallel - sequence started, and its current appearance, is added to the result - of any previous animations. For instance, you could use this to - animate pixel_y separately from pixel_x with different timing and - easing. You could also use this to apply a rotational transform - after a previous animation sequence did a translate. (When using - this flag, the src var may be included, but it is optional.) This - flag is implied if using the `tag` argument for a named sequence. -+ `ANIMATION_RELATIVE`: The vars specified are relative to the current state. This works for - maptext_x/y/width/height, pixel_x/y/w/z, luminosity, layer, alpha, - transform, and color. For transform and color, the current value is - multiplied by the new one. Vars not in this list are simply changed - as if this flag is not present. (If you supply an appearance instead - of individual vars, this flag is meaningless.) -+ `ANIMATION_CONTINUE`: This flag is equivalent to leaving out the `Object` argument. It - exists to make it easier to define an animation using a [for loop](/ref/proc/for.md). - If `Object` differs from the previous sequence, - this flag will be ignored and a new sequence will start. -+ `ANIMATION_SLICE`: Following a series of `animate()` calls, you can view just a portion - of the animation by using - `animate(object, delay=start, time=duration, flags=ANIMATION_SLICE)`. - The `loop` parameter may optionally be included. The `delay` is the start time of the slice, relative to the beginning of all the active - animations on the object. (That is, earlier animations that have - concluded will not be included.) You can call the proc again with a - different slice if you want to see a different portion of the - animation. A negative value for `time` will remove the slice and - finish any existing animations. -+ `ANIMATION_END_LOOP`: Tells previous animation sequences to stop looping and end - naturally. The delay for starting this new sequence is adjusted - based on that. If using the `tag` argument, only a previous sequence - with the same matching tag is told to stop looping. - -### Filters 512 - -[Filters](/ref/notes/filters.md) can be animated too. If you -want to animate a filter, you need to specify the filter to be animated. -If the last call to `animate()` used the same object as this filter, or a different filter for that object, then this will be treated as a new -step in the same animation sequece. Likewise, if the last `animate()` -call was to a filter, and this call is for the object that filter -belonged to, again it will be treated as a continuation of the sequence. - -### Example: + +Some easing functions may overshoot one line or the other, so it's fully possible to have a `pixel_w` value, for instance, animate from 0 to 100 but actually end up briefly outside of that range during the animation. + +Any combination of these flags may be used for animation (use `+` or `|` to combine them): + +Filters can be animated too. If you want to animate a filter, you need to specify the filter to be animated. If the last call to `animate()` used the same object as this filter, or a different filter for that object, then this will be treated as a new step in the same animation sequece. Likewise, if the last `animate()` call was to a filter, and this call is for the object that filter belonged to, again it will be treated as a continuation of the sequence. + ```dm atom/proc/BlurFade() @@ -214,24 +104,35 @@ atom/proc/BlurFade() animate(filters[filters.len], size = 5, time = 10) // Switching back to src to animate the next step animate(src, alpha = 0, time = 2.5) + ``` -### Named sequences 516 -The `tag` argument allows you to refer to an animation sequence -by name. This is useful for being able to replace or stop a previous -animation sequence with the same name, but leaving other parallel -sequences alone. +The `tag` argument allows you to refer to an animation sequence by name. This is useful for being able to replace or stop a previous animation sequence with the same name, but leaving other parallel sequences alone. + +The `ANIMATION_PARALLEL` flag is always implied when using a named sequence. However, a named sequence will always supersede an earlier sequence with the same name, so you can't have two sequences with the same name running concurrently. -The `ANIMATION_PARALLEL` flag is always -implied when using a named sequence. However, a named sequence will -always supersede an earlier sequence with the same name, so you can\'t -have two sequences with the same name running concurrently. +Stopping a named sequence is as simple as calling `animate(Object, tag=name)` with no other arguments. +If the `command` argument is present, a command will run on the client when this step ends. If this is part of a looping sequence, it will run each time. (If for any reason an entire loop runs in between client ticks, those loops will be ignored.) -Stopping a named sequence is as simple as calling -`animate(Object, tag=name)` with no other arguments. +The purpose of this is to synchronize events on the client, such as the .sound command, that otherwise couldn't be matched to the animation. + +Using `[[*]]` in the command will expand it to a reference to the object being animated. (If this is a filter, it references the object that owns the filter.) The reference will be in the same format output by ref(), without quotes. + + +```dm + +obj/bouncing_ball/New() + // this is only here to ensure the sound is included in resources + var/static/bounce = 'bounce.ogg' + var/sound_command = @".sound 'bounce.ogg' atom=[[*]] transform=1,0,0,0,0.707,0.707,0,0,0 falloff=10" + + animate(src, pixel_z=16, easing=QUAD_EASING|EASE_OUT, time=5, loop=-1) + animate(pixel_z=0, command=sound_command, easing=QUAD_EASING|EASE_IN, time=5) + +``` -> [!TIP] -> **See also:** -> + [vars (atom)](/ref/atom/var.md) +*** +**Related Pages:** ++ [vars (atom)](/ref/atom/var) diff --git a/ref/proc/arccos.md b/ref/proc/arccos.md index 192e8364..121cb0a1 100644 --- a/ref/proc/arccos.md +++ b/ref/proc/arccos.md @@ -1,22 +1,25 @@ -## arccos proc + +## arccos (proc) **Format:** + arccos(X) **Returns:** + The inverse cosine of X in degrees. -### Example: +*** ```dm + mob/verb/test() usr << arccos(0) // 90 usr << arccos(0.707107) // 45 usr << arccos(1) // 0 + ``` -> [!TIP] -> **See also:** -> + [arcsin proc](/ref/proc/arcsin.md) -> + [arctan proc](/ref/proc/arctan.md) -> + [cos proc](/ref/proc/cos.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arcsin proc](/ref/proc/arcsin) ++ [arctan proc](/ref/proc/arctan) ++ [cos proc](/ref/proc/cos) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/arcsin.md b/ref/proc/arcsin.md index 9134f32f..6236fe2e 100644 --- a/ref/proc/arcsin.md +++ b/ref/proc/arcsin.md @@ -1,22 +1,25 @@ -## arcsin proc + +## arcsin (proc) **Format:** + arcsin(X) **Returns:** + The inverse sine of X in degrees. -### Example: +*** ```dm + mob/verb/test() usr << arcsin(0) // 0 usr << arcsin(0.707107) // 45 usr << arcsin(1) // 90 + ``` -> [!TIP] -> **See also:** -> + [arccos proc](/ref/proc/arccos.md) -> + [arctan proc](/ref/proc/arctan.md) -> + [sin proc](/ref/proc/sin.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arccos proc](/ref/proc/arccos) ++ [arctan proc](/ref/proc/arctan) ++ [sin proc](/ref/proc/sin) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/arctan.md b/ref/proc/arctan.md index f67d89bb..138463f8 100644 --- a/ref/proc/arctan.md +++ b/ref/proc/arctan.md @@ -1,32 +1,28 @@ -## arctan proc -###### BYOND Version 513 + +## arctan (proc) **Format:** + arctan(Num) + arctan(x, y) + arctan(Vector) -**Args:** +**Arguments:** + Num: A number + x, y: 2D coordinates + Vector: A vector (only 2 dimensions are used) **Returns:** + The inverse tangent in degrees. +*** +When `arctan` is called with just one number argument, the number is a tangent, and the return value is the angle that produces that tangent. The resulting angle can range from -90 to 90. -When `arctan` is called with just one number argument, the -number is a tangent, and the return value is the angle that produces -that tangent. The resulting angle can range from -90 to 90. +The two-argument form returns a polar angle from -180 to 180. This angle starts at 0° for due east, and increases counter-clockwise from there. Therefore 1,0 has an arctangent of 0°, 0,1 is 90°, -1,0 is 180°, and so on. At point 0,0 the angle is undefined since it could be any angle, but `arctan` will return 0. -The two-argument form returns a polar angle from -180 to 180. This angle -starts at 0° for due east, and increases counter-clockwise from there. -Therefore 1,0 has an arctangent of 0°, 0,1 is 90°, -1,0 is 180°, and so on. At point 0,0 the angle is undefined since it could be any angle, but `arctan` will return 0. +Finally, you can use a vector instead of a number. Only the x and y components of a vector will be used. -Finally, you can use a vector instead -of a number. Only the x and y components of a vector will be used. -### Example: ```dm + mob/verb/test() usr << arctan(0) // 0 usr << arctan(1) // 45 @@ -36,10 +32,15 @@ mob/verb/test() usr << arctan(3, 4) // 53.1301 usr << arctan(-1, 1) // 135 usr << arctan(0, -5) // -90 + ``` -Here\'s another example, in which a -rotating turret points to a target on another tile. + + +Here's another example, in which a rotating turret points to a target on another tile. + + ```dm + mob/turret proc/PointAt(atom/target) if(!target) return @@ -47,11 +48,12 @@ mob/turret var/dy = target.y - y // turret's icon normally faces east transform = matrix().Turn(-arctan(dx, dy)) + ``` -> [!TIP] -> **See also:** -> + [arcsin proc](/ref/proc/arcsin.md) -> + [arccos proc](/ref/proc/arccos.md) -> + [tan proc](/ref/proc/tan.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arcsin proc](/ref/proc/arcsin) ++ [arccos proc](/ref/proc/arccos) ++ [tan proc](/ref/proc/tan) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/arglist.md b/ref/proc/arglist.md index 2793a163..418261a7 100644 --- a/ref/proc/arglist.md +++ b/ref/proc/arglist.md @@ -1,29 +1,23 @@ -## arglist proc + +## arglist (proc) **Format:** + arglist(List) -**Args:** +**Arguments:** + List: a list to be used as the arguments to a procedure +*** +Normally, if you were to pass a list directly to a procedure, it would only come through as a singe argument to that procedure. In some cases, you might instead want the items in the list to become the arguments to the procedure. That is what arglist() achieves. -Normally, if you were to pass a list directly to a procedure, -it would only come through as a singe argument to that procedure. In -some cases, you might instead want the items in the list to become the -arguments to the procedure. That is what `arglist()` achieves. +If the items in the list are associations, these are treated as named arguments. Each such list item is matched against the names of the procedure arguments and its associated value is assigned to that parameter. -If the items in the list are associations, these are treated as -[named arguments](/ref/proc/arguments/named.md) Each such list item is matched against the names of the procedure arguments and its associated -value is assigned to that parameter. +Most built-in DM instructions do not support use of arglist(), but all user-defined procedures automatically support it. The built-in instructions which support named arguments will also support arglist(). -Most built-in DM instructions do not support use of `arglist()`, but all user-defined -procedures automatically support it. The built-in instructions which -support named arguments will also support `arglist()`. +The following example shows how to use arglist() with both positional parameters and named arguments. Both of these examples could be replaced by a much simpler direct call without need for a list to hold the arguments; this is just to illustrate the syntax. -The following example shows how to use `arglist()` with both positional -parameters and named arguments. Both of these examples could be replaced by a much simpler direct call without need for a list to hold the arguments; this is just to illustrate the syntax. -### Example: ```dm + proc/MyProc(a,b) usr << "MyProc([a],[b])" @@ -33,11 +27,12 @@ mob/verb/test() lst = list(b=2,a=1) //just to illustrate that order does not matter MyProc(arglist(lst)) //MyProc(b=2,a=1) --> MyProc(1,2) + ``` -> [!TIP] -> **See also:** -> + [arguments (proc)](/ref/proc/arguments.md) -> + [call proc](/ref/proc/call.md) -> + [call_ext proc](/ref/proc/call_ext.md) -> + [list proc](/ref/proc/list.md) \ No newline at end of file +*** +**Related Pages:** ++ [arguments (proc)](/ref/proc/arguments) ++ [call proc](/ref/proc/call) ++ [call_ext() proc](/ref/proc/call_ext) ++ [list proc](/ref/proc/list) diff --git a/ref/proc/arguments.md b/ref/proc/arguments.md deleted file mode 100644 index cff69e20..00000000 --- a/ref/proc/arguments.md +++ /dev/null @@ -1,31 +0,0 @@ -## arguments (proc) - -The parameters to a proc are referred to as arguments. To -define argument variables, place them inside the ()\'s in the proc -definition. A default value may be specified. Otherwise, arguments -default to null. -### Example: - -```dm -proc/Sum(a,b) - return a + b -``` - -### Example: - -```dm -proc/set_mob_desc(mob/M,desc="big and bad") - M.desc = desc - world << "The new desc for [M] is [desc]." -``` - -Note how the variable type may be specified. It is just like -any other variable definition, except "`var/`" is implicit and does -not need to be typed. - -> [!TIP] -> **See also:** -> + [named arguments (proc)](/ref/proc/arguments/named.md) -> + [path operators](/ref/operator/path.md) -> + [arglist proc](/ref/proc/arglist.md) -> + [args var (proc)](/ref/proc/var/args.md) \ No newline at end of file diff --git a/ref/proc/arguments/index.md b/ref/proc/arguments/index.md new file mode 100644 index 00000000..e896b2c5 --- /dev/null +++ b/ref/proc/arguments/index.md @@ -0,0 +1,31 @@ + +## arguments (proc) +*** +The parameters to a proc are referred to as arguments. To define argument variables, place them inside the ()'s in the proc definition. A default value may be specified. Otherwise, arguments default to null. + + +```dm + +proc/Sum(a,b) + return a + b + +``` + + + +```dm + +proc/set_mob_desc(mob/M,desc="big and bad") + M.desc = desc + world << "The new desc for [M] is [desc]." + +``` + + +Note how the variable type may be specified. It is just like any other variable definition, except "var/" is implicit and does not need to be typed. +*** +**Related Pages:** ++ [named arguments (proc)](/ref/proc/arguments/named) ++ [path operators](/ref/operator/path) ++ [arglist proc](/ref/proc/arglist) ++ [args list var (proc)](/ref/proc/var/args) diff --git a/ref/proc/arguments/named.md b/ref/proc/arguments/named.md new file mode 100644 index 00000000..894820a1 --- /dev/null +++ b/ref/proc/arguments/named.md @@ -0,0 +1,63 @@ + +## named (proc) +*** +The parameters passed to a procedure are called arguments. These may either be passed in positional order, or they can be passed as named arguments. Not all procedures are defined with the intention of supporting named arguments, so consult the documentation for the procedure in question first. (This is mainly an issue of whether the argument names might change in the future.) + +The following example shows several ways of producing the same call to a procedure. + + +```dm + +mob/proc/MyProc(a,b,c) + src << "MyProc([a],[b],[c])" + +mob/verb/test() + MyProc(1,2,3) //positional parameters + MyProc(a=1,b=2,c=3) //named arguments + MyProc(1,b=2,c=3) //positional and named arguments + MyProc(c=3,a=1,b=2) //named arguments can come in any order + +``` + + +To prevent silent errors, named arguments that do not match any of the arguments of the procedure being called will generate a runtime error. This is somewhat different from the behavior of positional arguments in DM where it is perfectly acceptable to pass more arguments than were explicitly defined in the procedure. + +As always, arguments that are not assigned in the call will simply be given the value null (or whatever default value is specified in the definition). + +When an object procedure is overridden, the variable names in the new definition are the ones that get matched against named arguments in a call to that procedure. A procedure which is intended to support named arguments should therefore be defined with care so as to conform to the interface expected by users of the procedure. That doesn't stop you from changing that interface when overriding a procedure, but the normal case would be to preserve the argument names of the base procedure when overriding it. + +The following example is not useful, but it illustrates a situation where a procedure is overridden so as to preserve the same argument names and positions. As mentioned above, you are not required to preserve either the names or positions, but that is usually what you want. + + +```dm + +mob + proc/MyProc(a,b,c) + usr << "mob.MyProc([a],[b],[c])" + + mob/verb/test() + MyProc(a=1,b=2,c=3) + + special_mob + MyProc(a,b,c,d) + if(d) ..() //pass in same order + else ..(c,b,a) //pass in reverse order + + test() + MyProc(a=1,b=2,c=3,d=0) //normal order + MyProc(a=1,b=2,c=3,d=1) //reverse the order + + +``` + + +This example merely used positional parameters in the call to ..(), but one can use named arguments there too if it is desirable. + +The best time to use named arguments is when calling a procedure that takes a lot of optional parameters. You can just name the ones that you want to assign and leave the rest unspecified. Trying to do the same thing with positional parameters can be much more awkward–especially when the arguments you do want to assign are preceded by a number of ones that you don't care to assign. It's easy to lose your place in the list or to forget what it does. + +Since named arguments involve a slight amount of extra overhead, one should avoid them in code that is highly cpu intensive due to being called many many times. Otherwise, code clarity may be a bigger priority. +*** +**Related Pages:** ++ [New](/ref/atom/proc/New) ++ [arglist proc](/ref/proc/arglist) ++ [arguments (proc)](/ref/proc/arguments) diff --git a/ref/proc/ascii2text.md b/ref/proc/ascii2text.md index 70b8feeb..bbf72ad0 100644 --- a/ref/proc/ascii2text.md +++ b/ref/proc/ascii2text.md @@ -1,30 +1,27 @@ -## ascii2text proc +## ascii2text (proc) **Format:** + ascii2text(N) +**Arguments:** ++ N: A number. + **Returns:** + A text string. +*** +ASCII codes are numerical values corresponding to keyboard and special characters. Among other things, they are used to represent many symbols in HTML. This proc converts an ASCII code to its corresponding text representation. -**Args:** -+ N: A number. - -ASCII codes are numerical values corresponding to keyboard and -special characters. Among other things, they are used to represent many -symbols in HTML. This proc converts an ASCII code to its corresponding -text representation. -### Example: ```dm - T = ascii2text(65) // = "A" + +T = ascii2text(65) // = "A" + ``` -BYOND supports [Unicode](/ref/notes/Unicode.md) via UTF-8 encoding, so you -can use the character code for any valid Unicode character, not just -ASCII. -> [!TIP] -> **See also:** -> + [entities (text)](/ref/DM/text/entities.md) -> + [text2ascii proc](/ref/proc/text2ascii.md) \ No newline at end of file +BYOND now supports Unicode via UTF-8 encoding, so you can use the character code for any valid Unicode character, not just ASCII. +*** +**Related Pages:** ++ [entities (text)](/ref/DM/text/entities) ++ [text2ascii proc](/ref/proc/text2ascii) diff --git a/ref/proc/astype.md b/ref/proc/astype.md index 54c9c67a..489fb795 100644 --- a/ref/proc/astype.md +++ b/ref/proc/astype.md @@ -1,34 +1,32 @@ -## astype proc -##### BYOND Version 516 + +## astype (proc) + **Format:** + astype(Val,Type) + astype(Val) +**Arguments:** ++ Val: An object instance. ++ Type: An object prototype or instance. If no type is specified, it will be implied (see below). + **Returns:** + Val if Val is derived from Type; null otherwise. +*** +Forcibly casts an object to a type, returning null if it isn't valid. -**Args:** -+ Val: An object instance. -+ Type: An object prototype or instance. If no type is specified, it - will be implied (see below). -Forcibly casts an object to a type, returning null if it isn\'t -valid. -### Example: ```dm + astype(gift, /obj/potion)?.Drink() + ``` -Similarly to `istype()`, the type can be implied. The implied -type is determined as follows: -1. If `astype()` is on the right-hand side of an assignment operation, - the left-hand side\'s var type is the implied type, just like with - the `new()` operator. -2. Otherwise, the var type of the first argument is the implied type, - just as it is in `istype()`. -### Example: +Similarly to `istype()`, the type can be implied. The implied type is determined as follows: + + ```dm + // if obstacle is of type /obj/box, it will be assigned to B; otherwise B is null var/obj/box/B = astype(obstacle) if(B?.closed) B.Open() @@ -36,8 +34,10 @@ if(B?.closed) B.Open() // B is assigned no matter what, but astype() will return null if it isn't an /obj/box B = obstacle if(astype(B)?.closed) B.Open() + ``` -> [!TIP] -> **See also:** -> + [astype proc](/ref/proc/istype.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file + +*** +**Related Pages:** ++ [istype proc](/ref/proc/istype) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/proc/block.md b/ref/proc/block.md index 1d384dee..70fe53de 100644 --- a/ref/proc/block.md +++ b/ref/proc/block.md @@ -1,25 +1,24 @@ -## block proc + +## block (proc) **Format:** + block(Start,End) + block(StartX,StartY,StartZ, EndX=StartX,EndY=StartY,EndZ=StartZ) -**Returns:** -+ The list of turfs in the 3D block defined by Start and End - (inclusive). - -**Args:** -+ **Start**: A turf to be the lower-left corner of the block. -+ **End**: A turf to be the upper-right corner of the block. -+ **StartX, StartY, StartZ**: XYZ coordinates of the lower-left corner of - the block. -+ **EndX, EndY, EndZ**: XYZ coordinates of the upper-right corner of the - block. +**Arguments:** ++ Start: A turf to be the lower-left corner of the block. ++ End: A turf to be the upper-right corner of the block. ++ StartX, StartY, StartZ: XYZ coordinates of the lower-left corner of the block. ++ EndX, EndY, EndZ: XYZ coordinates of the upper-right corner of the block. +**Returns:** ++ The list of turfs in the 3D block defined by Start and End (inclusive). +*** The following example shows how to loop over a block of turfs. -### Example: + ```dm + world maxx = 20 maxy = 20 @@ -28,16 +27,15 @@ mob/verb/block_test() var/turf/T for(T in block(locate(1,1,1), locate(10,10,1))) T.text = " " + ``` - -In the version that uses coordinates directly -instead of two turfs, you can leave any of the EndX, EndY, or EndZ -values as null, and omit the last arguments entirely; they will default -to using the corresponding StartX, StartY, or StartZ. Therefore this -example is equivalent to the one above: -### Example: + + +In the version that uses coordinates directly instead of two turfs, you can leave any of the EndX, EndY, or EndZ values as null, and omit the last arguments entirely; they will default to using the corresponding StartX, StartY, or StartZ. Therefore this example is equivalent to the one above: + ```dm + world maxx = 20 maxy = 20 @@ -46,8 +44,9 @@ mob/verb/block_test() var/turf/T for(T in block(1,1,1, 10,10)) T.text = " " + ``` -> [!TIP] -> **See also:** -> + [list](/ref/list.md) \ No newline at end of file +*** +**Related Pages:** ++ [list](/ref/list) diff --git a/ref/proc/bound_pixloc.md b/ref/proc/bound_pixloc.md index 78bf18bc..92a299be 100644 --- a/ref/proc/bound_pixloc.md +++ b/ref/proc/bound_pixloc.md @@ -1,37 +1,35 @@ -## bound_pixloc proc -###### BYOND Version 516 + +## bound_pixloc (proc) **Format:** + bound_pixloc(Atom, Dir) -**Returns:** -+ A `pixloc` object representing a corner, side, or center of atom - bounds. - -**Args:** +**Arguments:** + Atom: An atom. + Dir: The side or corner to use, or 0 for center. -Creates a new `pixloc` object based on an existing object\'s -bounds. If either `bound_x` or `bound_y` (both deprecated) are nonzero, -then `bound_pixloc(atom, SOUTHWEST)` will differ from `atom.pixloc`. - +**Returns:** ++ A object representing a corner, side, or center of atom bounds. +*** +Creates a new `pixloc` object based on an existing object's bounds. If either `bound_x` or `bound_y` are nonzero, then `bound_pixloc(atom, SOUTHWEST)` will differ from `atom.pixloc`. If the atom is not directly on the map, this value is null. -### Example: + ```dm + mob/verb/DistanceTo(atom/A) var/my_center = bound_pixloc(src, 0) var/A_center = bound_pixloc(A, 0) var/vector/V = A_center - my_center return length(V) + ``` -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [pixloc var (atom)](/ref/atom/var/pixloc.md) -> + [pixloc proc](/ref/proc/pixloc.md) -> + [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) -> + [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) \ No newline at end of file +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [pixloc](/ref/atom/var/pixloc) ++ [pixloc proc](/ref/proc/pixloc) ++ [bound_width var (movable atom)](/ref/atom/movable/var/bound_width) ++ [bound_height var (movable atom)](/ref/atom/movable/var/bound_height) diff --git a/ref/proc/bounds.md b/ref/proc/bounds.md index aff39126..92ed7d15 100644 --- a/ref/proc/bounds.md +++ b/ref/proc/bounds.md @@ -1,59 +1,45 @@ -## bounds proc +## bounds (proc) **Format:** + bounds(Ref=src, Dist=0) + bounds(Ref, x_offset, y_offset, extra_width=0, extra_height=0) + bounds(x, y, width, height, z) -**Returns:** -+ A list of atoms (except areas) within the given bounding box. - -**Args:** -+ Ref: A turf, obj, mob, pixloc, or a pair of pixlocs as two - arguments. -+ Dist: A number (distance in pixels). +**Arguments:** ++ Ref: A turf, obj, mob, pixloc, or a pair of pixlocs as two arguments. ++ Dist: A number (distance in pixels). + x_offset, y_offset: Shifts bounding box position + extra_width, extra_height: Adjusts bounding box size -+ x, y, z: Lower left corner of bounding box in absolute coords; - x=1,y=1 is lower left of map ++ x, y, z: Lower left corner of bounding box in absolute coords; x=1,y=1 is lower left of map + width, height: Size of bounding box in absolute coords -To leave Ref out of the results, use [`obounds()`](/ref/proc/obounds.md) instead. - -> [!NOTE] -> A [vector](/ref/vector.md) may be used in place of any x/y or width/height pair. - -Calling bounds() will default to bounds(src,0), if src is a -turf, obj, or mob. This returns all turfs, objs, and mobs (including -src) within src\'s bounding box. If a single pixloc is used for Ref, it -will have no width or height; you can use a pair of pixlocs instead to -get a block between two pixlocs. - -Changing the distance will return all objects within that distance from the bounding box. E.g., -bounds(turf,12) will show you everything within 12 pixels of that turf. - - -An object\'s bounding box can also be offset. bounds(src,-6,0) -shows what src would touching if it moved 6 pixels west. -bounds(turf,-12,-12,24,24) is equivalent to bounds(turf,12). - -In the final form, bounds() can use absolute coordinates and does not need -an object to be Ref. Absolute coordinates start at 1,1 at the lower left -corner of the map, by tradition. - -> [!TIP] -> **See also:** -> + [obounds proc](/ref/proc/obounds.md) -> + [pixloc](/ref/pixloc.md) -> + [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) -> + [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) -> + [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) -> + [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) -> + [icon_w var (atom)](/ref/atom/var/icon_w.md) -> + [icon_z var (atom)](/ref/atom/var/icon_z.md) -> + [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) -> + [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) -> + [locs list var (movable atom)](/ref/atom/movable/var/locs.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) -> + [bounds var (client)](/ref/client/var/bounds.md) \ No newline at end of file +**Returns:** ++ A list of atoms (except areas) within the given bounding box. +*** +To leave Ref out of the results, use obounds() instead. + +Calling bounds() will default to bounds(src,0), if src is a turf, obj, or mob. This returns all turfs, objs, and mobs (including src) within src's bounding box. If a single pixloc is used for Ref, it will have no width or height; you can use a pair of pixlocs instead to get a block between two pixlocs. + +Changing the distance will return all objects within that distance from the bounding box. E.g., bounds(turf,12) will show you everything within 12 pixels of that turf. + +An object's bounding box can also be offset. bounds(src,-6,0) shows what src would touching if it moved 6 pixels west. bounds(turf,-12,-12,24,24) is equivalent to bounds(turf,12). + +In the final form, bounds() can use absolute coordinates and does not need an object to be Ref. Absolute coordinates start at 1,1 at the lower left corner of the map, by tradition. + +Note: A vector may be used in place of any x/y or width/height pair. +*** +**Related Pages:** ++ [obounds proc](/ref/proc/obounds) ++ [pixloc](/ref/pixloc) ++ [bound_x var (movable atom)](/ref/atom/movable/var/bound_x) ++ [bound_y var (movable atom)](/ref/atom/movable/var/bound_y) ++ [bound_width var (movable atom)](/ref/atom/movable/var/bound_width) ++ [bound_height var (movable atom)](/ref/atom/movable/var/bound_height) ++ [icon_w var (atom)](/ref/atom/var/icon_w) ++ [icon_z var (atom)](/ref/atom/var/icon_z) ++ [step_x var (movable atom)](/ref/atom/movable/var/step_x) ++ [step_y var (movable atom)](/ref/atom/movable/var/step_y) ++ [locs list var (movable atom)](/ref/atom/movable/var/locs) ++ [Pixel movement](/ref/{notes}/pixel-movement) ++ [bounds var (client)](/ref/client/var/bounds) diff --git a/ref/proc/bounds_dist.md b/ref/proc/bounds_dist.md index 39027fe3..5eb8e874 100644 --- a/ref/proc/bounds_dist.md +++ b/ref/proc/bounds_dist.md @@ -1,36 +1,30 @@ -## bounds_dist proc + +## bounds_dist (proc) **Format:** + bounds_dist(Ref, Target) -**Returns:** -+ The distance, in pixels, between Ref\'s and Target\'s bounding - boxes. - -**Args:** -+ **Ref**: A turf, obj, or mob. -+ **Target**: A turf, obj, or mob. - -The value returned by bounds_dist() is the number of pixels -that the two objects would have to move closer together (if this is even -possible, of course) to be touching but not overlapping. +**Arguments:** ++ Ref: A turf, obj, or mob. ++ Target: A turf, obj, or mob. -A return value of 12 for instance means the two objects have a gap of 12 -pixels between them. - -A return value of 0 means the two objects -are not overlapping, but their bounding boxes touch. - -A return value of -2 means the two objects are overlapping by 2 pixels; -they would have to move 2 pixels apart to separate. - -> [!TIP] -> **See also:** -> + [bound_x var (movable atom)](/ref/atom/movable/var/bound_x.md) -> + [bound_y var (movable atom)](/ref/atom/movable/var/bound_y.md) -> + [bound_width var (movable atom)](/ref/atom/movable/var/bound_width.md) -> + [bound_height var (movable atom)](/ref/atom/movable/var/bound_height.md) -> + [step_x var (movable atom)](/ref/atom/movable/var/step_x.md) -> + [step_y var (movable atom)](/ref/atom/movable/var/step_y.md) -> + [bounds proc](/ref/proc/bounds.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +**Returns:** ++ The distance, in pixels, between Ref's and Target's bounding boxes. +*** +The value returned by bounds_dist() is the number of pixels that the two objects would have to move closer together (if this is even possible, of course) to be touching but not overlapping. + +A return value of 12 for instance means the two objects have a gap of 12 pixels between them. + +A return value of 0 means the two objects are not overlapping, but their bounding boxes touch. + +A return value of -2 means the two objects are overlapping by 2 pixels; they would have to move 2 pixels apart to separate. +*** +**Related Pages:** ++ [bound_x var (movable atom)](/ref/atom/movable/var/bound_x) ++ [bound_y var (movable atom)](/ref/atom/movable/var/bound_y) ++ [bound_width var (movable atom)](/ref/atom/movable/var/bound_width) ++ [bound_height var (movable atom)](/ref/atom/movable/var/bound_height) ++ [step_x var (movable atom)](/ref/atom/movable/var/step_x) ++ [step_y var (movable atom)](/ref/atom/movable/var/step_y) ++ [bounds proc](/ref/proc/bounds) ++ [Pixel movement](/ref/{notes}/pixel-movement) diff --git a/ref/proc/break.md b/ref/proc/break.md index 5d7e237b..b94a32e4 100644 --- a/ref/proc/break.md +++ b/ref/proc/break.md @@ -1,17 +1,15 @@ -## break statement +## break (proc) **Format:** + break + break Label +*** +Terminate the loop with the given label. If no label is specified, the innermost loop containing the break statement is assumed. -Terminate the loop with the given label. If no label is -specified, the innermost loop containing the `break` statement is -assumed. -### Example: - ```dm + obj/zapper verb/use() var/mob/M @@ -22,25 +20,20 @@ obj/zapper if(!M) M = usr M << "ZAP!" del(M) + ``` -The zapper object kills the first mob it finds that doesn\'t -belong to a player. If none can be found, it kills the user. Be careful! -Note how this code takes advantage of the fact that the loop variable -`M` will be `null` if the loop terminates normally. - -For an example of how to use labeled loops, see the reference -section for the `continue` statement. - -The `break` statement can also be used inside of a [`switch()` proc](/ref/proc/switch.md) when using -[C-like syntax](/ref/DM/preprocessor/pragma/syntax.md) , where it breaks out of -a `case` block to the end of the switch. See [switch proc](/ref/proc/switch.md) for more details. - -> [!TIP] -> **See also:** -> + [continue statement](/ref/proc/continue.md) -> + [do proc](/ref/proc/do.md) -> + [for loop proc](/ref/proc/for/loop.md) -> + [while proc](/ref/proc/while.md) -> + [switch proc](/ref/proc/switch.md) -> + [#pragma syntax directive](/ref/DM/preprocessor/pragma/syntax.md) \ No newline at end of file + +The zapper object kills the first mob it finds that doesn't belong to a player. If none can be found, it kills the user. Be careful! Note how this code takes advantage of the fact that the loop variable `M` will be null if the loop terminates normally. + +For an example of how to use labeled loops, see the reference section for the continue statement. + +The `break` statement can also be used inside of a `switch()` proc when using C-like syntax, where it breaks out of a `case` block to the end of the switch. See switch proc for more details. +*** +**Related Pages:** ++ [continue statement](/ref/proc/continue) ++ [do proc](/ref/proc/do) ++ [for loop proc](/ref/proc/for/loop) ++ [while proc](/ref/proc/while) ++ [switch proc](/ref/proc/switch) ++ [#pragma syntax directive](/ref/DM/preprocessor/pragma/syntax) diff --git a/ref/proc/browse.md b/ref/proc/browse.md index 881b81ca..dc81c076 100644 --- a/ref/proc/browse.md +++ b/ref/proc/browse.md @@ -1,134 +1,46 @@ -## browse proc + +## browse (proc) **Format:** + usr << browse(Body,Options) -**Args:** +**Arguments:** + Body: html text, file, or null to close the browser. + Options: optional parameters +*** +This sends the html text or file to the user and optionally displays it in the web browser. The default action is to use the embedded browser panel in the Dream Seeker window; specifying an alternate window name (see below) causes it to appear in a popup window. Passing in 'null' for the html text causes the browser panel or named window to be closed. + +The option parameters should either be omitted or they should be in a text string of the following format: "`window`=name;`file`=name;`display`=1;
`size`=300x300;`border`=0;`can_close`=1;
`can_resize`=1;`can_minimize`=1;`titlebar`=1"
+ +You may use commas (,), ampersands (&), or semicolons (;) as the delimiter. Any or all of the parameters may be specified and they may be included in any order. + +Note also that many display options can be controlled through the html itself. For instance, to turn off the scrollbars, you can do: <body scroll=no>; to add a title, you can do: <head><title>My Title</title></head>; and so forth. + +The following example displays a help page in a popup window. -This sends the html text or file to the user and optionally -displays it in the web browser. The default action is to use the -embedded browser panel in the Dream Seeker window; specifying an -alternate window name (see below) causes it to appear in a popup window. -Passing in \'null\' for the html text causes the browser panel or named -window to be closed. - -The option parameters should either be -omitted or they should be in a text string of the following format: -` "``window``=name;``file``=name;``display``=1;`\ -`size``=300x300;``border``=0;``can_close``=1;`\ -`can_resize``=1;``can_minimize``=1;``titlebar``=1" ` - - -You may use commas (,), ampersands (&), or semicolons (;) as -the delimiter. Any or all of the parameters may be specified and they -may be included in any order. -### General options -These control how to handle the text or file. - -- **window** - - This is the name used to identify the popup window. It is not - visible to the user. Multiple calls to browse() with the same window - name overwrite previous contents of the same popup window. If window - is not specified, the embedded browser panel will be used. -- **file** - - When this is unspecified, the client will store the generated html - file in the user\'s byond "cache" directory with an appropriate - name. If Body is a text string, the client will generate a unique - name. If it is a file, it will use the name of the file. You can - override this by setting this parameter. This is only useful when - you need to reference the file later, typically in tandem with the - display setting below. -- **display** - - This controls whether the browser actually displays Body in the web - browser or not. If it is turned off (display=0), the text or file is - simply sent to the user and expected to be referenced later. This - might be useful, for instance, to first send an image to a user and - then display a web page that uses that image: - - ```dm - usr << browse('monster.png',"display=0") - usr << browse("A scary monster appears from the mist!") - ``` - > [!NOTE] - > this performs the same function as the - [browse_rsc](/ref/proc/browse_rsc.md) proc (preserved for legacy reasons). - It is a little more powerful because you can use it to send html - text as well as files. In that case, you\'ll have to also supply the - file=name argument so that you can reference the html text from - within a later browse(). - - - When display=0, all of the other arguments besides file are ignored. - -### Popup options -These control how the popup window initially appears. Setting these -parameters for an existing popup window or the embedded browser has no -effect. - -- **border** - - This is the width of the border between the edges of the dialogue - and the window content. The default value is 0, meaning that the - entire window is filled with html content. -- **size** - - This is the size of the popup window in pixels. The format is - `WIDTHxHEIGHT`. -- **can_close** - - This specifies whether the window should be closable. The default - value is 1, which enables the standard "X" button for closing. -- **can_resize** - - This controls whether the window is resizable. The default value is - 1, enabling resizing and maximizing. -- **can_minimize** - - This controls whether the window is minimizable. The default value - is 1, enabling the standard minimization button. -- **titlebar** - - The default titlebar=1 enables the standard bar at the top of the - window. Turning it off disables can_close and can_minimize. - - -> [!NOTE] -> Many display options can be controlled through -the html itself. For instance, to turn off the scrollbars, you can do: -``; to add a title, you can do: -`My Title`; and so forth. - -The -following example displays a help page in a popup window. -### Example: ```dm + var/const/help = {" - -Help! - + +Help! + You are beyond help! - - + + "} client/verb/help() usr << browse(help,"window=help") -``` - -You can use commands like [output()](/ref/proc/output.md) and -[winset()](/ref/proc/winset.md) to interact with popups. The name of the -window is the same name you gave the popup, and the browser is -"[windowname].browser". -### Example: -```dm -client/verb/more_help() - usr << output("You are still beyond help!", "help.browser") ``` -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [browse_rsc proc](/ref/proc/browse_rsc.md) -> + [file proc](/ref/proc/file.md) -> + [link proc](/ref/proc/link.md) -> + [run proc](/ref/proc/run.md) -> + [output proc](/ref/proc/output.md) \ No newline at end of file +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [browse_rsc](/ref/proc/browse_rsc) ++ [file proc](/ref/proc/file) ++ [link proc](/ref/proc/link) ++ [run proc](/ref/proc/run) ++ [output proc](/ref/proc/output) diff --git a/ref/proc/browse_rsc.md b/ref/proc/browse_rsc.md index 34a72c91..198e214f 100644 --- a/ref/proc/browse_rsc.md +++ b/ref/proc/browse_rsc.md @@ -1,27 +1,22 @@ -## browse_rsc proc + +## browse_rsc (proc) **Format:** + usr << browse_rsc(File,FileName) -**Args:** +**Arguments:** + File: a resource file (such as an image) + FileName: name of file (if different from source file) +*** +This sends the specified resource file to usr (or anybody else) and stores it in their cache directory with the specified name. In subsequent browse() output, you can then refer to that file. -This sends the specified resource file to usr (or anybody else) -and stores it in their `cache` directory with the specified name. In -subsequent `browse()` output, you can then refer to that file. +If your world is always running on the internet, you can save yourself the trouble and simply link to the image files through a web server. However, if it may be played offline, you can compile in the resource files and manually send them to players with browse_rsc(). -If your world is always running on the internet, you can save -yourself the trouble and simply link to the image files through a web -server. However, if it may be played offline, you can compile in the -resource files and manually send them to players with `browse_rsc()`. +Note that no data is transmitted if it already exists in the user's cache, so there is little overhead in calling this every time you are about to use browse(). -Note that no data is transmitted if it already exists in the -user\'s cache, so there is little overhead in calling this every time -you are about to use `browse()`. -### Example: ```dm + area var room_graphic = 'cozy_room.jpg' @@ -29,9 +24,12 @@ area . = ..() //do default checks if(.) //if we got clearance to enter O << browse_rsc(room_graphic,"room.jpg") - O << browse("

[desc]") + O << browse("[desc]") + ``` -> [!TIP] -> **See also:** -> + [browse proc](/ref/proc/browse.md) + + +*** +**Related Pages:** ++ [browse proc](/ref/proc/browse) diff --git a/ref/proc/call.md b/ref/proc/call.md index 1731db62..a04c693d 100644 --- a/ref/proc/call.md +++ b/ref/proc/call.md @@ -1,37 +1,28 @@ -## call proc + +## call (proc) **Format:** + call(ProcRef)(Arguments) + call(Object,ProcName)(Arguments) -+ call(LibName,FuncName)(Arguments) (use `call_ext()` instead) DEPRECATED ++ call(LibName,FuncName)(Arguments) (use instead) -**Args:** -+ **ProcRef**: path of proc (/proc/MyProc) -+ **Object**: source of proc or verb -+ **ProcName**: name of proc or verb ("MyProc") -+ **LibName**: name of external library ("test.DLL") DEPRECATED -+ **FuncName**: name of function in external library ("func") DEPRECATED +**Arguments:** ++ ProcRef: path of proc (/proc/MyProc) ++ Object: source of proc or verb ++ ProcName: name of proc or verb ("MyProc") ++ LibName: name of external library ("test.DLL") ++ FuncName: name of function in external library ("func") **Returns:** + The return value of the proc being called. +*** +This instruction exists in order to call procs dynamically, since the proc reference or name may be an expression rather than a hard-coded value. This may serve the same purpose as a "function pointer" in C programs. -> [!NOTE] -> In prior versions, `call()` was also used to access -third-party libraries (.DLL files on Windows, .SO files on Unix), but -this has been moved to [call_ext()](/ref/proc/call_ext.md) for clarity. - -This instruction exists in order to call procs dynamically, -since the proc reference or name may be an expression rather than a -hard-coded value. This may serve the same purpose as a "function -pointer" in C programs. +The following examples do not demonstrate why you would want to do this, but the syntax is illustrated. The first one calls a specific procedure by using a path reference to that procedure. -The following examples do not -demonstrate why you would want to do this, but the syntax is -illustrated. The first one calls a specific procedure by using a path -reference to that procedure. -### Example: ```dm + /proc/MyProc(Arg) usr << "MyProc([Arg])" mob @@ -40,13 +31,15 @@ mob verb call_myproc() call(MyProc)("Hello, world!") + ``` -The next example calls an object procedure (or verb) -by name, rather than by path. -### Example: + +The next example calls an object procedure (or verb) by name, rather than by path. + ```dm + mob proc Proc1(Arg) @@ -56,11 +49,14 @@ mob verb call_proc(Proc in list("Proc1","Proc2")) call(src,Proc)("Hello, world!") + ``` -> [!TIP] -> **See also:** -> + [arglist proc](/ref/proc/arglist.md) -> + [call_ext proc](/ref/proc/call_ext.md) -> + [hascall proc](/ref/proc/hascall.md) -> + [path operators](/ref/operator/path.md) \ No newline at end of file + +Note: In prior versions, `call()` was also used to access third-party libraries (.DLL files on Windows, .SO files on Unix), but this has been moved to call_ext() for clarity. +*** +**Related Pages:** ++ [arglist proc](/ref/proc/arglist) ++ [call_ext() proc](/ref/proc/call_ext) ++ [hascall proc](/ref/proc/hascall) ++ [path operators](/ref/operator/path) diff --git a/ref/proc/call_ext.md b/ref/proc/call_ext.md index 29978916..73b7fb5d 100644 --- a/ref/proc/call_ext.md +++ b/ref/proc/call_ext.md @@ -1,80 +1,33 @@ -## call_ext proc -###### BYOND Version 515 + +## call_ext (proc) **Format:** + call_ext(LibName,FuncName)(Arguments) + call_ext(LoadedFunc)(Arguments) -**Args:** -+ LibName: name of external library ("test.DLL") (note: the .dll or - .so suffix is not required) -+ FuncName: name of function in external library ("func"), which may - have prefixes to describe the type of function -+ LoadedFunc: reference to a function that was loaded via `load_ext()` +**Arguments:** ++ LibName: name of external library ("test.DLL") (note: the .dll or .so suffix is not required) ++ FuncName: name of function in external library ("func"), which may have prefixes to describe the type of function ++ LoadedFunc: reference to a function that was loaded via **Returns:** + The return value of the external library function. +*** +This instruction exists in order to access third-party libraries (.DLL files on Windows, .SO files on Unix), as long as the one or more of the following conditions is met: -This instruction exists in order to access third-party -libraries (.DLL files on Windows, .SO files on Unix), as long as the one -or more of the following conditions is met: -- The library is located in the BYOND user `bin/` folder - (`~/.byond/bin` on Unix, typically `%APPDATA%/Documents/BYOND/bin/` - on Windows). This is intended to allow the user to install - permanently "trusted" libraries. ***OR*** -- The server is run in `-trusted` mode. ***OR*** -- The server grants permission to access the library at runtime, - through a prompt query. - - -If the library access or lookup fails for any reason, a runtime -error will be thrown. - -Normally you use LibName and FuncName, -and `call_ext()` will look up the function for you. However you can save -a little time by using `load_ext()`, which will do the lookup once and -let you reuse the reference to that function as often as you need to, -which should be helpful for performance-hungry code. -### String version - - -The standard way of making external calls (and until version -515, the only way) uses strings for everything. Any arguments that are -not strings are passed as empty strings instead. The call is prototyped -in the DLL this way: -``` cpp -extern "C" char *func(unsigned int argc, char *argv[]); -``` +If the library access or lookup fails for any reason, a runtime error will be thrown. +Normally you use LibName and FuncName, and `call_ext()` will look up the function for you. However you can save a little time by using `load_ext()`, which will do the lookup once and let you reuse the reference to that function as often as you need to, which should be helpful for performance-hungry code. + +The standard way of making external calls (and until version 515, the only way) uses strings for everything. Any arguments that are not strings are passed as empty strings instead. The call is prototyped in the DLL this way: + +The `argc` argument is a number of arguments, and `argv` is an array of the arguments themselves. The integer must be 32-bit. + +As the library prototype is `char**`, the `call_ext()` arguments must be strings. Other types (like numbers) will be passed as the empty string (`""`) into the library function. -The `argc` argument is a number of arguments, and `argv` is an -array of the arguments themselves. The integer must be 32-bit. - - -As the library prototype is `char**`, the `call_ext()` -arguments must be strings. Other types (like numbers) will be passed as -the empty string (`""`) into the library function. -### Example: {#example .cpp} -``` cpp -// test.dll, a win32 C++ library compiled in VC++: -#include -// This is an example of an exported function. -// Windows requires __declspec(dllexport) to be used to declare public symbols -// The name of the function from within the dll may be compiler-dependent -// (in this case it will usually be "merge" or "_merge"). -// Google "name decoration" for more information on this exciting topic. -extern "C" __declspec(dllexport) char *merge(int n, char *v[]) -{ - static char buf[500]; - *buf=0; - for(int i=0; i515 - - -A newer and more flexible way of calling external libraries is -now available, and it allows you to pass strings, numbers, and -references, and also get other types of valus in return. This uses -[Byondapi](/ref/appendix/Byondapi.md) and requires your external -library to be compiled with the `byondapi.h` header file (if using C or -C++). Byondapi also includes helpful C++ wrapper classes in separate -files. - -With Byondapi calls, the function name you use in -`call_ext()` should be prefixed by `byond:` so that the engine knows -what type of function it is. In your library, the call is prototyped -like so: -``` cpp -extern "C" CByondValue func(u4c argc, CByondValue argv[]); ``` -The `u4c` type is an unsigned 32-bit integer, defined in -`byondapi.h`. `CByondValue` is also defined there. Interacting with a -CByondValue structure requires the functions exported as part of -Byondapi. -### Example: -``` cpp -// test_byondapi.dll, a win32 C++ library compiled in VC++: -#include -#include -#include -// a different take on the merge example above -extern "C" BYOND_EXPORT CByondValue merge(int n, CByondValue v[]) -{ - CByondValue result; - u4c buflen = 1024; // initial size of buffer - u4c totallen = 0; // length of total string so far (not including trailing null) - char *buf = (char*)malloc(buflen); - if(!buf) { // we couldn't allocate memory - ByondValue_Clear(&result); - return result; - } - for(int i=0; i 0, it's the new size of the buffer we need - else if(len) { - len = (len + 1023) & ~1023; // round up to 1K increments - char *newbuf = (char *)mallloc(len); - if(!newbuf) { // out of memory; stop here - ByondValue_Clear(&result); - return result; - } - memcpy(newbuf, buf, totallen+1); // include trailing null in copy - free(buf); - buf = newbuf; buflen = len; - --i; // retry Byond_ToString() for this argument - } - // if we failed but len == 0, there was an error - else { - free(buf); - ByondValue_Clear(&result); - return result; - } - } - ByondValue_SetStr(&result, buf); // create a new internal string - free(buf); // free the buffer - return result; -} -extern "C" BYOND_EXPORT CByondValue average(int n, CByondValue v[]) -{ - CByondValue result; - float total = 0.0f; - int count = 0; - for(int i=0; iByondapi and requires your external library to be compiled with the `byondapi.h` header file (if using C or C++). Byondapi also includes helpful C++ wrapper classes in separate files. + +With Byondapi calls, the function name you use in `call_ext()` should be prefixed by `byond:` so that the engine knows what type of function it is. In your library, the call is prototyped like so: + +The `u4c` type is an unsigned 32-bit integer, defined in `byondapi.h`. `CByondValue` is also defined there. Interacting with a CByondValue structure requires the functions exported as part of Byondapi. + ```dm + // DM code to use test_byondapi.dll mob/verb/test() usr << call_ext("test_byondapi","byond:merge")("fee","fi","fo") // returns "feefifo" mob/verb/average() usr << call_ext("test_byondapi","byond:average")(1,6,8) // returns 5 + +``` + + +You are of course allowed to mix different argument types, so they don't all have to be numbers or all strings. Your library code can use the Byondapi functions to interact with these values. + +Reference counting in Byondapi is done by calling `ByondValue_IncRef()` to increment the reference count, and `ByondValue_DecRef()` to decrement the count (and possibly initiate garbage collection). If you use the C++ wrappers, a lot of this is taken care of for you via the `ByondValue` class (see below). + +Byondapi calls that fill pointers or arrays with results will automatically increment the reference count, so for instance the value that goes into the result for `Byond_ReadVar()`, or every value received in `Byond_ReadList()`, has been incremented. You will need to clean these references up when you're done with them. + +The value you return from your library function back to DM should be incremented. If you got it from a function like `Byond_ReadVar()` then that's already been done for you. + +You don't have to call `ByondValue_DecRef()` on any of the arguments sent to your function. Their reference counts will be decremented when the call returns to DM. + +The C++ wrapper file included for Byondapi defines a new `ByondValue` class that handles all your reference counting for you. All of the functions are wrapped so you send them a `ByondValue` reference instead of a `CByondValue` pointer. Anything that can fail with an error can throw an exception for you to catch. + +The `ByondValue` class contains a referenced `CByondValue`. The destructor calls `ByondValue_DecRef()` for you. You can manage references in a few ways: + +This is what your function would look like with the C++ wrappers: + +Here's a different example reading from a list: + +Because every value is defined as a `ByondValue` rather than a `CByondValue`, they clean up after themselves. The return value gets cast to `ByondValueResult` so it automatically detaches, meaning the reference count doesn't go down. The caller will use this reference and decrement it later. + +For Byondapi, there is also an asynchronous version you can call. In `call_ext()` or `load_ext()` the function name should be prefixed with `byond,await:` instead of `byond:`, and the function in your library has a different format. + +The function has no return value, and accepts a third argument which is the /callee object of the calling proc. Your BYOND proc will sleep when it calls `call_ext()` for this function. In your library function you would typically either spawn a new thread or pass `waiting_proc` to an existing thread. When it's ready to return, you call `Byond_Return(waiting_proc, return_value)`. + + +```dm + +// this call will sleep until the library calls Byond_Return() +usr << "Sleeping now..." +usr << call_ext("mylib", "byond_await:Sleep2sec")() + ``` -You are of course allowed to mix different argument -types, so they don\'t all have to be numbers or all strings. Your -library code can use the Byondapi functions to interact with these -values. -### Other prefixes - -For advanced users: on Windows, `call_ext()` uses the `__cdecl` -convention by default. If you are designing or linking to a DLL that -uses the `__stdcall` convention instead, you can inform `call_ext()` by -prefacing the function name with the `"@"` symbol. E.g., -`call_ext("test.dll","@merge")` would call a version of `merge` declared -with the `__stdcall` convention. Likewise if you use the Byondapi -version, you can use `call_ext("test.dll","@byond:merge")` or -`call_ext("test.dll","byond:@merge")` (it doesn\'t matter which order -the prefixes go in). - -> [!TIP] -> **See also:** -> + [load_ext proc](/ref/proc/load_ext.md) -> + [arglist proc](/ref/proc/arglist.md) -> + [call proc](/ref/proc/call.md) -> + [path operators](/ref/operator/path.md) -> + [Byondapi](/ref/appendix/Byondapi.md) \ No newline at end of file + +When `Byond_Return()` is called, the sleeping proc is added to the scheduler as if it had been spawned. This is the same behavior you would see in a call such as `winget()` that has to wait for a response. + +For advanced users: on Windows, `call_ext()` uses the `__cdecl` convention by default. If you are designing or linking to a DLL that uses the `__stdcall` convention instead, you can inform `call_ext()` by prefacing the function name with the `"@"` symbol. E.g., `call_ext("test.dll","@merge")` would call a version of `merge` declared with the `__stdcall` convention. Likewise if you use the Byondapi version, you can use `call_ext("test.dll","@byond:merge")` or `call_ext("test.dll","byond:@merge")` (it doesn't matter which order the prefixes go in). +*** +**Related Pages:** ++ [load_ext proc](/ref/proc/load_ext) ++ [arglist proc](/ref/proc/arglist) ++ [call proc](/ref/proc/call) ++ [path operators](/ref/operator/path) ++ [Byondapi](/ref/{{appendix}}/Byondapi) diff --git a/ref/proc/ceil.md b/ref/proc/ceil.md index 0d216e6a..9ddbd43f 100644 --- a/ref/proc/ceil.md +++ b/ref/proc/ceil.md @@ -1,29 +1,30 @@ -## ceil proc -###### BYOND Version 515 + +## ceil (proc) **Format:** + ceil(A) +**Arguments:** ++ A: A number, pixloc, or vector. + **Returns:** + the ceiling of A +*** +Returns the ceiling of A (the largest integer greater than or equal to A). -**Args:** -+ A: A number, pixloc, or vector. - -Returns the ceiling of A (the largest integer greater than or -equal to A). -### Example: ```dm + usr << ceil(1.45) // outputs 2 usr << ceil(-1.45) // outputs -1 + ``` -> [!TIP] -> **See also:** -> + [floor proc](/ref/proc/floor.md) -> + [round proc](/ref/proc/round.md) -> + [trunc proc](/ref/proc/trunc.md) -> + [fract proc](/ref/proc/fract.md) -> + [sign proc](/ref/proc/sign.md) \ No newline at end of file +*** +**Related Pages:** ++ [floor proc](/ref/proc/floor) ++ [round proc](/ref/proc/round) ++ [trunc proc](/ref/proc/trunc) ++ [fract proc](/ref/proc/fract) ++ [sign proc](/ref/proc/sign) diff --git a/ref/proc/ckey.md b/ref/proc/ckey.md index 1a8577e6..f24c03f7 100644 --- a/ref/proc/ckey.md +++ b/ref/proc/ckey.md @@ -1,29 +1,24 @@ -## ckey proc + +## ckey (proc) **Format:** + ckey(Key) -**Args:** +**Arguments:** + Key: The player key to convert to canonical form. **Returns:** -+ The key in canonical form. To do this, it strips all punctuation and - space from the key and converts to lowercase. The result is still ++ The key in canonical form. To do this, it strips all punctuation and + space from the key and converts to lowercase. The result is still unique for each different key. +*** +The result could be used as a unique directory name in a server-side save file. Each player could be stored in a separate directory. By converting to canonical form, possible problems resulting from punctuation (like the path delimiter '/') in the key would be avoided. If players are saved in stand-alone files, it could be equally useful for generating a unique file name. -The result could be used as a unique directory name in a -server-side save file. Each player could be stored in a separate -directory. By converting to canonical form, possible problems resulting -from punctuation (like the path delimiter \'/\') in the key would be -avoided. If players are saved in stand-alone files, it could be equally -useful for generating a unique file name. - -> [!NOTE] -> This may be used on any text string. It is not just limited to keys. +Note that this may be used on any text string. It is not just limited to keys. -### Example: ```dm + var/savefile/SaveFile = new("world.sav") proc/SavePlayer(mob/M) var/keydir = ckey(M.key) @@ -38,22 +33,15 @@ proc/LoadPlayer(mob/M) SaveFile.cd = keydir M.Read(SaveFile) return 1 + ``` -This example defines two -procs for saving and loading players to a server-side file. These could -be called in mob.Login() and mob.Logout(). Notice that instead of -calling SaveFile.Write(M), this example instead calls M.Write(SaveFile) -directly. The difference is that in this example we did not want a new -mob to be created when loading the player but instead wanted to load -information into an existing mob. - -In this example, the ckey() -proc was used, but it would be more efficient to use mob.ckey, which is -the same value precomputed. - -> [!TIP] -> **See also:** -> + [ckeyEx proc](/ref/proc/ckeyEx.md) -> + [ckey var (mob)](/ref/mob/var/ckey.md) -> + [savefile](/ref/savefile.md) \ No newline at end of file + +This example defines two procs for saving and loading players to a server-side file. These could be called in mob.Login() and mob.Logout(). Notice that instead of calling SaveFile.Write(M), this example instead calls M.Write(SaveFile) directly. The difference is that in this example we did not want a new mob to be created when loading the player but instead wanted to load information into an existing mob. + +In this example, the ckey() proc was used, but it would be more efficient to use mob.ckey, which is the same value precomputed. +*** +**Related Pages:** ++ [ckeyEx proc](/ref/proc/ckeyEx) ++ [ckey](/ref/mob/var/ckey) ++ [savefile](/ref/savefile) diff --git a/ref/proc/ckeyEx.md b/ref/proc/ckeyEx.md index f8635b62..bb7838af 100644 --- a/ref/proc/ckeyEx.md +++ b/ref/proc/ckeyEx.md @@ -1,25 +1,21 @@ -## ckeyEx proc + +## ckeyEx (proc) **Format:** + ckeyEx(Text) -**Args:** -+ Text: The text string to convert to case-sensitive canonical key - form. +**Arguments:** ++ Text: The text string to convert to case-sensitive canonical key form. **Returns:** -+ The same text stripped of all punctuation and space. Unlike, ckey(), - case is preserved as are the \'-\' and \'\_\' characters. - -The true canonical form of a key is in all lowercase, but -occasionally, it is nice to preserve case when stripping a key (or other -text) of any special characters. ++ The same text stripped of all punctuation and space. Unlike, ckey(), + case is preserved as are the '-' and '_' characters. +*** +The true canonical form of a key is in all lowercase, but occasionally, it is nice to preserve case when stripping a key (or other text) of any special characters. -> [!NOTE] -> This proc used to be named `cKey`, like `ckey` but with a capital -k. To avoid confusion it has been renamed, but old code will still -compile with a warning. -> [!TIP] -> **See also:** -> + [ckey proc](/ref/proc/ckey.md) \ No newline at end of file +> [!TIP] +> Note: This proc used to be named `cKey`, like `ckey` but with a capital k. To avoid confusion it has been renamed, but old code will still compile with a warning. +*** +**Related Pages:** ++ [ckey proc](/ref/proc/ckey) diff --git a/ref/proc/clamp.md b/ref/proc/clamp.md index c759ab8f..2e43a3ef 100644 --- a/ref/proc/clamp.md +++ b/ref/proc/clamp.md @@ -1,11 +1,11 @@ -## clamp proc -###### BYOND Version 513 + +## clamp (proc) **Format:** + clamp(Value, Low, High) + clamp(List, Low, High) -**Args:** +**Arguments:** + Value: A number, text, pixloc, or vector (or null, treated as 0). + List: A list of values. + Low: The lowest value that can be returned. @@ -14,33 +14,27 @@ **Returns:** + A copy of the original Value, constrained between Low and High. + The original List, whose contents have all been clamped. +*** +"Clamps" a value, usually a number, to a given allowable range from `Low` to `High`. If the value is already in that range, it is unchanged. Otherwise, the closer of `Low` or `High` is returned. -"Clamps" a value, usually a number, to a given allowable -range from `Low` to `High`. If the value is already in that range, it is -unchanged. Otherwise, the closer of `Low` or `High` is returned. - -If the `Low` and `High` values are out of order, it doesn\'t -matter. +If the `Low` and `High` values are out of order, it doesn't matter. This is effectively equivalent to `min(max(Value, min(Low,High)), max(Low,High))`, but slightly faster. -### Example: + ```dm + usr << clamp(5, 0, 10) // 5; it falls between 0 and 10 usr << clamp(-1, 0, 10) // 0; it is less than 0 usr << clamp(20, 0, 10) // 10; it is more than 10 + ``` -If the compared items are objects such as pixlocs or vectors, the result of clamping them is a -new object, not one of the objects that was compared. -The list format will accept a list in place of a value as the first argument, and -it behaves as if you looped through the entire list and ran `clamp()` on -each value. Please note the original list will be modified. If you want -to leave the original list alone, use the [`Copy()` -proc](/ref/list/proc/Copy.md) to pass a copy to `clamp()` instead. +If the compared items are objects such as pixlocs or vectors, the result of clamping them is a new object, not one of the objects that was compared. -> [!TIP] -> **See also:** -> + [min proc](/ref/proc/min.md) -> + [max proc](/ref/proc/max.md) \ No newline at end of file +The list format will accept a list in place of a value as the first argument, and it behaves as if you looped through the entire list and ran `clamp()` on each value. Please note the original list will be modified. If you want to leave the original list alone, use the `Copy()` proc to pass a copy to `clamp()` instead. +*** +**Related Pages:** ++ [min proc](/ref/proc/min) ++ [max proc](/ref/proc/max) diff --git a/ref/proc/cmptext.md b/ref/proc/cmptext.md index d409ea1e..d298714b 100644 --- a/ref/proc/cmptext.md +++ b/ref/proc/cmptext.md @@ -1,30 +1,29 @@ -## cmptext proc + +## cmptext (proc) **Format:** + cmptext(T1,T2,...) -**Returns:** -+ 1 if all arguments are equal; 0 otherwise. - -**Args:** +**Arguments:** + Any number of text strings to compare. +**Returns:** ++ 1 if all arguments are equal; 0 otherwise. +*** +This instruction is NOT sensitive to case. It also ignores the \proper and \improper text macros. The case-sensitive version is cmptextEx(). -This instruction is NOT sensitive to case. It also ignores the -`\proper` and `\improper` text macros. The case-sensitive version is -cmptextEx(). -### Example: ```dm + if(cmptext("Hi","HI")) world << "Equal!" else world << "Not equal!" + ``` - -This outputs "Equal!" -since "Hi" and "HI" are the same, ignoring case. -> [!TIP] -> **See also:** -> + [cmptextEx proc](/ref/proc/cmptextEx.md) \ No newline at end of file + +This outputs "Equal!" since "Hi" and "HI" are the same, ignoring case. +*** +**Related Pages:** ++ [cmptextEx proc](/ref/proc/cmptextEx) diff --git a/ref/proc/cmptextEx.md b/ref/proc/cmptextEx.md index 69bb3336..a9902d59 100644 --- a/ref/proc/cmptextEx.md +++ b/ref/proc/cmptextEx.md @@ -1,35 +1,35 @@ -## cmptextEx proc + +## cmptextEx (proc) **Format:** + cmptextEx(T1,T2,...) +**Arguments:** ++ Any number of text strings to compare. + **Returns:** + 1 if all arguments are equal; 0 otherwise. +*** +This instruction is sensitive to case. The case-insensitive version is cmptext(). -**Args:** -+ Any number of text strings to compare. - +Because identical text is internally combined to conserve memory, cmptextEx(T1,T2) is equivalent to (T1 == T2). -This instruction is sensitive to case. The case-insensitive -version is cmptext(). -Because identical text is internally combined to conserve memory, cmptextEx(T1,T2) is equivalent to (T1 == T2). -### Example: ```dm + if(cmptextEx("Hi","HI")) world << "Equal!" else world << "Not equal!" + ``` - -This outputs "Not equal!" since "Hi" and "HI" are different when taking case into -account. - -> [!NOTE] -> This proc used to be named cmpText, like cmptext but with a -capital T. To avoid confusion it has been renamed, but old code will -still compile. - -> [!TIP] -> **See also:** -> + [cmptext proc](/ref/proc/cmptext.md) \ No newline at end of file + + +This outputs "Not equal!" since "Hi" and "HI" are different when taking case into account. + + +> [!TIP] +> Note: This proc used to be named cmpText, like cmptext but with a capital T. To avoid confusion it has been renamed, but old code will still compile. +*** +**Related Pages:** ++ [cmptext proc](/ref/proc/cmptext) diff --git a/ref/proc/continue.md b/ref/proc/continue.md index e13f3b13..0b49af76 100644 --- a/ref/proc/continue.md +++ b/ref/proc/continue.md @@ -1,37 +1,32 @@ -## continue statement + +## continue (proc) **Format:** + continue + continue Label +*** +Begins the next iteration of the loop with the given label. If no label is specified, the innermost loop containing the continue statement is assumed. -Begins the next iteration of the loop with the given label. If -no label is specified, the innermost loop containing the continue -statement is assumed. +In a `for(Init,Test,Inc)` loop, the `continue` statement will jump to the `Inc` portion (if any) and move on to the conditional `Test`. In a `for(item in list)` loop, it will skip to the next item in the list. In a `while` or `do-while` loop, `continue` jumps to the condition in the `while` statement. -In a `for(Init,Test,Inc)` loop, the -`continue` statement will jump to the `Inc` portion (if any) and move on -to the conditional `Test`. In a `for(item in list)` loop, it will skip -to the next item in the list. In a `while` or `do-while` loop, -`continue` jumps to the condition in the `while` statement. -### Example: ```dm + client/verb/who() var/mob/M usr << "Players:" for(M in world) if(M == usr) continue if(M.key) usr << M.key + ``` -This displays a list of players who have a mob in the world. -The `continue` statement is used here to avoid including the user in the -list. The same thing could have been achieved by using only the `if` -statement. In more complicated situations, however, very long -conditional expressions and deeply nested `if` statements can be avoided -by using `continue` and its companion `break`. -Here is an example using a label to continue an outer loop from inside an inner one: +This displays a list of players who have a mob in the world. The continue statement is used here to avoid including the user in the list. The same thing could have been achieved by using only the if statement. In more complicated situations, however, very long conditional expressions and deeply nested if statements can be avoided by using continue and its companion break. + +Here is an example using a label to continue an outer loop from inside an inner one: + + ```dm client/verb/loners() var/mob/M @@ -45,16 +40,14 @@ Here is an example using a label to continue an outer loop from inside an inner //found a loner usr << M.name + ``` -This displays a list of mobs who do not belong in -anyone else\'s group. Notice the syntax for labeling a list. The name of -the block is simply placed in the code followed by a colon and its -contents are indented inside it. - -> [!TIP] -> **See also:** -> + [break statement](/ref/proc/break.md) -> + [do proc](/ref/proc/do.md) -> + [for loop proc](/ref/proc/for/loop.md) -> + [while proc](/ref/proc/while.md) \ No newline at end of file + +This displays a list of mobs who do not belong in anyone else's group. Notice the syntax for labeling a list. The name of the block is simply placed in the code followed by a colon and its contents are indented inside it. +*** +**Related Pages:** ++ [break statement](/ref/proc/break) ++ [do proc](/ref/proc/do) ++ [for loop proc](/ref/proc/for/loop) ++ [while proc](/ref/proc/while) diff --git a/ref/proc/copytext.md b/ref/proc/copytext.md index 751dcc8c..526001ac 100644 --- a/ref/proc/copytext.md +++ b/ref/proc/copytext.md @@ -1,47 +1,43 @@ -## copytext proc +## copytext (proc) **Format:** + copytext(T,Start=1,End=0) +**Arguments:** ++ T: A text string. ++ Start: The text byte position in which to begin the copy. ++ End: The text byte position immediately following the last character to be copied. + **Returns:** + A text string. +*** +Copy characters in T between Start and End. The default end position of 0 stands for `length(T)+1`, so by default the entire text string is copied. -**Args:** -+ T: A text string. -+ Start: The text byte position in which to begin the copy. -+ End: The text byte position immediately following the last character - to be copied. - -Copy characters in T between Start and End. The default end -position of 0 stands for `length(T)+1`, so by default the entire text -string is copied. -### Example: ```dm - pre = copytext("Hi there",1,3))// = "Hi" post = -copytext("Hi there",4)) // = "there" + +pre = copytext("Hi there",1,3))// = "Hi" +post = copytext("Hi there",4)) // = "there" + ``` - -If the start or end position is negative, it counts backwards from the end of -the string. -### Example: + + +If the start or end position is negative, it counts backwards from the end of the string. + ```dm - post = copytext("Hi there",-5)) // = "there" + +post = copytext("Hi there",-5)) // = "there" ``` - -Note: In strings containing non-ASCII characters, -byte position and character position are not the same thing. Use -`copytext_char()` to work with character counts instead of bytes, at a -performance cost. See the [Unicode](/ref/notes/Unicode.md) section for -more information. - -> [!TIP] -> **See also:** -> + [splicetext proc](/ref/proc/splicetext.md) -> + [findtext proc](/ref/proc/findtext.md) -> + [splittext proc](/ref/proc/splittext.md) -> + [trimtext proc](/ref/proc/trimtext.md) -> + [Copy proc (list)](/ref/list/proc/Copy.md) \ No newline at end of file + + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `copytext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [splicetext proc](/ref/proc/splicetext) ++ [findtext proc](/ref/proc/findtext) ++ [splittext proc](/ref/proc/splittext) ++ [trimtext proc](/ref/proc/trimtext) ++ [Copy proc (list)](/ref/list/proc/Copy) diff --git a/ref/proc/cos.md b/ref/proc/cos.md index 23bb48a3..6ce9be51 100644 --- a/ref/proc/cos.md +++ b/ref/proc/cos.md @@ -1,22 +1,25 @@ -## cos proc + +## cos (proc) **Format:** + cos(X) **Returns:** + The cosine of X, where X is in degrees. -### Example: +*** ```dm + mob/verb/test() usr << cos(0) // 1 usr << cos(45) // 0.707... usr << cos(90) // 0 + ``` -> [!TIP] -> **See also:** -> + [arccos proc](/ref/proc/arccos.md) -> + [sin proc](/ref/proc/sin.md) -> + [tan proc](/ref/proc/tan.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arccos proc](/ref/proc/arccos) ++ [sin proc](/ref/proc/sin) ++ [tan proc](/ref/proc/tan) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/del.md b/ref/proc/del.md index 331bc2c3..1e529f14 100644 --- a/ref/proc/del.md +++ b/ref/proc/del.md @@ -1,44 +1,31 @@ -## del proc + +## del (proc) **Format:** + del Object -**Args:** +**Arguments:** + Object: Any data object (datum, savefile, world, you name it) +*** +Destroy an object and null out all references to it. Procs that are executing with src equal to that object are silently killed, causing execution to return to the caller. If that is not what you want, you should detach the proc from the source object by setting src to null. -Destroy an object and null out all references to it. Procs that -are executing with `src` equal to that object are silently killed, -causing execution to return to the caller. If that is not what you want, -you should detach the proc from the source object by setting `src` to -`null`. +When an object is deleted, its Del() procedure is called. Currently, if the Del() procedure does not execute the default action (by calling ..()), then the deletion of the object is aborted. You should not depend on this, as it may change. In other words, be sure to always call the default handler after doing your own stuff. -When an object is deleted, its Del() procedure is -called. Currently, if the Del() procedure does not execute the default -action (by calling ..()), then the deletion of the object is aborted. -You should not depend on this, as it may change. In other words, be sure -to always call the default handler after doing your own stuff. -### Example: ```dm + mob/Del() src << "Aaaaaaaah!" ..() mob/verb/self_destruct() del usr + ``` -While manual object deletion is useful in many cases, the search for live references to an -object does take some time. The more active objects in the world, and -the more variables in those objects, the longer the search will take. -For larger projects, this search time can become significant. In these -cases, as a best practice, manual deletion should be avoided by ensuring -that all references to an object are taken care of when the need for -object destruction arises. Objects that have no references are deleted -automatically without the need for a search. See [garbage -collection](/ref/DM/garbage.md) for more details. - -> [!TIP] -> **See also:** -> + [Del proc (datum)](/ref/datum/proc/Del.md) -> + [garbage collection](/ref/DM/garbage.md) -> + [refcount proc](/ref/proc/refcount.md) \ No newline at end of file + +While manual object deletion is useful in many cases, the search for live references to an object does take some time. The more active objects in the world, and the more variables in those objects, the longer the search will take. For larger projects, this search time can become significant. In these cases, as a best practice, manual deletion should be avoided by ensuring that all references to an object are taken care of when the need for object destruction arises. Objects that have no references are deleted automatically without the need for a search. See garbage collection for more details. +*** +**Related Pages:** ++ [Del proc (datum)](/ref/datum/proc/Del) ++ [garbage collection](/ref/DM/garbage) ++ [refcount proc](/ref/proc/refcount) diff --git a/ref/proc/do.md b/ref/proc/do.md index 3e223938..89838dba 100644 --- a/ref/proc/do.md +++ b/ref/proc/do.md @@ -1,30 +1,38 @@ -## do proc + +## do (proc) **Format:** + do Statement while( E ) - -Execute Statement. If E is true (non-zero) do it over again. -Continue until E is false (zero). +*** +Execute Statement. If E is true (non-zero) do it over again. Continue until E is false (zero). Statement may be a block of code or a single statement. -### Example: + ```dm + var/i = 3 do world << i-- while(i) + ``` -This outputs: + + +This outputs: + + ```dm + 3 2 1 + ``` -> [!TIP] -> **See also:** -> + [break statement](/ref/proc/break.md) -> + [continue statement](/ref/proc/continue.md) -> + [for loop proc](/ref/proc/for/loop.md) -> + [while proc](/ref/proc/while.md) \ No newline at end of file +*** +**Related Pages:** ++ [break statement](/ref/proc/break) ++ [continue statement](/ref/proc/continue) ++ [for loop proc](/ref/proc/for/loop) ++ [while proc](/ref/proc/while) diff --git a/ref/proc/fcopy.md b/ref/proc/fcopy.md index 0b3252e7..4111563a 100644 --- a/ref/proc/fcopy.md +++ b/ref/proc/fcopy.md @@ -1,41 +1,35 @@ -## fcopy proc + +## fcopy (proc) **Format:** + fcopy(Src,Dst) -**Args:** +**Arguments:** + Src: file to copy + Dst: new copy to make **Returns:** + 1 on success; 0 otherwise. +*** +Src may be either a cache file, a savefile, or the name of an external file. Cache files are specified in single quotes and external files are in double quotes. If the path to the destination file does not already exist, it will be created. -Src may be either a cache file, a savefile, or the name of an -external file. Cache files are specified in single quotes and external -files are in double quotes. If the path to the destination file does not -already exist, it will be created. +If the source and target are paths ending in "/", the contents of the source directory (including sub-directories) will be copied to the target path. -If the source and target are -paths ending in "/", the contents of the source directory (including -sub-directories) will be copied to the target path. +This instruction could be useful when players upload files (like code) that you might want to dump to an external file. -This instruction could be useful when players upload files (like code) that -you might want to dump to an external file. -### Example: ```dm + mob/verb/change_world(F as file) fcopy(F,"world.dm") shell("DreamMaker world") world.Reboot() + ``` - -This (somewhat dangerous) example allows players to upload code, recompile, -and reboot the world. It assumes that DreamMaker is in the path where -the shell looks for executable files and also that the name of the -running world is world.dmb. - -> [!TIP] -> **See also:** -> + [fcopy_rsc proc](/ref/proc/fcopy_rsc.md) -> + [shell proc](/ref/proc/shell.md) \ No newline at end of file + + +This (somewhat dangerous) example allows players to upload code, recompile, and reboot the world. It assumes that DreamMaker is in the path where the shell looks for executable files and also that the name of the running world is world.dmb. +*** +**Related Pages:** ++ [fcopy_rsc proc](/ref/proc/fcopy_rsc) ++ [shell proc](/ref/proc/shell) diff --git a/ref/proc/fcopy_rsc.md b/ref/proc/fcopy_rsc.md index 70aa8c45..d105a1f7 100644 --- a/ref/proc/fcopy_rsc.md +++ b/ref/proc/fcopy_rsc.md @@ -1,33 +1,23 @@ -## fcopy_rsc proc + +## fcopy_rsc (proc) **Format:** + fcopy_rsc(File) -**Args:** +**Arguments:** + File: file to copy into the resource cache **Returns:** + reference to the file as a cache entry +*** +The file to copy may either be a file name (text string) or the return value of file() operating on the same. If a cache entry is passed as the argument, it will simply be returned with no action necessary. -The file to copy may either be a file name (text string) or the -return value of file() operating on the same. If a cache entry is passed -as the argument, it will simply be returned with no action necessary. - -Once a file has been copied into the resource cache (i.e. the -world\'s .rsc file), it may be used as an icon or a sound or whatever is -appropriate. Most internal operations involving resource files -automatically perform this operation when you try to use an external -file in place of a cache entry. For example, when assigning a file() -object to atom.icon, fcopy_rsc() is implicitly invoked. - -The main reason you would ever want to call this explicitly is if you are -storing references to resource files in your own data structures and you -want to ensure that all values are converted to cache entries so they -may be directly compared to one another. +Once a file has been copied into the resource cache (i.e. the world's .rsc file), it may be used as an icon or a sound or whatever is appropriate. Most internal operations involving resource files automatically perform this operation when you try to use an external file in place of a cache entry. For example, when assigning a file() object to atom.icon, fcopy_rsc() is implicitly invoked. -> [!TIP] -> **See also:** -> + [cache](/ref/DM/cache.md) -> + [fcopy proc](/ref/proc/fcopy.md) -> + [file proc](/ref/proc/file.md) -> + [load_resource proc](/ref/proc/load_resource.md) \ No newline at end of file +The main reason you would ever want to call this explicitly is if you are storing references to resource files in your own data structures and you want to ensure that all values are converted to cache entries so they may be directly compared to one another. +*** +**Related Pages:** ++ [cache](/ref/DM/cache) ++ [fcopy proc](/ref/proc/fcopy) ++ [file proc](/ref/proc/file) ++ [load_resource proc](/ref/proc/load_resource) diff --git a/ref/proc/fdel.md b/ref/proc/fdel.md index ea1f2158..3b97d807 100644 --- a/ref/proc/fdel.md +++ b/ref/proc/fdel.md @@ -1,19 +1,18 @@ -## fdel proc + +## fdel (proc) **Format:** + fdel(File) -**Args:** +**Arguments:** + File: name of file to delete **Returns:** + 1 on success; 0 otherwise. - -If the specified file ends in \'`/`\', it is treated as a -directory. Any contents (including sub-directories) are deleted as well. +*** +If the specified file ends in '/', it is treated as a directory. Any contents (including sub-directories) are deleted as well. Be careful! - -> [!TIP] -> **See also:** -> + [shell proc](/ref/proc/shell.md) \ No newline at end of file +*** +**Related Pages:** ++ [shell proc](/ref/proc/shell) diff --git a/ref/proc/fexists.md b/ref/proc/fexists.md index e96e888a..b6ca211b 100644 --- a/ref/proc/fexists.md +++ b/ref/proc/fexists.md @@ -1,16 +1,16 @@ -## fexists proc + +## fexists (proc) **Format:** + fexists(File) -**Args:** +**Arguments:** + File: name of file to test **Returns:** + 1 if file exists; 0 otherwise. - -> [!TIP] -> **See also:** -> + [flist proc](/ref/proc/flist.md) -> + [ftime proc](/ref/proc/ftime.md) -> + [length proc](/ref/proc/length.md) \ No newline at end of file +****** +**Related Pages:** ++ [flist proc](/ref/proc/flist) ++ [ftime proc](/ref/proc/ftime) ++ [length proc](/ref/proc/length) diff --git a/ref/proc/file.md b/ref/proc/file.md index 2913ca99..59cd1c63 100644 --- a/ref/proc/file.md +++ b/ref/proc/file.md @@ -1,38 +1,30 @@ -## file proc + +## file (proc) **Format:** + file(Path) +*** +Returns a file object corresponding to the named file. This file object can then be used in a variety of ways. One would be to send it to a player to view using the browse() instruction. Output may also be appended to the file using the << operator. -Returns a file object corresponding to the named file. This -file object can then be used in a variety of ways. One would be to send -it to a player to view using the browse() instruction. Output may also -be appended to the file using the << operator. +Note that the file exists in the external filesystem (ie the hard disk) and not the cache. That means the path is specified in double quotes and will be evaluated at run-time rather than compile-time. The file need not exist at compile time and may even be modified at a later date. This is the principle reason for using a file in the filesystem rather than a cached resource file (specified in single quotes). -Note that the file exists in the external filesystem (ie the hard disk) and not the -cache. That means the path is specified in double quotes and will be -evaluated at run-time rather than compile-time. The file need not exist -at compile time and may even be modified at a later date. This is the -principle reason for using a file in the filesystem rather than a cached -resource file (specified in single quotes). -### Example: ```dm + mob/verb/help() usr << browse(file("help.html")) + ``` -Many DM instructions that deal with files treat -file("name") and "name" the same. There are cases such as browse() -where a simple text string is not interpreted as a filename; it is in -those situations where file() is really necessary. - -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [fcopy_rsc proc](/ref/proc/fcopy_rsc.md) -> + [ftp proc](/ref/proc/ftp.md) -> + [isfile proc](/ref/proc/isfile.md) -> + [link proc](/ref/proc/link.md) -> + [run proc](/ref/proc/run.md) -> + [savefile](/ref/savefile.md) -> + [sound proc](/ref/proc/sound.md) \ No newline at end of file + +Many DM instructions that deal with files treat file("name") and "name" the same. There are cases such as browse() where a simple text string is not interpreted as a filename; it is in those situations where file() is really necessary. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [fcopy_rsc proc](/ref/proc/fcopy_rsc) ++ [ftp proc](/ref/proc/ftp) ++ [isfile proc](/ref/proc/isfile) ++ [link proc](/ref/proc/link) ++ [run proc](/ref/proc/run) ++ [savefile](/ref/savefile) ++ [sound proc](/ref/proc/sound) diff --git a/ref/proc/file2text.md b/ref/proc/file2text.md index ec37cd35..a7cefac4 100644 --- a/ref/proc/file2text.md +++ b/ref/proc/file2text.md @@ -1,27 +1,28 @@ -## file2text proc + +## file2text (proc) **Format:** + file2text(File) -**Args:** +**Arguments:** + File: file to read **Returns:** + the contents of the file. +*** +This can be useful when interacting with external applications that generate output in a text file. For example, you might have an external program that mimics conversation: -This can be useful when interacting with external applications -that generate output in a text file. For example, you might have an -external program that mimics conversation: -### Example: ```dm + mob/oracle/verb/tell(T as text) text2file(T,"talk.in") shell("talk < talk.in > talk.out") usr << file2text("talk.out") + ``` -> [!TIP] -> **See also:** -> + [shell proc](/ref/proc/shell.md) -> + [text2file proc](/ref/proc/text2file.md) \ No newline at end of file +*** +**Related Pages:** ++ [shell proc](/ref/proc/shell) ++ [text2file proc](/ref/proc/text2file) diff --git a/ref/proc/filter.md b/ref/proc/filter.md index 29d34f4f..489c6ea0 100644 --- a/ref/proc/filter.md +++ b/ref/proc/filter.md @@ -1,41 +1,31 @@ -## filter proc -###### BYOND Version 512 + +## filter (proc) **Format:** + filter(type = Type, parameter = Value, ...) +*** +Creates a graphical filter that can be assigned or added to a list of filters on an atom or image. -Creates a graphical filter that can be assigned or added to a -list of filters on an atom or image. +This proc uses named arguments, and the "type" value must always be included. To see which types of filters are available and what parameters they accept, see Filter effects. -This proc uses named -arguments, and the "type" value must always be included. To see which -types of filters are available and what parameters they accept, see [Filter effects](/ref/notes/filters.md) -### Example: ```dm + atom/proc/Highlight(apply) if(apply) filters = filter(type="outline", size=1, color=rgb(255,0,0)) else filters = null -``` - -A filter created with this proc is an *abstract* -filter; it is not associated with any atom. When you add it to atom\'s -filters, the atom gets a copy of this filter, so changing the abstract -filter\'s values afterward will not change the atom\'s filters. For the -same reason, an abstract filter can\'t be animated. - -A filter that is part of an atom\'s filters list, like obj.filters[1], is an -*attached* filter. Changing the values for an attached filter will -change how that atom is displayed, and attached filters can be animated. -### Named Filters 516 - -Filters can also be given a `name` argument, and can be -referred to in an atom\'s `filters` list via that name (e.g. as -`filters["shadow"]`) instead of a numeric index. - -> [!TIP] -> **See also:** -> + [filters var (atom)](/ref/atom/var/filters.md) -> + [Filter effects](/ref/notes/filters.md) \ No newline at end of file + +``` + + +A filter created with this proc is an *abstract* filter; it is not associated with any atom. When you add it to atom's filters, the atom gets a copy of this filter, so changing the abstract filter's values afterward will not change the atom's filters. For the same reason, an abstract filter can't be animated. + +A filter that is part of an atom's filters list, like obj.filters[1], is an *attached* filter. Changing the values for an attached filter will change how that atom is displayed, and attached filters can be animated. + +Filters can also be given a `name` argument, and can be referred to in an atom's `filters` list via that name (e.g. as `filters["shadow"]`) instead of a numeric index. +*** +**Related Pages:** ++ [filters var (atom)](/ref/atom/var/filters) ++ [Filter effects](/ref/{notes}/filters) diff --git a/ref/proc/findlasttext.md b/ref/proc/findlasttext.md index d5bb78d6..ee6665a0 100644 --- a/ref/proc/findlasttext.md +++ b/ref/proc/findlasttext.md @@ -1,42 +1,28 @@ -## findlasttext proc -###### BYOND Version 510 + +## findlasttext (proc) **Format:** + findlasttext(Haystack,Needle,Start=0,End=1) -**Returns:** -+ The last position of Needle in Haystack; 0 if not found. - -**Args:** +**Arguments:** + Haystack: The text string to search. + Needle: The sub-text to search for. -+ Start: The text byte position in Haystack in which to begin the - search. Because this searches backwards, the default is the end of - the string (0). -+ End: The earliest position in Haystack that can be matched as a - result. ++ Start: The text byte position in Haystack in which to begin the search. + Because this searches backwards, the default is the end of the string (0). ++ End: The earliest position in Haystack that can be matched as a result. -> [!NOTE] -> Unlike findtext(), a regular expression may NOT be used -as the Needle. Searching backwards is simply too complex for the regular -expression engine. - -This instruction is NOT sensitive to the case of Haystack or -Needle. The case-sensitive version is findlasttextEx(). - -If the start or end position is negative, the position is counted backwards -from the end of the string. E.g., findlasttext("Banana", "na", -3) -starts three characters from the end and will skip over the last "na". +**Returns:** ++ The last position of Needle in Haystack; 0 if not found. +*** +This instruction is NOT sensitive to the case of Haystack or Needle. The case-sensitive version is findlasttextEx(). +If the start or end position is negative, the position is counted backwards from the end of the string. E.g., findlasttext("Banana", "na", -3) starts three characters from the end and will skip over the last "na". -> [NOTE] -> In strings containing non-ASCII -characters, byte position and character position are not the same thing. -Use `findlasttext_char()` to work with character counts instead of -bytes, at a performance cost. See the [Unicode](/ref/notes/Unicode.md) section for more information. +Note: Unlike findtext(), a regular expression may NOT be used as the Needle. Searching backwards is simply too complex for the regular expression engine. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [findtextEx proc](/ref/proc/findtextEx.md) -> + [findlasttextEx proc](/ref/proc/findlasttextEx.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `findlasttext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [findtextEx proc](/ref/proc/findtextEx) ++ [findlasttextEx proc](/ref/proc/findlasttextEx) diff --git a/ref/proc/findlasttextEx.md b/ref/proc/findlasttextEx.md index 3f969746..04430e6a 100644 --- a/ref/proc/findlasttextEx.md +++ b/ref/proc/findlasttextEx.md @@ -1,39 +1,28 @@ -## findlasttextEx proc -###### BYOND Version 510 + +## findlasttextEx (proc) **Format:** + findlasttextEx(Haystack,Needle,Start=0,End=1) -**Returns:** -+ The last position of Needle in Haystack; 0 if not found. - -**Args:** +**Arguments:** + Haystack: The text string to search. + Needle: The sub-text to search for. -+ Start: The text byte position in Haystack in which to begin the - search. Because this searches backwards, the default is the end of - the string (0). -+ End: The earliest position in Haystack that can be matched as a - result. ++ Start: The text byte position in Haystack in which to begin the search. + Because this searches backwards, the default is the end of the string (0). ++ End: The earliest position in Haystack that can be matched as a result. -> [!NOTE] -> Unlike findtextEx(), a regular expression may NOT be used as the Needle. Searching backwards is -simply too complex for the regular expression engine. - -This instruction is sensitive to the case of Haystack and -Needle. The case-insensitive version is findlasttext(). +**Returns:** ++ The last position of Needle in Haystack; 0 if not found. +*** +This instruction is sensitive to the case of Haystack and Needle. The case-insensitive version is findlasttext(). -If the start or end position is negative, the position is counted backwards -from the end of the string. +If the start or end position is negative, the position is counted backwards from the end of the string. -> [!NOTE] -> In strings containing non-ASCII characters, byte position and character -position are not the same thing. Use `findlasttextEx_char()` to work -with character counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. +Note: Unlike findtextEx(), a regular expression may NOT be used as the Needle. Searching backwards is simply too complex for the regular expression engine. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [findtextEx proc](/ref/proc/findtextEx.md) -> + [findlasttext proc](/ref/proc/findlasttext.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `findlasttextEx_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [findtextEx proc](/ref/proc/findtextEx) ++ [findlasttext proc](/ref/proc/findlasttext) diff --git a/ref/proc/findtext.md b/ref/proc/findtext.md index 87ec4aa3..41c726fb 100644 --- a/ref/proc/findtext.md +++ b/ref/proc/findtext.md @@ -1,48 +1,40 @@ -## findtext proc + +## findtext (proc) **Format:** + findtext(Haystack,Needle,Start=1,End=0) +**Arguments:** ++ Haystack: The text string to search. ++ Needle: The sub-text to search for. May be a regular expression (regex). ++ Start: The text byte position in Haystack in which to begin the search. ++ End: The text byte position in Haystack immediately following the last + character to search. + **Returns:** + The first position of Needle in Haystack; 0 if not found. +*** +When Needle is text, this instruction is NOT sensitive to the case of Haystack or Needle. The case-sensitive version is findtextEx(). -**Args:** -+ Haystack: The text string to search. -+ Needle: The sub-text to search for. May be a regular expression - (regex). -+ Start: The text byte position in Haystack in which to begin the - search. -+ End: The text byte position in Haystack immediately following the - last character to search. - -When Needle is text, this instruction is NOT sensitive to the -case of Haystack or Needle. The case-sensitive version is findtextEx(). -### Example: ```dm + if(findtext("Hi There","there")==0) world << "Not found!" else world << "Found!" + ``` -This outputs "Found!", since "there" is a part of the string "Hi There", -ignoring case. - -If the start or end position is negative, the -position is counted backwards from the end of the string. E.g., -findtext("Banana", "na", -3) starts three characters from the end -and only searches the final "ana". - -> [!NOTE] -> In strings containing non-ASCII characters, byte position and character position -are not the same thing. Use `findtext_char()` to work with character -counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. - -> [!TIP] -> **See also:** -> + [findlasttext proc](/ref/proc/findlasttext.md) -> + [findtextEx proc](/ref/proc/findtextEx.md) -> + [replacetext proc](/ref/proc/replacetext.md) -> + [Regular expressions](/ref/notes/regex.md) \ No newline at end of file + +This outputs "Found!", since "there" is a part of the string "Hi There", ignoring case. + +If the start or end position is negative, the position is counted backwards from the end of the string. E.g., findtext("Banana", "na", -3) starts three characters from the end and only searches the final "ana". + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `findtext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findlasttext proc](/ref/proc/findlasttext) ++ [findtextEx proc](/ref/proc/findtextEx) ++ [replacetext proc](/ref/proc/replacetext) ++ [Regular expressions](/ref/{notes}/regex) diff --git a/ref/proc/findtextEx.md b/ref/proc/findtextEx.md index 1854c9df..ce553bfa 100644 --- a/ref/proc/findtextEx.md +++ b/ref/proc/findtextEx.md @@ -1,51 +1,43 @@ -## findtextEx proc + +## findtextEx (proc) **Format:** + findtextEx(Haystack,Needle,Start=1,End=0) +**Arguments:** ++ Haystack: The text string to search. ++ Needle: The sub-text to search for. May be a regular expression (regex). ++ Start: The text byte position in Haystack in which to begin the search. ++ End: The text byte position in Haystack immediately following the last + character to search. + **Returns:** + The position of Needle in Haystack; 0 if not found. +*** +When Needle is text, this instruction is sensitive to the case of Haystack and Needle. The case-insensitive version is findtext(). -**Args:** -+ Haystack: The text string to search. -+ Needle: The sub-text to search for. May be a regular expression - (regex). -+ Start: The text byte position in Haystack in which to begin the - search. -+ End: The text byte position in Haystack immediately following the - last character to search. - -When Needle is text, this instruction is sensitive to the case -of Haystack and Needle. The case-insensitive version is findtext(). -### Example: ```dm - if(findtextEx("Hi There","there")==0) world << "Not -found!" else world << "Found!" + +if(findtextEx("Hi There","there")==0) + world << "Not found!" +else + world << "Found!" + ``` -This outputs -"Not found!", since "there" is not a part of the string "Hi -There", taking into account case. - -If the start or end position -is negative, the position is counted backwards from the end of the -string. E.g., findtextEx("Banana", "na", -3) starts three characters -from the end and only searches the final "ana". - -> [!NOTE] -> In strings containing non-ASCII characters, byte position and character -position are not the same thing. Use `findtextEx_char()` to work with -character counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. - -> [!NOTE] -> This proc used to be named `findText`, like `findtext` but with a -capital T. To avoid confusion it has been renamed, but old code will -still compile. - -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [replacetextEx proc](/ref/proc/replacetextEx.md) -> + [Regular expressions](/ref/notes/regex.md) \ No newline at end of file + +This outputs "Not found!", since "there" is not a part of the string "Hi There", taking into account case. + +If the start or end position is negative, the position is counted backwards from the end of the string. E.g., findtextEx("Banana", "na", -3) starts three characters from the end and only searches the final "ana". + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `findtextEx_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. + + +> [!TIP] +> Note: This proc used to be named `findText`, like `findtext` but with a capital T. To avoid confusion it has been renamed, but old code will still compile. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [replacetextEx proc](/ref/proc/replacetextEx) ++ [Regular expressions](/ref/{notes}/regex) diff --git a/ref/proc/flick.md b/ref/proc/flick.md index 9c8392c0..91fd393c 100644 --- a/ref/proc/flick.md +++ b/ref/proc/flick.md @@ -1,25 +1,25 @@ -## flick proc + +## flick (proc) **Format:** + flick(Icon,Object) -**Args:** -+ Icon: An icon file or state name. -+ Object: The target object. +**Arguments:** ++ Icon: An icon file or state name. ++ Object: The target object. +*** +Cause the icon attached to Object to be temporarily replaced with the specified icon or icon state for the duration of the animation. This is a purely visual effect and does not effect the actual value of the object's icon variable. -Cause the icon attached to Object to be temporarily replaced -with the specified icon or icon state for the duration of the animation. -This is a purely visual effect and does not effect the actual value of -the object\'s icon variable. -### Example: ```dm + flick('blink.dmi',usr) //show another icon -flick("fight",usr) //show usr's fight state +flick("fight",usr) //show usr's fight state + ``` -The target object may be any atom or image. -> [!TIP] -> **See also:** -> + [icon_state var (atom)](/ref/atom/var/icon_state.md) \ No newline at end of file +The target object may be any atom or image. +*** +**Related Pages:** ++ [icon_state](/ref/atom/var/icon_state) diff --git a/ref/proc/flist.md b/ref/proc/flist.md index c9ea382f..13ae9bd7 100644 --- a/ref/proc/flist.md +++ b/ref/proc/flist.md @@ -1,26 +1,20 @@ -## flist proc + +## flist (proc) **Format:** + flist(Path) -**Args:** +**Arguments:** + Path: The path in the filesystem to get a listing of. **Returns:** + A list of files contained in the specified directory and whose names - begin with the specified text. The names of sub-directories are - listed too, and are marked by a trailing "/". - -The path is of the form "dir1/dir2/.../file". Only files -beginning with the "file" part are listed, so be sure to end a -directory name with "/" if you wish to see its contents. Otherwise you -will just get that directory name back with a "/" appended. - -Only files and sub-directories directly contained in the -specified path are listed (ie not the contents of the sub-directories -too). The file names in the list do not include the path information but -just the bare file name. + begin with the specified text. The names of sub-directories are listed + too, and are marked by a trailing "/". +*** +The path is of the form "dir1/dir2/.../file". Only files beginning with the "file" part are listed, so be sure to end a directory name with "/" if you wish to see its contents. Otherwise you will just get that directory name back with a "/" appended. -> [!TIP] -> **See also:** -> + [fexists proc](/ref/proc/fexists.md) \ No newline at end of file +Only files and sub-directories directly contained in the specified path are listed (ie not the contents of the sub-directories too). The file names in the list do not include the path information but just the bare file name. +*** +**Related Pages:** ++ [fexists proc](/ref/proc/fexists) diff --git a/ref/proc/floor.md b/ref/proc/floor.md index 28e520e7..7fefe4e1 100644 --- a/ref/proc/floor.md +++ b/ref/proc/floor.md @@ -1,29 +1,30 @@ -## floor proc -###### BYOND Version 515 + +## floor (proc) **Format:** + floor(A) +**Arguments:** ++ A: A number, pixloc, or vector. + **Returns:** + the floor of A +*** +Returns the floor of A (the largest integer less than or equal to A). -**Args:** -+ A: A number, pixloc, or vector. - -Returns the floor of A (the largest integer less than or equal -to A). -### Example: ```dm + usr << floor(1.45) // outputs 1 usr << floor(-1.45) // outputs -2 + ``` -> [!TIP] -> **See also:** -> + [ceil proc](/ref/proc/ceil.md) -> + [round proc](/ref/proc/round.md) -> + [trunc proc](/ref/proc/trunc.md) -> + [fract proc](/ref/proc/fract.md) -> + [sign proc](/ref/proc/sign.md) \ No newline at end of file +*** +**Related Pages:** ++ [ceil proc](/ref/proc/ceil) ++ [round proc](/ref/proc/round) ++ [trunc proc](/ref/proc/trunc) ++ [fract proc](/ref/proc/fract) ++ [sign proc](/ref/proc/sign) diff --git a/ref/proc/for.md b/ref/proc/for.md deleted file mode 100644 index 1411e02c..00000000 --- a/ref/proc/for.md +++ /dev/null @@ -1,9 +0,0 @@ -## for proc - -The for proc can be used to iterate values over a fixed range -or list. Consult the appropriate entry for more information. - -> [!TIP] -> **See also:** -> + [for list proc](/ref/proc/for/list.md) -> + [for loop proc](/ref/proc/for/loop.md) \ No newline at end of file diff --git a/ref/proc/for/index.md b/ref/proc/for/index.md new file mode 100644 index 00000000..0eee28e8 --- /dev/null +++ b/ref/proc/for/index.md @@ -0,0 +1,8 @@ + +## for (proc) +*** +The for proc can be used to iterate values over a fixed range or list. Consult the appropriate entry for more information. +*** +**Related Pages:** ++ [for list proc](/ref/proc/for/list) ++ [for loop proc](/ref/proc/for/loop) diff --git a/ref/proc/for/list.md b/ref/proc/for/list.md new file mode 100644 index 00000000..7e687f20 --- /dev/null +++ b/ref/proc/for/list.md @@ -0,0 +1,84 @@ + +## list (proc) + +**Format:** ++ for (Var [as Type] [in List]) Statement ++ for (Var in Start to End [step Step]) Statement ++ for (Key [as Type], Value in List) Statement + +**Arguments:** ++ Var: A variable to sequentially contain each member of the list. ++ List: The list to loop through. This defaults to the whole world. ++ Type: One or more of area, turf, mob, or obj, ORed together. If no + type is specified, the declared type of Var will be used to skip over + inappropriate elements in the list. ++ Start: A starting numeric value. ++ End: An ending numeric value (inclusive). ++ Step: An increment for the numeric value; default is 1. ++ Key: A variable to sequentially contain each "key" in a key,value pair from an [list associations](/ref/list/associations) ++ Value: A variable to sequentially contain each associated value in a key,value pair list +*** + +```dm + +usr << "Mobs:" +var/mob/M +for(M in view()) + usr << M.name + +``` + + +This loops M through the mobs in view(), outputting the name at each iteration. + +When you loop through a list, with the exception of looping through world, you're actually looping through a copy of that list. If the list changes, those changes won't have any bearing on this loop. If you want to be able to handle a list that might change, you'll need to use the for loop proc instead. + +You can declare the variable right inside the for statement. Its scope is entirely contained within the for statement, so it will not conflict with a similar variable declared elsewhere in the same procedure. + + +```dm + +client/verb/who() + for(var/client/Player) + usr << Player + +``` + + +If the loop var has a type, a hidden `istype()` call is included in the code. Only items of that type, or its descendants, are handled within the loop. That means null values and objects of unrelated types will be skipped. + +The numeric loop form is a quick internal version of the for loop proc. It's equivalent to `for(Var = Start, Var <= End, Var += Step)` unless Step is negative, in which case a >= comparison is used instead. The main difference is that unlike in a for loop proc, the values of Step and End are calculated at the beginning and never change after that, so an expression like `list.len` that might be subject to change will not be read again—in much the same way that looping through a list only loops through a copy of that list. + + +```dm + +for(var/count in 1 to 100) + src << count + +``` + + +Note: Although you can use fractional values for `step` in this numeric format, there may be accuracy considerations to keep in mind. See Numbers for more information. + +The key,value pair loop is meant for quickly traversing the items in an associative list, without having to do an additional lookup of `List[Key]` in the list. Additionally this also copies the associated values when the list is copied, so the loop won't react to changes in the original list. + + +```dm + +var/alist/prices = alist(/obj/item/weapon/sword = 100, /obj/item/armor/helmet = 50) +player << "Welcome to my shop!" +for(var/item,price in prices) + player << "[item::name] - $[price]" + +``` + + +If the key var has a type, a hidden `istype()` call is included in the loop, just like in a regular `for(Var in List)` loop. You can also use the `as` clause to specify basic types like `obj`, `num`, `text`, etc. + +If this format is used with non-associative lists, then the associated value will always be assigned null. +*** +**Related Pages:** ++ [for loop proc](/ref/proc/for/loop) ++ [list](/ref/list) ++ [list associations](/ref/list/associations) ++ [istype proc](/ref/proc/istype) diff --git a/ref/proc/for/loop.md b/ref/proc/for/loop.md new file mode 100644 index 00000000..cc1f9d17 --- /dev/null +++ b/ref/proc/for/loop.md @@ -0,0 +1,60 @@ + +## loop (proc) + +**Format:** ++ for(Init, Test, Inc) Statement +*** +First execute Init. Then if Test is true (non-zero), execute Statement. After this execute Inc. Continue checking Test, doing Statement, and performing Inc until Test turns out to be false (zero). + +Statement may be a code block or a single statement. Semicolons may be substituted for commas inside the parentheses as a convenience to C/C++ programmers. + +Init and Inc may be omitted. If Test is omitted, the loop will continue forever (unless a break, goto, or return instruction is used to get out of the loop). + + +```dm + +var/i +for(i=0, i<3, i++) + world << i + +``` + + +This outputs: + + +```dm + +0 +1 +2 + +``` + + +Note: An Inc statement like `i += 0.1` is perfectly valid, but you should keep in mind that numerical accuracy is not exact. See Numbers for more information. + +Using the `#pragma syntax` directive you can change `for()` to be more like other languages such as C. This uses a semicolon `;` in place of commas to separate Init, Test, and Inc. Instead the comma is treated as a way of stringing multiple statements together. + + +```dm + +// make this syntax change temporary +#pragma push +#pragma syntax C for + +var/i,j +for(i=j=0; i<=10; ++i,j+=i) + world << "A triangle [i] block\s high has [j] block\s total." + +#pragma pop + +``` + +*** +**Related Pages:** ++ [break statement](/ref/proc/break) ++ [continue statement](/ref/proc/continue) ++ [do proc](/ref/proc/do) ++ [for list proc](/ref/proc/for/list) ++ [while proc](/ref/proc/while) diff --git a/ref/proc/for_list.md b/ref/proc/for_list.md deleted file mode 100644 index a7f9274c..00000000 --- a/ref/proc/for_list.md +++ /dev/null @@ -1,121 +0,0 @@ -## for list proc - -**Format:** -+ for (Var [as Type] [in List]) Statement -+ for (Var in Start to End [step Step]) Statement -+ for (Key [as Type], Value in List) Statement 516 - -**Args:** -+ **Var**: A variable to sequentially contain each member of the list. -+ **List**: The list to loop through. This defaults to the whole world, unless `Var` is a /datum which are handled differently -+ **Type**: One or more of area, turf, mob, or obj, ORed together. If no - type is specified, the declared type of Var will be used to skip - over inappropriate elements in the list. -+ **Start**: A starting numeric value. -+ **End**: An ending numeric value (inclusive). -+ **Step**: An increment for the numeric value; default is 1. -+ **Key**: A variable to sequentially contain each "key" in a key,value - pair from an [associative list](/list/assoc) -+ **Value**: A variable to sequentially contain each associated value in a - key,value pair list - -### Example: - -```dm -usr << "Mobs:" -var/mob/M -for(M in view()) - usr << M.name -``` - -This loops M through the mobs in view(), -outputting the name at each iteration. - -When you loop through a list, with the exception of looping through world, you\'re actually -looping through a copy of that list. If the list changes, those changes -won\'t have any bearing on this loop. If you want to be able to handle a -list that might change, you\'ll need to use the [for loop proc](/ref/proc/for_loop.md) instead. - -You can declare the variable -right inside the for statement. Its scope is entirely contained within -the for statement, so it will not conflict with a similar variable -declared elsewhere in the same procedure. - -### Example: -```dm -client/verb/who() - for(var/client/Player) - usr << Player -``` - -If the variable type is one of /client, /atom, /turf, /obj or /mob and you're looping through `world`, -only the type and its children are looped over. This can be faster in some cases than maintaining your -own lists. -### Example: -```dm -var/list/players = list() -for(var/mob/player/p in world) - players.Add(p) -``` -In the above example, only /mob and children of /mob are looped over. - -If the loop var has a type, a hidden `istype()` call -is included in the code. Only items of that type, or its descendants, -are handled within the loop. That means null values and objects of -unrelated types will be skipped. - -### Numeric loop - -The numeric loop form is a quick internal version of the [for loop proc](/ref/proc/for_loop.md) . It\'s equivalent to -`for(Var = Start, Var <= End, Var += Step)` unless Step is negative, in -which case a >= comparison is used instead. The main difference is that -unlike in a for loop proc, the values of Step and End are calculated at -the beginning and never change after that, so an expression like -`list.len` that might be subject to change will not be read again---in -much the same way that looping through a list only loops through a copy -of that list. - -### Example: - -```dm -for(var/count in 1 to 100) - src << count -``` - -> [!NOTE] -> Although you can use fractional values for `step` in this -numeric format, there may be accuracy considerations to keep in mind. -See [Numbers](/ref/notes/numbers.md) for more information. - -### Key,value pair loop 516 - -The key,value pair loop is meant for quickly traversing the -items in an [associative list](/list/assoc), without having to do an -additional lookup of `List[Key]` in the list. Additionally this also -copies the associated values when the list is copied, so the loop won\'t -react to changes in the original list. - -### Example: - -```dm -var/alist/prices = alist(/obj/item/weapon/sword = 100, /obj/item/armor/helmet = 50) -player << "Welcome to my shop!" -for(var/item,price in prices) - player << "[item::name] - $[price]" -``` - -If the key var has a type, a hidden -`istype()` call is included in the loop, just like in a regular -`for(Var in List)` loop. You can also use the `as` clause to specify -basic types like `obj`, `num`, `text`, etc. - -If this format is -used with non-associative lists, then the associated value will always -be assigned null. - -> [!TIP] -> **See also:** -> + [for loop proc](/ref/proc/for/loop.md) -> + [list](/ref/list.md) -> + [list associations](/ref/list/assoc.md) -> + [istype](/ref/proc/istype.md) diff --git a/ref/proc/for_loop.md b/ref/proc/for_loop.md deleted file mode 100644 index a8c3c31d..00000000 --- a/ref/proc/for_loop.md +++ /dev/null @@ -1,65 +0,0 @@ -## for loop proc - -**Format:** -+ for(Init, Test, Inc) Statement - -First execute Init. Then if Test is true (non-zero), execute -Statement. After this execute Inc. Continue checking Test, doing -Statement, and performing Inc until Test turns out to be false (zero). - - -Statement may be a code block or a single statement. Semicolons -may be substituted for commas inside the parentheses as a convenience to -C/C++ programmers. - -Init and Inc may be omitted. If Test is -omitted, the loop will continue forever (unless a break, goto, or return -instruction is used to get out of the loop). - -### Example: - -```dm -var/i -for(i=0, i<3, i++) - world << i -``` - -This outputs: -```dm -0 -1 -2 -``` - -> [!NOTE] -> An Inc statement like `i += 0.1` is perfectly valid, but you should keep in -mind that numerical accuracy is not exact. See [Numbers](/ref/notes/numbers.md) for more information. - -### C-like syntax - -Using the [`#pragma syntax`directive](/ref/DM/preprocessor/pragma/syntax.md) you can change `for()` to be -more like other languages such as C. This uses a semicolon `;` in place -of commas to separate Init, Test, and Inc. Instead the comma is treated -as a way of stringing multiple statements together. - -### Example: - -```dm -// make this syntax change temporary -#pragma push -#pragma syntax C for - -var/i,j -for(i=j=0; i<=10; ++i,j+=i) - world << "A triangle [i] block\s high has [j] block\s total." - -#pragma pop -``` - -> [!TIP] -> **See also:** -> + [break statement](/ref/proc/break.md) -> + [continue statement](/ref/proc/continue.md) -> + [do proc](/ref/proc/do.md) -> + [for list proc](/ref/proc/for/list.md) -> + [while proc](/ref/proc/while.md) \ No newline at end of file diff --git a/ref/proc/fract.md b/ref/proc/fract.md index 7d68fd64..0ac91558 100644 --- a/ref/proc/fract.md +++ b/ref/proc/fract.md @@ -1,33 +1,32 @@ -## fract proc -###### BYOND Version 515 + +## fract (proc) **Format:** + fract(A) +**Arguments:** ++ A: A number, pixloc, or vector. + **Returns:** + fractional part of A +*** +Returns the fractional part of the number A, with the same sign. This is everything after the decimal point. -**Args:** -+ A: A number, pixloc, or vector. - -Returns the fractional part of the number A, with the same -sign. This is everything after the decimal point. -### Example: ```dm + usr << fract(1.45) // outputs 0.45 usr << fract(-1.45) // outputs -0.45 + ``` - -If A is a pixloc, it will be -treated as a vector with just its x and y parts, and the result will be -a vector. - -> [!TIP] -> **See also:** -> + [trunc proc](/ref/proc/trunc.md) -> + [floor proc](/ref/proc/floor.md) -> + [ceil proc](/ref/proc/ceil.md) -> + [round proc](/ref/proc/round.md) -> + [sign proc](/ref/proc/sign.md) \ No newline at end of file + + +If A is a pixloc, it will be treated as a vector with just its x and y parts, and the result will be a vector. +*** +**Related Pages:** ++ [trunc proc](/ref/proc/trunc) ++ [floor proc](/ref/proc/floor) ++ [ceil proc](/ref/proc/ceil) ++ [round proc](/ref/proc/round) ++ [sign proc](/ref/proc/sign) diff --git a/ref/proc/ftime.md b/ref/proc/ftime.md index cf178d98..bb4f6d52 100644 --- a/ref/proc/ftime.md +++ b/ref/proc/ftime.md @@ -1,19 +1,18 @@ -## ftime proc + +## ftime (proc) **Format:** + ftime(File, IsCreationTime) -**Args:** +**Arguments:** + File: name of file to test -+ IsCreationTime (optional): true to return file creation time, false - (default) to return last-modified time ++ IsCreationTime (optional): true to return file creation time, false (default) to return last-modified time **Returns:** + A time value that can be sent to time2text(). - -> [!TIP] -> **See also:** -> + [time2text proc](/ref/proc/time2text.md) -> + [flist proc](/ref/proc/flist.md) -> + [fexists proc](/ref/proc/fexists.md) -> + [length proc](/ref/proc/length.md) \ No newline at end of file +****** +**Related Pages:** ++ [time2text proc](/ref/proc/time2text) ++ [flist proc](/ref/proc/flist) ++ [fexists proc](/ref/proc/fexists) ++ [length proc](/ref/proc/length) diff --git a/ref/proc/ftp.md b/ref/proc/ftp.md index 2d217130..300aa2f4 100644 --- a/ref/proc/ftp.md +++ b/ref/proc/ftp.md @@ -1,30 +1,28 @@ -## ftp proc + +## ftp (proc) **Format:** + target << ftp(File, Name) +*** +Sends a file to the target with the (optional) suggested name for saving to disk. The file may be a cache file (loaded at compile time) or an external file (accessed at run-time). Cache files are specified in single quotes, and external files are in double quotes. -Sends a file to the target with the (optional) suggested name -for saving to disk. The file may be a cache file (loaded at compile -time) or an external file (accessed at run-time). Cache files are -specified in single quotes, and external files are in double quotes. +This function could be used to distribute source code, supplementary documentation, or anything. -This function could be used to distribute source code, -supplementary documentation, or anything. -### Example: ```dm - mob/verb/geticon(O in view()) - usr << ftp(O:icon) + +mob/verb/geticon(O in view()) + usr << ftp(O:icon) + ``` - -This example allows the user to download the icons -from other objects in the game. - -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [browse proc](/ref/proc/browse.md) -> + [file proc](/ref/proc/file.md) -> + [link proc](/ref/proc/link.md) -> + [run proc](/ref/proc/run.md) -> + [sound proc](/ref/proc/sound.md) \ No newline at end of file + + +This example allows the user to download the icons from other objects in the game. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [browse proc](/ref/proc/browse) ++ [file proc](/ref/proc/file) ++ [link proc](/ref/proc/link) ++ [run proc](/ref/proc/run) ++ [sound proc](/ref/proc/sound) diff --git a/ref/proc/generator.md b/ref/proc/generator.md index c20f29fb..4b292415 100644 --- a/ref/proc/generator.md +++ b/ref/proc/generator.md @@ -1,59 +1,21 @@ -## generator proc -###### BYOND Version 514 + +## generator (proc) **Format:** + generator(type, A, B, rand) -**Args:** -+ type: The type of generator object, which determines what kind of - results it produces +**Arguments:** ++ type: The type of generator object, which determines what kind of results it produces + A: One extreme of the generator results + B: The other extreme + rand: Type of random distribution used - -Creates a generator that can be used to produce a random value. -This generator can be used in client-side particle effects, or it can be -used in proc code. The types of values it can produce are numbers, 2D or -3D vectors, or colors (a text string like "#rrggbb" or a color -matrix). - | Generator type | Result type | Description | - | --- | --- | --- | - | num | num | A random number between A and B. | - | vector | vector | A random vector on a line between A and B. | - | box | vector | A random vector within a box whose corners are at A and B. | - | color | color (string) or color matrix | Result type depends on whether A or B are matrices or not. The result is interpolated between A and B; components are not randomized separately. | - | circle | vector | A random XY-only vector in a ring between radius A and B, centered at 0,0. | - | sphere | vector | A random vector in a spherical shell between radius A and B, centered at 0,0,0. | - | square | vector | A random XY-only vector between squares of sizes A and B. (The length of the square is between A*2 and B*2, centered at 0,0.) | - | cube | vector | A random vector between cubes of sizes A and B. (The length of the cube is between A*2 and B*2, centered at 0,0,0.) | - -> [!NOTE] -> Worlds compiled in older BYOND versions before [vector](/ref/vector.md) will return lists from vector generators. - -The optional `rand` argument determines the type of random -distribution: - - - **UNIFORM_RAND**: Default. Random values are uniformly likely to be chosen. - - **NORMAL_RAND**: Approximates a Gaussian normal distribution, but on a finite interval. Values closest to the mean are more likely to be chosen, while the extremes are much less likely. - - **LINEAR_RAND**: The probability of choosing a number is proportional to its absolute value. - - **SQUARE_RAND**: The probability of choosing a number is proportional to its square. - - -The result of calling `generator()` is a datum of type -`/generator` and you can get a random value from it by calling its -`Rand()` proc. -### Example: - -```dm -var/generator/G = generator("num", -1, 1) // generates a random number between -1 and 1 -world << G.Rand() // generate a number and output it to world -``` - -> [!TIP] -> **See also:** -> + [Generators](/ref/notes/generators.md) -> + [Particle effects](/ref/notes/particles.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [Color matrix](/ref/notes/color-matrix.md) -> + [vector](/ref/vector.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file +*** +Creates a generator that can be used to produce a random value. This generator can be used in client-side particle effects, or it can be used in proc code. The types of values it can produce are numbers, 2D or 3D vectors, or colors (a text string like "#rrggbb" or a color matrix). +*** +**Related Pages:** ++ [Generators](/ref/{notes}/generators) ++ [Particle effects](/ref/{notes}/particles) ++ [color var (atom)](/ref/atom/var/color) ++ [Color matrix](/ref/{notes}/color-matrix) ++ [vector](/ref/vector) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/proc/get_dir.md b/ref/proc/get_dir.md index 3c64b8bc..eb890d98 100644 --- a/ref/proc/get_dir.md +++ b/ref/proc/get_dir.md @@ -1,24 +1,19 @@ -## get_dir proc + +## get_dir (proc) **Format:** + get_dir(Loc1, Loc2) -**Returns:** -+ The direction from Loc1 to Loc2. - -**Args:** +**Arguments:** + Loc1: An object on the map. + Loc2: An object on the map. -If `Loc1` and `Loc2` are the same, this will return `0`. Otherwise, possible results are `NORTH`, -`SOUTH`, `EAST`, `WEST`, `NORTHEAST`, `NORTHWEST`, `SOUTHEAST`, and -`SOUTHWEST`. - -If the direction is not directly lying along one of the four -primary cardinal directions, the result will become the nearest diagonal -direction (eg. if `Loc2` is mostly north but a little to the east of -`Loc1`, the direction returned will be `NORTHEAST`). - -> [!TIP] -> **See also:** -> + [dir var (atom)](/ref/atom/var/dir.md) +**Returns:** ++ The direction from Loc1 to Loc2. Possible results are , + , , , , + , , and . +*** +If the direction is not directly lying along one of the four primary cardinal directions, the result will become the nearest diagonal direction (eg. if `Loc2` is mostly north but a little to the east of `Loc1`, the direction returned will be `NORTHEAST`). +*** +**Related Pages:** ++ [dir](/ref/atom/var/dir) diff --git a/ref/proc/get_dist.md b/ref/proc/get_dist.md index c57528f9..88a73a34 100644 --- a/ref/proc/get_dist.md +++ b/ref/proc/get_dist.md @@ -1,29 +1,24 @@ -## get_dist proc + +## get_dist (proc) **Format:** + get_dist(Loc1, Loc2) -**Returns:** -+ The distance between `Loc1` and `Loc2`, in tiles. This is the number - of full-tile movements (disregarding any obstacles and allowing - diagonal moves *including across Z levels*) required to go from one - to the other. You can think of it as the max of their x, y, and z - distances. - -> [!NOTE] -> Prior to BYOND 515, `get_dist()` never returned -a value greater than 127, which it counted as "infinite". - -**Args:** +**Arguments:** + Loc1: An object on the map. + Loc2: An object on the map. -`get_dist()` will return -1 when `Loc1` and `Loc2` are the same -object. If one or both of them is not on the map, an infinite value is -returned. - +**Returns:** ++ The distance between and , in tiles. This is +the number of full-tile movements (disregarding any obstacles and allowing +diagonal moves ) required to go from one to +the other. You can think of it as the max of their x, y, and z distances. +*** For a distance in pixels, use `bounds_dist()`. -> [!TIP] -> **See also:** -> + [bounds_dist proc](/ref/proc/bounds_dist.md) \ No newline at end of file +`get_dist()` will return -1 when `Loc1` and `Loc2` are the same object. If one or both of them is not on the map, an infinite value is returned. + +Note: Prior to BYOND 515, `get_dist()` never returned a value greater than 127, which it counted as "infinite". +*** +**Related Pages:** ++ [bounds_dist proc](/ref/proc/bounds_dist) diff --git a/ref/proc/get_step.md b/ref/proc/get_step.md index 43048029..55b8fd05 100644 --- a/ref/proc/get_step.md +++ b/ref/proc/get_step.md @@ -1,19 +1,20 @@ -## get_step proc + +## get_step (proc) **Format:** + get_step(Ref, Dir) -**Returns:** -+ The location of the new position. - -**Args:** +**Arguments:** + Ref: Starting point or object. -+ Dir: One of `NORTH`, `SOUTH`, `EAST`, `WEST`, `NORTHEAST`, - `NORTHWEST`, `SOUTHEAST`, `SOUTHWEST`. ++ Dir: One of , , , , + , , , + . +**Returns:** ++ The location of the new position. +*** Calculate the position of a step from `Ref` in the direction `Dir`. - -> [!TIP] -> **See also:** -> + [step proc](/ref/proc/step.md) -> + [walk proc](/ref/proc/walk.md) \ No newline at end of file +*** +**Related Pages:** ++ [step proc](/ref/proc/step) ++ [walk proc](/ref/proc/walk) diff --git a/ref/proc/get_step_away.md b/ref/proc/get_step_away.md index 15f01c2b..7993ae2f 100644 --- a/ref/proc/get_step_away.md +++ b/ref/proc/get_step_away.md @@ -1,22 +1,19 @@ -## get_step_away proc + +## get_step_away (proc) **Format:** + get_step_away(Ref, Trg, Max=5) -**Returns:** -+ The location of the new position, or 0 if no change. - -**Args:** +**Arguments:** + Ref: Starting point or object. + Trg: An object on the map. -+ Max: The maximum distance between Ref and Targ before movement - halts. ++ Max: The maximum distance between Ref and Targ before movement halts. -Calculate position of a step from `Ref` on a path away from -`Trg`, taking obstacles into account. If `Ref` is farther than `Max` -steps from `Trg`, 0 will be returned. - -> [!TIP] -> **See also:** -> + [step_away proc](/ref/proc/step_away.md) -> + [walk_away proc](/ref/proc/walk_away.md) \ No newline at end of file +**Returns:** ++ The location of the new position, or 0 if no change. +*** +Calculate position of a step from `Ref` on a path away from `Trg`, taking obstacles into account. If `Ref` is farther than `Max` steps from `Trg`, 0 will be returned. +*** +**Related Pages:** ++ [step_away proc](/ref/proc/step_away) ++ [walk_away proc](/ref/proc/walk_away) diff --git a/ref/proc/get_step_rand.md b/ref/proc/get_step_rand.md index 9714ade0..52add398 100644 --- a/ref/proc/get_step_rand.md +++ b/ref/proc/get_step_rand.md @@ -1,17 +1,17 @@ -## get_step_rand proc + +## get_step_rand (proc) **Format:** + get_step_rand(Ref) -**Returns:** -+ The location of the new position, or 0 if no change. - -**Args:** +**Arguments:** + Ref: Starting point or object. +**Returns:** ++ The location of the new position, or 0 if no change. +*** Calculate position of a step from `Ref` in random motion. - -> [!TIP] -> **See also:** -> + [step_rand proc](/ref/proc/step_rand.md) -> + [walk_rand proc](/ref/proc/walk_rand.md) \ No newline at end of file +*** +**Related Pages:** ++ [step_rand proc](/ref/proc/step_rand) ++ [walk_rand proc](/ref/proc/walk_rand) diff --git a/ref/proc/get_step_to.md b/ref/proc/get_step_to.md index 8e0f5fb0..49399a74 100644 --- a/ref/proc/get_step_to.md +++ b/ref/proc/get_step_to.md @@ -1,26 +1,22 @@ -## get_step_to proc + +## get_step_to (proc) **Format:** + get_step_to(Ref, Trg, Min=0) -**Returns:** -+ The location of the new position, or 0 if no change. - -**Args:** +**Arguments:** + Ref: Starting point or object. + Trg: An object on the map. + Min: The minimum distance between Ref and Trg before movement halts. -Calculate the position of a step from `Ref` on a path to `Trg`, -taking obstacles into account. - -If `Ref` is within `Min` steps -of `Trg`, no step is computed. This is also true if the target is too -far away (more than twice `world.view` steps). In either case, null is -returned. +**Returns:** ++ The location of the new position, or 0 if no change. +*** +Calculate the position of a step from `Ref` on a path to `Trg`, taking obstacles into account. -> [!TIP] -> **See also:** -> + [step_to proc](/ref/proc/step_to.md) -> + [walk_to proc](/ref/proc/walk_to.md) -> + [get_steps_to proc](/ref/proc/get_steps_to.md) \ No newline at end of file +If `Ref` is within `Min` steps of `Trg`, no step is computed. This is also true if the target is too far away (more than twice `world.view` steps). In either case, null is returned. +*** +**Related Pages:** ++ [step_to proc](/ref/proc/step_to) ++ [walk_to proc](/ref/proc/walk_to) ++ [get_steps_to proc](/ref/proc/get_steps_to) diff --git a/ref/proc/get_step_towards.md b/ref/proc/get_step_towards.md index 1cab2288..5f7904dd 100644 --- a/ref/proc/get_step_towards.md +++ b/ref/proc/get_step_towards.md @@ -1,19 +1,18 @@ -## get_step_towards proc + +## get_step_towards (proc) **Format:** + get_step_towards(Ref, Trg) -**Returns:** -+ The location of the new position. - -**Args:** +**Arguments:** + Ref: Starting point or object. + Trg: An object on the map. -Calculate the position of a step from `Ref` in the direction of -`Trg`. - -> [!TIP] -> **See also:** -> + [step_towards proc](/ref/proc/step_towards.md) -> + [walk_towards proc](/ref/proc/walk_towards.md) \ No newline at end of file +**Returns:** ++ The location of the new position. +*** +Calculate the position of a step from `Ref` in the direction of `Trg`. +*** +**Related Pages:** ++ [step_towards proc](/ref/proc/step_towards) ++ [walk_towards proc](/ref/proc/walk_towards) diff --git a/ref/proc/get_steps_to.md b/ref/proc/get_steps_to.md index 074efc1f..141b2635 100644 --- a/ref/proc/get_steps_to.md +++ b/ref/proc/get_steps_to.md @@ -1,28 +1,23 @@ -## get_steps_to proc -###### BYOND Version 515 + +## get_steps_to (proc) **Format:** + get_steps_to(Ref, Trg, Min=0) -**Returns:** -+ A list of directions to step. - -**Args:** +**Arguments:** + Ref: Starting point or object. + Trg: An object on the map. + Min: The minimum distance between Ref and Trg before movement halts. -Calculate a set of steps from `Ref` on a path to `Trg`, taking -obstacles into account. The result of the proc is a list of directions -that can be used with `step()`, or null if a path could not be found. - -If `Ref` is within `Min` steps of `Trg`, no steps are computed. -This is also true if the target is too far away (more than twice -`world.view` steps). In either case, null is returned. +**Returns:** ++ A list of directions to step. +*** +Calculate a set of steps from `Ref` on a path to `Trg`, taking obstacles into account. The result of the proc is a list of directions that can be used with `step()`, or null if a path could not be found. -> [!TIP] -> **See also:** -> + [step proc](/ref/proc/step.md) -> + [step_to proc](/ref/proc/step_to.md) -> + [walk_to proc](/ref/proc/walk_to.md) -> + [get_step_to proc](/ref/proc/get_step_to.md) \ No newline at end of file +If `Ref` is within `Min` steps of `Trg`, no steps are computed. This is also true if the target is too far away (more than twice `world.view` steps). In either case, null is returned. +*** +**Related Pages:** ++ [step proc](/ref/proc/step) ++ [step_to proc](/ref/proc/step_to) ++ [walk_to proc](/ref/proc/walk_to) ++ [get_step_to proc](/ref/proc/get_step_to) diff --git a/ref/proc/goto.md b/ref/proc/goto.md index 484c571e..d9320c0f 100644 --- a/ref/proc/goto.md +++ b/ref/proc/goto.md @@ -1,33 +1,30 @@ -## goto proc + +## goto (proc) **Format:** + goto node - +*** Jump to the specified node in the current proc. -> [!CAUTION] -> `goto` should be used judiciously. It\'s easy to fall into the trap of -"spaghetti logic" where `goto` is relied on so much that it becomes -too difficult to follow how the flow of code execution will proceed. -Normally, you\'ll want to use a construct like `while()` or `for()` -loops, and `break` and `continue` statements. `goto` is for more complex -situations that aren\'t readily handled by any of these. -### Example: ```dm + goto End world << "ERR" End world << "The end" -``` - -This displays "The end". - -> [!TIP] -> **See also:** -> + [break statement](/ref/proc/break.md) -> + [continue statement](/ref/proc/continue.md) -> + [do proc](/ref/proc/do.md) -> + [for loop proc](/ref/proc/for/loop.md) -> + [for list proc](/ref/proc/for/list.md) -> + [while proc](/ref/proc/while.md) \ No newline at end of file + +``` + + +This displays "The end". + +Note: `goto` should be used judiciously. It's easy to fall into the trap of "spaghetti logic" where `goto` is relied on so much that it becomes too difficult to follow how the flow of code execution will proceed. Normally, you'll want to use a construct like `while()` or `for()` loops, and `break` and `continue` statements. `goto` is for more complex situations that aren't readily handled by any of these. +*** +**Related Pages:** ++ [break statement](/ref/proc/break) ++ [continue statement](/ref/proc/continue) ++ [do proc](/ref/proc/do) ++ [for loop proc](/ref/proc/for/loop) ++ [for list proc](/ref/proc/for/list) ++ [while proc](/ref/proc/while) diff --git a/ref/proc/gradient.md b/ref/proc/gradient.md index 30ea497c..8bfbcc13 100644 --- a/ref/proc/gradient.md +++ b/ref/proc/gradient.md @@ -1,63 +1,62 @@ -## gradient proc + +## gradient (proc) **Format:** + gradient(Item1, Item2, ..., index) + gradient(Gradient, index) -**Args:** -+ Gradient: A [color gradient](/ref/notes/color-gradient.md) list -+ Item1, Item2...: Elements of a [color gradient](/ref/notes/color-gradient.md) list +**Arguments:** ++ Gradient: A list [Color gradient](/ref/{notes}/color-gradient) ++ Item1, Item2...: Elements of a list [Color gradient](/ref/{notes}/color-gradient) + index: The index along the gradient where the interpolation is done. **Returns:** + A color, represented by a text string in #RRGGBB or #RRGGBBAA format +*** +Interpolates between two or more colors along a color gradient. By default, gradients extend from an index of 0 to 1, but they are allowed to go beyond that if you choose. -Interpolates between two or more colors along a [color gradient](/ref/notes/color-gradient.md). -By default, gradients extend from an index of 0 to 1, but they -are allowed to go beyond that if you choose. +The simplest way to use this proc is to interpolate between two colors: -The simplest way to use this proc is to interpolate -between two colors: -### Example: ```dm + // 20% of the way from red to black // prints #cc0000 which is rgb(204,0,0) src << gradient("red", "black", 0.2) + ``` -Anything that applies to color gradients can be used -in this proc, so you can have a looping gradient, or a gradient that -uses a color space other than RGB. -In the first format where -you specify all the items separately, you can use [named arguments](/ref/proc/arguments/named.md) -for `index` and `space` (the gradient\'s color space). -If you don\'t specify an argument called "index", the last argument -is assumed to be the index. -### Example: +Anything that applies to color gradients can be used in this proc, so you can have a looping gradient, or a gradient that uses a color space other than RGB. + +In the first format where you specify all the items separately, you can use named arguments for `index` and `space` (the gradient's color space). If you don't specify an argument called "index", the last argument is assumed to be the index. + ```dm + // This gradient loops through all the hues and goes from 0 to 6. // Because this is a looping gradient, index=10 becomes index=4. // In HSL, this will give you blue (#0000ff). src << gradient(0, "#f00", 3, "#0ff", 6, "#f00", "loop", space=COLORSPACE_HSL, index=10) + ``` - -The `gradient(Gradient, index)` format is -used for cases where you want to pass an existing gradient to the proc. -### Example: + + +The `gradient(Gradient, index)` format is used for cases where you want to pass an existing gradient to the proc. + ```dm + var/candy_cane_gradient = list(0.5,"red",0.5,"white","loop") // the color output alternates between red and white depending on the current time src << gradient(candy_cane_gradient, world.time/100) + ``` -> [!TIP] -> **See also:** -> + [Color gradient](/ref/notes/color-gradient.md) -> + [rgb proc](/ref/proc/rgb.md) -> + [rgb2num proc](/ref/proc/rgb2num.md) -> + [Color space](/ref/appendix/color-space.md) \ No newline at end of file +*** +**Related Pages:** ++ [Color gradient](/ref/{notes}/color-gradient) ++ [rgb proc](/ref/proc/rgb) ++ [rgb2num proc](/ref/proc/rgb2num) ++ [Color space](/ref/{{appendix}}/color-space) diff --git a/ref/proc/hascall.md b/ref/proc/hascall.md index 79509af3..cc8b36a0 100644 --- a/ref/proc/hascall.md +++ b/ref/proc/hascall.md @@ -1,15 +1,15 @@ -## hascall proc + +## hascall (proc) **Format:** + hascall(Object,ProcName) -**Args:** +**Arguments:** + Object: source of proc or verb + ProcName: name of proc or verb ("MyProc") **Returns:** + 1 if object has such a proc or verb; 0 otherwise - -> [!TIP] -> **See also:** -> + [call proc](/ref/proc/call.md) \ No newline at end of file +****** +**Related Pages:** ++ [call proc](/ref/proc/call) diff --git a/ref/proc/hearers.md b/ref/proc/hearers.md index 4f98d2d6..ddafffc3 100644 --- a/ref/proc/hearers.md +++ b/ref/proc/hearers.md @@ -1,14 +1,12 @@ -## hearers -**Format:** -+ hearers(Depth=world.view, Center=usr) - -This is just like `viewers()`, but it is a list of mobs that -can hear the center object. Currently, this is computed on the -assumption that opaque objects block sound, just like they block light. +## hearers (proc) -> [!TIP] -> **See also:** -> + [ohearers](/ref/proc/ohearers.md) -> + [view proc](/ref/proc/view.md) -> + [viewers](/ref/proc/viewers.md) \ No newline at end of file +**Format:** ++ hearers(Depth=world.view,Center=usr) +*** +This is just like viewers(), but it is a list of mobs that can hear the center object. Currently, this is computed on the assumption that opaque objects block sound, just like they block light. +*** +**Related Pages:** ++ [ohearers](/ref/proc/ohearers) ++ [view proc](/ref/proc/view) ++ [viewers](/ref/proc/viewers) diff --git a/ref/proc/html_decode.md b/ref/proc/html_decode.md index ae62e469..7eed8fcd 100644 --- a/ref/proc/html_decode.md +++ b/ref/proc/html_decode.md @@ -1,23 +1,18 @@ -## html_decode proc + +## html_decode (proc) **Format:** + html_decode(HtmlText) -**Args:** +**Arguments:** + HtmlText: text to be "unescaped" **Returns:** + unescaped text +*** +Special characters such as < and > are not displayed literally in html and may produce garbled output. To display these characters literally, they must be "escaped". For example, < is produced by the code &lt; and > is produced by the code &gt;. -Special characters such as < and > are not displayed -literally in html and may produce garbled output. To display these -characters literally, they must be "escaped". For example, < is -produced by the code `<` and > is produced by the code `>`. - -The `html_decode()` instruction takes a text string containing -such escaped symbols and turns them into their literal counterparts. The -more useful function is `html_encode()` which does the reverse. - -> [!TIP] -> **See also:** -> + [html_encode proc](/ref/proc/html_encode.md) \ No newline at end of file +The html_decode() instruction takes a text string containing such escaped symbols and turns them into their literal counterparts. The more useful function is html_encode() which does the reverse. +*** +**Related Pages:** ++ [html_encode proc](/ref/proc/html_encode) diff --git a/ref/proc/html_encode.md b/ref/proc/html_encode.md index 850ec6c5..31a3bad8 100644 --- a/ref/proc/html_encode.md +++ b/ref/proc/html_encode.md @@ -1,40 +1,31 @@ -## html_encode proc + +## html_encode (proc) **Format:** + html_encode(PlainText) -**Args:** +**Arguments:** + PlainText: text to be html "escaped" **Returns:** + escaped text +*** +Special characters such as < and > are not displayed literally in html and may produce garbled output. If you want to ensure that an entire text string is displayed literally, you can "escape" those characters. For example, < is produced by the code &lt; and > is produced by the code &gt;. -Special characters such as < and > are not displayed -literally in html and may produce garbled output. If you want to ensure -that an entire text string is displayed literally, you can "escape" -those characters. For example, < is produced by the code `<` and > -is produced by the code `>`. +The html_encode() instruction does this for you automatically. If you wanted to disallow html input from players, you could use this to force their text to be displayed literally: -The `html_encode()` instruction -does this for you automatically. If you wanted to disallow html input -from players, you could use this to force their text to be displayed -literally: -### Example: ```dm + mob/verb/say(T as text) view() << "[usr] says, '[html_encode(T)]'" + ``` -If a URL is included in the -text, special characters like & that are part of the URL will be -skipped. This keeps automatically created links in the output from being -broken. -Note for BYOND oldies: the old-style formatting codes -such as "\\red" which are still parsed but not encouraged are -completely stripped out by html_encode(). +If a URL is included in the text, special characters like & that are part of the URL will be skipped. This keeps automatically created links in the output from being broken. -> [!TIP] -> **See also:** -> + [html_decode proc](/ref/proc/html_decode.md) \ No newline at end of file +Note for BYOND oldies: the old-style formatting codes such as "\red" which are still parsed but not encouraged are completely stripped out by html_encode(). +*** +**Related Pages:** ++ [html_decode proc](/ref/proc/html_decode) diff --git a/ref/proc/icon.md b/ref/proc/icon.md index 8c53a602..237d2537 100644 --- a/ref/proc/icon.md +++ b/ref/proc/icon.md @@ -1,24 +1,21 @@ -## icon proc + +## icon (proc) **Format:** -+ icon(icon, state, dir, frame, moving) (supports [named arguments](/ref/proc/arguments/named.md)) ++ icon(icon,state,dir,frame,moving) ++ -**Args:** +**Arguments:** + icon: an icon file or /icon object -+ icon_state: an optional text string, specifying a single icon state - to load ++ icon_state: an optional text string, specifying a single icon state to load + dir: an optional direction to extract + frame: an optional animation frame to extract -+ moving: Non-zero to extract only movement states, 0 for non-movement - states, or null (default) for both - -This is equivalent to new/icon(). It creates an /icon object, -which is initialized to contain the same graphical data as the given -file. If an icon state or direction are specified, only those parts of -the original icon will be included in the new icon object. - -> [!TIP] -> **See also:** -> + [file proc](/ref/proc/file.md) -> + [icon_states proc](/ref/proc/icon_states.md) -> + [icons](/ref/DM/icon.md) ++ moving: Non-zero to extract only movement states, 0 for non-movement states, + or null (default) for both +*** +This is equivalent to new/icon(). It creates an /icon object, which is initialized to contain the same graphical data as the given file. If an icon state or direction are specified, only those parts of the original icon will be included in the new icon object. +*** +**Related Pages:** ++ [file proc](/ref/proc/file) ++ [icon_states proc](/ref/proc/icon_states) ++ [icons](/ref/DM/icon) diff --git a/ref/proc/icon_states.md b/ref/proc/icon_states.md index 9939ca9e..fb8389b5 100644 --- a/ref/proc/icon_states.md +++ b/ref/proc/icon_states.md @@ -1,43 +1,27 @@ -## icon_states proc + +## icon_states (proc) **Format:** + icon_states(Icon, mode=0) -**Returns:** -+ A list of text strings. - -**Args:** +**Arguments:** + Icon: the icon being accessed -+ mode: applies to icons larger than one tile when using - map_format=TILED_ICON_MAP; see below ++ mode: applies to icons larger than one tile when using map_format=TILED_ICON_MAP; see below -Icons may have one or more internal states, which are -identified by name. The state "" is the default. - -If you are not using the TILED_ICON_MAP value for world.map_format, -you can ignore the mode argument. +**Returns:** ++ A list of text strings. +*** +Icons may have one or more internal states, which are identified by name. The state "" is the default. -When graphics bigger than world.icon_size -are used as an icon, and the map_format in use is TILED_ICON_MAP, they -are internally broken up into tiles, one per icon state. The `mode` -argument was added for big icons that get split into several smaller -tiles. Those icons have several smaller states per true icon_state. For -example if your 64×64 icon has a state named "open", it will contain -states "open", "open 0,0", "open 1,0", "open 0,1", and "open -1,1" which are all used internally. (If the state name is blank, the -sub-states are just "0,0", etc.) When using the TILED_ICON_MAP format, -you need these for displaying the icon over several different atoms. +If you are not using the TILED_ICON_MAP value for world.map_format, you can ignore the mode argument. -mode=0 will only show the sub-states ("open 0,0" and so on), -all of which can be safely extracted in a single-tile icon via the -`icon()` proc. mode=1 will show the main state names ("open"); any -time you work with that state name you\'re working with the full-size -icon. mode=2 will show all of the states. +When graphics bigger than world.icon_size are used as an icon, and the map_format in use is TILED_ICON_MAP, they are internally broken up into tiles, one per icon state. The `mode` argument was added for big icons that get split into several smaller tiles. Those icons have several smaller states per true icon_state. For example if your 64×64 icon has a state named "open", it will contain states "open", "open 0,0", "open 1,0", "open 0,1", and "open 1,1" which are all used internally. (If the state name is blank, the sub-states are just "0,0", etc.) When using the TILED_ICON_MAP format, you need these for displaying the icon over several different atoms. -> [!TIP] -> **See also:** -> + [icons](/ref/DM/icon.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) \ No newline at end of file +mode=0 will only show the sub-states ("open 0,0" and so on), all of which can be safely extracted in a single-tile icon via the `icon()` proc. mode=1 will show the main state names ("open"); any time you work with that state name you're working with the full-size icon. mode=2 will show all of the states. +*** +**Related Pages:** ++ [icons](/ref/DM/icon) ++ [icon_size var (world)](/ref/world/var/icon_size) ++ [map_format var (world)](/ref/world/var/map_format) ++ [Big icons](/ref/{notes}/big-icons) ++ [Tiled icons](/ref/{notes}/tiled-icons) diff --git a/ref/proc/if.md b/ref/proc/if.md index e97b8579..4507439a 100644 --- a/ref/proc/if.md +++ b/ref/proc/if.md @@ -1,26 +1,25 @@ -## if proc + +## if (proc) **Format:** + if( E ) Statement1 + else if( E2 ) Statement2 + else Statement3 +*** +If the expression E is true (non-zero) then execute Statement1. Otherwise, test E2, etc. Finally, if none of the expressions are true, execute Statement3. The else nodes are all optional. -If the expression E is true (non-zero) then execute Statement1. -Otherwise, test E2, etc. Finally, if none of the expressions are true, -execute Statement3. The else nodes are all optional. +Statement1, Statement2, and Statement3 may be a single statement or a code block with optional braces: {}. -Statement1, Statement2, and Statement3 may be a single -statement or a code block with optional braces: {}. -### Example: ```dm + if(T==1) world << "TRUE" else world << "FALSE" + ``` - -This will display "TRUE" if T has value 1, and -"FALSE" otherwise. -> [!TIP] -> **See also:** -> + [goto proc](/ref/proc/goto.md) \ No newline at end of file + +This will display "TRUE" if T has value 1, and "FALSE" otherwise. +*** +**Related Pages:** ++ [goto proc](/ref/proc/goto) diff --git a/ref/proc/image.md b/ref/proc/image.md index f02e4ddf..ce025876 100644 --- a/ref/proc/image.md +++ b/ref/proc/image.md @@ -1,83 +1,68 @@ -## image proc -**Format:** -+ image(icon, loc, icon_state, layer, dir) (supports [named arguments](/ref/proc/arguments/named.md)) +## image (proc) -**Returns:** -+ An image reference on success; 0 on failure. +**Format:** ++ image(icon,loc,icon_state,layer,dir) ++ -**Args:** -+ icon: An icon, icon_state, object prototype, object instance, or - other image. -+ loc: The location at which to display the image. +**Arguments:** ++ icon: An icon, icon_state, object prototype, object instance, or other image. ++ loc: The location at which to display the image. + icon_state: The icon state to use. + layer: The drawing layer to use. + dir: The direction to orient the image. -Images are "virtual" objects, which have a purely visual -effect. Once created, they can be made to appear to selected players. -The image() instruction is simply a short-hand for new/image(). - -The image remains attached to the location specified by -`loc`. For example, if `loc` is a mob, the image -will appear above the mob until it is destroyed. - -The `icon` argument can be anything that can be interpreted as an appearance, i.e. -anything you might add to an overlays list. If this argument is -interpreted as an appearance, it will be used *instead of* the -appearance of the image type. A null value will use the image type\'s -own default appearance. An icon value will use the default appearance -but change the icon. A text string will be interpreted as the -`icon_state` argument if one is not present, but otherwise will be -interpreted as an appearance. - -The arguments `icon_state`, `layer`, and `dir` may be -used to override the settings associated with the icon or object used to -create the image. For example, the default drawing layer for an plain -icon is FLY_LAYER (above all other objects), but you could change this -to OBJ_LAYER to make it appear under mobs on the map. - -> [!NOTE] -> The fact that `image` -is essentially a wrapper for `new/image()` means that the arguments in -[image/New()](/ref/datum/proc/New.md) are always treated the same way -as defined in this article. This applies even to subtypes, like -`/image/thing`. If you create a user-defined subtype like -`new/image/thing()` it will still use the arguments the same way as in -`image()`. You can\'t meaningfully customize the arguments in `New()` -for images. -### Example: +**Returns:** ++ An image reference on success; 0 on failure. +*** +Images are "virtual" objects, which have a purely visual effect. Once created, they can be made to appear to selected players. The image() instruction is simply a short-hand for new/image(). + +The image remains attached to the location specified by `loc`. For example, if `loc` is a mob, the image will appear above the mob until it is destroyed. + +The `icon` argument can be anything that can be interpreted as an appearance, i.e. anything you might add to an overlays list. If this argument is interpreted as an appearance, it will be used *instead of* the appearance of the image type. A null value will use the image type's own default appearance. An icon value will use the default appearance but change the icon. A text string will be interpreted as the `icon_state` argument if one is not present, but otherwise will be interpreted as an appearance. + +The arguments `icon_state`, `layer`, and `dir` may be used to override the settings associated with the icon or object used to create the image. For example, the default drawing layer for an plain icon is FLY_LAYER (above all other objects), but you could change this to OBJ_LAYER to make it appear under mobs on the map. + ```dm + var/Box Box = image ('highlight.dmi', usr) usr << Box ... del(Box) //when done, remove image + ``` -Another -common use of images is in making an overlay: + +Another common use of images is in making an overlay: + + ```dm + overlays += image('pants.dmi',icon_state = "red") + ``` - -Since the `loc` argument could never be a text string, the above statement can be -further shortened: + + +Since the loc argument could never be a text string, the above statement can be further shortened: + + ```dm + overlays += image('pants.dmi',"red") + ``` -This is much preferable -to achieving the same effect with `icon('pants.dmi',"red")`, since that -involves the overhead of creating a new icon file, which should only be -done when it is really necessary. - -> [!TIP] -> **See also:** -> + [<< operator](/ref/operator/%3c%3c.md) -> + [del proc](/ref/proc/del.md) -> + [icon](/ref/icon.md) -> + [image objects](/ref/image.md) -> + [images var (client)](/ref/client/var/images.md) -> + [overlays var (atom)](/ref/atom/var/overlays.md) \ No newline at end of file + +This is much preferable to achieving the same effect with icon('pants.dmi',"red"), since that involves the overhead of creating a new icon file, which should only be done when it is really necessary. + +Note: The fact that `image` is essentially a wrapper for `new/image()` means that the arguments in image/New() are always treated the same way as defined in this article. This applies even to subtypes, like `/image/thing`. If you create a user-defined subtype like `new/image/thing()` it will still use the arguments the same way as in `image()`. You can't meaningfully customize the arguments in `New()` for images. +*** +**Related Pages:** ++ [<< operator](/ref/operator/%3c%3c) ++ [del proc](/ref/proc/del) ++ [icon](/ref/icon) ++ [image objects](/ref/image) ++ [images var (client)](/ref/client/var/images) ++ [overlays](/ref/atom/var/overlays) diff --git a/ref/proc/index.md b/ref/proc/index.md new file mode 100644 index 00000000..1734359d --- /dev/null +++ b/ref/proc/index.md @@ -0,0 +1,55 @@ + +## proc (proc) +*** +Procs may be derived from /proc. These procs are "global", in that they can be called anywhere in the code. + + +```dm + +proc/poof() + world << "POOF!" + +``` + + +The proc `poof()` may now be called anywhere in the code. + +Procs may also be attached to objects by defining them under the appropriate `object/proc` subnode. Currently DM allows procs to be defined or overridden for `/mob`, `/obj`, `/turf`, `/area`, `world`, and `/client`, as well as for datum objects derived from `/`. Predefined procs are discussed under the "procs" entry for the object type. + + +```dm + +mob/proc/poof() + world << "POOF!" + +``` + + +This can be called by a mob var M, using `M.poof()`. + +It is possible to define what type of value a proc is expected to return, by following its definition with an `as` clause. This can be a type path, such as `as /mob/player`, or a more intrinsic type like `as num` or `as list`. + + +```dm + +mob/monster + var/mob/player/target + + proc/GetTarget() as /mob/player + if(!target) + // find a /mob/player in view + target = locate() in view(src) + return target + +``` + + +Currently the only purpose for using the `as` clause is for situations where the compiler needs to infer the type of an expression. Mainly this applies to the . and ?. operators in an expression such as `GetTarget()?.Attack(src)`. Giving `GetTarget()` a return type allows the compiler to check if `Attack()` is a valid proc for `/mob/player`. Otherwise, the `.` and `?.` operators act like `:` and `?:`, respectively; the compiler won't do any checking to see if `Attack()` is valid. +*** +**Related Pages:** ++ [vars (procs)](/ref/proc/var) ++ [arguments (proc)](/ref/proc/arguments) ++ [procs (area)](/ref/area/proc) ++ [procs (mob)](/ref/mob/proc) ++ [procs (obj)](/ref/obj/proc) ++ [procs (turf)](/ref/turf/proc) diff --git a/ref/proc/initial.md b/ref/proc/initial.md index bae75593..d9dabdd3 100644 --- a/ref/proc/initial.md +++ b/ref/proc/initial.md @@ -1,26 +1,25 @@ -## initial proc + +## initial (proc) **Format:** + initial(Var) -**Args:** +**Arguments:** + Var: A variable to find the initial value of. +*** +This returns the original compile-time value of a variable. It could be used to reset a variable to its default value or to check if a variable has changed. -This returns the original compile-time value of a variable. It -could be used to reset a variable to its default value or to check if a -variable has changed. -### Example: ```dm + obj/verb/set_icon(I as null|icon) if(!I) I = initial(icon) icon = I + ``` -This example allows an object\'s icon to be modified. If the user -does not specify a new icon, it will be reset to the original one. - -> [!TIP] -> **See also:** -> + [:: operator](/ref/operator/::.md) -> + [issaved proc](/ref/proc/issaved.md) -> + [vars list var (datum)](/ref/datum/var/vars.md) \ No newline at end of file + +*** +**Related Pages:** ++ [:: operator](/ref/operator/::) ++ [issaved proc](/ref/proc/issaved) ++ [vars](/ref/datum/var/vars) diff --git a/ref/proc/input.md b/ref/proc/input.md index 9a755b09..b6487182 100644 --- a/ref/proc/input.md +++ b/ref/proc/input.md @@ -1,32 +1,27 @@ -## input proc -**Format:** -+ input(Recipient=usr, Message, Title, Default) as Type in List +## input (proc) -**Returns:** -+ User\'s response. +**Format:** ++ input(Recipient=usr,Message,Title,Default) as Type in List -**Args:** +**Arguments:** + Recipient: The user who will see this input prompt. -+ Message: A message in the prompt, to tell the user what it\'s asking - for. ++ Message: A message in the prompt, to tell the user what it's asking for. + Title: The title of the prompt window. -+ Default: Default value that is pre-populated or pre-selected, if the user cancels the input. -+ Type: A verb input type, such as `text`, `message`, `num`, - `anything`. If you omit "as Type", the type defaults to `text`. ++ Default: Default value if the user cancels the input. ++ Type: A verb input type, such as , , , . If you omit "as Type", the type defaults to . + List: An optional list of items to choose from. -Creates a prompt dialog that asks the user for a response. The -current proc sleeps until they respond. +**Returns:** ++ User's response. +*** +Creates a prompt dialog that asks the user for a response. The current proc sleeps until they respond. + +The only required argument is the message. The type may be any combination of input types allowed for verb arguments, which can be combined with the `|` operator. The `null` type will allow the user to cancel, e.g. `as null | anything in contents`. -The only required -argument is the message. The type may be any combination of input types -allowed for verb arguments, which can be combined with the `|` operator. -The `null` type will allow the user to cancel, e.g. -`as null | anything in contents`. -### Example: ```dm + mob/verb/create_character() usr.name = input("Choose a name for your character.", "Your Name", @@ -35,19 +30,17 @@ mob/verb/create_character() usr.gender = input("Select a gender for your character.", "Your Gender", usr.gender) in list("male","female","neuter") + ``` -If the target of the input prompt is not a player, the result -will be the default value. If no default value is specified and null is -allowed by the input type, null will be returned. Otherwise, an error -will result, crashing the proc that called `input()`. -A more common use for `input()` is to give a player a list of things to choose -from. For example, this is a simple shopkeeper NPC, where the -shopkeeper\'s inventory is its contents. -### Example: +If the target of the input prompt is not a player, the result will be the default value. If no default value is specified and null is allowed by the input type, null will be returned. Otherwise, an error will result, crashing the proc that called `input()`. + +A more common use for `input()` is to give a player a list of things to choose from. For example, this is a simple shopkeeper NPC, where the shopkeeper's inventory is its contents. + ```dm + mob/shopkeeper/verb/Buy() var/list/options = list() var/obj/item @@ -65,25 +58,23 @@ mob/shopkeeper/verb/Buy() new t(usr) usr.gold -= item.price usr << "You bought \a [item] for $[item.price]." + ``` -Using `as num` is another popular input choice, -which you might use for haggling, deciding how many of an item to pick -up or drop, etc. +Using `as num` is another popular input choice, which you might use for haggling, deciding how many of an item to pick up or drop, etc. + > [!CAUTION] -> This next part is important! Always validate input from a user to make -sure it\'s correct. +> +> > [!NOTE] +> > This next part is important! Always validate input from a user to make sure it's correct. + +You should be sure to sanitize any user input to make sure the value is valid. For instance, if you have a verb that gives gold to another player, you should check that the amount isn't negative and doesn't contain any fractions, and isn't more than they have. -You should be sure to sanitize any user -input to make sure the value is valid. For instance, if you have a verb -that gives gold to another player, you should check that the amount -isn\'t negative and doesn\'t contain any fractions, and isn\'t more than -they have. -### Example: ```dm + mob/player/verb/Give_Gold() set src in oview(1) var/amount = input("How much?", "Give gold") as null|num @@ -95,16 +86,12 @@ mob/player/verb/Give_Gold() usr.gold -= amount usr << "You gave [src] $[amount]." src << "[src] gave you $[amount]." + ``` -Likewise if you\'re allowing a user -to input text, it too should be sanitized. If they shouldn\'t enter -multi-line text, you should strip out `"\n"` characters. If they\'re -putting in something like a character name, strip out any HTML via -`html_encode()`, or you can simply reject anything that contains invalid -characters and make them do it again. - -> [!TIP] -> **See also:** -> + [alert proc](/ref/proc/alert.md) -> + [arguments (verb)](/ref/verb/arguments.md) \ No newline at end of file + +Likewise if you're allowing a user to input text, it too should be sanitized. If they shouldn't enter multi-line text, you should strip out `"\n"` characters. If they're putting in something like a character name, strip out any HTML via `html_encode()`, or you can simply reject anything that contains invalid characters and make them do it again. +*** +**Related Pages:** ++ [alert proc](/ref/proc/alert) ++ [arguments (verb)](/ref/verb/arguments) diff --git a/ref/proc/isarea.md b/ref/proc/isarea.md index 3ba372af..550cedbd 100644 --- a/ref/proc/isarea.md +++ b/ref/proc/isarea.md @@ -1,14 +1,14 @@ -## isarea proc + +## isarea (proc) **Format:** + isarea(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid areas; 0 otherwise - -> [!TIP] -> **See also:** -> + [isloc proc](/ref/proc/isloc.md) \ No newline at end of file +****** +**Related Pages:** ++ [isloc proc](/ref/proc/isloc) diff --git a/ref/proc/isfile.md b/ref/proc/isfile.md index f9448f14..9b02f231 100644 --- a/ref/proc/isfile.md +++ b/ref/proc/isfile.md @@ -1,16 +1,15 @@ -## isfile proc + +## isfile (proc) **Format:** + isfile(File) -**Args:** +**Arguments:** + File: the value to test - -This returns a true value when given a file. Both objects -returned by file() and files stored in the resource cache qualify. - -> [!TIP] -> **See also:** -> + [cache](/ref/DM/cache.md) -> + [file proc](/ref/proc/file.md) -> + [isicon proc](/ref/proc/isicon.md) \ No newline at end of file +*** +This returns a true value when given a file. Both objects returned by file() and files stored in the resource cache qualify. +*** +**Related Pages:** ++ [cache](/ref/DM/cache) ++ [file proc](/ref/proc/file) ++ [isicon proc](/ref/proc/isicon) diff --git a/ref/proc/isicon.md b/ref/proc/isicon.md index 4dfae145..17ec30fd 100644 --- a/ref/proc/isicon.md +++ b/ref/proc/isicon.md @@ -1,19 +1,18 @@ -## isicon proc + +## isicon (proc) **Format:** + isicon(Icon) -**Args:** +**Arguments:** + Icon: the value to test **Returns:** + 1 if the value is a valid icon; 0 otherwise. - -This returns a true value when given an icon. Both `/icon` -memory objects and icon files stored in the resource cache qualify. - -> [!TIP] -> **See also:** -> + [cache](/ref/DM/cache.md) -> + [icon](/ref/icon.md) -> + [isfile proc](/ref/proc/isfile.md) \ No newline at end of file +*** +This returns a true value when given an icon. Both `/icon` memory objects and icon files stored in the resource cache qualify. +*** +**Related Pages:** ++ [cache](/ref/DM/cache) ++ [icon](/ref/icon) ++ [isfile proc](/ref/proc/isfile) diff --git a/ref/proc/isinf.md b/ref/proc/isinf.md index 77505fb5..4de4432f 100644 --- a/ref/proc/isinf.md +++ b/ref/proc/isinf.md @@ -1,18 +1,16 @@ -## isinf proc -###### BYOND Version 515 + +## isinf (proc) **Format:** + isinf(n) -**Args:** +**Arguments:** + n: A number **Returns:** -+ 1 if this is an infinite numeric value, either positive or negative; - 0 otherwise - -> [!TIP] -> **See also:** -> + [isnum proc](/ref/proc/isnum.md) -> + [isnan proc](/ref/proc/isnan.md) -> + [Numbers](ref/notes/numbers) \ No newline at end of file ++ 1 if this is an infinite numeric value, either positive or negative; 0 otherwise +****** +**Related Pages:** ++ [isnum proc](/ref/proc/isnum) ++ [isnan proc](/ref/proc/isnan) ++ [Numbers](/ref/{notes}/numbers) diff --git a/ref/proc/islist.md b/ref/proc/islist.md index 63c751ea..2fe1ff44 100644 --- a/ref/proc/islist.md +++ b/ref/proc/islist.md @@ -1,19 +1,17 @@ -## islist proc -###### BYOND Version 513 + +## islist (proc) **Format:** + islist(Object) -**Args:** +**Arguments:** + Object: The value to test **Returns:** + 1 if the object is a valid list; 0 otherwise. - -Tests whether an object is a list. This includes user-defined -lists, special lists like `contents` and `overlays`, and more. - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [list proc](/ref/proc/list.md) \ No newline at end of file +*** +Tests whether an object is a list. This includes user-defined lists, special lists like `contents` and `overlays`, and more. +*** +**Related Pages:** ++ [list](/ref/list) ++ [list proc](/ref/proc/list) diff --git a/ref/proc/isloc.md b/ref/proc/isloc.md index 4d5b4a25..30107992 100644 --- a/ref/proc/isloc.md +++ b/ref/proc/isloc.md @@ -1,15 +1,16 @@ -# isloc proc + +## isloc (proc) + **Format:** + isloc(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid locs; 0 otherwise. +*** +Tests validity of a location. If all arguments are mobs, objs, turfs, or areas, this returns 1. -Tests validity of a location. If all arguments are mobs, objs, -turfs, or areas, this returns 1. - -For a single argument this is -equivalent to: `(ismob(Loc) || isobj(Loc) || isturf(Loc) || isarea(Loc))`. \ No newline at end of file +For a single argument this is equivalent to: `(ismob(Loc) || isobj(Loc) || isturf(Loc) || isarea(Loc))`. +*** \ No newline at end of file diff --git a/ref/proc/ismob.md b/ref/proc/ismob.md index 16c4ab20..92190682 100644 --- a/ref/proc/ismob.md +++ b/ref/proc/ismob.md @@ -1,15 +1,15 @@ -## ismob proc + +## ismob (proc) **Format:** + ismob(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid mobs; 0 otherwise - -> [!TIP] -> **See also:** -> + [isloc proc](/ref/proc/isloc.md) -> + [ismovable proc](/ref/proc/ismovable.md) \ No newline at end of file +****** +**Related Pages:** ++ [isloc proc](/ref/proc/isloc) ++ [ismovable proc](/ref/proc/ismovable) diff --git a/ref/proc/ismovable.md b/ref/proc/ismovable.md index 21df9b01..e56414e0 100644 --- a/ref/proc/ismovable.md +++ b/ref/proc/ismovable.md @@ -1,21 +1,18 @@ -## ismovable proc -###### BYOND Version 513 + +## ismovable (proc) **Format:** + ismovable(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid objs or mobs; 0 otherwise - - -Movable atoms are either objs or mobs, so this combines the -`isobj` and `ismob` tests into a single proc. - -> [!TIP] -> **See also:** -> + [isloc proc](/ref/proc/isloc.md) -> + [isobj proc](/ref/proc/isobj.md) -> + [ismob proc](/ref/proc/ismob.md) \ No newline at end of file +*** +Movable atoms are either objs or mobs, so this combines the `isobj` and `ismob` tests into a single proc. +*** +**Related Pages:** ++ [isloc proc](/ref/proc/isloc) ++ [isobj proc](/ref/proc/isobj) ++ [ismob proc](/ref/proc/ismob) diff --git a/ref/proc/isnan.md b/ref/proc/isnan.md index fcfeda64..1791f879 100644 --- a/ref/proc/isnan.md +++ b/ref/proc/isnan.md @@ -1,25 +1,20 @@ -## isnan proc -###### BYOND Version 515 + +## isnan (proc) **Format:** + isnan(n) -**Args:** +**Arguments:** + n: A number **Returns:** -+ 1 if this is a numeric value but is an invalid "not a number" - (NaN); 0 otherwise - -Some math operations return the special number `NaN` if -they\'re undefined, such as dividing 0 by 0. This tells you if a number -is that type. - -NaN is never greater than, less than, or equal to -another number, even itself. ++ 1 if this is a numeric value but is an invalid "not a number" (NaN); 0 otherwise +*** +Some math operations return the special number `NaN` if they're undefined, such as dividing 0 by 0. This tells you if a number is that type. -> [!TIP] -> **See also:** -> + [isnum proc](/ref/proc/isnum.md) -> + [isinf proc](/ref/proc/isinf.md) -> + [Numbers](ref/notes/numbers) \ No newline at end of file +NaN is never greater than, less than, or equal to another number, even itself. +*** +**Related Pages:** ++ [isnum proc](/ref/proc/isnum) ++ [isinf proc](/ref/proc/isinf) ++ [Numbers](/ref/{notes}/numbers) diff --git a/ref/proc/isnull.md b/ref/proc/isnull.md index 347343ee..2e3f1015 100644 --- a/ref/proc/isnull.md +++ b/ref/proc/isnull.md @@ -1,11 +1,11 @@ -## isnull proc + +## isnull (proc) **Format:** + isnull(Val) **Returns:** + 1 if Val is null; 0 otherwise - -> [!TIP] -> **See also:** -> + [null](/ref/DM/null.md) \ No newline at end of file +****** +**Related Pages:** ++ [null](/ref/DM/null) diff --git a/ref/proc/isnum.md b/ref/proc/isnum.md index b2454bb6..8d7603bd 100644 --- a/ref/proc/isnum.md +++ b/ref/proc/isnum.md @@ -1,14 +1,13 @@ -## isnum proc +## isnum (proc) **Format:** + isnum(Val) **Returns:** + 1 if Val is a number; 0 otherwise - -> [!TIP] -> **See also:** -> + [isinf proc](/ref/proc/isinf.md) -> + [isnan proc](/ref/proc/isnan.md) -> + [Numbers](ref/notes/numbers) \ No newline at end of file +****** +**Related Pages:** ++ [isinf proc](/ref/proc/isinf) ++ [isnan proc](/ref/proc/isnan) ++ [Numbers](/ref/{notes}/numbers) diff --git a/ref/proc/isobj.md b/ref/proc/isobj.md index 6c65ebd4..476913af 100644 --- a/ref/proc/isobj.md +++ b/ref/proc/isobj.md @@ -1,15 +1,15 @@ -## isobj proc + +## isobj (proc) **Format:** + isobj(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid objs; 0 otherwise - -> [!TIP] -> **See also:** -> + [isloc proc](/ref/proc/isloc.md) -> + [ismovable proc](/ref/proc/ismovable.md) \ No newline at end of file +****** +**Related Pages:** ++ [isloc proc](/ref/proc/isloc) ++ [ismovable proc](/ref/proc/ismovable) diff --git a/ref/proc/ispath.md b/ref/proc/ispath.md index a77bcff6..9b4e453a 100644 --- a/ref/proc/ispath.md +++ b/ref/proc/ispath.md @@ -1,27 +1,29 @@ -## ispath proc + +## ispath (proc) **Format:** + ispath(Val) + ispath(Val,Type) +**Arguments:** ++ Val: A type path. ++ Type: A type path or instance. + **Returns:** + single-argument: 1 if Val is a type path -+ double-argument: 1 if Val is a type path derived from Type; 0 - otherwise. - -**Args:** -+ Val: A type path. -+ Type: A type path or instance. -### Example: ++ double-argument: 1 if Val is a type path derived from Type; 0 otherwise. +*** ```dm + var/M M = /mob/ugly/duckling if(ispath(M,/mob/ugly)) //true if(ispath(M)) //true if(ispath(new/mob)) //false + ``` -> [!TIP] -> **See also:** -> + [typesof proc](/ref/proc/typesof.md) \ No newline at end of file +*** +**Related Pages:** ++ [typesof proc](/ref/proc/typesof) diff --git a/ref/proc/ispointer.md b/ref/proc/ispointer.md index d5d4f1cb..90f25d13 100644 --- a/ref/proc/ispointer.md +++ b/ref/proc/ispointer.md @@ -1,23 +1,19 @@ -## ispointer proc -###### BYOND Version 515 + +## ispointer (proc) **Format:** + ispointer(Value) -**Args:** +**Arguments:** + Value: The value to test **Returns:** + 1 if the value is a pointer; 0 otherwise. +*** +Tests whether an value is a pointer. -Tests whether an value is a pointer. - -> [!NOTE] -> This does not check if the pointer is still valid, like for instance if the object -it belongs to has been deleted, or if it points to a list index that is -now out of bounds. - -> [!TIP] -> **See also:** -> + [* operator (pointers)](/ref/operator/*.md) -> + [& operator (pointers)](/ref/operator/&.md) \ No newline at end of file +Note: This does not check if the pointer is still valid, like for instance if the object it belongs to has been deleted, or if it points to a list index that is now out of bounds. +*** +**Related Pages:** ++ [* operator (pointers)](/ref/operator/*) ++ [& operator (pointers)](/ref/operator/&) diff --git a/ref/proc/issaved.md b/ref/proc/issaved.md index 80aa45c6..6be8affd 100644 --- a/ref/proc/issaved.md +++ b/ref/proc/issaved.md @@ -1,18 +1,16 @@ -## issaved proc + +## issaved (proc) **Format:** + issaved(Var) -**Args:** +**Arguments:** + Var: The variable to test. - -This returns 1 if the given variable should be automatically -saved when writing an object to a savefile and 0 otherwise. Variables -which are not global, const, or tmp will return 1. - -> [!TIP] -> **See also:** -> + [initial proc](/ref/proc/initial.md) -> + [savefile](/ref/savefile.md) -> + [tmp vars](/ref/var/tmp.md) -> + [vars list var (datum)](/ref/datum/var/vars.md) \ No newline at end of file +*** +This returns 1 if the given variable should be automatically saved when writing an object to a savefile and 0 otherwise. Variables which are not global, const, or tmp will return 1. +*** +**Related Pages:** ++ [initial proc](/ref/proc/initial) ++ [savefile](/ref/savefile) ++ [tmp vars](/ref/var/tmp) ++ [vars](/ref/datum/var/vars) diff --git a/ref/proc/istext.md b/ref/proc/istext.md index 4f2c1998..c47122e5 100644 --- a/ref/proc/istext.md +++ b/ref/proc/istext.md @@ -1,6 +1,9 @@ -# istext proc + +## istext (proc) + **Format:** + istext(Val) **Returns:** -+ 1 if Val is text; 0 otherwise \ No newline at end of file ++ 1 if Val is text; 0 otherwise +****** \ No newline at end of file diff --git a/ref/proc/isturf.md b/ref/proc/isturf.md index 4be02df3..3fe60197 100644 --- a/ref/proc/isturf.md +++ b/ref/proc/isturf.md @@ -1,14 +1,14 @@ -## isturf proc + +## isturf (proc) **Format:** + isturf(Loc1, Loc2 ...) -**Args:** +**Arguments:** + Any number of locations to test. **Returns:** + 1 if all args are valid turfs; 0 otherwise - -> [!TIP] -> **See also:** -> + [isloc proc](/ref/proc/isloc.md) \ No newline at end of file +****** +**Related Pages:** ++ [isloc proc](/ref/proc/isloc) diff --git a/ref/proc/istype.md b/ref/proc/istype.md index 7b0a2d13..ac2dd75f 100644 --- a/ref/proc/istype.md +++ b/ref/proc/istype.md @@ -1,43 +1,48 @@ -## istype proc + +## istype (proc) **Format:** + istype(Val,Type) + istype(Val) +**Arguments:** ++ Val: An object instance. ++ Type: An object prototype or instance. If no type is specified and a + variable was passed in as the first argument, it will default to the + declared type of the variable. + **Returns:** + 1 if Val is derived from Type; 0 otherwise. +*** +If you don't have an object instance to test, but just want to see if one prototype derives from another one, use ispath() instead. -**Args:** -+ Val: An object instance. -+ Type: An object prototype or instance. If no type is specified and a - variable was passed in as the first argument, it will default to the - declared type of the variable. - -If you don\'t have an object instance to test, but just want to -see if one prototype derives from another one, use -[ispath()](/ref/proc/ispath.md) instead. -### Example: ```dm + var/M M = new/mob/ugly/duckling() if(istype(M,/mob/ugly)) //this will be true usr << "[M] is ugly!" + ``` -Using implicit types, that same example can be rewritten as -follows: + +Using implicit types, that same example can be rewritten as follows: + + ```dm + var/mob/ugly/M M = new/mob/ugly/duckling() if(istype(M)) //this will be true usr << "[M] is ugly!" + ``` -> [!TIP] -> **See also:** -> + [ispath proc](/ref/proc/ispath.md) -> + [locate proc](/ref/proc/locate.md) -> + [typesof proc](/ref/proc/typesof.md) -> + [astype proc](/ref/proc/astype.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +*** +**Related Pages:** ++ [ispath proc](/ref/proc/ispath) ++ [locate proc](/ref/proc/locate) ++ [typesof proc](/ref/proc/typesof) ++ [astype proc](/ref/proc/astype) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/proc/jointext.md b/ref/proc/jointext.md index 4d9f6954..0539a158 100644 --- a/ref/proc/jointext.md +++ b/ref/proc/jointext.md @@ -1,38 +1,35 @@ -## jointext proc -###### BYOND Version 510 + +## jointext (proc) **Format:** + jointext(List,Glue,Start=1,End=0) -**Returns:** -+ A text string made up of the items in List, joined together by Glue. - -**Args:** +**Arguments:** + List: The list to be joined. + Glue: The text that will go between each item. + Start: The list item on which to begin. + End: The list item immediately following the last item to be joined. -+ include_delimiters: True if any delimiters found should be included - in the result. ++ include_delimiters: True if any delimiters found should be included in + the result. + +**Returns:** ++ A text string made up of the items in List, joined together by Glue. +*** +Any items in List that are not already text will be converted to text. The Glue string only goes between two items, so a single-item list is the same as converting that one item to text, and an empty list becomes an empty string. -Any items in List that are not already text will be converted -to text. The Glue string only goes between two items, so a single-item -list is the same as converting that one item to text, and an empty list -becomes an empty string. -### Example: ```dm + var/list/items = list("apples", "oranges", "bananas") usr << jointext(items, ", ") + ``` -If the start or end position is negative, the position -is counted backwards from the end of the list. -Calling List.Join(Glue,Start,End) is -the same thing, as long as List is a valid list. +If the start or end position is negative, the position is counted backwards from the end of the list. -> [!TIP] -> **See also:** -> + [splittext proc](/ref/proc/splittext.md) -> + [Join proc (list)](/ref/list/proc/Join.md) \ No newline at end of file +Calling List.Join(Glue,Start,End) is the same thing, as long as List is a valid list. +*** +**Related Pages:** ++ [splittext proc](/ref/proc/splittext) ++ [Join proc (list)](/ref/list/proc/Join) diff --git a/ref/proc/json_decode.md b/ref/proc/json_decode.md index 87e10a71..8bb9e3f3 100644 --- a/ref/proc/json_decode.md +++ b/ref/proc/json_decode.md @@ -1,55 +1,28 @@ -## json_decode proc -###### BYOND Version 510 + +## json_decode (proc) **Format:** + json_decode(JSON) + json_decode(JSON, flags) -**Returns:** -+ A value interpreted from a JSON-formatted text string. - -**Args:** +**Arguments:** + JSON: The JSON-formatted text to decode. + flags: A set of flags that tell the decoder how to act. +**Returns:** ++ A value interpreted from a JSON-formatted text string. +*** +Arrays like `[1,2,3]` will be converted to regular lists like `list(1,2,3)`. -Arrays like `[1,2,3]` will be converted to regular lists like -`list(1,2,3)`. - -Object literals like `{"a":1}` will be converted -to associative lists such as `list("a"=1)`. Each item in the list is -also decoded. Except in strict mode, non-string values are allowed as -the "keys" in an associaitve list, even though that\'s not valid JSON, -and strings used as keys can be left unquoted. BYOND doesn\'t care, as -long as it can understand the formatted text it\'s given. The only -exception is that a number isn\'t allowed to be an associative list key, -and will be converted to a string instead, so `{1:2}` becomes -`list("1"=2)`. - -Special numbers `NaN` and `Infinity` are -recognized correctly (these are case-sensitive). All other numbers are -parsed and stored in the regular BYOND format (32-bit floating point). - - -Since BYOND doesn\'t have dedicated boolean values, `true` and -`false` are interpreted as 1 and 0, respectively. +Object literals like `{"a":1}` will be converted to associative lists such as `list("a"=1)`. Each item in the list is also decoded. Except in strict mode, non-string values are allowed as the "keys" in an associaitve list, even though that's not valid JSON, and strings used as keys can be left unquoted. BYOND doesn't care, as long as it can understand the formatted text it's given. The only exception is that a number isn't allowed to be an associative list key, and will be converted to a string instead, so `{1:2}` becomes `list("1"=2)`. -The -`JSON_STRICT` flag uses stricter JSON parsing rules and will not allow -some things. In strict mode: -- All strings must be double-quoted. -- Special numbers `NaN` and `Infinity` are not allowed, but the - `{__number__:"NaN"}` format used by `json_encode()` is recognized as - a number. -- Keys in an associative list must always be strings, and must be - double-quoted. +Special numbers `NaN` and `Infinity` are recognized correctly (these are case-sensitive). All other numbers are parsed and stored in the regular BYOND format (32-bit floating point). +Since BYOND doesn't have dedicated boolean values, `true` and `false` are interpreted as 1 and 0, respectively. -The `JSON_ALLOW_COMMENTS` flag allows you to include `//` -single-line comments and `/* ... */` long-form comments in the text to -be decoded. This can be mixed with the strict flag. This flag is now -used by default. +The `JSON_STRICT` flag uses stricter JSON parsing rules and will not allow some things. In strict mode: -> [!TIP] -> **See also:** -> + [json_encode proc](/ref/proc/json_encode.md) \ No newline at end of file +The `JSON_ALLOW_COMMENTS` flag allows you to include `//` single-line comments and `/* ... */` long-form comments in the text to be decoded. This can be mixed with the strict flag. This flag is now used by default. +*** +**Related Pages:** ++ [json_encode proc](/ref/proc/json_encode) diff --git a/ref/proc/json_encode.md b/ref/proc/json_encode.md index b4adbc35..9eaec456 100644 --- a/ref/proc/json_encode.md +++ b/ref/proc/json_encode.md @@ -1,52 +1,40 @@ -## json_encode proc -###### BYOND Version 510 + +## json_encode (proc) **Format:** + json_encode(Value) + json_encode(Value, flags) -**Returns:** -+ A JSON-formatted text string representing Value. - -**Args:** +**Arguments:** + Value: The value to encode. + flags: A set of flags that tell the encoder how to act. -If Value is a simple list or a matrix, the result will be -formatted as a JSON array, and each item in the list is encoded. +**Returns:** ++ A JSON-formatted text string representing Value. +*** +If Value is a simple list or a matrix, the result will be formatted as a JSON array, and each item in the list is encoded. + +If Value is an associative list, the result will be formatted as a JSON object literal, and each item and associated value is encoded. (The keys in the object literal don't have to be strings. Even though that isn't valid JSON, BYOND doesn't care. Be aware however that strict JSON parsers *will* care.) -If Value is an associative list, the result will be formatted -as a JSON object literal, and each item and associated value is encoded. -(The keys in the object literal don\'t have to be strings. Even though -that isn\'t valid JSON, BYOND doesn\'t care. Be aware however that -strict JSON parsers *will* care.) +Datums are *not* serialized, but are converted to the equivalent of `"[Value]"` instead. -Datums are *not* serialized, -but are converted to the equivalent of `"[Value]"` instead. +The special numbers NaN and infinity will be encoded as object literals in a form like `{"__number__":"NaN"}`. -The special numbers NaN and infinity will be encoded as object literals in a -form like `{"__number__":"NaN"}`. -### Example: ```dm + var/list/info = list("name"="fridge", "power"=12) // send {"name":"fridge","power":12} to a JavaScript function usr << output(url_encode(json_encode(info)), "mybrowser:myJSfunction") + ``` -BYOND formatting such as \\red is removed from -encoded strings. -Situations where a list has a reference to -itself will cause the nested version to print a null value instead. +BYOND formatting such as \red is removed from encoded strings. -The `JSON_PRETTY_PRINT` flag introduces spacing into the output -for improved readibility. Spaces will be added after colons and commas. -Non-empty arrays and object literals will have a line break and tabs -before each item, and a line break with one fewer tab before the closing -bracket or brace. (The special formatting for numbers like Infinity, or -the list form for matrices, will not be given tabs and line breaks.) +Situations where a list has a reference to itself will cause the nested version to print a null value instead. -> [!TIP] -> **See also:** -> + [json_decode proc](/ref/proc/json_decode.md) \ No newline at end of file +The `JSON_PRETTY_PRINT` flag introduces spacing into the output for improved readibility. Spaces will be added after colons and commas. Non-empty arrays and object literals will have a line break and tabs before each item, and a line break with one fewer tab before the closing bracket or brace. (The special formatting for numbers like Infinity, or the list form for matrices, will not be given tabs and line breaks.) +*** +**Related Pages:** ++ [json_decode proc](/ref/proc/json_decode) diff --git a/ref/proc/length.md b/ref/proc/length.md index f70104db..ec2ca8cc 100644 --- a/ref/proc/length.md +++ b/ref/proc/length.md @@ -1,46 +1,48 @@ -## length proc +## length (proc) **Format:** + length(E) +**Arguments:** ++ E: text, list, file, or vector + **Returns:** + The length of the data associated with E. +*** -**Args:** -+ E: text, list, file, or vector -> [!NOTE] -> In strings containing non-ASCII characters, this is the length in bytes, not -characters; a character may span multiple bytes. Use `length_char()` to -work with character counts instead of bytes. See the -[Unicode](/ref/notes/Unicode.md) section for more information. +```dm +world << length("Hi") -For vectors, the length is the magnitude of the vector. See -[vector.len](/ref/vector/var/len.md). +``` -### Example: -```dm - world << length("Hi") -``` - This outputs, "2", the length of the string "Hi". -### Example: + ```dm - world << length(list(1,2,3)) + +world << length(list(1,2,3)) + ``` + This outputs, "3", the length of the list. -### Example: + ```dm - world << length(file("test.txt")) + +world << length(file("test.txt")) + ``` -This outputs the length of the file. -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) \ No newline at end of file +This outputs the length of the file. + +Note: In strings containing non-ASCII characters, this is the length in bytes, not characters; a character may span multiple bytes. Use `length_char()` to work with character counts instead of bytes. See the Unicode section for more information. + +For vectors, the length is the order of the vector, as in 2 for a 2D vector or 3 for a 3D vector. See vector.len. +*** +**Related Pages:** ++ [vector](/ref/vector) diff --git a/ref/proc/lentext.md b/ref/proc/lentext.md index 69b9515a..040d14fc 100644 --- a/ref/proc/lentext.md +++ b/ref/proc/lentext.md @@ -1,17 +1,20 @@ -## lentext proc -> [!IMPORTANT] -> `lentext()` is deprecated. Use [`length()`](/ref/proc/length.md) instead +## lentext (proc) **Format:** + lentext(T) +**Arguments:** ++ T: A text string. + **Returns:** + The length of text T. +*** -**Args:** -+ T: A text string. - -> [!TIP] -> **See also:** -> + [length proc](/ref/proc/length.md) \ No newline at end of file +> [!WARNING] +> +> > [!NOTE] +> > Use length() instead. +*** +**Related Pages:** ++ [length proc](/ref/proc/length) diff --git a/ref/proc/lerp.md b/ref/proc/lerp.md index c2cbcc04..32fa1494 100644 --- a/ref/proc/lerp.md +++ b/ref/proc/lerp.md @@ -1,37 +1,34 @@ -## lerp proc -###### BYOND Version 516 + +## lerp (proc) **Format:** + lerp(A, B, factor) -**Returns:** -+ The number that is factor% between A and B +**Arguments:** ++ A: A number, matrix, vector, or turf/pixloc. ++ B: Another number, matrix, vector, or turf/pixloc. ++ factor: Interpolation factor, usually 0 to 1 -**Args:** -+ A: A number, matrix, vector or turf/pixloc -+ B: A number, matrix, vector or turf/pixloc -+ factor: Interpolation Factor, usually between 0 and 1 +**Returns:** ++ An interpolated value between A and B +*** +Returns an interpolation or extrapolation from A to B. If factor is 0, A is returned; if factor is 1, B is returned. Otherwise an interpolated value between A and B is returned, based on the value of factor. The types of A and B must match, with few exceptions. -Returns an interpolation or extrapolation from A to B. If factor is 0, A is returned; if factor is 1, B is returned. Otherwise an interpolated value between A and B is returned, based on the value of factor. +This is basically equivalent to returning `A + (B-A) * factor` for most things. When interpolating objects such as vectors, the returned value is always a new value, never a direct copy of A or B. -This is basically equivalent to returning A + (B-A) * factor for most things. When interpolating objects such as vectors, the returned value is always a new value, never a direct copy of A or B. -> [!IMPORTANT] -> The types of A and B must match, with few exceptions. +```dm -### Example: +usr << lerp(1, 5, 0.25) // outputs 2 -```dm -world << lerp(0, 10, 0.25) // outputs 2.5 -world << lerp(5, 10, 0.25) // outputs 7.5 -world << lerp(1, 10, 2) // outputs 21 ``` -Turfs can be treated like pixlocs in lerp(), so you can interpolate between turfs. Note that they must have the same Z coordinate. -Matrix interpolation behaves according to the rules in the [matrix Interpolate proc](/ref/matrix/proc/Interpolate.md). -> [!TIP] -> **See also:** -> + [vector](/ref/vector/vector.md) -> + [pixloc](/ref/pixloc/pixloc.md) -> + [Interpolate proc (matrix)](/ref/matrix/proc/Interpolate.md) \ No newline at end of file +Turfs can be treated like pixlocs in `lerp()`, so you can interpolate between turfs. Note that they must have the same Z coordinate. + +Matrix interpolation behaves according to the rules in the matrix Interpolate() proc. For linear interpolation you need to use `A + (B-A) * factor` instead. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [pixloc](/ref/pixloc) ++ [Interpolate proc (matrix)](/ref/matrix/proc/Interpolate) diff --git a/ref/proc/link.md b/ref/proc/link.md index d744daba..b19b62f1 100644 --- a/ref/proc/link.md +++ b/ref/proc/link.md @@ -1,32 +1,35 @@ -## link proc + +## link (proc) **Format:** + O << link(url) +*** +This causes the recipient (O) to view the specified url. The url could be a web or BYOND address. In the latter case, the player will disconnect from the current world and connect to the specified one. + +The format of a BYOND url is as follows: -This causes the recipient (O) to view the specified url. The -url could be a web or BYOND address. In the latter case, the player will -disconnect from the current world and connect to the specified one. -The format of a BYOND url is as follows: ```dm -byond://address:port?TopicData + +byond://address:port?TopicData + ``` - -To access a registered world, address:port may be replaced by the registered name in -the hub. The optional topic data is processed by the world once the -player has connected. If only a topic is specified, the current world -processes it. -### Example: + + +To access a registered world, address:port may be replaced by the registered name in the hub. The optional topic data is processed by the world once the player has connected. If only a topic is specified, the current world processes it. + ```dm + usr << link("byond://byond.com:6000") //BYOND address usr << link("http://www.byond.com") //web address usr << link("?myTopic") //topic + ``` -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [file proc](/ref/proc/file.md) -> + [run proc](/ref/proc/run.md) \ No newline at end of file +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [file proc](/ref/proc/file) ++ [run proc](/ref/proc/run) diff --git a/ref/proc/list.md b/ref/proc/list.md index e5a12ba5..ea776542 100644 --- a/ref/proc/list.md +++ b/ref/proc/list.md @@ -1,55 +1,55 @@ -## list proc + +## list (proc) **Format:** + list(A,B,C,...) + or + list(A=a,B=b,C=c,...) -**Returns:** -+ A new list with contents A, B, C, and (optional) associated values - a, b, c. - -**Args:** +**Arguments:** + Arbitrary number of elements to be inserted into the list. - +**Returns:** ++ A new list with contents A, B, C, and (optional) associated values a, b, c. +*** Assign elements to a list. -### Example: + ```dm + var/L[] L = list(1,2,3) + ``` -This creates a new list \'L\' that initially contains elements 1, 2, and 3. The -length of L is 3. -The `list()` instruction may also be used to -create associative lists. -### Example: +This creates a new list 'L' that initially contains elements 1, 2, and 3. The length of L is 3. + +The list() instruction may also be used to create associative lists. + ```dm + var/list/lst = list("player" = "James Byond", "score" = 2000) + ``` -That creates a list with contents -("player, "score") and associated values ("James Byond", 2000) -respectively. -The index values should be constants, and that -usually means text constants. When these index values happen to be text -strings that satisfy all the requirements for variable names, this may -also be written in a convenient short-hand without the double quotes: +That creates a list with contents ("player, "score") and associated values ("James Byond", 2000) respectively. + +The index values should be constants, and that usually means text constants. When these index values happen to be text strings that satisfy all the requirements for variable names, this may also be written in a convenient short-hand without the double quotes: + ```dm + var/list/lst = list(player = "James Byond", score = 2000) + ``` - -In other words, this is exactly the same -syntax as for [named arguments](/ref/proc/arguments/named.md) - -> [!TIP] -> **See also:** -> + [arglist proc](/ref/proc/arglist.md) -> + [list](/ref/list.md) -> + [list associations](/ref/list/associations.md) \ No newline at end of file + + +In other words, this is exactly the same syntax as for named arguments. +*** +**Related Pages:** ++ [arglist proc](/ref/proc/arglist) ++ [list](/ref/list) ++ [list associations](/ref/list/associations) diff --git a/ref/proc/list2params.md b/ref/proc/list2params.md index 4e56d540..ef8f5187 100644 --- a/ref/proc/list2params.md +++ b/ref/proc/list2params.md @@ -1,60 +1,48 @@ -## list2params proc + +## list2params (proc) **Format:** + list2params(List) -**Args:** +**Arguments:** + List: List to encode as a text string. +*** +This instruction converts a list of parameter names and associated values into a single text string suitable for use in a URL or similar situation. The format of the resulting text string is: -This instruction converts a list of parameter names and -associated values into a single text string suitable for use in a URL or -similar situation. The format of the resulting text string is: ```dm - "name1=value1&name2=value2&..." + +"name1=value1&name2=value2&..." + ``` -Special characters such as \'=\' and \'&\' inside the parameter -names or values are written in the form: `%xx` where `xx` are two -hexadecimal digits representing the ASCII value of the character. For -[Unicode](/ref/notes/Unicode.md) characters, their UTF-8 encoding will -be processed this way, which may make up multiple `%xx` sequences. In -addition, spaces are converted to `+`. -This parameter format is -the same one used by most HTML forms and is known by the MIME type -`application/x-www-form-urlencoded`. It is often used in DM to pack -information into topic links. +Special characters such as '=' and '&' inside the parameter names or values are written in the form: %xx where xx are two hexadecimal digits representing the ASCII value of the character. For Unicode characters, their UTF-8 encoding will be processed this way, which may make up multiple %xx sequences. In addition, spaces are converted to `+`. + +This parameter format is the same one used by most HTML forms and is known by the MIME type `application/x-www-form-urlencoded`. It is often used in DM to pack information into topic links. + +The original list has items `"name1"`, `"name2"`, and so on. These in turn are associated with the corresponding values `"value1"`, `"value2"`, and so on. -The original list has items -`"name1"`, `"name2"`, and so on. These in turn are associated with the -corresponding values `"value1"`, `"value2"`, and so on. -### Example: ```dm + var/plist[0] plist["offense"] = "jwalk" plist["time"] = "10:00" usr << list2params(plist) + ``` -The above example creates a simple parameter list which -associates the item "offense" with the value "jwalk" and the item -"time" with the value "10:00". This will produce the text string -"offense=jwalk&time=10:00". - -Object values in the list (like -say a mob) get turned into references in the parameter text, just as -though you had embedded them with "\\ref[Object]". When read back in -with params2list(), you could convert these values back into real -references by using locate(). - -> [!TIP] -> **See also:** -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [list associations](/ref/list/associations.md) -> + [params var (world)](/ref/world/var/params.md) -> + [params2list proc](/ref/proc/params2list.md) -> + [text2num proc](/ref/proc/text2num.md) \ No newline at end of file + +The above example creates a simple parameter list which associates the item "offense" with the value "jwalk" and the item "time" with the value "10:00". This will produce the text string "offense=jwalk&time=10:00". + +Object values in the list (like say a mob) get turned into references in the parameter text, just as though you had embedded them with "\ref[Object]". When read back in with params2list(), you could convert these values back into real references by using locate(). +*** +**Related Pages:** ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [list associations](/ref/list/associations) ++ [params](/ref/world/var/params) ++ [params2list proc](/ref/proc/params2list) ++ [text2num proc](/ref/proc/text2num) diff --git a/ref/proc/load_ext.md b/ref/proc/load_ext.md index 785db201..84924ef3 100644 --- a/ref/proc/load_ext.md +++ b/ref/proc/load_ext.md @@ -1,41 +1,34 @@ -## load_ext proc -###### BYOND Version 516 + +## load_ext (proc) **Format:** + load_ext(LibName,FuncName) -**Args:** -+ LibName: name of external library ("test.DLL") (note: the .dll or - .so suffix is not required) -+ FuncName: name of function in external library ("func"), which may - have prefixes to describe the type of function +**Arguments:** ++ LibName: name of external library ("test.DLL") (note: the .dll or .so suffix is not required) ++ FuncName: name of function in external library ("func"), which may have prefixes to describe the type of function **Returns:** -+ A reference to a function in an external library, for use with - `call_ext()`. ++ A reference to a function in an external library, for use with . +*** +Use `load_ext()` to pre-load external library functions you intend to use often, when maximum performance is required. (See call_ext() for the rules for loading libraries.) -Use `load_ext()` to pre-load external library functions you -intend to use often, when maximum performance is required. (See -[call_ext()](/ref/proc/call_ext.md) for the rules for loading -libraries.) +The result of this proc can be passed to `call_ext()` as a single argument in lieu of the normal LibName and FuncName. -The result of this proc can be passed to -`call_ext()` as a single argument in lieu of the normal LibName and -FuncName. +If the lookup fails for any reason, a runtime error will be thrown. -If the lookup fails for any reason, a runtime error -will be thrown. -### Example: ```dm + var/logfunc proc/LogLine(msg) logfunc ||= load_ext("my_lib", "byond:OutputToLog") call_ext(logfunc)(msg) + ``` -> [!TIP] -> **See also:** -> + [call_ext proc](/ref/proc/call_ext.md) -> + [Byondapi](/ref/appendix/Byondapi.md) \ No newline at end of file +*** +**Related Pages:** ++ [call_ext() proc](/ref/proc/call_ext) ++ [Byondapi](/ref/{{appendix}}/Byondapi) diff --git a/ref/proc/load_resource.md b/ref/proc/load_resource.md index f48efbeb..4a8fd246 100644 --- a/ref/proc/load_resource.md +++ b/ref/proc/load_resource.md @@ -1,44 +1,34 @@ -## load_resource proc + +## load_resource (proc) **Format:** + Player << load_resource(File) + Player << load_resource(File, KeepTime) -+ Player << load_resource(File1, File2..., KeepTime1, File3, - File4..., KeepTime2...) ++ Player << load_resource(File1, File2..., KeepTime1, File3, File4..., KeepTime2...) -**Args:** +**Arguments:** + Player: A mob or client, a list of them, or world + File: A resource file (image or sound) -+ KeepTime: Minimum time (in seconds) to keep the file loaded; - 0=default, -1=forever ++ KeepTime: Minimum time (in seconds) to keep the file loaded; 0=default, -1=forever +*** +Tells the player's client (or multiple players) to load the specified resources now, and how long to keep them. If you do not specify a keep time, 0 is used which will use the default time. -Tells the player\'s client (or multiple players) to load the -specified resources now, and how long to keep them. If you do not -specify a keep time, 0 is used which will use the default time. +This may be useful for loading sounds into memory before they play, or to load an icon as soon as possible even if it hasn't been displayed yet. This can avoid delays later on when the resources are needed. -This may be useful for loading sounds into memory before they -play, or to load an icon as soon as possible even if it hasn\'t been -displayed yet. This can avoid delays later on when the resources are -needed. +Dream Seeker keeps most assets loaded for at least 5 minutes (300 seconds) after their last use. However if you think a more appropriate time is closer to half an hour, you can set a keep time of 1800 seconds. Or if you want them to stay loaded indefinitely, set a keep time of -1. -Dream Seeker keeps most assets loaded for at least 5 -minutes (300 seconds) after their last use. However if you think a more -appropriate time is closer to half an hour, you can set a keep time of -1800 seconds. Or if you want them to stay loaded indefinitely, set a -keep time of -1. -### Example: ```dm + mob/Login() ..() // load up these songs now and keep them loaded indefinitely src << load_resource('music1.ogg', 'music2.ogg', 'music3.ogg', -1) + ``` -> [!IMPORTANT] -> In cases of extreme memory duress, Dream Seeker\'s garbage collector -will get more aggressive and can still override your choices if need be. -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) \ No newline at end of file +In cases of extreme memory duress, Dream Seeker's garbage collector will get more aggressive and can still override your choices if need be. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) diff --git a/ref/proc/locate.md b/ref/proc/locate.md index d2d05eb5..efcd40fc 100644 --- a/ref/proc/locate.md +++ b/ref/proc/locate.md @@ -1,4 +1,5 @@ -## locate proc + +## locate (proc) **Format:** + locate(Type) in Container @@ -6,58 +7,58 @@ + locate(Tag) + locate(TextRef) -**Returns:** -+ An object of the specified type or the turf at the given - coordinates. If a text string is given in place of an object type, - the object with the same tag is found. If a container is given, only - objects directly within that object are searched. - -**Args:** -+ Type: An object prototype or tag. If locate() is being used in an - assignment to a variable with a declared type, this argument is - optional and will default to the type of the variable being - assigned. -+ Container: An optional container object. (The default is `world`.) +**Arguments:** ++ Type: An object prototype or tag. If locate() is being used in an assignment to a variable with a declared type, this argument is optional and will default to the type of the variable being assigned. ++ Container: An optional container object. (The default is .) + X,Y,Z: A set of numerical coordinates. -+ Tag: The value of an object\'s tag variable (must be unique). -+ TextRef: An embedded object reference created by the \\ref text - macro. ++ Tag: The value of an object's tag variable (must be unique). ++ TextRef: An embedded object reference created by the \ref text macro. -Types are matched in the same manner as istype(). In other -words, locate(/obj) could return an instance of something derived from -/obj, such as /obj/armor. +**Returns:** ++ An object of the specified type or the turf at the given coordinates. + If a text string is given in place of an object type, the object with + the same tag is found. If a container is given, only objects + directly within that object are searched. +*** +Types are matched in the same manner as istype(). In other words, locate(/obj) could return an instance of something derived from /obj, such as /obj/armor. + +If there is more than one instance of the specified type, the first one found will be chosen. -If there is more than one instance of -the specified type, the first one found will be chosen. -### Example: ```dm + var/mob/shopkeeper/M = locate() if(M) usr << "Found the shopkeeper." else usr << "Could not find the shopkeeper." + ``` - -This looks for a mob of a type /mob/shopkeeper in -the world (world.contents). -### Example: + + +This looks for a mob of a type /mob/shopkeeper in the world (world.contents). + ```dm - usr.Move(locate(/turf/Home)) + +usr.Move(locate(/turf/Home)) + ``` - + + This "teleports" the usr to a turf of the type /turf/Home. -### Example: + ```dm - usr.Move(locate(1,2,3)) + +usr.Move(locate(1,2,3)) + ``` - -This moves the usr to the turf at coordinates (x,y,z) = (1,2,3). -> [!TIP] -> **See also:** -> + [istype proc](/ref/proc/istype.md) -> + [tag var (datum)](/ref/datum/var/tag.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file + +This moves the usr to the turf at coordinates (x,y,z) = (1,2,3). +*** +**Related Pages:** ++ [istype proc](/ref/proc/istype) ++ [tag](/ref/datum/var/tag) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/proc/log.md b/ref/proc/log.md index 2a3d0709..510cc635 100644 --- a/ref/proc/log.md +++ b/ref/proc/log.md @@ -1,25 +1,25 @@ -## log proc + +## log (proc) **Format:** + log(X,Y) + log(Y) **Returns:** -+ The logarithm (base X) of Y. If X is not specified, a natural - logarithm is computed (base 2.718...). ++ The logarithm (base X) of Y. If X is not specified, a natural logarithm +is computed (base 2.718...). +*** +The logarithm is the power to which you have to raise X in order to get Y. In other words, the following is true (ignoring round-off error): + -The logarithm is the power to which you have to raise X in -order to get Y. In other words, the following is true (ignoring -round-off error): ```dm - X ** log(X,Y) == Y + +X ** log(X,Y) == Y + ``` -One nice property of this function is that it gradually -increases, with a slope that continuously tapers off. In other words, it -can be useful to represent diminishing returns from some input, such as -money, experience points, and so forth. -> [!TIP] -> **See also:** -> + [** operator](/ref/operator/**.md) \ No newline at end of file +One nice property of this function is that it gradually increases, with a slope that continuously tapers off. In other words, it can be useful to represent diminishing returns from some input, such as money, experience points, and so forth. +*** +**Related Pages:** ++ [** operator](/ref/operator/**) diff --git a/ref/proc/lowertext.md b/ref/proc/lowertext.md index 1debcf49..f8512c79 100644 --- a/ref/proc/lowertext.md +++ b/ref/proc/lowertext.md @@ -1,21 +1,24 @@ -## lowertext proc + +## lowertext (proc) **Format:** + lowertext(T) -**Returns:** -+ A lowercase text string. - -**Args:** +**Arguments:** + T: A text string. +**Returns:** ++ A lowercase text string. +*** Make all of the characters of T lowercase. -### Example: + ```dm - L = lowertext("HI THERE") // = "hi there" + +L = lowertext("HI THERE") // = "hi there" + ``` -> [!TIP] -> **See also:** -> + [uppertext proc](/ref/proc/uppertext.md) \ No newline at end of file +*** +**Related Pages:** ++ [uppertext proc](/ref/proc/uppertext) diff --git a/ref/proc/matrix.md b/ref/proc/matrix.md index 258e38f1..e2464cc6 100644 --- a/ref/proc/matrix.md +++ b/ref/proc/matrix.md @@ -1,5 +1,5 @@ -## matrix proc -###### BYOND Version 500 + +## matrix (proc) **Format:** + matrix() @@ -10,31 +10,20 @@ + matrix(angle, MATRIX_ROTATE) + matrix(x, y, MATRIX_TRANSLATE) -**Returns:** -+ A new matrix. - -**Args:** +**Arguments:** + Matrix: a matrix to copy + a - f: The individual matrix components (in column-major order) -+ x, y: Arguments affecting how the shortcut matrix format affects x - and y ++ x, y: Arguments affecting how the shortcut matrix format affects x and y + n: The same value used for x and y together + angle: Rotation angle in degrees, clockwise -If no arguments are provided, a new default (identity) matrix -is created. - -There are also several "shortcut" matrix calls -that can be made:\ -- `matrix(x, y, MATRIX_SCALE)` *or* `matrix(n, MATRIX_SCALE)`\ -A scaling matrix, scaling either x and y independently or both - together -- `matrix(angle, MATRIX_ROTATE)`\ -A matrix that rotates by the angle in degrees, clockwise -- `matrix(x, y, MATRIX_TRANSLATE)`\ -A matrix that translates by x and y +**Returns:** ++ A new matrix. +*** +If no arguments are provided, a new default (identity) matrix is created. -> [!TIP] -> **See also:** -> + [matrix](/ref/matrix.md) -> + [transform var (atom)](/ref/atom/var/transform.md) \ No newline at end of file +There are also several "shortcut" matrix calls that can be made: +*** +**Related Pages:** ++ [matrix](/ref/matrix) ++ [transform var (atom)](/ref/atom/var/transform) diff --git a/ref/proc/max.md b/ref/proc/max.md index d588616b..88d52b6a 100644 --- a/ref/proc/max.md +++ b/ref/proc/max.md @@ -1,30 +1,28 @@ -## max proc + +## max (proc) **Format:** + max(A,B,C,...) **Returns:** + the maximum of the arguments. -### Example: +*** ```dm - usr << max(1,2,3) + +usr << max(1,2,3) + ``` - -This example displays `3`. -If a single argument is specified, this is expected -to be a list and the maximum item from the list is returned. -Items to be compared may be numbers, text strings, pixlocs, or -vectors, or null, but different types may not be mixed. (Null values can -be mixed with nums or text, but that\'s the only exception.) +This example displays 3. + +If a single argument is specified, this is expected to be a list and the maximum item from the list is returned. -If -the compared items are objects such as pixlocs or vectors, the result is -a new object, not one of the objects that was compared. +Items to be compared may be numbers, text strings, pixlocs, or vectors, or null, but different types may not be mixed. (Null values can be mixed with nums or text, but that's the only exception.) -> [!TIP] -> **See also:** -> + [min proc](/ref/proc/min.md) -> + [clamp proc](/ref/proc/clamp.md) \ No newline at end of file +If the compared items are objects such as pixlocs or vectors, the result is a new object, not one of the objects that was compared. +*** +**Related Pages:** ++ [min proc](/ref/proc/min) ++ [clamp proc](/ref/proc/clamp) diff --git a/ref/proc/md5.md b/ref/proc/md5.md index 42112370..dcfb2398 100644 --- a/ref/proc/md5.md +++ b/ref/proc/md5.md @@ -1,27 +1,22 @@ -## md5 proc +## md5 (proc) **Format:** + md5(T) + md5(F) -**Returns:** -+ text or null. - -**Args:** +**Arguments:** + T: A text string. + F: A file. -This proc implements MD5 hashing. A hash function is a one-way -process that compacts information to a short value: a hash. The same -value will always have the same hash. Among other uses, most computers -use hashing to store passwords. By storing just the hash, the password -file contains very little sensitive information, but the password can -still be verified by confirming that `md5(password)==hash`. MD5 is a -widely-used hash function. -### Example: +**Returns:** ++ text or null. +*** +This proc implements MD5 hashing. A hash function is a one-way process that compacts information to a short value: a hash. The same value will always have the same hash. Among other uses, most computers use hashing to store passwords. By storing just the hash, the password file contains very little sensitive information, but the password can still be verified by confirming that md5(password)==hash. MD5 is a widely-used hash function. + ```dm + mob/var/hash mob/Read(savefile/S) @@ -30,24 +25,18 @@ mob/Read(savefile/S) if(md5("[level]/[exp]/[exp_needed]") != hash) src << "Cheater!" del(src) + ``` - -In the example, a few vars -belonging to a mob were saved along with a hash of those values. When -the mob is loaded again, the game compares the hash to the values to -make sure it\'s still accurate. If the values or hash had been changed -by a sneaky player, they wouldn\'t match. (But a sneaky player could -still calculate `hash` themselves if they knew the exact text used to -make it, so this should be kept secret.) - -If the argument is a -file, `md5()` will read the file and return the MD5 hash of the file\'s -entire contents. If the file doesn\'t exist, it returns null. The file -may be a cache file or an external file. -### Examples: + + +In the example, a few vars belonging to a mob were saved along with a hash of those values. When the mob is loaded again, the game compares the hash to the values to make sure it's still accurate. If the values or hash had been changed by a sneaky player, they wouldn't match. (But a sneaky player could still calculate hash themselves if they knew the exact text used to make it, so this should be kept secret.) + +If the argument is a file, `md5()` will read the file and return the MD5 hash of the file's entire contents. If the file doesn't exist, it returns null. The file may be a cache file or an external file. + ```dm -var/hash = "(insert hash value here)" // Compute this ahead of time + +var/hash = "(insert hash value here)" // Compute this ahead of time // Check that the cached default icon is still the same if (md5('default.dmi') != hash) @@ -56,15 +45,14 @@ if (md5('default.dmi') != hash) // Or check that the entire game resource file is pristine if (md5(file("mygame.rsc")) != hash) world << "The game resources have been modified!" + ``` -Note that you must pass the -result of [file()](/ref/proc/file.md) in order to compute the hash of -an external file\'s contents at runtime. Otherwise `md5()` will treat -the filename as text and return the hash of the name only. -If `T` is anything but a text string or file, the proc returns null. -> [!TIP] -> **See also:** -> + [sha1 proc](/ref/proc/sha1.md) -> + [file proc](/ref/proc/file.md) \ No newline at end of file +Note that you must pass the result of file() in order to compute the hash of an external file's contents at runtime. Otherwise `md5()` will treat the filename as text and return the hash of the name only. + +If `T` is anything but a text string or file, the proc returns null. +*** +**Related Pages:** ++ [sha1 proc](/ref/proc/sha1) ++ [file proc](/ref/proc/file) diff --git a/ref/proc/min.md b/ref/proc/min.md index e07d445f..f75c88d4 100644 --- a/ref/proc/min.md +++ b/ref/proc/min.md @@ -1,29 +1,28 @@ -## min proc + +## min (proc) **Format:** + min(A,B,C,...) **Returns:** + the minimum of the arguments. -### Example: +*** ```dm - usr << min(1,2,3) + +usr << min(1,2,3) + ``` - -This example displays `1`. -If a single argument is specified, this is expected -to be a list and the minimum item from the list is returned. -Items to be compared may be numbers, text strings, pixlocs, or -vectors, or null, but different types may not be mixed. (Null values can -be mixed with nums or text, but that\'s the only exception.) +This example displays 1. + +If a single argument is specified, this is expected to be a list and the minimum item from the list is returned. -If the compared items are objects such as pixlocs or vectors, the result is -a new object, not one of the objects that was compared. +Items to be compared may be numbers, text strings, pixlocs, or vectors, or null, but different types may not be mixed. (Null values can be mixed with nums or text, but that's the only exception.) -> [!TIP] -> **See also:** -> + [max proc](/ref/proc/max.md) -> + [clamp proc](/ref/proc/clamp.md) \ No newline at end of file +If the compared items are objects such as pixlocs or vectors, the result is a new object, not one of the objects that was compared. +*** +**Related Pages:** ++ [max proc](/ref/proc/max) ++ [clamp proc](/ref/proc/clamp) diff --git a/ref/proc/missile.md b/ref/proc/missile.md index 84d02c5e..72283e23 100644 --- a/ref/proc/missile.md +++ b/ref/proc/missile.md @@ -1,18 +1,21 @@ -# missile proc + +## missile (proc) + **Format:** + missile(Type, Start, End) -**Args:** -+ Type: An object prototype or icon file. +**Arguments:** ++ Type: An object prototype or icon file. + Start: The starting location. -+ End: The ending location. - ++ End: The ending location. +*** +Send a missile of the given Type between two locations. The effect is purely visual. When Type is an object, its icon is used for the missile. -Send a missile of the given Type between two locations. The -effect is purely visual. When Type is an object, its icon is used for -the missile. -### Example: ```dm - missile(/obj/fireball, usr, loc) + +missile(/obj/fireball, usr, loc) + ``` + +*** \ No newline at end of file diff --git a/ref/proc/named arguments.md b/ref/proc/named arguments.md deleted file mode 100644 index bd4c9ef9..00000000 --- a/ref/proc/named arguments.md +++ /dev/null @@ -1,91 +0,0 @@ -## named arguments (proc) - -The parameters passed to a procedure are called arguments. -These may either be passed in positional order, or they can be passed as -*named arguments*. Not all procedures are defined with the intention of -supporting named arguments, so consult the documentation for the -procedure in question first. (This is mainly an issue of whether the -argument names might change in the future.) - -> [!TIP] -> The best time to use named arguments is when calling a -procedure that takes a lot of optional parameters. You can just name the -ones that you want to assign and leave the rest unspecified. Trying to -do the same thing with positional parameters can be much more -awkward--especially when the arguments you do want to assign are -preceded by a number of ones that you don\'t care to assign. It\'s easy -to lose your place in the list or to forget what it does. - -> [!CAUTION] -> Since named arguments involve a slight amount of extra overhead, one should -avoid them in code that is highly cpu intensive due to being called many -many times. Otherwise, code clarity may be a bigger priority. - -The following example shows several ways of producing the same call to a procedure. -### Example: - -```dm -mob/proc/MyProc(a,b,c) - src << "MyProc([a],[b],[c])" - -mob/verb/test() - MyProc(1,2,3) //positional parameters - MyProc(a=1,b=2,c=3) //named arguments - MyProc(1,b=2,c=3) //positional and named arguments - MyProc(c=3,a=1,b=2) //named arguments can come in any order -``` - -> [!IMPORTANT] -> To prevent silent errors, -named arguments that do not match any of the arguments of the procedure -being called will generate a runtime error. This is somewhat different -from the behavior of positional arguments in DM where it is perfectly -acceptable to pass more arguments than were explicitly defined in the -procedure. - -As always, arguments that are not assigned in the -call will simply be given the value null (or whatever default value is -specified in the definition). - -When an object procedure is -overridden, the variable names in the new definition are the ones that -get matched against named arguments in a call to that procedure. A -procedure which is intended to support named arguments should therefore -be defined with care so as to conform to the interface expected by users -of the procedure. That doesn\'t stop you from changing that interface -when overriding a procedure, but the normal case would be to preserve -the argument names of the base procedure when overriding it. - -The following example is not useful, but it illustrates a -situation where a procedure is overridden so as to preserve the same -argument names and positions. As mentioned above, you are not *required* -to preserve either the names or positions, but that is usually what you -want. -### Example: - -```dm -mob - proc/MyProc(a,b,c) - usr << "mob.MyProc([a],[b],[c])" - - mob/verb/test() - MyProc(a=1,b=2,c=3) - - special_mob - MyProc(a,b,c,d) - if(d) ..() //pass in same order - else ..(c,b,a) //pass in reverse order - - test() - MyProc(a=1,b=2,c=3,d=0) //normal order - MyProc(a=1,b=2,c=3,d=1) //reverse the order -``` - -This example merely used positional parameters in the call to -`..()`, but one can use named arguments there too if it is desirable. - -> [!TIP] -> **See also:** -> + [New proc (atom)](/ref/atom/proc/New.md) -> + [arglist proc](/ref/proc/arglist.md) -> + [arguments (proc)](/ref/proc/arguments.md) \ No newline at end of file diff --git a/ref/proc/nameof.md b/ref/proc/nameof.md index bb0f6d53..74eb6e86 100644 --- a/ref/proc/nameof.md +++ b/ref/proc/nameof.md @@ -1,24 +1,23 @@ -## nameof proc -###### BYOND Version 515 + +## nameof (proc) **Format:** + nameof(Var) + nameof(ProcRef) + nameof(Path) -**Args:** +**Arguments:** + Var: A variable, e.g. src.density or foo::bar. + ProcRef: A proc reference, e.g. /mob::Enter(). + Path: A type path, e.g. /obj/item/barrel. +*** +This returns the name of a var or proc, or the last part of a type path. This proc only exists at compile-time. -This returns the name of a var or proc, or the last part of a -type path. This proc only exists at compile-time. +The main purpose of this proc is to turn a proc reference into a name, which is useful in some esoteric situations. -The main purpose of this proc is to turn a proc reference into a name, which is -useful in some esoteric situations. -### Example: ```dm + var/list/event_queue proc/CallLater(object, procref, a, b, c) @@ -36,8 +35,9 @@ world/Tick() var/b = forlater[4] var/c = forlater[5] call(object, procname)(a, b, c) + ``` -> [!TIP] -> **See also:** -> + [:: operator](/ref/operator/::.md) \ No newline at end of file +*** +**Related Pages:** ++ [:: operator](/ref/operator/::) diff --git a/ref/proc/new.md b/ref/proc/new.md index eb450c73..4fc8e854 100644 --- a/ref/proc/new.md +++ b/ref/proc/new.md @@ -1,40 +1,38 @@ -## new proc + +## new (proc) **Format:** + new Type(Args) -**Returns:** -+ A reference to a new instance of Type. - -**Args:** +**Arguments:** + Type: The type of object to create. + Args: Arguments for the Type.New() proc. -A new instance of Type is created. The arguments (Args) are -passed to its New() proc. A handy short-cut: if Type is not specified -and new() is being used in an assignment, the variable type of the -left-hand-side will be used as the default type. +**Returns:** ++ A reference to a new instance of Type. +*** +A new instance of Type is created. The arguments (Args) are passed to its New() proc. A handy short-cut: if Type is not specified and new() is being used in an assignment, the variable type of the left-hand-side will be used as the default type. + +The atom types /area, /turf, /obj, and /mob all take a location argument specifying the initial position. If not specified, it defaults to null. -The atom types `/area`, `/turf`, `/obj`, and `/mob` all take a location argument specifying the -initial position. If not specified, it defaults to null. +Newly created areas or turfs replace any existing area or turf at the specified location. -Newly created areas or turfs replace any existing area or turf at the -specified location. -### Example: ```dm + obj/stick mob/verb/magic_stick() var/obj/stick/S = new(src) //create a stick in my inventory S.desc = "This is no ordinary stick!" view() << "[src] creates \an [S] from thin air!" + ``` -> [!TIP] -> **See also:** -> + [New proc (atom)](/ref/atom/proc/New.md) -> + [New proc (datum)](/ref/datum/proc/New.md) -> + [New proc (icon)](/ref/icon/proc/New.md) -> + [newlist proc](/ref/proc/newlist.md) -> + [path operators](/ref/operator/path.md) -> + [\_\_IMPLIED_TYPE\_\_ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__.md) \ No newline at end of file +*** +**Related Pages:** ++ [New](/ref/atom/proc/New) ++ [New proc (datum)](/ref/datum/proc/New) ++ [New proc (icon)](/ref/icon/proc/New) ++ [newlist proc](/ref/proc/newlist) ++ [path operators](/ref/operator/path) ++ [__IMPLIED_TYPE__ macro](/ref/DM/preprocessor/__IMPLIED_TYPE__) diff --git a/ref/proc/newlist.md b/ref/proc/newlist.md index e8b9a487..716581cb 100644 --- a/ref/proc/newlist.md +++ b/ref/proc/newlist.md @@ -1,54 +1,46 @@ -## newlist proc + +## newlist (proc) **Format:** + newlist(A,B,C,...) -**Returns:** -+ A list of new objects, just as though you had done - `list(new A,new B,new C,...)`. - -**Args:** +**Arguments:** + Arbitrary number of types to be created in the list. -### Example: + +**Returns:** ++ A list of new objects, just as though you had done . +*** ```dm - mob/contents = newlist(/obj/scroll/readme) + +mob/contents = newlist(/obj/scroll/readme) + ``` -This causes new mobs to be created with a readme scroll in -their inventory. -It is possible to make simple initializations -when you want variables to have values other than the default for the -particular type you are creating. -### Example: +This causes new mobs to be created with a readme scroll in their inventory. + +It is possible to make simple initializations when you want variables to have values other than the default for the particular type you are creating. + ```dm + mob/contents = newlist( /obj/scroll/readme { name = "Introduction" desc = "The fate of Bracolia depends on you ..." } ) + ``` -This is the most common use of "modified types", -but it is not specific to the newlist instruction. Anywhere a type value -may be used in DM, it may be followed by a list of initializations. The -general syntax for a modified types is: - -*path* {*var1* = -*val1*; *var2* = *val2*} - -The semicolon is necessary if you put -several variable assignments on the same line. The braces are necessary, -even though they are generally optional in DM (since the compiler looks -at your indentation). The reason is that the path + initializations must -be parsed as a single expression, which is a different context from the -usual use of braces in DM when you are defining a true type. Also, -indentation inside of an argument list is always ignored anyway. - -> [!TIP] -> **See also:** -> + [list proc](/ref/proc/list.md) -> + [new proc](/ref/proc/new.md) \ No newline at end of file + +This is the most common use of "modified types", but it is not specific to the newlist instruction. Anywhere a type value may be used in DM, it may be followed by a list of initializations. The general syntax for a modified types is: + +path {var1 = val1; var2 = val2} + +The semicolon is necessary if you put several variable assignments on the same line. The braces are necessary, even though they are generally optional in DM (since the compiler looks at your indentation). The reason is that the path + initializations must be parsed as a single expression, which is a different context from the usual use of braces in DM when you are defining a true type. Also, indentation inside of an argument list is always ignored anyway. +*** +**Related Pages:** ++ [list proc](/ref/proc/list) ++ [new proc](/ref/proc/new) diff --git a/ref/proc/noise_hash.md b/ref/proc/noise_hash.md index 31ebd1ef..c03e21c8 100644 --- a/ref/proc/noise_hash.md +++ b/ref/proc/noise_hash.md @@ -1,5 +1,5 @@ -## noise_hash proc -###### BYOND Version 515 + +## noise_hash (proc) **Format:** + noise_hash(num1, num2, num3...) @@ -7,31 +7,20 @@ + noise_hash(hash_name, num1, num2, num3...) + noise_hash(hash_name, list_of_nums) -**Returns:** -+ A number between 0 and 1 (excluding 1 itself) - -**Args:** +**Arguments:** + num1, num2, num3...: Numbers to be hashed (at least one) + list_of_nums: A list containing the numbers to hash -+ hash_name: A text string indicating the hash type (reserved for - future use) ++ hash_name: A text string indicating the hash type (reserved for future use) +**Returns:** ++ A number between 0 and 1 (excluding 1 itself) +*** +For some games using concepts of procedural generation, it's nice to be able to reliably create pseudo-random numbers in a repeatable, reliable way. This proc takes all the numbers put into it and hashes them together to get a value from 0 to 1. That output value will be the same for any given set of input numbers. This can be used on its own or as part of a more in-depth noise algorithm. -For some games using concepts of procedural generation, it\'s -nice to be able to reliably create pseudo-random numbers in a -repeatable, reliable way. This proc takes all the numbers put into it -and hashes them together to get a value from 0 to 1. That output value -will be the same for any given set of input numbers. This can be used on -its own or as part of a more in-depth noise algorithm. - -If the first argument is a string, that may be used in future versions to -specify the type of hash to use. For now it is not used. - -> [!DANGER] -> Non-numbers provided to the proc will be interpreted -arbitrarily. Don\'t do that. +If the first argument is a string, that may be used in future versions to specify the type of hash to use. For now it is not used. -> [!TIP] -> **See also:** -> + [rand proc](/ref/proc/rand.md) -> + [rand_seed proc](/ref/proc/rand_seed.md) \ No newline at end of file +Non-numbers provided to the proc will be interpreted arbitrarily. Don't do that. +*** +**Related Pages:** ++ [rand proc](/ref/proc/rand) ++ [rand_seed proc](/ref/proc/rand_seed) diff --git a/ref/proc/nonspantext.md b/ref/proc/nonspantext.md index 1b3402d2..ffac417a 100644 --- a/ref/proc/nonspantext.md +++ b/ref/proc/nonspantext.md @@ -1,36 +1,24 @@ -## nonspantext proc -###### BYOND Version 510 + +## nonspantext (proc) **Format:** + nonspantext(Haystack,Needles,Start=1) -**Returns:** -+ The number of consecutive characters, from the start position, that - do NOT match the characters in Needles. - -**Args:** +**Arguments:** + Haystack: The text string to search. -+ Needles: A text string with all the characters that should not - match. -+ Start: The text byte position in Haystack in which to begin the - search. ++ Needles: A text string with all the characters that should not match. ++ Start: The text byte position in Haystack in which to begin the search. -This proc is case-sensitive. A common use for this proc is in -parsing. For instance nonspantext("apples, oranges",", ") will -return 6, because the first 6 characters don\'t match a comma or a -space. - -If the start position is negative, the position is -counted backwards from the end of the string. +**Returns:** ++ The number of consecutive characters, from the start position, that do NOT match the characters in Needles. +*** +This proc is case-sensitive. A common use for this proc is in parsing. For instance nonspantext("apples, oranges",", ") will return 6, because the first 6 characters don't match a comma or a space. -Note: In strings -containing non-ASCII characters, byte position and character position -are not the same thing. Use `nonspantext_char()` to work with character -counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. +If the start position is negative, the position is counted backwards from the end of the string. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [spantext proc](/ref/proc/spantext.md) -> + [splittext proc](/ref/proc/splittext.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `nonspantext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [spantext proc](/ref/proc/spantext) ++ [splittext proc](/ref/proc/splittext) diff --git a/ref/proc/num2text.md b/ref/proc/num2text.md index 95045c3d..a626b8fd 100644 --- a/ref/proc/num2text.md +++ b/ref/proc/num2text.md @@ -1,44 +1,41 @@ -## num2text proc + +## num2text (proc) **Format:** + num2text(N, SigFig=6) + num2text(N, Digits, Radix) -**Returns:** -+ A text string. - -**Args:** +**Arguments:** + N: A number. + SigFig: Number of significant digits. + Digits: Minimum number of digits + Radix: The base of the number, e.g. 16 is hexadecimal. -Get the text string for a number. The number of significant -digits determines when scientific notation is used. The default is 6, so -scientific notation will only be used when there are more than 6 digits. -### Example: +**Returns:** ++ A text string. +*** +Get the text string for a number. The number of significant digits determines when scientific notation is used. The default is 6, so scientific notation will only be used when there are more than 6 digits. + ```dm + T = num2text(12) // = "12" T = num2text(12,1) // = "1.2e1" + ``` -The Radix format is intended for -converting numbers to bases other than 10, although you can still use -10. In this format, Digits represents the minimum number of digits to -use, and the result will be left-padded with zeroes if necessary. Also, -in this form only the integer part of the number is used, and it can\'t -be any larger than what a 32-bit integer could store (about 4 billion). -These limitations may be lessened or removed in the future, but this -format was mainly intended for simple conversions. -### Example: + +The Radix format is intended for converting numbers to bases other than 10, although you can still use 10. In this format, Digits represents the minimum number of digits to use, and the result will be left-padded with zeroes if necessary. Also, in this form only the integer part of the number is used, and it can't be any larger than what a 32-bit integer could store (about 4 billion). These limitations may be lessened or removed in the future, but this format was mainly intended for simple conversions. + ```dm + world << num2text(11, 2, 16) // "0b" world << num2text(343, 0, 7) // "1000" + ``` -> [!TIP] -> **See also:** -> + [isnum proc](/ref/proc/isnum.md) -> + [text2num proc](/ref/proc/text2num.md) \ No newline at end of file +*** +**Related Pages:** ++ [isnum proc](/ref/proc/isnum) ++ [text2num proc](/ref/proc/text2num) diff --git a/ref/proc/obounds.md b/ref/proc/obounds.md index b52d81fb..7e056747 100644 --- a/ref/proc/obounds.md +++ b/ref/proc/obounds.md @@ -1,23 +1,20 @@ -## obounds proc + +## obounds (proc) **Format:** + obounds(Ref, Dist=0) + obounds(Ref, x_offset, y_offset, extra_width=0, extra_height=0) -**Returns:** -+ A list of atoms (except areas) within Ref\'s bounding box, excluding - Ref. - -**Args:** -+ Ref: A turf, obj, or mob. -+ Dist: A number (distance in pixels). +**Arguments:** ++ Ref: A turf, obj, or mob. ++ Dist: A number (distance in pixels). + x_offset, y_offset: Shifts bounding box position + extra_width, extra_height: Adjusts bounding box size - -The results from obounds() are identical to bounds(), but -obounds() leaves Ref out of the results. - -> [!TIP] -> **See also:** -> + [bounds proc](/ref/proc/bounds.md) \ No newline at end of file +**Returns:** ++ A list of atoms (except areas) within Ref's bounding box, excluding Ref. +*** +The results from obounds() are identical to bounds(), but obounds() leaves Ref out of the results. +*** +**Related Pages:** ++ [bounds proc](/ref/proc/bounds) diff --git a/ref/proc/ohearers.md b/ref/proc/ohearers.md index 24554f22..25610ecc 100644 --- a/ref/proc/ohearers.md +++ b/ref/proc/ohearers.md @@ -1,15 +1,12 @@ -## ohearers + +## ohearers (proc) **Format:** + ohearers(Depth=world.view,Center=usr) - - -This is just like `hearers()`, but it excludes the center -object and its contents from the list. It is a list of all other mobs -that can hear the center object. - -> [!TIP] -> **See also:** -> + [hearers](/ref/proc/hearers.md) -> + [oview proc](/ref/proc/oview.md) -> + [oviewers](/ref/proc/oviewers.md) \ No newline at end of file +*** +This is just like hearers(), but it excludes the center object and its contents from the list. It is a list of all other mobs that can hear the center object. +*** +**Related Pages:** ++ [hearers](/ref/proc/hearers) ++ [oview proc](/ref/proc/oview) ++ [oviewers](/ref/proc/oviewers) diff --git a/ref/proc/orange.md b/ref/proc/orange.md index 100180b4..9deaf939 100644 --- a/ref/proc/orange.md +++ b/ref/proc/orange.md @@ -1,23 +1,20 @@ -## orange proc + +## orange (proc) **Format:** + orange(Dist,Center=usr) -**Returns:** -+ A list of objects within Dist tiles of Center, excluding Center. - -**Args:** -+ Dist: A number. +**Arguments:** ++ Dist: A number. + Center: An object on the map. - -This instruction is identical to oview() except visibility is -ignored. All objects are included in the list whether they are visible -or not. The center object and its contents are excluded. - -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [block](/ref/proc/block.md) -> + [oview proc](/ref/proc/oview.md) -> + [range proc](/ref/proc/range.md) \ No newline at end of file +**Returns:** ++ A list of objects within Dist tiles of Center, excluding Center. +*** +This instruction is identical to oview() except visibility is ignored. All objects are included in the list whether they are visible or not. The center object and its contents are excluded. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [block](/ref/proc/block) ++ [oview proc](/ref/proc/oview) ++ [range proc](/ref/proc/range) diff --git a/ref/proc/output.md b/ref/proc/output.md index 392bcd87..b1f494e1 100644 --- a/ref/proc/output.md +++ b/ref/proc/output.md @@ -1,72 +1,62 @@ -## output proc +## output (proc) **Format:** + output(msg, control) -**Args:** +**Arguments:** + msg: Text, an atom, a file, or null -+ control: The ID of a control in the player\'s skin, or null for the - default ++ control: The ID of a control in the player's skin, or null for the default +*** +This is used in conjunction with the << output operator to send output to a particular control in the player's skin. If null is sent, the control will be cleared. -This is used in conjunction with the << output operator to -send output to a particular control in the player\'s skin. If null is -sent, the control will be cleared. -### Example: - ```dm -usr << output("Your score is [score].", "scorepane.output") + +usr << output("Your score is [score].", "scorepane.output") + ``` - -As with `winset()`, the -control name may be in the form `":[type]"` which sends to the default -control of that type, e.g. `":output"`. -The control ID can be -followed by a colon and extra info such as a name or a grid cell, which -can send the output to the control in a different way. In a grid, this -can output directly to a specific grid cell, like so: -### Example: + +As with `winset()`, the control name may be in the form `":[type]"` which sends to the default control of that type, e.g. `":output"`. + +The control ID can be followed by a colon and extra info such as a name or a grid cell, which can send the output to the control in a different way. In a grid, this can output directly to a specific grid cell, like so: + ```dm - usr << output("Column 3, Row 2", "examplegrid:3,2") + +usr << output("Column 3, Row 2", "examplegrid:3,2") + ``` -For a browser control, the extra info is a -JavaScript function. The format for sending a script to the browser -control is `output("[params]","[control]:[scriptname]")` where -"[params]" is a URL-encoded list of string arguments to the -javascript function, as formatted by -[list2params()](/ref/proc/list2params.md). -### Example: + +For a browser control, the extra info is a JavaScript function. The format for sending a script to the browser control is `output("[params]","[control]:[scriptname]")` where "[params]" is a URL-encoded list of string arguments to the javascript function, as formatted by list2params(). + + ```dm + mob/Login() . = ..() usr << output(\ {" - -
This text can change.
-

And this can't.

+ +This text can change. +And this can't. "}, ":browser"); #define LP(str) list2params(list(str)) mob/verb/newtext(T as text) usr << output(LP(T), ":browser:replace") + ``` -This allows for the creation of more dynamic -interfaces, since javascript provides access to many client-side -operations and flicker-free updates. -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [winclone proc](/ref/proc/winclone.md) -> + [winset proc](/ref/proc/winset.md) \ No newline at end of file +And this can't. + +This allows for the creation of more dynamic interfaces, since javascript provides access to many client-side operations and flicker-free updates. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [winclone proc](/ref/proc/winclone) ++ [winset proc](/ref/proc/winset) diff --git a/ref/proc/oview.md b/ref/proc/oview.md index ebe93003..d3683e82 100644 --- a/ref/proc/oview.md +++ b/ref/proc/oview.md @@ -1,26 +1,27 @@ -## oview proc + +## oview (proc) **Format:** + oview(Dist,Center=usr) -**Returns:** -+ A list of visible objects within Dist tiles of Center, excluding - Center. - -**Args:** -+ Dist: A number. +**Arguments:** ++ Dist: A number. + Center: An object on the map. -This instruction is just like view() except it doesn\'t include -Center or its contents in the list. -### Example: +**Returns:** ++ A list of visible objects within Dist tiles of Center, excluding Center. +*** +This instruction is just like view() except it doesn't include Center or its contents in the list. + ```dm - oview() << "to others in sight of [usr]" + +oview() << "to others in sight of [usr]" + ``` -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [orange proc](/ref/proc/orange.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [orange proc](/ref/proc/orange) ++ [view proc](/ref/proc/view) diff --git a/ref/proc/oviewers.md b/ref/proc/oviewers.md index f58d2271..99830308 100644 --- a/ref/proc/oviewers.md +++ b/ref/proc/oviewers.md @@ -1,14 +1,12 @@ -## oviewers + +## oviewers (proc) **Format:** + oviewers(Depth=world.view,Center=usr) - -This is just like `viewers()`, but it excludes the center -object and its contents from the list. It is a list of all other mobs -that can see the center object. - -> [!TIP] -> **See also:** -> + [hearers](/ref/proc/hearers.md) -> + [oview proc](/ref/proc/oview.md) -> + [oviewers](/ref/proc/oviewers.md) \ No newline at end of file +*** +This is just like viewers(), but it excludes the center object and its contents from the list. It is a list of all other mobs that can see the center object. +*** +**Related Pages:** ++ [hearers](/ref/proc/hearers) ++ [oview proc](/ref/proc/oview) ++ [oviewers](/ref/proc/oviewers) diff --git a/ref/proc/params2list.md b/ref/proc/params2list.md index 6bccc397..960ed839 100644 --- a/ref/proc/params2list.md +++ b/ref/proc/params2list.md @@ -1,92 +1,55 @@ -## params2list proc + +## params2list (proc) **Format:** + params2list(Params) -**Args:** +**Arguments:** + Params: Text string of parameter values. **Returns:** + An associative list of parameter names and values. +*** +This instruction converts a parameter text string to a list of individual parameters and associated values. The format of the parameter text is: + -This instruction converts a parameter text string to a list of -individual parameters and associated values. A common use for accessing params like this is to extract information from [Click](/ref/client/proc/Click.md). -### Example: -```dm -client - Click(object,location,control,params) - var/alist/params_list = params2list(params) - if(params_list["right"]) - RightClick(object, location, control, params) - else - ..() - - proc - RightClick(object, location, control, params) - usr << "You Right clicked on [object]" -``` -### Parameter Text Format -The format of the parameter -text is: ```dm - "name1=value1&name2=value2&..." + +"name1=value1&name2=value2&..." + ``` -The field separator `;` may be used in place of `&`. - -Special characters such as `=`, `;`, and `&` inside the -parameter names or values should be written in the form `%xx`, where -`xx` are two hexadecimal digits representing the ASCII value of the -character. (For [Unicode](/ref/notes/Unicode.md) characters, this may be -several `%xx` sequences using UTF-8 encoding.) For example, `=` would be -written `%3d`, `;` would be `%3b`, `&` would be `%26`, and `%` would be -`%25`. These "escaped" codes are automatically translated into the -corresponding character when read by `params2list()`. - -This parameter format is the same one used by most HTML forms and is known by -the MIME type `application/x-www-form-urlencoded`. It is often used in -DM to pack information into topic links. Though DM does not require it, -the standard format is for newlines to be written as CR LF pairs -(`%0d%0a`) and spaces to be written as `+` characters. That means if you -want to write a `+` symbol, you will have to use `%2b`. - -The list produced from the parameter text has items `"name1"`, `"name2"`, -and so on. To access the values associated with these, you use the -parameter name as the list index. -### Example: + +The field separator `;` may be used in place of `&`. + +Special characters such as `=`, `;`, and `&` inside the parameter names or values should be written in the form %xx, where xx are two hexadecimal digits representing the ASCII value of the character. (For Unicode characters, this may be several %xx sequences using UTF-8 encoding.) For example, `=` would be written %3d, `;` would be %3b, `&` would be %26, and `%` would be %25. These "escaped" codes are automatically translated into the corresponding character when read by `params2list()`. + +This parameter format is the same one used by most HTML forms and is known by the MIME type `application/x-www-form-urlencoded`. It is often used in DM to pack information into topic links. Though DM does not require it, the standard format is for newlines to be written as CR LF pairs (%0d%0a) and spaces to be written as `+` characters. That means if you want to write a `+` symbol, you will have to use %2b. + +The list produced from the parameter text has items `"name1"`, `"name2"`, and so on. To access the values associated with these, you use the parameter name as the list index. + ```dm + var/ptext = "offense=jwalk&time=10:00" var/plist[] = params2list(ptext) var/p for(p in plist) usr << "[p] = [plist[p]]" + ``` -The above example defines a simple -parameter text string containing two parameters: `"offense"` and -`"time"`. These are associated with the values `"jwalk"` and `"10:00"`. -The `for` loop illustrates how one might loop through the list and print -out each setting. - ->[!NOTE] -> ll values are stored as text -strings in the list. If you wish to perform a numerical operation (such -as addition), you should convert the value to a number first using -`text2num()`. If the value is an object text reference, you can convert -that into the object itself by using `locate()`. - -If you have -multiple items with the same name, they will be combined into a list of -text strings. For example, `"key=value1;key=value2"` would set -`list["key"]` to a list containing `"value1"` and `"value2"`, not -necessarily in that order. - -> [!TIP] -> **See also:** -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [list associations](/ref/list/associations.md) -> + [list2params proc](/ref/proc/list2params.md) -> + [params var (world)](/ref/world/var/params.md) -> + [text2num proc](/ref/proc/text2num.md) \ No newline at end of file + +The above example defines a simple parameter text string containing two parameters: `"offense"` and `"time"`. These are associated with the values `"jwalk"` and `"10:00"`. The for loop illustrates how one might loop through the list and print out each setting. + +Note that all values are stored as text strings in the list. If you wish to perform a numerical operation (such as addition), you should convert the value to a number first using `text2num()`. If the value is an object text reference, you can convert that into the object itself by using `locate()`. + +If you have multiple items with the same name, they will be combined into a list of text strings. For example, `"key=value1;key=value2"` would set `list["key"]` to a list containing `"value1"` and `"value2"`, not necessarily in that order. +*** +**Related Pages:** ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [list associations](/ref/list/associations) ++ [list2params](/ref/proc/list2params) ++ [params](/ref/world/var/params) ++ [text2num proc](/ref/proc/text2num) diff --git a/ref/proc/pick.md b/ref/proc/pick.md index ae4cdd2f..194f657b 100644 --- a/ref/proc/pick.md +++ b/ref/proc/pick.md @@ -1,4 +1,5 @@ -## pick proc + +## pick (proc) **Format:** + pick(Val1,Val2,...) @@ -6,26 +7,26 @@ **Returns:** + One of the given values randomly chosen. +*** +Randomly chooses an item from a list or from the arguments provided. If only one argument is included and it is a list, then the item is chosen from that list. -Randomly chooses an item from a list or from the arguments -provided. If only one argument is included and it is a list, then the -item is chosen from that list. +When not using the list form, you can make a particular value more or less likely to be chosen by providing a relative probability like this: -When not using the list form, -you can make a particular value more or less likely to be chosen by -providing a relative probability like this: ```dm + prob(P); Val Or -P; Val +P; Val + ``` -A value for P of 200 makes it twice as -likely as the norm, 50 half as likely, and so on. -### Example: +A value for P of 200 makes it twice as likely as the norm, 50 half as likely, and so on. + + ```dm + obj/food verb/eat() usr << pick ( @@ -36,10 +37,11 @@ obj/food "[usr] wolfs down \a [src]." ) del(src) + ``` - -There is no analogous weighted format for the list version of this proc. -> [!TIP] -> **See also:** -> + [prob proc](/ref/proc/prob.md) \ No newline at end of file + +There is no analogous weighted format for the list version of this proc. +*** +**Related Pages:** ++ [prob proc](/ref/proc/prob) diff --git a/ref/proc/pixloc.md b/ref/proc/pixloc.md index 9c833ffb..284ba7d7 100644 --- a/ref/proc/pixloc.md +++ b/ref/proc/pixloc.md @@ -1,8 +1,5 @@ -## pixloc proc -###### BYOND Version 516 -> ### Community Resources -> + [Ter's Pixloc Primer](https://www.byond.com/forum/post/2949303) +## pixloc (proc) **Format:** + pixloc(x, y, z) @@ -13,40 +10,39 @@ + pixloc(Pixloc, x, y) + pixloc(Pixloc, Vector) -**Returns:** -+ A new `pixloc` object or null. - -**Args:** -+ x, y, z: Pixel coordinates in world space (starting at 1,1,1). When - the first argument is an atom or pixloc, x and y are offsets. +**Arguments:** ++ x, y, z: Pixel coordinates in world space (starting at 1,1,1). When the first argument is an atom or pixloc, x and y are offsets. + Atom: An atom whose pixloc will be copied. + Pixloc: An existing pixloc to copy. + Vector: A 2D vector to offset the new pixloc by. -Creates a new `pixloc` object based on an existing object\'s -location or using raw world coordinates. If the pixloc can\'t be -created, for instance if the Atom argument is not directly on the map, -the result is null. -### Example: +**Returns:** ++ A new object or null. +*** +Creates a new `pixloc` object based on an existing object's location or using raw world coordinates. If the pixloc can't be created, for instance if the Atom argument is not directly on the map, the result is null. + ```dm + mob/proc/GoToStrangeForest() // in a world with 32x32 icon size, this is x=18, y=29, step_x=5, step_y=11 mob.pixloc = pixloc(550, 907, 1) + ``` - -When the pixloc is created with world -coordinates, x and y are a combination of tile x and step_x, and tile y -and step_y, starting at a value of 1. The world x and y for any tile and -step combo can be calculated like so (if for any reason you needed to): + + +When the pixloc is created with world coordinates, x and y are a combination of tile x and step_x, and tile y and step_y, starting at a value of 1. The world x and y for any tile and step combo can be calculated like so (if for any reason you needed to): + ```dm + world_x = (tile_x - 1) * pixels_per_x_tile + step_x + 1 world_y = (tile_y - 1) * pixels_per_y_tile + step_y + 1 + ``` -> [!TIP] -> **See also:** -> + [pixloc](/ref/pixloc.md) -> + [pixloc var (atom)](/ref/atom/var/pixloc.md) -> + [bound_pixloc proc](/ref/proc/bound_pixloc.md) +*** +**Related Pages:** ++ [pixloc](/ref/pixloc) ++ [pixloc](/ref/atom/var/pixloc) ++ [bound_pixloc proc](/ref/proc/bound_pixloc) diff --git a/ref/proc/prob.md b/ref/proc/prob.md index cefed553..efa2e828 100644 --- a/ref/proc/prob.md +++ b/ref/proc/prob.md @@ -1,17 +1,17 @@ -## prob proc + +## prob (proc) **Format:** + prob(P) -**Returns:** -+ 1 with probability P percent; otherwise 0 - -**Args:** +**Arguments:** + P: A number. -> [!TIP] -> **See also:** -> + [pick proc](/ref/proc/pick.md) -> + [rand proc](/ref/proc/rand.md) -> + [rand_seed proc](/ref/proc/rand_seed.md) -> + [roll proc](/ref/proc/roll.md) \ No newline at end of file +**Returns:** ++ 1 with probability P percent; otherwise 0 +****** +**Related Pages:** ++ [pick proc](/ref/proc/pick) ++ [rand proc](/ref/proc/rand) ++ [rand_seed proc](/ref/proc/rand_seed) ++ [roll proc](/ref/proc/roll) diff --git a/ref/proc/proc.md b/ref/proc/proc.md deleted file mode 100644 index ee8dd638..00000000 --- a/ref/proc/proc.md +++ /dev/null @@ -1,63 +0,0 @@ -## procs - -Procs may be derived from /proc. These procs are "global", in -that they can be called anywhere in the code. -### Example: - -```dm -proc/poof() - world << "POOF!" -``` - -The proc `poof()` may now be called anywhere in the code. - -Procs may also be attached to objects by defining them under the appropriate -`object/proc` subnode. Currently DM allows procs to be defined or -overridden for `/mob`, `/obj`, `/turf`, `/area`, `world`, and `/client`, -as well as for [datum objects](/ref/datum.md) derived from `/`. Predefined -procs are discussed under the "procs" entry for the object type. -### Example: - -```dm -mob/proc/poof() - world << "POOF!" -``` - -This can be called by a mob var M, using `M.poof()`. -### Return types - -It is possible to define what type of value a proc is expected -to return, by following its definition with an `as` clause. This can be -a type path, such as `as /mob/player`, or a more intrinsic type like -`as num` or `as list`. -### Example: - -```dm -mob/monster - var/mob/player/target - - proc/GetTarget() as /mob/player - if(!target) - // find a /mob/player in view - target = locate() in view(src) - return target -``` - -Currently the only -purpose for using the `as` clause is for situations where the compiler -needs to infer the type of an expression. Mainly this applies to the -[.](/ref/operator/%2e.md) and [?.](/ref/operator/%3f%2e.md) operators -in an expression such as `GetTarget()?.Attack(src)`. Giving -`GetTarget()` a return type allows the compiler to check if `Attack()` -is a valid proc for `/mob/player`. Otherwise, the `.` and `?.` operators -act like `:` and `?:`, respectively; the compiler won\'t do any checking -to see if `Attack()` is valid. - -> [!TIP] -> **See also:** -> + [vars (procs)](/ref/proc/var.md) -> + [arguments (proc)](/ref/proc/arguments.md) -> + [procs (area)](/ref/area/proc.md) -> + [procs (mob)](/ref/mob/proc.md) -> + [procs (obj)](/ref/obj/proc.md) -> + [procs (turf)](/ref/turf/proc.md) \ No newline at end of file diff --git a/ref/proc/rand.md b/ref/proc/rand.md index 29e21bf8..24811135 100644 --- a/ref/proc/rand.md +++ b/ref/proc/rand.md @@ -1,19 +1,19 @@ -## rand proc + +## rand (proc) **Format:** + rand(L=0,H) or rand() -**Returns:** -+ A random integer between L and H inclusive; or a random number from - 0 up to 1 if L and H are omitted. - -**Args:** +**Arguments:** + L: A number for the lower-bound. + H: A number for the upper-bound. -> [!TIP] -> **See also:** -> + [pick proc](/ref/proc/pick.md) -> + [prob proc](/ref/proc/prob.md) -> + [rand_seed proc](/ref/proc/rand_seed.md) -> + [roll proc](/ref/proc/roll.md) \ No newline at end of file +**Returns:** ++ A random integer between L and H inclusive; or a random number from 0 up +to 1 if L and H are omitted. +****** +**Related Pages:** ++ [pick proc](/ref/proc/pick) ++ [prob proc](/ref/proc/prob) ++ [rand_seed proc](/ref/proc/rand_seed) ++ [roll proc](/ref/proc/roll) diff --git a/ref/proc/rand_seed.md b/ref/proc/rand_seed.md index 3f04bf12..7ca4407a 100644 --- a/ref/proc/rand_seed.md +++ b/ref/proc/rand_seed.md @@ -1,34 +1,20 @@ -## rand_seed proc + +## rand_seed (proc) **Format:** + rand_seed(Seed) -**Args:** +**Arguments:** + Seed: An integer used to initialize the random number generator. +*** +Many DM procedures make use of a pseudo-random number generator. You can use rand_seed() to initialize the generator. The sequence returned by the generator is identical each time it is initialized with the same seed, so you could use this to reproduce the same output from an algorithm that uses the random number generator. If you never call rand_seed(), the generator is initialized with a seed from the system clock, so it is effectively random. +Note that with multiple realtime algorithms making calls to the generator at unpredictable times, you are likely not to get the same result even when using the same seed. The overall sequence will be the same, but individual sub-components of your world might call it in a different order. -Many DM procedures make use of a pseudo-random number -generator. You can use rand_seed() to initialize the generator. The -sequence returned by the generator is identical each time it is -initialized with the same seed, so you could use this to reproduce the -same output from an algorithm that uses the random number generator. If -you never call rand_seed(), the generator is initialized with a seed -from the system clock, so it is effectively random. - -Note that -with multiple realtime algorithms making calls to the generator at -unpredictable times, you are likely not to get the same result even when -using the same seed. The overall sequence will be the same, but -individual sub-components of your world might call it in a different -order. - -The pseudo-random number generator is system dependent, -so do not expect the sequence generated from a particular seed to be -identical on two different machines or operating systems. - -> [!TIP] -> **See also:** -> + [pick proc](/ref/proc/pick.md) -> + [prob proc](/ref/proc/prob.md) -> + [rand proc](/ref/proc/rand.md) -> + [roll proc](/ref/proc/roll.md) \ No newline at end of file +The pseudo-random number generator is system dependent, so do not expect the sequence generated from a particular seed to be identical on two different machines or operating systems. +*** +**Related Pages:** ++ [pick proc](/ref/proc/pick) ++ [prob proc](/ref/proc/prob) ++ [rand proc](/ref/proc/rand) ++ [roll proc](/ref/proc/roll) diff --git a/ref/proc/range.md b/ref/proc/range.md index e9f8c688..f261de76 100644 --- a/ref/proc/range.md +++ b/ref/proc/range.md @@ -1,30 +1,22 @@ -## range proc + +## range (proc) **Format:** + range(Dist,Center=usr) -**Returns:** -+ A list of objects within Dist tiles of Center. - -**Args:** -+ Dist: A number. +**Arguments:** ++ Dist: A number. + Center: An object on the map. +**Returns:** ++ A list of objects within Dist tiles of Center. +*** +This instruction is identical to view() except visibility is ignored. All objects are included in the list whether they are visible or not. -This instruction is identical to view() except visibility is -ignored. All objects are included in the list whether they are visible -or not. - -A Dist of 0 includes Center, the contents of Center -(normally usr.contents), its location (normally the turf a mob is -standing on), and any other contents of that location. A value of 1 -extends the region to the neighboring squares on the map and so on. You -can also use a rectangular box size using a text string such as -"13x11". Both arguments are optional and may be passed in any order. - -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [block](/ref/proc/block.md) -> + [view proc](/ref/proc/view.md) -> + [orange proc](/ref/proc/orange.md) \ No newline at end of file +A Dist of 0 includes Center, the contents of Center (normally usr.contents), its location (normally the turf a mob is standing on), and any other contents of that location. A value of 1 extends the region to the neighboring squares on the map and so on. You can also use a rectangular box size using a text string such as "13x11". Both arguments are optional and may be passed in any order. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [block](/ref/proc/block) ++ [view proc](/ref/proc/view) ++ [orange proc](/ref/proc/orange) diff --git a/ref/proc/ref.md b/ref/proc/ref.md index 69aea588..1a4c4b0d 100644 --- a/ref/proc/ref.md +++ b/ref/proc/ref.md @@ -1,17 +1,17 @@ -## ref proc + +## ref (proc) **Format:** + ref(Object) -**Args:** +**Arguments:** + Object: The object to get a reference for **Returns:** + A string containing a reference ID. - +*** This is a shortcut for `"\ref[Object]"`. - -> [!TIP] -> **See also:** -> + [\\ref text macro](/ref/DM/text/macros/ref.md) -> + [locate proc](/ref/proc/locate.md) \ No newline at end of file +*** +**Related Pages:** ++ [\ref text macro](/ref/DM/text/macros/ref) ++ [locate proc](/ref/proc/locate) diff --git a/ref/proc/refcount.md b/ref/proc/refcount.md index 5b0a2d21..1b983373 100644 --- a/ref/proc/refcount.md +++ b/ref/proc/refcount.md @@ -1,31 +1,20 @@ -## refcount proc -###### BYOND Version 515 + +## refcount (proc) **Format:** + refcount(Object) -**Args:** +**Arguments:** + Object: The object to get a reference count for **Returns:** + A count of references for the object. +*** +This gets a reference count for a value, not including the reference that was placed on the stack while evaluating this proc. -This gets a reference count for a value, not including the -reference that was placed on the stack while evaluating this proc. - -A return value of 0 can mean one of several things: Either this -was the last reference and the object was subsequently deleted after -refcount(), or the value doesn\'t support reference counting. - -> [!NOTE] -> A nonzero return value does not necessarily mean the -object will be deleted when its count reaches zero; mobs for instance -will not be soft-deleted by the garbage collector if their `key` var is -set, and some objects like clients and areas never soft-delete. A zero -value also does not necessarily mean the object is immortal; it may be -transient, like the `args` list in a proc that only lives as long as -that copy of the proc lives. +A return value of 0 can mean one of several things: Either this was the last reference and the object was subsequently deleted after refcount(), or the value doesn't support reference counting. -> [!TIP] -> **See also:** -> + [garbage collection](/ref/DM/garbage.md) \ No newline at end of file +Note: A nonzero return value does not necessarily mean the object will be deleted when its count reaches zero; mobs for instance will not be soft-deleted by the garbage collector if their `key` var is set, and some objects like clients and areas never soft-delete. A zero value also does not necessarily mean the object is immortal; it may be transient, like the `args` list in a proc that only lives as long as that copy of the proc lives. +*** +**Related Pages:** ++ [garbage collection](/ref/DM/garbage) diff --git a/ref/proc/regex.md b/ref/proc/regex.md index a632f9ac..1a9c66e9 100644 --- a/ref/proc/regex.md +++ b/ref/proc/regex.md @@ -1,30 +1,25 @@ -## regex proc -###### BYOND Version 510 +## regex (proc) **Format:** + regex(pattern, flags) + regex(Regex) -**Returns:** -+ A new /regex datum. - -**Args:** +**Arguments:** + pattern: The pattern string to search for -+ flags: (optional) A text string containing any combination of - modifier flags ++ flags: (optional) A text string containing any combination of modifier flags + Regex: an existing /regex datum to copy - -Creates a [regular expression](/ref/notes/regex.md) stored in -a /regex datum, that can be used for searching and/or replacing text. - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex datum](/ref/regex.md) -> + [regex procs](/ref/regex/proc.md) -> + [findtext proc](/ref/proc/findtext.md) -> + [replacetext proc](/ref/proc/replacetext.md) -> + [splittext proc](/ref/proc/splittext.md) -> + [REGEX_QUOTE proc](/ref/proc/REGEX_QUOTE.md) \ No newline at end of file +**Returns:** ++ A new /regex datum. +*** +Creates a regular expression, stored in a /regex datum, that can be used for searching and/or replacing text. +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex datum](/ref/regex) ++ [regex procs](/ref/regex/proc) ++ [findtext proc](/ref/proc/findtext) ++ [replacetext proc](/ref/proc/replacetext) ++ [splittext proc](/ref/proc/splittext) ++ [REGEX_QUOTE proc](/ref/proc/REGEX_QUOTE) diff --git a/ref/proc/replacetext.md b/ref/proc/replacetext.md index 81764b1a..109a44d8 100644 --- a/ref/proc/replacetext.md +++ b/ref/proc/replacetext.md @@ -1,57 +1,40 @@ -## replacetext proc -###### BYOND Version 510 + +## replacetext (proc) **Format:** + replacetext(Haystack,Needle,Replacement,Start=1,End=0) +**Arguments:** ++ Haystack: The text string to search. ++ Needle: The sub-text to search for. May be a regular expression (regex). ++ Replacement: The replacement text, or a proc. ++ Start: The text byte position in Haystack in which to begin the search. ++ End: The text byte position in Haystack immediately following the last + character to search. + **Returns:** + The Haystack text with all cases of Needle replaced by Replacement +*** +When Needle is text, this instruction is NOT sensitive to the case of Haystack or Needle. The case-sensitive version is replacetextEx(). If the Needle is a lowercase word, the replacement will be changed to uppercase or all caps if the found text is uppercase or all caps. -**Args:** -+ Haystack: The text string to search. -+ Needle: The sub-text to search for. May be a regular expression - (regex). -+ Replacement: The replacement text, or a proc. -+ Start: The text byte position in Haystack in which to begin the - search. -+ End: The text byte position in Haystack immediately following the - last character to search. - -When Needle is text, this instruction is NOT sensitive to the -case of Haystack or Needle. The case-sensitive version is -replacetextEx(). If the Needle is a lowercase word, the replacement will -be changed to uppercase or all caps if the found text is uppercase or -all caps. -### Example: ```dm - world << replacetext("One on one", "one", "two") -``` +world << replacetext("One on one", "one", "two") -This outputs "Two on two", where the first case\'s -"One" is identified as uppercase. +``` -You may use a proc as the -Replacement value. In that case, the proc will be called with the found -text as an argument, and its return value will be the replacement. There -will be no automatic correction to uppercase or all caps in this case. +This outputs "Two on two", where the first case's "One" is identified as uppercase. -When the Needle value is a regular expression, this proc -behaves identically to the [regex Replace()](/ref/regex/proc/Replace.md) proc. -Case-sensitivity, and whether one match or all are replaced, depend on -the regular expression. +You may use a proc as the Replacement value. In that case, the proc will be called with the found text as an argument, and its return value will be the replacement. There will be no automatic correction to uppercase or all caps in this case. -Note: In strings containing non-ASCII -characters, byte position and character position are not the same thing. -Use `replacetext_char()` to work with character counts instead of bytes, -at a performance cost. See the [Unicode](/ref/notes/Unicode.md) section -for more information. +When the Needle value is a regular expression, this proc behaves identically to the regex Replace() proc. Case-sensitivity, and whether one match or all are replaced, depend on the regular expression. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [replacetextEx proc](/ref/proc/replacetextEx.md) -> + [Regular expressions](/ref/notes/regex.md) -> + [Replace proc (regex)](/ref/regex/proc/Replace.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `replacetext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [replacetextEx proc](/ref/proc/replacetextEx) ++ [Regular expressions](/ref/{notes}/regex) ++ [Replace proc (regex)](/ref/regex/proc/Replace) diff --git a/ref/proc/replacetextEx.md b/ref/proc/replacetextEx.md index 4eb56f11..909a8c6c 100644 --- a/ref/proc/replacetextEx.md +++ b/ref/proc/replacetextEx.md @@ -1,51 +1,40 @@ -## replacetextEx proc -###### BYOND Version 510 + +## replacetextEx (proc) **Format:** + replacetextEx(Haystack,Needle,Replacement,Start=1,End=0) -**Returns:** -+ The Haystack text with all cases of Needle replaced by Replacement - -**Args:** +**Arguments:** + Haystack: The text string to search. -+ Needle: The sub-text to search for. May be a regular expression - (regex). ++ Needle: The sub-text to search for. May be a regular expression (regex). + Replacement: The replacement text, or a proc. -+ Start: The text byte position in Haystack in which to begin the - search. -+ End: The text byte position in Haystack immediately following the - last character to search. ++ Start: The text byte position in Haystack in which to begin the search. ++ End: The text byte position in Haystack immediately following the last + character to search. + +**Returns:** ++ The Haystack text with all cases of Needle replaced by Replacement +*** +When Needle is text, this instruction is sensitive to the case of Haystack and Needle. The case-insensitive version is replacetext(). -When Needle is text, this instruction is sensitive to the case -of Haystack and Needle. The case-insensitive version is replacetext(). -### Example: ```dm - world << replacetext("One on one", "one", "two") + +world << replacetext("One on one", "one", "two") + ``` -This outputs "Two on two", where the first case\'s -"One" is identified as uppercase. - -You may use a proc as the -Replacement value. In that case, the proc will be called with the found -text as an argument, and its return value will be the replacement. There -will be no automatic correction to uppercase or all caps in this case. - -When the Needle value is a regular expression, this proc -behaves identically to the [regex Replace()](/ref/regex/proc/Replace.md) proc. -Case-sensitivity, and whether one match or all are replaced, depend on -the regular expression. - -Note: In strings containing non-ASCII -characters, byte position and character position are not the same thing. -Use `replacetextEx_char()` to work with character counts instead of -bytes, at a performance cost. See the [Unicode](/ref/notes/Unicode.md) section for more information. - -> [!TIP] -> **See also:** -> + [findtextEx proc](/ref/proc/findtextEx.md) -> + [replacetext proc](/ref/proc/replacetext.md) -> + [Regular expressions](/ref/notes/regex.md) -> + [Replace proc (regex)](/ref/regex/proc/Replace.md) \ No newline at end of file + +This outputs "Two on two", where the first case's "One" is identified as uppercase. + +You may use a proc as the Replacement value. In that case, the proc will be called with the found text as an argument, and its return value will be the replacement. There will be no automatic correction to uppercase or all caps in this case. + +When the Needle value is a regular expression, this proc behaves identically to the regex Replace() proc. Case-sensitivity, and whether one match or all are replaced, depend on the regular expression. + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `replacetextEx_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtextEx proc](/ref/proc/findtextEx) ++ [replacetext proc](/ref/proc/replacetext) ++ [Regular expressions](/ref/{notes}/regex) ++ [Replace proc (regex)](/ref/regex/proc/Replace) diff --git a/ref/proc/return.md b/ref/proc/return.md index 25f04e52..93f52651 100644 --- a/ref/proc/return.md +++ b/ref/proc/return.md @@ -1,12 +1,10 @@ -## return statement + +## return (proc) **Format:** + return E - -Stop execution of the current proc and return the value of E to -the caller. If no value is specified, the value of `.` will be returned, -which defaults to null. - -> [!TIP] -> **See also:** -> + [. var (proc)](/ref/proc/var/%2e.md) \ No newline at end of file +*** +Stop execution of the current proc and return the value of E to the caller. If no value is specified, the value of `.` will be returned, which defaults to null. +*** +**Related Pages:** ++ [. var (proc)](/ref/proc/var/%2e) diff --git a/ref/proc/rgb.md b/ref/proc/rgb.md index ff39bb07..3b7820be 100644 --- a/ref/proc/rgb.md +++ b/ref/proc/rgb.md @@ -1,81 +1,60 @@ -## rgb proc + +## rgb (proc) **Format:** + rgb(R,G,B) + rgb(R,G,B,A) -+ rgb(x,y,z,space=*color space*) ++ rgb(x,y,z,space=) + rgb(x,y,z,a,space) -**Args:** +**Arguments:** + R,G,B: Numbers from 0-255 corresponding to the red, green, and blue - components of a color. +components of a color. + A: Optional alpha component; 0 is transparent, 255 is opaque. + x,y,z: Color components for a different color space -+ space: [Color space](/ref/appendix/color-space.md) ; defaults - to `COLORSPACE_RGB` ++ space: ; defaults to [Color space](/ref/{{appendix}}/color-space) **Returns:** + A color, represented by a text string in #RRGGBB or #RRGGBBAA format +*** +A way of representing a color to be used in conjunction with icon arithmetic, atom.color, or other effects. The colors `rgb(0,0,0)` and `rgb(255,255,255)` represent black and white, two corners of the "color cube". -A way of representing a color to be used in conjunction with -icon arithmetic, atom.color, or other effects. The colors `rgb(0,0,0)` -and `rgb(255,255,255)` represent black and white, two corners of the -"color cube". -### Example: ```dm + mob/proc/hurtme() // make a mob look damaged by adding red to its icon - src.icon += rgb(20,0,0) + src.icon += rgb(20,0,0) + ``` -This proc -returns a text string in the form used by HTML (#RRGGBB). rgb(255,0,128) -for example becomes "#ff0080". If you use an alpha component, the -format is #RRGGBBAA. You can use strings like this in most procs that -use colors such as icon blending operations, and you can also use the -short form #RGB or #RGBA. So if you know in advance that you want to use -the color white, you can simply use"#fff" instead of rgb(255,255,255). - -You can create colors other ways by specifying a different -[color space](/ref/appendix/color-space.md) . A color space can be -specified by using a [named](/ref/proc/arguments/named.md) "space" argument, -or by using a 5-argument format (you can leave the alpha value blank or -null to skip it), or by using named arguments for the other components. -### Example: + +This proc returns a text string in the form used by HTML (#RRGGBB). rgb(255,0,128) for example becomes "#ff0080". If you use an alpha component, the format is #RRGGBBAA. You can use strings like this in most procs that use colors such as icon blending operations, and you can also use the short form #RGB or #RGBA. So if you know in advance that you want to use the color white, you can simply use"#fff" instead of rgb(255,255,255). + +You can create colors other ways by specifying a different color space. A color space can be specified by using a named "space" argument, or by using a 5-argument format (you can leave the alpha value blank or null to skip it), or by using named arguments for the other components. + ```dm + // All of these lines are equivalent. // They create (0,100,50) in HSL which is red (#ff0000). src << rgb(0, 100, 50, space=COLORSPACE_HSL) src << rgb(0, 100, 50, , COLORSPACE_HSL) src << rgb(h=0, s=100, l=50) + ``` -Named arguments that are -valid in `rgb()` are: -- `space` -- `red` -- `green` -- `blue` -- `alpha` -- `hue` -- `saturation` -- `chroma` -- `value` -- `luminance` -- `y` (HCY luminance) - -With the exception of `space`, only the first letter of the -argument name matters, so `r` and `red` are the same thing. - -> [!TIP] -> **See also:** -> + [rgb2num proc](/ref/proc/rgb2num.md) -> + [gradient proc](/ref/proc/gradient.md) -> + [Color space](/ref/appendix/color-space.md) -> + [HTML colors](/ref/appendix/html-colors.md) -> + [color var (atom)](/ref/atom/var/color.md) -> + [Blend proc (icon)](/ref/icon/proc/Blend.md) -> + [Color matrix](/ref/notes/color-matrix.md) -> + [Color matrix filter](/ref/notes/filters/color.md) -> + [Particle effects](/ref/notes/particles.md) \ No newline at end of file + +Named arguments that are valid in `rgb()` are: + +With the exception of `space`, only the first letter of the argument name matters, so `r` and `red` are the same thing. +*** +**Related Pages:** ++ [rgb2num proc](/ref/proc/rgb2num) ++ [gradient proc](/ref/proc/gradient) ++ [Color space](/ref/{{appendix}}/color-space) ++ [HTML colors](/ref/{{appendix}}/html-colors) ++ [color var (atom)](/ref/atom/var/color) ++ [Blend proc (icon)](/ref/icon/proc/Blend) ++ [Color matrix](/ref/{notes}/color-matrix) ++ [Color matrix filter](/ref/{notes}/filters/color) ++ [Particle effects](/ref/{notes}/particles) diff --git a/ref/proc/rgb2num.md b/ref/proc/rgb2num.md index 33c5c573..8f89264a 100644 --- a/ref/proc/rgb2num.md +++ b/ref/proc/rgb2num.md @@ -1,43 +1,45 @@ -## rgb2num proc + +## rgb2num (proc) **Format:** + rgb2num(color) + rgb2num(color, space) -**Args:** -+ color: A color value (see [HTML - colors](/ref/appendix/html-colors.md) ) -+ space: [Color space](/ref/appendix/color-space.md) default is - `COLORSPACE_RGB` +**Arguments:** ++ color: A color value (see ) [HTML colors](/ref/{{appendix}}/html-colors) ++ space: ; default is [Color space](/ref/{{appendix}}/color-space) **Returns:** + A list with the components of this color +*** +Parses a color into a list with 3 or 4 component values; the 4th value is alpha, if it's part of the color provided. -Parses a color into a list with 3 or 4 component values; the -4th value is alpha, if it\'s part of the color provided. -### Example: ```dm + var/list/RGB = rgb2num("#ff8000") src << RGB[1] // red (255) src << RGB[2] // green (128) src << RGB[3] // blue (0) + ``` - -By specifying a different color space, you can -convert a color into a different format. -### Example: + + +By specifying a different color space, you can convert a color into a different format. + ```dm + var/list/HSL = rgb2num("#5af", COLORSPACE_HSL) src << HSL[1] // hue (210) src << HSL[2] // saturation (100) src << HSL[3] // luminance (66.6667) + ``` -> [!TIP] -> **See also:** -> + [rgb proc](/ref/proc/rgb.md) -> + [gradient proc](/ref/proc/gradient.md) -> + [Color space](/ref/appendix/color-space.md) -> + [HTML colors](/ref/appendix/html-colors.md) \ No newline at end of file +*** +**Related Pages:** ++ [rgb proc](/ref/proc/rgb) ++ [gradient proc](/ref/proc/gradient) ++ [Color space](/ref/{{appendix}}/color-space) ++ [HTML colors](/ref/{{appendix}}/html-colors) diff --git a/ref/proc/roll.md b/ref/proc/roll.md index 8ce19cce..158c66bb 100644 --- a/ref/proc/roll.md +++ b/ref/proc/roll.md @@ -1,36 +1,34 @@ -## roll proc + +## roll (proc) **Format:** + roll(ndice=1,sides) + roll(dice) -**Returns:** -+ The sum of the rolled dice. - -**Args:** +**Arguments:** + ndice: number of dice to role. + sides: number of sides to the dice. + dice: a text string encoding both ndice and sides (see below). -The sides of the dice are numbered 1 through the total number -of sides and each is equally likely. +**Returns:** ++ The sum of the rolled dice. +*** +The sides of the dice are numbered 1 through the total number of sides and each is equally likely. + +An alternate form takes the dice parameters in a single text value such as "3d4". This may be useful when you want to store the dice information in a single variable. You can even specify an offset, such as "3d4+5". That adds 5 to the sum of 3 dice having 4 sides each. -An alternate form takes -the dice parameters in a single text value such as "3d4". This may be -useful when you want to store the dice information in a single variable. -You can even specify an offset, such as "3d4+5". That adds 5 to the -sum of 3 dice having 4 sides each. -### Example: ```dm + obj/potion/healing var/dice = "3d6" verb/drink() var/h = roll(dice) if(h>15) usr << "Very refreshing!" else usr << "You feel better." + ``` -> [!TIP] -> **See also:** -> + [rand proc](/ref/proc/rand.md) \ No newline at end of file +*** +**Related Pages:** ++ [rand proc](/ref/proc/rand) diff --git a/ref/proc/round.md b/ref/proc/round.md index 30fdbf3e..76379ed3 100644 --- a/ref/proc/round.md +++ b/ref/proc/round.md @@ -1,34 +1,38 @@ -## round proc + +## round (proc) **Format:** -+ round(A) Deprecated ++ round(A) + round(A,B) -**Returns:** -+ rounded A - -**Args:** +**Arguments:** + A: A number, pixloc, or vector. + B: The nearest multiple to round A. -The first format returns the floor of A (the largest integer -less than or equal to A), and has been deprecated in favor of -`floor(A)`. The second format rounds A to the nearest multiple of B. -### Example: +**Returns:** ++ rounded A +*** +The first format returns the floor of A (the largest integer less than or equal to A), and has been deprecated in favor of `floor(A)`. The second format rounds A to the nearest multiple of B. + ```dm + usr << round(1.45) // outputs 1 + usr << round(-1.45) // outputs -2 -usr << round(1.45,1.5) // outputs 1.5 + +usr << round(1.45,1.5) // outputs 1.5 + ``` -If A is a vector, B can also be a vector to round each component separately. -If A is a pixloc, only the x and y portions will be considered. B may be a vector. -> [!TIP] -> **See also:** -> + [floor proc](/ref/proc/floor.md) -> + [ceil proc](/ref/proc/ceil.md) -> + [trunc proc](/ref/proc/trunc.md) -> + [fract proc](/ref/proc/fract.md) -> + [sign proc](/ref/proc/sign.md) \ No newline at end of file +If A is a vector, B can also be a vector to round each component separately. + +If A is a pixloc, only the x and y portions will be considered. B may be a vector. +*** +**Related Pages:** ++ [floor proc](/ref/proc/floor) ++ [ceil proc](/ref/proc/ceil) ++ [trunc proc](/ref/proc/trunc) ++ [fract proc](/ref/proc/fract) ++ [sign proc](/ref/proc/sign) diff --git a/ref/proc/run.md b/ref/proc/run.md index f23d3c79..6fab634c 100644 --- a/ref/proc/run.md +++ b/ref/proc/run.md @@ -1,28 +1,27 @@ -## run proc + +## run (proc) **Format:** + O << run(File) +*** +This is similar to link() but instead of a URL, you can pass a file to be viewed directly. The file may be a cache file or an external file. -This is similar to link() but instead of a URL, you can pass a -file to be viewed directly. The file may be a cache file or an external -file. -### Example: ```dm + mob/var/picture = 'mob.jpg' mob/verb/view_pic(mob/M as mob in view()) usr << run(M.picture) mob/verb/set_pic(F as file) usr.picture = F + ``` -This example defines a picture to be -associated with each mob and a verb for viewing another mob\'s picture. -Players can also configure their own pictures. -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [file proc](/ref/proc/file.md) -> + [link proc](/ref/proc/link.md) \ No newline at end of file +This example defines a picture to be associated with each mob and a verb for viewing another mob's picture. Players can also configure their own pictures. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [file proc](/ref/proc/file) ++ [link proc](/ref/proc/link) diff --git a/ref/proc/set.md b/ref/proc/set.md deleted file mode 100644 index 39386a50..00000000 --- a/ref/proc/set.md +++ /dev/null @@ -1,19 +0,0 @@ -# settings (proc) - -proc settings:\ -verb/set -- [name](/ref/verb/set/name.md) -- [desc](/ref/verb/set.md) -- [category](/ref/verb/set/category.md) -- [hidden](/ref/verb/set/hidden.md) -- [popup_menu](/ref/verb/set/popup_menu.md) -- [instant](/ref/verb/set/instant.md) -- [invisibility](/ref/verb/set/invisibility.md) -- [src](/ref/verb/set/src.md) -- [background](/ref/proc/set_background.md) -- [waitfor](/ref/proc/set_waitfor.md) - -Procs and verbs are the same "type" so these attributes may -be set for both procs and verbs; most of them only apply to verbs, so -they only take effect if the proc is invoked as a verb (by adding it to -a verb list). \ No newline at end of file diff --git a/ref/proc/set/background.md b/ref/proc/set/background.md new file mode 100644 index 00000000..7b4c3261 --- /dev/null +++ b/ref/proc/set/background.md @@ -0,0 +1,29 @@ + +## background (proc) +*** +To avoid lag from procedures that hog the CPU for too long, you can turn on background processing. This will cause it to periodically sleep for long enough to allow other events to be processed. + +The following example is a typical "ticker" procedure. It spawns off an infinite loop which does some work and then sleeps before iterating again. By running this in the background, you ensure that the work being done does not create large delays. You could achieve a similar thing by sprinkling calls to sleep(0) or sleep(-1) in the "working" part of the loop. + + +```dm + +proc/Ticker() + set background = 1 + spawn while(1) + for(var/mob/M in world) + M.Tick() + sleep(10) + +``` + + +Since the background procedure sleeps at unpredictable times, you must be aware that race conditions are possible if the background procedure interacts with variables modified by other procedures. It's still much safer than multi-threaded programs because the background procedure never interrupts other code; but other code may interrupt the background procedure. + +Note that procedures that are called by the background procedure do not automatically run in the background unless they too have the background setting turned on. For instance, the code in the above example does not imply that the mob Tick() procs would run in the background. This is convenient, because you should only ever apply background processing to code after checking that there are no potential race conditions involved. + +If you have an eye for race conditions, you might think that the above code has one in which a mob gets deleted after it is assigned to M but before the call to M.Tick() is executed. However, background processing is only interrupted at loop points in the code, so the above code is safe. It would only ever be interrupted at the end of the for or while loops. +*** +**Related Pages:** ++ [sleep proc](/ref/proc/sleep) ++ [spawn proc](/ref/proc/spawn) diff --git a/ref/proc/set/index.md b/ref/proc/set/index.md new file mode 100644 index 00000000..94f0754d --- /dev/null +++ b/ref/proc/set/index.md @@ -0,0 +1,7 @@ + +## set (proc) +*** +proc settings:
 verb/set name desc category hidden popup_menu instant invisibility src background waitfor 
+ +Procs and verbs are the same "type" so these attributes may be set for both procs and verbs; most of them only apply to verbs, so they only take effect if the proc is invoked as a verb (by adding it to a verb list). +*** \ No newline at end of file diff --git a/ref/proc/set/waitfor.md b/ref/proc/set/waitfor.md new file mode 100644 index 00000000..36a07a7b --- /dev/null +++ b/ref/proc/set/waitfor.md @@ -0,0 +1,26 @@ + +## waitfor (proc) +*** +By default, procs that sleep usually expect their callers to wait for them to finish, so the callers must sleep as well. Using `set waitfor=0` will disable that behavior, causing any sleep to return control to the caller immediately. + + +```dm + +mob/proc/LongLoop() + set waitfor = 0 + while(1) + UpdateAI() + // proc will return to caller here + sleep(1) + +``` + + +This setting will also dictate what happens if a callee sleeps. Consider an example where proc A calls proc B which calls proc C, and proc B has `waitfor` set to 0. When proc C sleeps, proc B will also sleep, but proc A will continue running as if proc B returned early. The `.` var currently in proc B will be used as its return value to A. When proc C wakes up and finishes, it will wake up proc B, but now B's return value will be ignored since A is no longer waiting for it. + +In older versions, the `New` proc always had `waitfor` set to 0 by default, but this was later changed. Now 1 is always the default, so setting `waitfor` to 1 will result in a warning that it is no longer necessary. +*** +**Related Pages:** ++ [sleep proc](/ref/proc/sleep) ++ [spawn proc](/ref/proc/spawn) ++ [. var (proc)](/ref/proc/var/%2e) diff --git a/ref/proc/set_background.md b/ref/proc/set_background.md deleted file mode 100644 index b8bbf5a5..00000000 --- a/ref/proc/set_background.md +++ /dev/null @@ -1,51 +0,0 @@ -## background setting (proc) - -To avoid lag from procedures that hog the CPU for too long, you -can turn on background processing. This will cause it to periodically -sleep for long enough to allow other events to be processed. - -The following example is a typical "ticker" procedure. It -spawns off an infinite loop which does some work and then sleeps before -iterating again. By running this in the background, you ensure that the -work being done does not create large delays. You could achieve a -similar thing by sprinkling calls to sleep(0) or sleep(-1) in the -"working" part of the loop. - -### Example - -```dm -proc/Ticker() - set background = 1 - spawn while(1) - for(var/mob/M in world) - M.Tick() - sleep(10) -``` - -Since the background procedure sleeps at unpredictable times, you must be aware -that race conditions are possible if the background procedure interacts -with variables modified by other procedures. It\'s still much safer than -multi-threaded programs because the background procedure never -interrupts other code; but other code may interrupt the background -procedure. - -> [!NOTE] -> Procedures that are called by the -background procedure do not automatically run in the background unless -they too have the background setting turned on. For instance, the code -in the above example does not imply that the mob Tick() procs would run -in the background. This is convenient, because you should only ever -apply background processing to code after checking that there are no -potential race conditions involved. - -If you have an eye for race conditions, you might think that the above -code has one in which a mob gets deleted after it is assigned to M but -before the call to M.Tick() is executed. However, *background -processing is only interrupted at loop points in the code*, -so the above code is safe. It would only ever be interrupted at -the end of the `for` or `while` loops. - -> [!TIP] -> **See also:** -> + [sleep proc](/ref/proc/sleep.md) -> + [spawn proc](/ref/proc/spawn.md) \ No newline at end of file diff --git a/ref/proc/set_waitfor.md b/ref/proc/set_waitfor.md deleted file mode 100644 index 7255185a..00000000 --- a/ref/proc/set_waitfor.md +++ /dev/null @@ -1,35 +0,0 @@ -## waitfor setting (proc) - -By default, procs that sleep usually expect their callers to -wait for them to finish, so the callers must sleep as well. Using -`set waitfor=0` will disable that behavior, causing any sleep to return -control to the caller immediately. -### Example - -```dm -mob/proc/LongLoop() - set waitfor = 0 - while(1) - UpdateAI() - // proc will return to caller here - sleep(1) -``` - -This setting will also dictate what happens if a callee sleeps. Consider an -example where proc A calls proc B which calls proc C, and proc B has -`waitfor` set to 0. When proc C sleeps, proc B will also sleep, but proc -A will continue running as if proc B returned early. The `.` var -currently in proc B will be used as its return value to A. When proc C -wakes up and finishes, it will wake up proc B, but now B\'s return value -will be ignored since A is no longer waiting for it. - -In older versions, the [`New` proc](/ref/datum/proc/New.md) always had `waitfor` set to -0 by default, but this was later changed. Now 1 is always the default, -so setting `waitfor` to 1 will result in a warning that it is no longer -necessary. - -> [!TIP] -> **See also:** -> + [sleep proc](/ref/proc/sleep.md) -> + [spawn proc](/ref/proc/spawn.md) -> + [. var (proc)](/ref/proc/var/%2e.md) \ No newline at end of file diff --git a/ref/proc/sha1.md b/ref/proc/sha1.md index 42cc088f..23024750 100644 --- a/ref/proc/sha1.md +++ b/ref/proc/sha1.md @@ -1,27 +1,22 @@ -## sha1 proc -###### BYOND Version 513 + +## sha1 (proc) **Format:** + sha1(T) + sha1(F) -**Returns:** -+ text or null. - -**Args:** +**Arguments:** + T: A text string. + F: A file. -This proc implements SHA1 hashing. A hash function is a one-way -process that compacts information to a short value: a hash. The same -value will always have the same hash. Among other uses, most computers -use hashing to store passwords. By storing just the hash, the password -file contains very little sensitive information, but the password can -still be verified by confirming that `sha1(password)==hash`. SHA1 is a -widely-used hash function. -### Example: +**Returns:** ++ text or null. +*** +This proc implements SHA1 hashing. A hash function is a one-way process that compacts information to a short value: a hash. The same value will always have the same hash. Among other uses, most computers use hashing to store passwords. By storing just the hash, the password file contains very little sensitive information, but the password can still be verified by confirming that sha1(password)==hash. SHA1 is a widely-used hash function. + ```dm + mob/var/hash mob/Read(savefile/S) @@ -30,23 +25,17 @@ mob/Read(savefile/S) if(sha1("[level]/[exp]/[exp_needed]") != hash) src << "Cheater!" del(src) + ``` -In the example, a few vars -belonging to a mob were saved along with a hash of those values. When -the mob is loaded again, the game compares the hash to the values to -make sure it\'s still accurate. If the values or hash had been changed -by a sneaky player, they wouldn\'t match. (But a sneaky player could -still calculate `hash` themselves if they knew the exact text used to -make it, so this should be kept secret.) -If the argument is a -file, `sha1()` will read the file and return the SHA1 hash of the -file\'s entire contents. If the file doesn\'t exist, it returns null. -The file may be a cache file or an external file. -### Examples: +In the example, a few vars belonging to a mob were saved along with a hash of those values. When the mob is loaded again, the game compares the hash to the values to make sure it's still accurate. If the values or hash had been changed by a sneaky player, they wouldn't match. (But a sneaky player could still calculate hash themselves if they knew the exact text used to make it, so this should be kept secret.) + +If the argument is a file, `sha1()` will read the file and return the SHA1 hash of the file's entire contents. If the file doesn't exist, it returns null. The file may be a cache file or an external file. + ```dm + var/hash = "(insert hash value here)" // Compute this ahead of time // Check that the cached default icon is still the same @@ -56,16 +45,14 @@ if (sha1('default.dmi') != hash) // Or check that the entire game resource file is pristine if (sha1(file("mygame.rsc")) != hash) world << "The game resources have been modified!" + ``` -Note that you must pass the -result of [file()](/ref/proc/file.md) in order to compute the hash of -an external file\'s contents at runtime. Otherwise `sha1()` will treat -the filename as text and return the hash of the name only. -If `T` is anything but a text string or file, the proc returns null. +Note that you must pass the result of file() in order to compute the hash of an external file's contents at runtime. Otherwise `sha1()` will treat the filename as text and return the hash of the name only. -> [!TIP] -> **See also:** -> + [md5 proc](/ref/proc/md5.md) -> + [file proc](/ref/proc/file.md) \ No newline at end of file +If `T` is anything but a text string or file, the proc returns null. +*** +**Related Pages:** ++ [md5 proc](/ref/proc/md5) ++ [file proc](/ref/proc/file) diff --git a/ref/proc/shell.md b/ref/proc/shell.md index 1f281d3c..67771df8 100644 --- a/ref/proc/shell.md +++ b/ref/proc/shell.md @@ -1,48 +1,38 @@ -## shell proc + +## shell (proc) **Format:** + shell(Command) -**Args:** +**Arguments:** + Command: system command to run **Returns:** + null on failure to execute command + exit code of command otherwise +*** +This function is used to run an external program. The syntax of Command depends on the server machine's operating system. Be sure to redirect input and output to files if there is any. Also realize that the command will fail if the program you try to run is not in the path where the shell expects to find executable files (unless you specify a full path). + +Since shell() allows arbitrary access to the system, each call requires authorization from the person hosting the world, unless running in trusted mode. Authorization is only sought when running in Dream Seeker, since Dream Daemon is intended to be non-interactive. Calling shell() with no arguments is a way of checking if it is allowed by the current safety settings. It will return true if running in Dream Seeker (regardless of safety mode) or if running in Dream Daemon in trusted mode. + +The calling proc will sleep until the command is finished executing. -This function is used to run an external program. The syntax of -Command depends on the server machine\'s operating system. Be sure to -redirect input and output to files if there is any. Also realize that -the command will fail if the program you try to run is not in the path -where the shell expects to find executable files (unless you specify a -full path). - -Since shell() allows arbitrary access to the -system, each call requires authorization from the person hosting the -world, unless running in trusted mode. Authorization is only sought when -running in Dream Seeker, since Dream Daemon is intended to be -non-interactive. Calling shell() with no arguments is a way of checking -if it is allowed by the current safety settings. It will return true if -running in Dream Seeker (regardless of safety mode) or if running in -Dream Daemon in trusted mode. - -The calling proc will sleep until -the command is finished executing. -### Example: ```dm + mob/verb/dir(Path as text) shell("dir [Path] > dir.out") usr << file2text("dir.out") + ``` -This example displays the output of the "dir" command to the user. -> [!TIP] -> **See also:** -> + [fcopy proc](/ref/proc/fcopy.md) -> + [fdel proc](/ref/proc/fdel.md) -> + [file2text proc](/ref/proc/file2text.md) -> + [process var (world)](/ref/world/var/process.md) -> + [system_type var (world)](/ref/world/var/system_type.md) -> + [text2file proc](/ref/proc/text2file.md) \ No newline at end of file +This example displays the output of the "dir" command to the user. +*** +**Related Pages:** ++ [fcopy proc](/ref/proc/fcopy) ++ [fdel proc](/ref/proc/fdel) ++ [file2text proc](/ref/proc/file2text) ++ [process var (world)](/ref/world/var/process) ++ [system_type var (world)](/ref/world/var/system_type) ++ [text2file proc](/ref/proc/text2file) diff --git a/ref/proc/shutdown.md b/ref/proc/shutdown.md index 4ccc9c3e..f0aca4c4 100644 --- a/ref/proc/shutdown.md +++ b/ref/proc/shutdown.md @@ -1,18 +1,18 @@ -## shutdown proc + +## shutdown (proc) **Format:** + shutdown(Addr,Natural=0) -**Args:** +**Arguments:** + Addr: This is the address of the child world returned by startup(). + Natural: Specifies whether to wait for the child world to die - naturally, or whether it should be killed with the "Del" world - topic. The default value of 0 kills the child, and a value of 1 - waits for the child to exit of its own accord. - + naturally, or whether it should be killed with the "Del" world topic. + The default value of 0 kills the child, and a value of 1 waits for the + child to exit of its own accord. +*** If no address is specified, the current world is shut down. - -> [!TIP] -> **See also:** -> + [Export proc (world)](/ref/world/proc/Export.md) -> + [startup proc](/ref/proc/startup.md) \ No newline at end of file +*** +**Related Pages:** ++ [Export proc (world)](/ref/world/proc/Export) ++ [startup proc](/ref/proc/startup) diff --git a/ref/proc/sign.md b/ref/proc/sign.md index a2dfae0a..a71664ca 100644 --- a/ref/proc/sign.md +++ b/ref/proc/sign.md @@ -1,30 +1,30 @@ -## sign proc -###### BYOND Version 516 + +## sign (proc) **Format:** + sign(A) -**Returns:** -+ The sign of A +**Arguments:** ++ A: A number or a . [vector](/ref/vector) -**Args:** -+ A: A number +**Returns:** ++ 1 if A > 0, -1 if A < 0, 0 if A == 0 +*** +Returns the sign of A. If used with a vector, a new vector is returned where `sign()` has been applied to each component. -Returns 1 if A is a positive number -Returns -1 if A is a negative number -Returns 0 if A is anything else -### Example: ```dm + usr << sign(20) // outputs 1 usr << sign(0) // outputs 0 usr << sign(-3) // outputs -1 + ``` -> [!TIP] -> **See also:** -> + [floor proc](/ref/proc/floor.md) -> + [floor proc](/ref/proc/ceil.md) -> + [round proc](/ref/proc/round.md) -> + [trunc proc](/ref/proc/trunc.md) -> + [fract proc](/ref/proc/fract.md) \ No newline at end of file +*** +**Related Pages:** ++ [floor proc](/ref/proc/floor) ++ [ceil proc](/ref/proc/ceil) ++ [round proc](/ref/proc/round) ++ [trunc proc](/ref/proc/trunc) ++ [fract proc](/ref/proc/fract) diff --git a/ref/proc/sin.md b/ref/proc/sin.md index 9a1c2228..48d03565 100644 --- a/ref/proc/sin.md +++ b/ref/proc/sin.md @@ -1,22 +1,25 @@ -## sin proc + +## sin (proc) **Format:** + sin(X) **Returns:** + The sine of X, where X is in degrees. -### Example: +*** ```dm + mob/verb/test() usr << sin(0) // 0 usr << sin(45) // 0.707... usr << sin(90) // 1 + ``` -> [!TIP] -> **See also:** -> + [arcsin proc](/ref/proc/arcsin.md) -> + [cos proc](/ref/proc/cos.md) -> + [tan proc](/ref/proc/tan.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arcsin proc](/ref/proc/arcsin) ++ [cos proc](/ref/proc/cos) ++ [tan proc](/ref/proc/tan) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/sleep.md b/ref/proc/sleep.md index 21ea199d..1258635e 100644 --- a/ref/proc/sleep.md +++ b/ref/proc/sleep.md @@ -1,42 +1,25 @@ -## sleep proc +## sleep (proc) **Format:** + sleep(Delay) -**Args:** +**Arguments:** + Delay: The amount of time to sleep, in 1/10 seconds. +*** +When a proc sleeps, it actually makes a copy of itself. The copy is what will wake up later, and the current proc simply ends. The same thing happens to its callers. + +Pause the current proc (and its callers) for a specified amount of time. If no delay is specified, it will be scheduled to resume as soon as other immediately pending events are processed. + +Note that sleeping in some procedures results in the return value being lost. For example, if you sleep inside Entered() or Exited(), it will be as if you returned immediately where you started sleeping. This is because `Move()` calls them in away that says the return value should be ignored. Also if a proc has its waitfor setting changed to 0, it will return the value of the `.` var to its caller immediately if it or one of its callees sleeps. + +Also be aware that a sleeping procedure whose `src` object gets deleted will automatically terminate when execution returns to it. This is to protect you against trying to access properties or procedures of a deleted (and therefore null) object. If you do not want the procedure to be terminated, you should set `src` to null. + +One common use of sleep is to create what is known as a *ticker*. That is an infinite loop that performs some periodic operation. -> [!IMPORTANT] -> When a proc sleeps, it actually makes a copy of itself. The -copy is what will wake up later, and the current proc simply ends. The -same thing happens to its callers. - -Pause the current proc (and its callers) for a specified amount -of time. If no delay is specified, it will be scheduled to resume as -soon as other immediately pending events are processed. - -> [!NOTE] -> Sleeping in some procedures results in the return value being lost. -For example, if you sleep inside `Entered()` or `Exited()`, it will be -as if you returned immediately where you started sleeping. This is -because `Move()` calls them in away that says the return value should be -ignored. Also if a proc has its [waitfor](/ref/proc/set/waitfor.md) -setting changed to 0, it will return the value of the `.` var to its -caller immediately if it or one of its callees sleeps. - -Also be aware that a sleeping procedure whose `src` object gets -deleted will automatically terminate when execution returns to it. This -is to protect you against trying to access properties or procedures of a -deleted (and therefore `null`) object. If you do not want the procedure -to be terminated, you should set `src` to `null`. - -One common use of `sleep` is to create what is known as a -*ticker*. That is an infinite loop that performs some periodic -operation. -### Example: ```dm + proc/Weather() spawn while(1) //infinite ticker loop world << "The sun rises in the east." @@ -45,43 +28,29 @@ proc/Weather() sleep(500) world << "The sun sinks low in the west." sleep(1000) + ``` -Notice how such infinite -loops are usually created using `spawn` to prevent the caller from -getting locked up. You could call this procedure from `world.New()` to -start it rolling. -> [!NOTE] -> Sleep time is in 1/10s units, not -server ticks. If your `world.tick_lag` or `world.fps` value is different -from the default, `sleep(1)` still means "sleep for 1/10s". To sleep -for exactly `N` ticks, call `sleep(N * world.tick_lag)`. +Notice how such infinite loops are usually created using spawn to prevent the caller from getting locked up. You could call this procedure from world.New() to start it rolling. + +Note: sleep time is in 1/10s units, not server ticks. If your world.tick_lag or world.fps value is different from the default, `sleep(1)` still means "sleep for 1/10s". To sleep for exactly `N` ticks, call sleep(N * world.tick_lag). + +If the ticker does intensive processing during each iteration, you probably want to run it in the background like this: + -If the -ticker does intensive processing during each iteration, you probably -want to run it in the background like this: ```dm + proc/Ticker() set background = 1 + ``` -Calling sleep() with a negative -argument (such as sleep(-1)) causes it to do a backlog check. Only if -other pending events have become backlogged will it sleep. This is -similar to running in the background, but you manually control where the -backlog checks are made. The difference between this and sleep(0) is -that sleep(0) *always* sleeps the current procedure for as short a time -as possible, whereas sleep(-1) only sleeps the current procedure if -other scheduled events have become backlogged. Therefore, sleep(-1) will -tend to run the current procedure at a higher priority with fewer -interruptions. It is appropriate when there is a single task that needs -to be done before anything else can happen, and you just want to make -sure that network and user I/O are not terribly lagged in the process. - -> [!TIP] -> **See also:** -> + [background setting (proc)](/ref/proc/set/background.md) -> + [waitfor setting (proc)](/ref/proc/set/waitfor.md) -> + [spawn proc](/ref/proc/spawn.md) -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) \ No newline at end of file + +Calling sleep() with a negative argument (such as sleep(-1)) causes it to do a backlog check. Only if other pending events have become backlogged will it sleep. This is similar to running in the background, but you manually control where the backlog checks are made. The difference between this and sleep(0) is that sleep(0) *always* sleeps the current procedure for as short a time as possible, whereas sleep(-1) only sleeps the current procedure if other scheduled events have become backlogged. Therefore, sleep(-1) will tend to run the current procedure at a higher priority with fewer interruptions. It is appropriate when there is a single task that needs to be done before anything else can happen, and you just want to make sure that network and user I/O are not terribly lagged in the process. +*** +**Related Pages:** ++ [background setting (proc)](/ref/proc/set/background) ++ [waitfor setting (proc)](/ref/proc/set/waitfor) ++ [spawn proc](/ref/proc/spawn) ++ [tick_lag var (world)](/ref/world/var/tick_lag) diff --git a/ref/proc/sorttext.md b/ref/proc/sorttext.md index 5f0aac41..28c74a89 100644 --- a/ref/proc/sorttext.md +++ b/ref/proc/sorttext.md @@ -1,32 +1,33 @@ -## sorttext proc + +## sorttext (proc) **Format:** + sorttext(T1,T2,...) -**Args:** +**Arguments:** + Any number of text strings to sort. **Returns:** + 1 if text is ascending + -1 if text is descending + 0 otherwise +*** +This instruction is NOT sensitive to case. The case sensitive version is sorttextEx(). -This instruction is NOT sensitive to case. The case sensitive -version is sorttextEx(). -### Example: ```dm + switch(sorttext("A","B")) if(1) world << "ascending" if(-1)world << "descending" if(0) world << "neither" + ``` -This outputs "ascending", since "A" -comes before "B" in the alphabet. -> [!TIP] -> **See also:** -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [sorttextEx proc](/ref/proc/sorttextEx.md) \ No newline at end of file +This outputs "ascending", since "A" comes before "B" in the alphabet. +*** +**Related Pages:** ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [sorttextEx proc](/ref/proc/sorttextEx) diff --git a/ref/proc/sorttextEx.md b/ref/proc/sorttextEx.md index 7bd50f7f..de428482 100644 --- a/ref/proc/sorttextEx.md +++ b/ref/proc/sorttextEx.md @@ -1,39 +1,39 @@ -## sorttextEx proc -###### This proc used to be named `sortText`, like `sorttext` but with a capital T. To avoid confusion it as been renamed, but old code will still compile. +## sorttextEx (proc) **Format:** + sorttextEx(T1,T2,...) -**Args:** +**Arguments:** + Any number of text strings to sort. **Returns:** + 1 if text is ascending + -1 if text is descending + 0 otherwise. +*** +This instruction is sensitive to case. The case-insensitive version is sorttext(). +Note: Uppercase letters are lower in the alphabetical order than lowercase letters. -This instruction is sensitive to case. The case-insensitive -version is sorttext(). - -> [!NOTE] ->Uppercase letters are lower in the alphabetical order than lowercase letters. - -### Example: ```dm + switch(sorttextEx("a","B")) if(1) world << "ascending" if(-1)world << "descending" if(0) world << "neither" + ``` - -This outputs, "descending", since -"B" comes before "a" in the alphabet. - -> [!TIP] -> **See also:** -> + [> operator](/ref/operator/%3e.md) -> + [< operator](/ref/operator/%3c.md) -> + [sorttext proc](/ref/proc/sorttext.md) \ No newline at end of file + + +This outputs, "descending", since "B" comes before "a" in the alphabet. + + +> [!TIP] +> Note: This proc used to be named `sortText`, like `sorttext` but with a capital T. To avoid confusion it has been renamed, but old code will still compile. +*** +**Related Pages:** ++ [> operator](/ref/operator/%3e) ++ [< operator](/ref/operator/%3c) ++ [sorttext proc](/ref/proc/sorttext) diff --git a/ref/proc/sound.md b/ref/proc/sound.md index 49e0c3a6..e18db37b 100644 --- a/ref/proc/sound.md +++ b/ref/proc/sound.md @@ -1,42 +1,37 @@ -## sound proc +## sound (proc) **Format:** + sound(file,repeat=0,wait,channel,volume) -+ [(supports named arguments)]{.small} ++ -**Args:** +**Arguments:** + file: A sound file to play + repeat: 1 to play sound repeatedly + wait: 0 to interrupt current sound on channel; 1 to wait in queue -+ channel: 0 for any available channel, 1-1024 for specific channel - (non-MIDI only) -+ volume: 100 for full volume (default), 0 for none, or any value in - between ++ channel: 0 for any available channel, 1-1024 for specific channel (non-MIDI only) ++ volume: 100 for full volume (default), 0 for none, or any value in between +*** +This is used to play a sound file. +The sound file must be a music or sample file. Music files include MIDI (.mid or .midi), and module formats .mod, .it, .s3m, .xm, and .oxm. A sample file used for sound effects can be .wav, .ogg, .raw, .wma, or .aiff.* -This is used to play a sound file. +The following example plays some sound files. Note that sound() is not even necessary when you don't need to set any additional parameters. -The sound file must -be a music or sample file. Music files include MIDI (.mid or .midi), and -module formats .mod, .it, .s3m, .xm, and .oxm. A sample file used for -sound effects can be .wav, .ogg, .raw, .wma, or .aiff.* - -The -following example plays some sound files. Note that `sound()` is not -even necessary when you don\'t need to set any additional parameters. -### Example: ```dm + usr << 'giggle.wav' // play a giggle once usr << sound('gigue.midi',1) // repeat gigue usr << sound('boom.wav', volume=50) // play an explosion at half volume + ``` -> [!TIP] -> **See also:** -> + [sound support](/ref/DM/sound.md) -> + [sound datum](/ref/sound.md) -> + [vars (sound)](/ref/sound/var.md) -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [load_resource proc](/ref/proc/load_resource.md) \ No newline at end of file + +*See **Notes** under sound support for more information. +*** +**Related Pages:** ++ [sound datum](/ref/sound) ++ [vars (sound)](/ref/sound/var) ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [load_resource proc](/ref/proc/load_resource) diff --git a/ref/proc/spantext.md b/ref/proc/spantext.md index 43a0a767..b71091c2 100644 --- a/ref/proc/spantext.md +++ b/ref/proc/spantext.md @@ -1,35 +1,24 @@ -## spantext proc -###### BYOND Version 510 + +## spantext (proc) **Format:** + spantext(Haystack,Needles,Start=1) -**Returns:** -+ The number of consecutive characters, from the start position, that - match the characters in Needles. - -**Args:** +**Arguments:** + Haystack: The text string to search. + Needles: A text string with all the characters that match. -+ Start: The text byte position in Haystack in which to begin the - search. ++ Start: The text byte position in Haystack in which to begin the search. -This proc is case-sensitive. A common use for this proc is in -parsing. spantext("apples, oranges",", ",7) will tell you that, -starting at position 7, you need to skip 2 characters to get past any -commas or spaces. - -If the start position is negative, the -position is counted backwards from the end of the string. +**Returns:** ++ The number of consecutive characters, from the start position, that match the characters in Needles. +*** +This proc is case-sensitive. A common use for this proc is in parsing. spantext("apples, oranges",", ",7) will tell you that, starting at position 7, you need to skip 2 characters to get past any commas or spaces. -Note: -In strings containing non-ASCII characters, byte position and character -position are not the same thing. Use `spantext_char()` to work with -character counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. +If the start position is negative, the position is counted backwards from the end of the string. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [nonspantext proc](/ref/proc/nonspantext.md) -> + [splittext proc](/ref/proc/splittext.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `spantext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [nonspantext proc](/ref/proc/nonspantext) ++ [splittext proc](/ref/proc/splittext) diff --git a/ref/proc/spawn.md b/ref/proc/spawn.md index c9b77cf8..d1a57f2d 100644 --- a/ref/proc/spawn.md +++ b/ref/proc/spawn.md @@ -1,55 +1,36 @@ -## spawn proc + +## spawn (proc) **Format:** -+ ```dm - spawn(Delay=0) Statement - ``` -+ ```dm - spawn(Delay=0) - Statement - ``` - -**Args:** -+ Delay: The amount of time (in 1/10 seconds) before Statement is - executed. - -Run Statement after a delay. Statement may be a single -statement or a code block enclosed in (optional) braces and indented. If -delay is negative, the spawned code is executed before continuing in the -main code. If it is zero, the spawned code is scheduled to happen right -after other existing events that are immediately pending. -### Example: ++ spawn(Delay=0) Statement ++ spawn(Delay=0)Statement + +**Arguments:** ++ Delay: The amount of time (in 1/10 seconds) before Statement is executed. +*** +Run Statement after a delay. Statement may be a single statement or a code block enclosed in (optional) braces and indented. If delay is negative, the spawned code is executed before continuing in the main code. If it is zero, the spawned code is scheduled to happen right after other existing events that are immediately pending. + ```dm + spawn(30) storm() usr << "Storm clouds are brewing!" + ``` -This will display `"Storm clouds are brewing!"` and -then call the storm() proc after 3 seconds. - -> [!IMPORTANT] ->A spawned statement or block is a copy of the current proc. The -current proc keeps running and the copy waits its turn. The copy stops -at the end of the statement/block, and its return value is discarded. -> In the case of spawn(-1), the original proc keeps running the -statement/block and then stops, while the copy runs everything after -that. - -The important feature of spawn() is that the caller does not -have to wait around for the spawned code to finish. - -Any vars -you have defined in the proc itself, including arguments, will be copied -between the spawned code and the code that runs right away. This means -that if one part modifies one of those vars, the other part will not see -that change. Changes made to objects, lists, datums, etc. however will -be visible to both code blocks. - -[Pointers](/ref/operator/&/pointer.md) to any vars that belong to the -proc will stay with the original proc, not the copy. - -> [!TIP] -> **See also:** -> + [background setting (proc)](/ref/proc/set/background.md) -> + [sleep proc](/ref/proc/sleep.md) \ No newline at end of file + +This will display "Storm clouds are brewing!" and then call the storm() proc after 3 seconds. + +A spawned statement or block is a copy of the current proc. The current proc keeps running and the copy waits its turn. The copy stops at the end of the statement/block, and its return value is discarded. + +In the case of spawn(-1), the original proc keeps running the statement/block and then stops, while the copy runs everything after that. + +The important feature of spawn() is that the caller does not have to wait around for the spawned code to finish. + +Any vars you have defined in the proc itself, including arguments, will be copied between the spawned code and the code that runs right away. This means that if one part modifies one of those vars, the other part will not see that change. Changes made to objects, lists, datums, etc. however will be visible to both code blocks. + +Pointers to any vars that belong to the proc will stay with the original proc, not the copy. +*** +**Related Pages:** ++ [background setting (proc)](/ref/proc/set/background) ++ [sleep proc](/ref/proc/sleep) diff --git a/ref/proc/splicetext.md b/ref/proc/splicetext.md index 02d4deeb..ca4525fe 100644 --- a/ref/proc/splicetext.md +++ b/ref/proc/splicetext.md @@ -1,44 +1,35 @@ -## splicetext proc -###### BYOND Version 514 + +## splicetext (proc) **Format:** + splicetext(Text,Start=1,End=0,Insert="") -**Returns:** -+ Spliced text - -**Args:** +**Arguments:** + Text: The text string to splice. + Start: The text byte position in Text where the splice will begin. + End: The text byte position in Text immediately following the last - character to be cut from the splice. 0 is the end of the string. + character to be cut from the splice. 0 is the end of the string. + Insert: Text to be inserted. -Cuts out a section of a text string and inserts a different -piece of text in its place. This is basically equivalent to -`copytext(Text,1,Start) + Insert + copytext(Text,End)`, but faster. -### Example: +**Returns:** ++ Spliced text +*** +Cuts out a section of a text string and inserts a different piece of text in its place. This is basically equivalent to `copytext(Text,1,Start) + Insert + copytext(Text,End)`, but faster. + ```dm + // cuts "nan" from "banana" and replaces it with "laclav" // prints "balaclava" usr << splicetext("banana", 3, 6, "laclav") + ``` - -The `Start` and `End` index values can -be negative, which count backwards from the end of the string. If the -index values are out of range, there will be no error; they will simply -be clamped to the beginning or end of the string. If `End` comes before -`Start`, the two values are swapped. - -> [!NOTE] -> In strings -containing non-ASCII characters, byte position and character position -are not the same thing. Use `splicetext_char()` to work with character -counts instead of bytes, at a performance cost. See the -[Unicode](/ref/notes/Unicode.md) section for more information. - -> [!TIP] -> **See also:** -> + [copytext proc](/ref/proc/copytext.md) -> + [Splice proc (list)](/ref/list/proc/Splice.md) \ No newline at end of file + + +The `Start` and `End` index values can be negative, which count backwards from the end of the string. If the index values are out of range, there will be no error; they will simply be clamped to the beginning or end of the string. If `End` comes before `Start`, the two values are swapped. + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `splicetext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [copytext proc](/ref/proc/copytext) ++ [Splice proc (list)](/ref/list/proc/Splice) diff --git a/ref/proc/splittext.md b/ref/proc/splittext.md index 73bc37af..20c9ef63 100644 --- a/ref/proc/splittext.md +++ b/ref/proc/splittext.md @@ -1,66 +1,46 @@ -## splittext proc -###### BYOND Version 510 + +## splittext (proc) **Format:** + splittext(Text,Delimiter,Start=1,End=0,include_delimiters=0) -**Returns:** -+ A list of text strings split by the delimiter given. - -**Args:** +**Arguments:** + Text: The text string to search. -+ Delimiter: A text string that will be used as the separator between - items, OR a regular expression (regex) used to find splits -+ Start: The text byte position in Text in which to begin looking for - splits. ++ Delimiter: A text string that will be used as the separator between items, + OR a regular expression (regex) used to find splits ++ Start: The text byte position in Text in which to begin looking for splits. + End: The text byte position in Text immediately following the last - character to look at for splits. -+ include_delimiters: True if any delimiters found should be included - in the result. + character to look at for splits. ++ include_delimiters: True if any delimiters found should be included in + the result. + +**Returns:** ++ A list of text strings split by the delimiter given. +*** +Splits up a text string and returns a list. The delimiter is case-sensitive (unless you use a case-insensitive regular expression), and can be more than one character long. -Splits up a text string and returns a list. The delimiter is -case-sensitive (unless you use a case-insensitive regular expression), -and can be more than one character long. -### Example: ```dm + var/list/items = splittext("apples,oranges,bananas", ",") // prints "apples", "oranges", and "bananas" separately for(var/item in items) usr << item + ``` - -Where multiple -delimiters are next to each other, they\'re considered to be separating -an empty string. Therefore splittext("a,,b,c", ",") would return a -list with four elements instead of three. Splitting empty text returns -an empty list. -If a regular expression is used as the -delimiter, any capturing groups in the expression will be included in -the list, in order. (The whole match itself will come first, if -include_delimiters is true.) So for instance splitting by regex(",") -will not include the comma, but splitting by regex("(,)") will. Groups -that were not part of the match will be null. -If the start or -end position is negative, the position is counted backwards from the end -of the string. Please note that the start and end positions do NOT trim -the string; if you want to split a trimmed string, trim it with -[copytext()](/ref/proc/copytext.md) and send the result to -`splittext()` instead. +Where multiple delimiters are next to each other, they're considered to be separating an empty string. Therefore splittext("a,,b,c", ",") would return a list with four elements instead of three. Splitting empty text returns an empty list. + +If a regular expression is used as the delimiter, any capturing groups in the expression will be included in the list, in order. (The whole match itself will come first, if include_delimiters is true.) So for instance splitting by regex(",") will not include the comma, but splitting by regex("(,)") will. Groups that were not part of the match will be null. -> [!NOTE] -> In strings containing non-ASCII -characters, byte position and character position are not the same thing. -Use `splittext_char()` to work with character counts instead of bytes, -at a performance cost. See the [Unicode](/ref/notes/Unicode.md) section -for more information. +If the start or end position is negative, the position is counted backwards from the end of the string. Please note that the start and end positions do NOT trim the string; if you want to split a trimmed string, trim it with copytext() and send the result to `splittext()` instead. -> [!TIP] -> **See also:** -> + [findtext proc](/ref/proc/findtext.md) -> + [jointext proc](/ref/proc/jointext.md) -> + [nonspantext proc](/ref/proc/nonspantext.md) -> + [spantext proc](/ref/proc/spantext.md) -> + [Regular expressions](/ref/notes/regex.md) \ No newline at end of file +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `splittext_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [findtext proc](/ref/proc/findtext) ++ [jointext proc](/ref/proc/jointext) ++ [nonspantext proc](/ref/proc/nonspantext) ++ [spantext proc](/ref/proc/spantext) ++ [Regular expressions](/ref/{notes}/regex) diff --git a/ref/proc/sqrt.md b/ref/proc/sqrt.md index 29bf9004..1f32f1e0 100644 --- a/ref/proc/sqrt.md +++ b/ref/proc/sqrt.md @@ -1,14 +1,20 @@ -# sqrt proc + +## sqrt (proc) + **Format:** + sqrt(A) +**Arguments:** ++ A: A number. + **Returns:** + The square root of A - -**Args:** -+ A: A number. -### Example: +*** ```dm - usr << sqrt(2) // outputs 1.41421 + +usr << sqrt(2) // outputs 1.41421 + ``` + +*** \ No newline at end of file diff --git a/ref/proc/startup.md b/ref/proc/startup.md index 4e71c4d8..2ecff939 100644 --- a/ref/proc/startup.md +++ b/ref/proc/startup.md @@ -1,105 +1,20 @@ -## startup proc +## startup (proc) **Format:** + startup(File,Port=0,Options,...) -**Args:** -+ File: The dmb file to run in a new server or null to load the - current world. -+ Port: The network port to start the new server on. A value of 0 - indicates that any available port should be used. -+ Options: Any number of the options listed below. Each option should - be in an argument by itself. If the option takes a parameter, this - can be in the same argument or in the following one. -### The valid options are: -+ **-once**\ - automatically shuts down the server when all players have logged - off. -+ **-close**\ - Closes the child copy of DreamDaemon after the world it is running - shuts down. -+ **-log \**\ - sends all server output to the specified file. The path to the file - is relative to the world directory (the path containing the world - `.dmb` file). -+ **-logself**\ - is identical to "-log [YourWorldFile].log". -+ **-safe**\ - runs the server in a special protective mode. The server may only - access files in the same directory (or below) as the dmb file and - access to the shell() command is disabled. This is the default mode - if no security setting is specified and the world is run from a - directory by the same name as the dmb file. -+ **-home \**\ - runs with the specified "safe home" directory. Normally, in safe - mode the directory containing the world dmb file is the safe home. -+ **-ultrasafe**\ - like -safe, this prohibits all file access. This is the default if - no security mode is specified and the world is not run from a - directory with the same name. -+ **-trusted**\ - allows full access to files on the computer and to the shell() - command. Note that this does not bypass the normal security of the - operating system. For example, in the UNIX operating system, all of - the usual access restrictions apply. This mode merely removes - BYOND\'s built-in safety checks. -+ **-params \**\ - this is for passing user-defined parameters to the world. Multiple - parameters may be packed into a single argument or -params may be - used several times. In either case, the parameters are all loaded - into world.params when the world starts up. The parameter format is - "name1=value1&name2=value2&...". -+ **-quiet**\ - disables the server\'s normal output indicating the BYOND version - number and network port. -+ **-nologdates**\ - disables automatic date/time output in the log. -+ **-CGI**\ - runs the world as a CGI program (to be executed by a web server). A - /client object is automatically created for the user and any output - sent to the associated mob gets returned to the user\'s web browser. - This option is normally specified in the compile-time setting: - [world.executor](/ref/world/var/executor.md) which is automatically - initialized for you if you include `html/CGI.dm` from the html - library. -+ **-suid \**\ - runs the world as the owner of the specified directory or path. This - only works if DreamDaemon is running as root on operating systems - where there even is such a thing. -+ **-suidself**\ - runs the world as the owner of the world dmb file. This only works - if DreamDaemon is running as root on operating systems where there - even is such a thing. -+ **-cd \**\ - runs with the specified working directory. Normally, the directory - containing the world dmb file is used. -+ **-port P**\ - sets the network port to P. The port may also be specified as a - positional argument (following the .dmb name). -+ **-ports \**\ - restricts the range of ports that DreamDaemon and any child worlds - may use. The syntax of *list* is a comma separated list of ports or - ranges of ports. Example: `-ports 1234,1236,1240-1250`. -+ **-ip \
**\ - sets the IP address of the server. This will only work for an IP - address the system recognizes as one it can use for hosting. Accepts - numerical addresses only. -+ **-webclient**\ - Enables the webclient, overriding default behavior. -+ **-nowebclient**\ - Disables the webclient, overriding default behavior. -+ **-verbose**\ - Runtime errors will continue outputting details after a certain - number of errors has been reached. Without this option, the number - of errors that provide detailed info (such as call stack) is - limited. Use this option with caution as it could fill up a log file - quickly if a problem occurs. +**Arguments:** ++ File: The dmb file to run in a new server or null to load the current world. ++ Port: The network port to start the new server on. A value of 0 + indicates that any available port should be used. ++ Options: Any number of the options listed below. Each option should be + in an argument by itself. If the option takes a parameter, this + can be in the same argument or in the following one. **Returns:** + The address of the new server in the form ip:port. - -> [!TIP] -> **See also:** -> + [params var (world)](/ref/world/var/params.md) -> + [shutdown proc](/ref/proc/shutdown.md) \ No newline at end of file +****** +**Related Pages:** ++ [params](/ref/world/var/params) ++ [shutdown proc](/ref/proc/shutdown) diff --git a/ref/proc/stat.md b/ref/proc/stat.md index d3baa211..79a6bca6 100644 --- a/ref/proc/stat.md +++ b/ref/proc/stat.md @@ -1,41 +1,33 @@ -## stat proc + +## stat (proc) **Format:** + stat(Name,Value) -**Args:** +**Arguments:** + Name: the name of the stat line + Value: the data to be displayed +*** +This is used in a Stat() proc to send a stat line to usr, the person looking at an object. A stat line has an optional name part which must be unique for each stat line (or successive calls will replace previous ones). -This is used in a Stat() proc to send a stat line to usr, the -person looking at an object. A stat line has an optional name part which -must be unique for each stat line (or successive calls will replace -previous ones). +The stat line gets appended to the current stat panel. The current panel may be changed by using statpanel(). -The stat line gets appended to the current stat -panel. The current panel may be changed by using statpanel(). +If no name is specified and the value is a list, this is the same as calling stat on each item in the list. This can be used (in conjunction with statpanel) to create an inventory panel or something similar. -If no name is specified and the value is a list, this is the -same as calling stat on each item in the list. This can be used (in -conjunction with statpanel) to create an inventory panel or something -similar. -### Example: ```dm + mob/Stat() stat("description",src.desc) if(src == usr) stat(src.contents) + ``` - -This example displays the mob\'s -description and inventory all in one panel. The code ensures that only -the mob may see his own inventory, but you don\'t have to worry about -that unless you change client.statobj to something other than one\'s own -mob. - -> [!TIP] -> **See also:** -> + [Stat proc (atom)](/ref/atom/proc/Stat.md) -> + [Stat proc (client)](/ref/client/proc/Stat.md) -> + [statpanel proc](/ref/proc/statpanel.md) -> + [Info control (skin)](/ref/skin/control/info.md) \ No newline at end of file + + +This example displays the mob's description and inventory all in one panel. The code ensures that only the mob may see his own inventory, but you don't have to worry about that unless you change client.statobj to something other than one's own mob. +*** +**Related Pages:** ++ [Stat](/ref/atom/proc/Stat) ++ [Stat proc (client)](/ref/client/proc/Stat) ++ [statpanel proc](/ref/proc/statpanel) ++ [Info](/ref/{skin}/control/info) diff --git a/ref/proc/statpanel.md b/ref/proc/statpanel.md index e2569ff3..4a10e452 100644 --- a/ref/proc/statpanel.md +++ b/ref/proc/statpanel.md @@ -1,41 +1,36 @@ -## statpanel proc + +## statpanel (proc) **Format:** + statpanel(Panel,Name,Value) -**Args:** +**Arguments:** + Panel: the name of the stat panel + Name: the name of the stat line + Value: the data to be displayed **Returns:** + If called with just a Panel argument, 1 is returned if the player is - looking at the panel and 0 is returned if not. This may be useful to - avoid the needless overhead of generating output to a panel that is - not visible. + looking at the panel and 0 is returned if not. This may be useful to + avoid the needless overhead of generating output to a panel that is not + visible. +*** +This is used in a Stat() proc to change the default panel (for subsequent stat lines) or to send one line to the specified panel. Name and Value are both optional. If neither is specified, this simply changes the default panel. Otherwise, the default panel is unchanged and a stat line is appended to Panel. -This is used in a Stat() proc to change the default panel (for -subsequent stat lines) or to send one line to the specified panel. Name -and Value are both optional. If neither is specified, this simply -changes the default panel. Otherwise, the default panel is unchanged and -a stat line is appended to Panel. -### Example: ```dm + mob/Stat() stat("description",src.desc) if(src == usr) statpanel("inventory",src.contents) + ``` -This example -displays the mob\'s description in one panel and inventory in another. -Only the mob may see his own inventory, but you don\'t have to worry -about that unless you change client.statobj to something other than -one\'s own mob. - -> [!TIP] -> **See also:** -> + [Stat proc (atom)](/ref/atom/proc/Stat.md) -> + [Stat proc (client)](/ref/client/proc/Stat.md) -> + [stat proc](/ref/proc/stat.md) -> + [Info control (skin)](/ref/skin/control/info.md) \ No newline at end of file + +This example displays the mob's description in one panel and inventory in another. Only the mob may see his own inventory, but you don't have to worry about that unless you change client.statobj to something other than one's own mob. +*** +**Related Pages:** ++ [Stat](/ref/atom/proc/Stat) ++ [Stat proc (client)](/ref/client/proc/Stat) ++ [stat proc](/ref/proc/stat) ++ [Info](/ref/{skin}/control/info) diff --git a/ref/proc/step.md b/ref/proc/step.md index 91c43966..45d906aa 100644 --- a/ref/proc/step.md +++ b/ref/proc/step.md @@ -1,21 +1,26 @@ -## step proc + +## step (proc) **Format:** + step(Ref,Dir,Speed=0) ++ step(Ref,Vector) -**Returns:** -+ 1 on success; 0 otherwise - -**Args:** +**Arguments:** + Ref: A mob or obj. -+ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, - SOUTHEAST, SOUTHWEST. ++ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, + SOUTHWEST. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. ++ Vector: A 2D vector to move by, in pixels. +**Returns:** ++ 1 on success; 0 otherwise +*** Move Ref in the direction Dir. -> [!TIP] -> **See also:** -> + [get_step proc](/ref/proc/get_step.md) -> + [walk proc](/ref/proc/walk.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +The vector version of this proc takes a 2D vector and tries to move by that amount of pixels. +*** +**Related Pages:** ++ [get_step proc](/ref/proc/get_step) ++ [walk proc](/ref/proc/walk) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) ++ [vector](/ref/vector) diff --git a/ref/proc/step_away.md b/ref/proc/step_away.md index 10e73fe8..2058da71 100644 --- a/ref/proc/step_away.md +++ b/ref/proc/step_away.md @@ -1,24 +1,21 @@ -## step_away proc + +## step_away (proc) **Format:** + step_away(Ref,Trg,Max=5,Speed=0) -**Returns:** -+ 1 on success; 0 otherwise. - -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. -+ Max: The maximum distance between Ref and Targ before movement - halts. ++ Max: The maximum distance between Ref and Targ before movement halts. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. -Move Ref on a path away from location Trg, taking obstacles -into account. If Ref is farther than Max steps from Trg, no action will -be taken. - -> [!TIP] -> **See also:** -> + [get_step_away proc](/ref/proc/get_step_away.md) -> + [walk_away proc](/ref/proc/walk_away.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +**Returns:** ++ 1 on success; 0 otherwise. +*** +Move Ref on a path away from location Trg, taking obstacles into account. If Ref is farther than Max steps from Trg, no action will be taken. +*** +**Related Pages:** ++ [get_step_away proc](/ref/proc/get_step_away) ++ [walk_away proc](/ref/proc/walk_away) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/step_rand.md b/ref/proc/step_rand.md index d63aaa02..ea650ad2 100644 --- a/ref/proc/step_rand.md +++ b/ref/proc/step_rand.md @@ -1,19 +1,19 @@ -## step_rand proc + +## step_rand (proc) **Format:** + step_rand(Ref,Speed=0) -**Returns:** -+ 1 on success; 0 otherwise. - -**Args:** +**Arguments:** + Ref: A mob or obj. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +**Returns:** ++ 1 on success; 0 otherwise. +*** Move Ref randomly. - -> [!TIP] -> **See also:** -> + [get_step_rand proc](/ref/proc/get_step_rand.md) -> + [walk_rand proc](/ref/proc/walk_rand.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +*** +**Related Pages:** ++ [get_step_rand proc](/ref/proc/get_step_rand) ++ [walk_rand proc](/ref/proc/walk_rand) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/step_to.md b/ref/proc/step_to.md index aa9598db..f7b736ac 100644 --- a/ref/proc/step_to.md +++ b/ref/proc/step_to.md @@ -1,25 +1,22 @@ -## step_to proc + +## step_to (proc) **Format:** + step_to(Ref,Trg,Min=0,Speed=0) -**Returns:** -+ 1 on success; 0 otherwise. - -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. + Min: The minimum distance between Ref and Trg before movement halts. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. -Move Ref on a path to the location Trg, taking obstacles into -account. If Ref is within Min steps of Trg, no action will be taken. -This is also the case if the target is too far away (more than twice -world.view steps). - -> [!TIP] -> **See also:** -> + [get_step_to proc](/ref/proc/get_step_to.md) -> + [get_steps_to proc](/ref/proc/get_steps_to.md) -> + [walk_to proc](/ref/proc/walk_to.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +**Returns:** ++ 1 on success; 0 otherwise. +*** +Move Ref on a path to the location Trg, taking obstacles into account. If Ref is within Min steps of Trg, no action will be taken. This is also the case if the target is too far away (more than twice world.view steps). +*** +**Related Pages:** ++ [get_step_to proc](/ref/proc/get_step_to) ++ [get_steps_to proc](/ref/proc/get_steps_to) ++ [walk_to proc](/ref/proc/walk_to) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/step_towards.md b/ref/proc/step_towards.md index e9622c63..5ac77bd0 100644 --- a/ref/proc/step_towards.md +++ b/ref/proc/step_towards.md @@ -1,20 +1,20 @@ -## step_towards proc + +## step_towards (proc) **Format:** + step_towards(Ref,Trg,Speed) -**Returns:** -+ 1 on success; 0 otherwise. - -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +**Returns:** ++ 1 on success; 0 otherwise. +*** Move Ref in the direction of the location Trg. - -> [!TIP] -> **See also:** -> + [get_step_towards proc](/ref/proc/get_step_towards.md) -> + [walk_towards proc](/ref/proc/walk_towards.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +*** +**Related Pages:** ++ [get_step_towards proc](/ref/proc/get_step_towards) ++ [walk_towards proc](/ref/proc/walk_towards) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/switch.md b/ref/proc/switch.md index 0277a6b0..0aa808b4 100644 --- a/ref/proc/switch.md +++ b/ref/proc/switch.md @@ -1,58 +1,47 @@ -## switch proc + +## switch (proc) **Format:** -switch(E) + if(A1,A2,...) Statement1 + if(B1,B2,...) Statement1 + else Statement3 +*** +The "switch" instruction is a compact notation for a lengthy "else-if" chain. The expression E is compared to the values A1, A2, B1, B2, etc. When a match is found, the following statement (or code block) is executed. An optional "else" statement is run if no match is found. Once a matching switch condition is found, no further conditions will be tested. -The "switch" instruction is a compact notation for a lengthy -"else-if" chain. The expression E is compared to the values A1, A2, -B1, B2, etc. When a match is found, the following statement (or code -block) is executed. An optional "else" statement is run if no match is -found. Once a matching switch condition is found, no further conditions -will be tested. +The values A1, A2, etc. must be constants. As a convenience, a range of values may be specified in the form: A1 to An. -The values A1, A2, etc. must be constants. As a -convenience, a range of values may be specified in the form: A1 to An. +The switch instruction is MUCH more efficient than a lengthy "else-if" chain, because the expression E is evaluated only once. The conditional values may be any constant expression, such as a number or text string. -The switch instruction is MUCH more efficient than a lengthy -"else-if" chain, because the expression E is evaluated only once. The -conditional values may be any constant expression, such as a number or -text string. -### Example: ```dm + switch (2) if(1) world << "ONE" if(4) world << "FOUR" if(2,3) world << "TWO or THREE" if(5 to 10) world << "FIVE to TEN" else world << "not ONE to TEN" + ``` -This outputs: + +This outputs: + + ```dm + TWO or THREE + ``` -> [!NOTE] -> Currently the compiler does not throw a warning or error -if there is a conflict between two different `if` blocks in a `switch`, -e.g. when you define `if(1 to 10)` and `if(5 to 20)` which overlap from -5 to 10. If two different blocks could handle a given value, the choice -of which block takes over is not defined. -### C-like syntax - -Using the [`#pragma syntax` -directive](/ref/DM/preprocessor/pragma/syntax.md) you can change `switch()` to -be more like other languages such as C. This replaces the if/else -instructions with `case `*`value`* and `default` with a trailing colon. -If you don\'t use the [`break` statement](/ref/proc/break.md) at the end of a -block, it will fall through to the next block. -### Example: + +Note: Currently the compiler does not throw a warning or error if there is a conflict between two different `if` blocks in a `switch`, e.g. when you define `if(1 to 10)` and `if(5 to 20)` which overlap from 5 to 10. If two different blocks could handle a given value, the choice of which block takes over is not defined. + +Using the `#pragma syntax` directive you can change `switch()` to be more like other languages such as C. This replaces the if/else instructions with `case *value*` and `default` with a trailing colon. If you don't use the `break` statement at the end of a block, it will fall through to the next block. + ```dm + // make this syntax change temporary #pragma push #pragma syntax C switch @@ -72,13 +61,12 @@ mob/proc/Greeting(friend) break #pragma pop + ``` -Multiple cases can be put together with either commas between -the values, or separate `case` statements. The *`A`*` to `*`B`* syntax -is still allowed also. -> [!TIP] -> **See also:** -> + [if proc](/ref/proc/if.md) -> + [#pragma syntax directive](/ref/DM/preprocessor/pragma/syntax.md) \ No newline at end of file +Multiple cases can be put together with either commas between the values, or separate `case` statements. The `*A* to *B*` syntax is still allowed also. +*** +**Related Pages:** ++ [if proc](/ref/proc/if) ++ [#pragma syntax directive](/ref/DM/preprocessor/pragma/syntax) diff --git a/ref/proc/tan.md b/ref/proc/tan.md index 0a1ad14e..2b3e0dd7 100644 --- a/ref/proc/tan.md +++ b/ref/proc/tan.md @@ -1,23 +1,25 @@ -## tan proc -###### BYOND Version 513 + +## tan (proc) **Format:** + tan(X) **Returns:** + The tangent of X, where X is in degrees. -### Example: +*** ```dm + mob/verb/test() usr << tan(0) // 0 usr << tan(45) // 1 usr << tan(90) // infinity (or close enough) + ``` -> [!TIP] -> **See also:** -> + [arctan proc](/ref/proc/arctan.md) -> + [cos proc](/ref/proc/cos.md) -> + [sin proc](/ref/proc/sin.md) -> + [turn proc](/ref/proc/turn.md) \ No newline at end of file +*** +**Related Pages:** ++ [arctan proc](/ref/proc/arctan) ++ [cos proc](/ref/proc/cos) ++ [sin proc](/ref/proc/sin) ++ [turn proc](/ref/proc/turn) diff --git a/ref/proc/text.md b/ref/proc/text.md index 9ef15396..c199e0f2 100644 --- a/ref/proc/text.md +++ b/ref/proc/text.md @@ -1,28 +1,27 @@ -## text proc + +## text (proc) **Format:** + text(FormatText,Args) -**Returns:** -+ The text with macros arguments substituted. - -**Args:** +**Arguments:** + FormatText: a text string possibly containing text macros. + Args: a set of arguments that corresponds to the number of empty - embedded expressions in FormatText. + embedded expressions in FormatText. + +**Returns:** ++ The text with macros arguments substituted. +*** +Complicated or lengthy embedded expressions in a text string can sometimes make the string difficult to read. In this case, one can use trailing arguments. The position in which the expression should be substituted should be marked with [] and the expression should then be passed as an argument after the text string. -Complicated or lengthy embedded expressions in a text string -can sometimes make the string difficult to read. In this case, one can -use trailing arguments. The position in which the expression should be -substituted should be marked with [] and the expression should then be -passed as an argument after the text string. -### Example: ```dm + usr << text("You are [] leagues from home.",sqrt(usr.x**2 + usr.y**2)) + ``` -> [!TIP] -> **See also:** -> + [<< operator](/ref/operator/%3c%3c.md) -> + [macros (text)](/ref/DM/text/macros.md) \ No newline at end of file +*** +**Related Pages:** ++ [<< operator](/ref/operator/%3c%3c) ++ [macros (text)](/ref/DM/text/macros) diff --git a/ref/proc/text2ascii.md b/ref/proc/text2ascii.md index 66058103..f5a8850f 100644 --- a/ref/proc/text2ascii.md +++ b/ref/proc/text2ascii.md @@ -1,47 +1,30 @@ -## text2ascii proc + +## text2ascii (proc) **Format:** + text2ascii(T,pos=1) -**Args:** +**Arguments:** + T: A text string. + pos: The byte position in T to use, starting at 1. **Returns:** -+ A number representing the character\'s ASCII or Unicode code. ++ A number representing the character's ASCII or Unicode code. +*** +ASCII codes are numerical values corresponding to keyboard and special characters. Among other things, they are used to represent many symbols in HTML. This proc converts a text string to its corresponding ascii representation. -ASCII codes are numerical values corresponding to keyboard and -special characters. Among other things, they are used to represent many -symbols in HTML. This proc converts a text string to its corresponding -ascii representation. -### Example: ```dm + world << text2ascii("A") // = 65 world << text2ascii("HAPPY",2) // = 65 + ``` - -With [Unicode](/ref/notes/Unicode.md) things may get more complicated. DM -stores text with UTF-8 encoding, so at this position there might be -several bytes strung together to make a single character. The value of -`pos` is in bytes, not characters. When the return value is 128 (0x80) -or higher, multiple bytes are used for the charcter. In that case the -next character position is not `pos + 1` like it is for regular text, -but you can use `pos + length(ascii2text(result))` instead. Or, you can -determine the byte count from this table: - | Character code | Size in bytes | - | --- | --- | - | 0 - 0x7F | 1 | - | 0x80 - 0x7FF | 2 | - | 0x800 - 0xFFFF | 3 | - | 0x10000 - 0x10FFFF | 4 | - - -Alternatively, you can use `test2ascii_char()` to work with -character positions instead of bytes, at a performance cost. - -> [!TIP] -> **See also:** -> + [ascii2text proc](/ref/proc/ascii2text.md) -> + [entities (text)](/ref/DM/text/entities.md) -> + [Unicode](/ref/notes/Unicode.md) \ No newline at end of file + + +With Unicode, things may get more complicated. DM stores text with UTF-8 encoding, so at this position there might be several bytes strung together to make a single character. The value of `pos` is in bytes, not characters. When the return value is 128 (0x80) or higher, multiple bytes are used for the charcter. In that case the next character position is not `pos + 1` like it is for regular text, but you can use `pos + length(ascii2text(result))` instead. Or, you can determine the byte count from this table: +*** +**Related Pages:** ++ [ascii2text proc](/ref/proc/ascii2text) ++ [entities (text)](/ref/DM/text/entities) ++ [Unicode](/ref/{notes}/Unicode) diff --git a/ref/proc/text2file.md b/ref/proc/text2file.md index 69a9922b..01a28543 100644 --- a/ref/proc/text2file.md +++ b/ref/proc/text2file.md @@ -1,31 +1,31 @@ -## text2file proc + +## text2file (proc) **Format:** + text2file(Text,File) -**Args:** +**Arguments:** + Text: text to be added to file + File: file to be appended to **Returns:** + 1 on success; 0 otherwise. +*** +Appends text to a file. If the file does not exist, one will be created. -Appends text to a file. If the file does not exist, one will be -created. +This can be useful when interacting with external applications that read output from a text file. For example, you might have an external program that mimics conversation: -This can be useful when interacting with external -applications that read output from a text file. For example, you might -have an external program that mimics conversation: -### Example: ```dm + mob/oracle/verb/tell(T as text) text2file(T,"oracle.in") shell("oracle < oracle.in > oracle.out") usr << file2text("oracle.out") + ``` -> [!TIP] -> **See also:** -> + [file2text proc](/ref/proc/file2text.md) -> + [shell proc](/ref/proc/shell.md) \ No newline at end of file +*** +**Related Pages:** ++ [file2text proc](/ref/proc/file2text) ++ [shell proc](/ref/proc/shell) diff --git a/ref/proc/text2num.md b/ref/proc/text2num.md index 9ad97dea..2b68d165 100644 --- a/ref/proc/text2num.md +++ b/ref/proc/text2num.md @@ -1,29 +1,29 @@ -## text2num proc + +## text2num (proc) **Format:** + text2num(T) + text2num(T, radix) -**Args:** +**Arguments:** + T: A text string. + radix: The radix/base of the number, e.g. 16 for hexadecimal **Returns:** + A number. +*** +If T is a text string for a number, return the number. Any non-numeric text following the initial portion will be ignored. If there is no initial numeric portion, the result is null. -If T is a text string for a number, return the number. Any -non-numeric text following the initial portion will be ignored. If there -is no initial numeric portion, the result is null. -### Example: ```dm - var/number = text2num("123") // = 123 + +var/number = text2num("123") // = 123 + ``` -The optional radix, which defaults to 10, can be any integer -from 2 to 36. -> [!TIP] -> **See also:** -> + [istext proc](/ref/proc/istext.md) -> + [num2text proc](/ref/proc/num2text.md) \ No newline at end of file +The optional radix, which defaults to 10, can be any integer from 2 to 36. +*** +**Related Pages:** ++ [istext proc](/ref/proc/istext) ++ [num2text proc](/ref/proc/num2text) diff --git a/ref/proc/text2path.md b/ref/proc/text2path.md index 7bc636df..21e868be 100644 --- a/ref/proc/text2path.md +++ b/ref/proc/text2path.md @@ -1,24 +1,26 @@ -## text2path proc + +## text2path (proc) **Format:** + text2path(T) -**Args:** +**Arguments:** + T: A text string. **Returns:** + a type path or null. -### Example: +*** ```dm + var/myturf = text2path("/turf/[src.color]") if(myturf) src.loc = locate(myturf) + ``` - -T is changed from a text -string to the equivalent type path, or null if there is no such type. -> [!TIP] -> **See also:** -> + [ispath proc](/ref/proc/ispath.md) \ No newline at end of file + +T is changed from a text string to the equivalent type path, or null if there is no such type. +*** +**Related Pages:** ++ [ispath proc](/ref/proc/ispath) diff --git a/ref/proc/throw.md b/ref/proc/throw.md index 6e99fe4b..6eceb7e7 100644 --- a/ref/proc/throw.md +++ b/ref/proc/throw.md @@ -1,35 +1,30 @@ -## throw statement + +## throw (proc) **Format:** + throw Value -**Args:** +**Arguments:** + Value: Any value, which will be sent to catch() if present. +*** +This keyword throws an exception, which will stop executing the current proc and go to the most recent catch block if one is present. The catch block will receive the thrown value. If there is no try/catch in use, the exception will be passed to `world.Error()` (if present), then the current proc will end and control will return to the caller. -This keyword throws an exception, which will stop executing the -current proc and go to the most recent catch block if one is present. -The catch block will receive the thrown value. If there is no try/catch -in use, the exception will be passed to `world.Error()` (if present), -then the current proc will end and control will return to the caller. -### Example: ```dm + try if(!src.ready) throw EXCEPTION("Not ready") DoSomething() catch(var/e) world.log << "Exception: [e]" + ``` -You can use the `EXCEPTION` macro to create a new -`/exception` datum, which contains a value or message as well as the -file and line number where the exception was created. The thrown value -does not have to be an `/exception` datum; you can throw anything, even -null. - -> [!TIP] -> **See also:** -> + [try statement](/ref/proc/try.md) -> + [Error proc (world)](/ref/world/proc/Error.md) -> + [EXCEPTION proc](/ref/proc/EXCEPTION.md) -> + [exception](/ref/exception.md) \ No newline at end of file + +You can use the `EXCEPTION` macro to create a new `/exception` datum, which contains a value or message as well as the file and line number where the exception was created. The thrown value does not have to be an `/exception` datum; you can throw anything, even null. +*** +**Related Pages:** ++ [try and catch statements](/ref/proc/try) ++ [Error proc (world)](/ref/world/proc/Error) ++ [EXCEPTION proc](/ref/proc/EXCEPTION) ++ [exception](/ref/exception) diff --git a/ref/proc/time2text.md b/ref/proc/time2text.md index 1e6b2d80..99b5314d 100644 --- a/ref/proc/time2text.md +++ b/ref/proc/time2text.md @@ -1,59 +1,25 @@ -## time2text proc + +## time2text (proc) **Format:** + time2text(timestamp,format,timezone) -**Args:** -+ timestamp: a time value as obtained from world.realtime or - world.timeofday +**Arguments:** ++ timestamp: a time value as obtained from world.realtime or world.timeofday + format: a text string describing the output format. + timezone: optional offset, in hours, from UTC **Returns:** + a text string containing the date and time in the specified format. +*** +A time value (UTC) is converted to text representing the time. The world's local time is used, unless you specify a `timezone` argument which will add an offset to UTC. -A time value (UTC) is converted to text representing the time. -The world\'s local time is used, unless you specify a `timezone` -argument which will add an offset to UTC. - -The default format is -"DDD MMM DD hh:mm:ss YYYY", which produces results such as "Wed, May -23 15:41:13 2001". As you can see, the fields in the format text are -replaced by components of the date and time. The following list contains -all of the recognized fields. Anything else in the format string is -inserted directly into the output. -YYYY -+ year (2001, 2002, ...) -YY -+ year (01, 02, ...) -Month -+ January, February, ... -MMM -+ Jan, Feb, ... -MM -+ number of the month (01, 02, ...) -Day -+ Monday, Tuesday, ... -DDD -+ Mon, Tue, ... -DD -+ day of the month -hh -+ hour (00, 01, ... 23) -mm -+ minute -ss -+ second - -Because world.timeofday is in a range of 0 to 864000, values in -this range are treated as a time for the current date. This way -time2text() can return accurate results for world.timeofday. Any other -values are interpreted as coming from world.realtime and will have the -right time and date. +The default format is "DDD MMM DD hh:mm:ss YYYY", which produces results such as "Wed, May 23 15:41:13 2001". As you can see, the fields in the format text are replaced by components of the date and time. The following list contains all of the recognized fields. Anything else in the format string is inserted directly into the output. -> [!TIP] -> **See also:** -> + [realtime var (world)](/ref/world/var/realtime.md) -> + [timeofday var (world)](/ref/world/var/timeofday.md) -> + [timezone var (world)](/ref/world/var/timezone.md) -> + [timezone var (client)](/ref/client/var/timezone.md) \ No newline at end of file +Because world.timeofday is in a range of 0 to 864000, values in this range are treated as a time for the current date. This way time2text() can return accurate results for world.timeofday. Any other values are interpreted as coming from world.realtime and will have the right time and date. +*** +**Related Pages:** ++ [realtime var (world)](/ref/world/var/realtime) ++ [timeofday var (world)](/ref/world/var/timeofday) ++ [timezone](/ref/world/var/timezone) ++ [timezone var (client)](/ref/client/var/timezone) diff --git a/ref/proc/trimtext.md b/ref/proc/trimtext.md index 94686fde..e1169a4a 100644 --- a/ref/proc/trimtext.md +++ b/ref/proc/trimtext.md @@ -1,20 +1,18 @@ -## trimtext proc -###### BYOND Version 515 + +## trimtext (proc) **Format:** + trimtext(Text) -**Returns:** -+ Text with whitespace trimmed from both ends - -**Args:** +**Arguments:** + Text: The text string to trim. -Trims whitespace from both ends of a text string. - -All [Unicode](/ref/notes/Unicode.md) whitespace characters are counted, -whether they can cause a break or not. +**Returns:** ++ Text with whitespace trimmed from both ends +*** +Trims whitespace from both ends of a text string. -> [!TIP] -> **See also:** -> + [copytext proc](/ref/proc/copytext.md) \ No newline at end of file +All Unicode whitespace characters are counted, whether they can cause a break or not. +*** +**Related Pages:** ++ [copytext proc](/ref/proc/copytext) diff --git a/ref/proc/trunc.md b/ref/proc/trunc.md index a0af463d..b538e86a 100644 --- a/ref/proc/trunc.md +++ b/ref/proc/trunc.md @@ -1,28 +1,30 @@ -## trunc proc -###### BYOND Version 515 + +## trunc (proc) **Format:** + trunc(A) +**Arguments:** ++ A: A number, pixloc, or vector. + **Returns:** + truncated A +*** +Returns the integer part of the number A. That is, this rounds toward 0 to an integer. -**Args:** -+ A: A number, pixloc, or vector. - -Returns the integer part of the number A. That is, this rounds -toward 0 to an integer. -### Example: ```dm + usr << trunc(1.45) // outputs 1 -usr << trunc(-1.45) // outputs -1 + +usr << trunc(-1.45) // outputs -1 + ``` -> [!TIP] -> **See also:** -> + [fract proc](/ref/proc/fract.md) -> + [floor proc](/ref/proc/floor.md) -> + [ceil proc](/ref/proc/ceil.md) -> + [round proc](/ref/proc/round.md) -> + [sign proc](/ref/proc/sign.md) \ No newline at end of file +*** +**Related Pages:** ++ [fract proc](/ref/proc/fract) ++ [floor proc](/ref/proc/floor) ++ [ceil proc](/ref/proc/ceil) ++ [round proc](/ref/proc/round) ++ [sign proc](/ref/proc/sign) diff --git a/ref/proc/try.md b/ref/proc/try.md index 31280b97..b8cd5c87 100644 --- a/ref/proc/try.md +++ b/ref/proc/try.md @@ -1,19 +1,13 @@ -## try and catch statements -###### BYOND Version 508 -The try and catch keywords are used for error handling. Any -code that runs inside of a try block will, if an error happens or the -throw keyword is used, stop executing and jump to the matching catch -block. (This is also true of indirect proc calls. If you call a proc -from inside a try block, any errors in that proc will be sent to the -catch.) +## try (proc) +*** +The try and catch keywords are used for error handling. Any code that runs inside of a try block will, if an error happens or the throw keyword is used, stop executing and jump to the matching catch block. (This is also true of indirect proc calls. If you call a proc from inside a try block, any errors in that proc will be sent to the catch.) + +For every try there must be a catch, even if it does nothing. The catch block takes an optional value that can receive the error. -For every try there must be a catch, even if it does -nothing. The catch block takes an optional value that can receive the -error. -### Example: ```dm + var/a = 2 try a += "Hello" // will throw a type mismatch error @@ -21,21 +15,16 @@ catch(var/exception/e) // file and line info is available if you enable debugging world.log << "[e] on [e.file]:[e.line]" world << "a is [a]" + ``` -Because the value in the catch -keyword is optional, you can simply use the catch keyword alone. It is -also not necessary to include any code under the catch keyword, if the -error is meant to be ignored. (However, it is not usually a good idea to -ignore errors.) - -The throw keyword is used if you want to throw -an error deliberately. When you use throw, the error thrown does not -have to be an /exception datum, but can be anything you like. - -> [!TIP] -> **See also:** -> + [Error proc (world)](/ref/world/proc/Error.md) -> + [throw statement](/ref/proc/throw.md) -> + [EXCEPTION proc](/ref/proc/EXCEPTION.md) -> + [exception](/ref/exception.md) \ No newline at end of file + +Because the value in the catch keyword is optional, you can simply use the catch keyword alone. It is also not necessary to include any code under the catch keyword, if the error is meant to be ignored. (However, it is not usually a good idea to ignore errors.) + +The throw keyword is used if you want to throw an error deliberately. When you use throw, the error thrown does not have to be an /exception datum, but can be anything you like. +*** +**Related Pages:** ++ [Error proc (world)](/ref/world/proc/Error) ++ [throw statement](/ref/proc/throw) ++ [EXCEPTION proc](/ref/proc/EXCEPTION) ++ [exception](/ref/exception) diff --git a/ref/proc/turn/icon.md b/ref/proc/turn/icon.md index 0255ef3b..f81a8b9f 100644 --- a/ref/proc/turn/icon.md +++ b/ref/proc/turn/icon.md @@ -1,32 +1,33 @@ -## turn proc (applied to an icon) + +## icon (proc) **Format:** + turn(Icon, Angle) -**Returns:** -+ The rotated icon. - -**Args:** +**Arguments:** + Icon: an icon to rotate + Angle: An angle in degrees (clockwise rotation). -> [!CAUTION] -> An icon that is not square will not be turned. - -### Example: +**Returns:** ++ The rotated icon. +*** ```dm + mob/verb/drink() //this effect is very confusing! usr.icon = turn(usr.icon,90) usr << "Woah! That stuff is powerful!" sleep(200) usr.icon = turn(usr.icon,-90) + ``` - -If the icon is an /icon datum, a new datum will be created as the result. -> [!TIP] -> **See also:** -> + [turn proc](/ref/proc/turn.md) -> + [icon](/ref/icon.md) \ No newline at end of file + +An icon that is not square will not be turned. + +If the icon is an /icon datum, a new datum will be created as the result. +*** +**Related Pages:** ++ [turn proc](/ref/proc/turn) ++ [icon](/ref/icon) diff --git a/ref/proc/turn/index.md b/ref/proc/turn/index.md new file mode 100644 index 00000000..1eb19832 --- /dev/null +++ b/ref/proc/turn/index.md @@ -0,0 +1,34 @@ + +## turn (proc) + +**Format:** ++ turn(Dir, Angle) + +**Arguments:** ++ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST. ++ Angle: An angle in degrees (counterclockwise rotation). + +**Returns:** ++ The rotated direction. +*** +This proc can also be applied to an icon, a matrix, or a vector. + + +```dm + +var/dir +dir = turn(NORTH, 90) // dir = west +dir = turn(dir, -90) // dir = north +dir = turn(dir, 45) // dir = northwest + +``` + + +Only multiples of 45 are allowed for angles. If an invalid angle is used, it will be treated as the closest multiple of 45 to 0. + +If the supplied Dir is invalid, such as 0, or something like UP or DOWN, the result is a random direction unless the angle is also 0. +*** +**Related Pages:** ++ [Turn proc (icon)](/ref/icon/proc/Turn) ++ [dir](/ref/atom/var/dir) ++ [Turn](/ref/vector/proc/Turn) diff --git a/ref/proc/turn/matrix.md b/ref/proc/turn/matrix.md index 046445ac..aa85b7c1 100644 --- a/ref/proc/turn/matrix.md +++ b/ref/proc/turn/matrix.md @@ -1,26 +1,29 @@ -## turn proc (applied to a matrix) + +## matrix (proc) **Format:** + turn(Matrix, Angle) -**Returns:** -+ A new matrix which has been rotated. - -**Args:** +**Arguments:** + Matrix: a matrix to rotate + Angle: An angle in degrees (clockwise rotation). -### Example: + +**Returns:** ++ A new matrix which has been rotated. +*** ```dm + mob/verb/drink() //this effect is very confusing! usr.transform = turn(usr.transform, 90) usr << "Woah! That stuff is powerful!" sleep(200) usr.transform = null + ``` -> [!TIP] -> **See also:** -> + [turn proc](/ref/proc/turn.md) -> + [matrix](/ref/matrix.md) \ No newline at end of file +*** +**Related Pages:** ++ [turn proc](/ref/proc/turn) ++ [matrix](/ref/matrix) diff --git a/ref/proc/turn/turn.md b/ref/proc/turn/turn.md deleted file mode 100644 index f0d3d298..00000000 --- a/ref/proc/turn/turn.md +++ /dev/null @@ -1,36 +0,0 @@ -## turn proc - -**Format:** -+ turn(Dir, Angle) - -**Args:** -+ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, - SOUTHEAST, SOUTHWEST. -+ Angle: An angle in degrees (counterclockwise rotation). - -**Returns:** -+ The rotated direction. - -This proc can also be applied to an [icon](/ref/proc/turn/icon.md) , a [matrix](/ref/proc/turn/matrix.md) , or a [vector](/ref/proc/turn/vector.md) -### Example: - -```dm -var/dir -dir = turn(NORTH, 90) // dir = west -dir = turn(dir, -90) // dir = north -dir = turn(dir, 45) // dir = northwest -``` - -Only multiples of 45 are allowed for angles. If an -invalid angle is used, it will be treated as the closest multiple of 45 -to 0. - -If the supplied Dir is invalid, such as 0, or something -like UP or DOWN, the result is a random direction unless the angle is -also 0. - -> [!TIP] -> **See also:** -> + [Turn proc (icon)](/ref/icon/proc/Turn.md) -> + [dir var (atom)](/ref/atom/var/dir.md) -> + [Turn proc (vector)](/ref/vector/proc/Turn.md) \ No newline at end of file diff --git a/ref/proc/turn/vector.md b/ref/proc/turn/vector.md index 4d015bd9..b48f2a5c 100644 --- a/ref/proc/turn/vector.md +++ b/ref/proc/turn/vector.md @@ -1,30 +1,25 @@ -## turn proc (applied to a vector) -###### BYOND Version 516 + +## vector (proc) **Format:** + turn(vector/A, angle) + turn(vector/A, vector/B) -**Returns:** -+ A new rotated vector. - -**Args:** +**Arguments:** + A: The vector to rotate. + angle: An angle to turn a vector counter-clockwise in 2D. + B: A vector to rotate around (left-hand rule). -All angles are in degrees. - -When the argument is an angle, the result is a copy of vector A, -rotated in 2 dimensions counter-clockwise. +**Returns:** ++ A new rotated vector. +*** +All angles are in degrees. -When the argument is a vector, the result is -rotated in 3 dimensions around vector B using the left-hand rule (thumb -pointed in the direction of B, rotation following curled fingers). The -angle of rotation is the length of B, in degrees. +When the argument is an angle, the result is a copy of vector A, rotated in 2 dimensions counter-clockwise. -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [Turn proc (vector)](/ref/vector/proc/Turn.md) \ No newline at end of file +When the argument is a vector, the result is rotated in 3 dimensions around vector B using the left-hand rule (thumb pointed in the direction of B, rotation following curled fingers). The angle of rotation is the length of B, in degrees. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [Turn](/ref/vector/proc/Turn) diff --git a/ref/proc/typesof.md b/ref/proc/typesof.md index ca910a23..4f6adcce 100644 --- a/ref/proc/typesof.md +++ b/ref/proc/typesof.md @@ -1,33 +1,35 @@ -## typesof proc + +## typesof (proc) **Format:** + typesof(Type1,Type2,...) -**Returns:** -+ A list of all types that are derived from the specified "base" - types, including the base types themselves. - -**Args:** +**Arguments:** + The "base" types. -### Example: + +**Returns:** ++ A list of all types that are derived from the specified "base" types, +including the base types themselves. +*** ```dm + obj/fruit apple peach mango var/list/fruit_types = typesof(/obj/fruit) + ``` - -In this example, fruit_types is -initialized to contain /obj/fruit, /obj/fruit/apple, /obj/fruit/peach, -and /obj/fruit/mango. -This procedure can also be used to list -procs and verbs. -### Example: + +In this example, fruit_types is initialized to contain /obj/fruit, /obj/fruit/apple, /obj/fruit/peach, and /obj/fruit/mango. + +This procedure can also be used to list procs and verbs. + ```dm + mob/admin_commands/verb shutdown_world() world.Del() @@ -39,9 +41,10 @@ mob/verb/add_admin() verbs += typesof(/mob/admin_commands/verb) mob/verb/remove_admin() verbs -= typesof(/mob/admin_commands/verb) + ``` -> [!TIP] -> **See also:** -> + [istype proc](/ref/proc/istype.md) -> + [locate proc](/ref/proc/locate.md) \ No newline at end of file +*** +**Related Pages:** ++ [istype proc](/ref/proc/istype) ++ [locate proc](/ref/proc/locate) diff --git a/ref/proc/uppertext.md b/ref/proc/uppertext.md index 77ce3c4a..2acf0f34 100644 --- a/ref/proc/uppertext.md +++ b/ref/proc/uppertext.md @@ -1,23 +1,24 @@ -## uppertext proc + +## uppertext (proc) **Format:** + uppertext(T) +**Arguments:** ++ T: A text string. + **Returns:** + A capitalized text string. +*** +Capitalize all of the characters of T. -**Args:** -+ T: A text string. +```dm -Capitalize all of the characters of T. -### Example: +U = uppertext("hi there") // = "HI THERE" -```dm - U = uppertext("hi there") // = "HI THERE" ``` - -> [!TIP] -> **See also:** -> + [lowertext proc](/ref/proc/lowertext.md) \ No newline at end of file +*** +**Related Pages:** ++ [lowertext proc](/ref/proc/lowertext) diff --git a/ref/proc/url_decode.md b/ref/proc/url_decode.md index e0b1b481..ae6c9a08 100644 --- a/ref/proc/url_decode.md +++ b/ref/proc/url_decode.md @@ -1,25 +1,19 @@ -## url_decode proc + +## url_decode (proc) **Format:** + url_decode(UrlText) -**Args:** +**Arguments:** + UrlText: text to be "unescaped" **Returns:** + unescaped text +*** +Most non-alphanumeric characters are converted to another format in a URL. To send these characters literally, they must be "escaped". - -Most non-alphanumeric characters are converted to another -format in a URL. To send these characters literally, they must be -"escaped". - -The `url_decode()` instruction takes a text string -containing such escaped symbols and turns them into their literal -counterparts. Usually this is done for you automatically in `Topic()`. -The more useful function is `url_encode()` which does the reverse. - -> [!TIP] -> **See also:** -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [url_encode proc](/ref/proc/url_encode.md) \ No newline at end of file +The url_decode() instruction takes a text string containing such escaped symbols and turns them into their literal counterparts. Usually this is done for you automatically in Topic(). The more useful function is url_encode() which does the reverse. +*** +**Related Pages:** ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [url_encode proc](/ref/proc/url_encode) diff --git a/ref/proc/url_encode.md b/ref/proc/url_encode.md index 4c15bd38..b33a5a22 100644 --- a/ref/proc/url_encode.md +++ b/ref/proc/url_encode.md @@ -1,39 +1,30 @@ -## url_encode proc + +## url_encode (proc) **Format:** + url_encode(PlainText, format=0) -**Args:** +**Arguments:** + PlainText: text to be URL "escaped" -+ format: 0 to treat PlainText as a query string, 1 to treat it as a - full URL ++ format: 0 to treat PlainText as a query string, 1 to treat it as a full URL **Returns:** + escaped text +*** +Special characters such as spaces are not used literally in URLs. If you want to ensure that an entire text string is sent literally, you can "escape" those characters. For example, a double quote (ASCII 34) is produced by the code %22, where 22 is hexadecimal for 34. +The url_encode() instruction does this for you automatically. Using format=1 will treat the URL as already encoded and only re-encode characters that don't belong in the result. Otherwise PlainText is treated as part of a query string; in this case spaces are converted to + instead of %20, and most characters are escaped. -Special characters such as spaces are not used literally in -URLs. If you want to ensure that an entire text string is sent -literally, you can "escape" those characters. For example, a double -quote (ASCII 34) is produced by the code `%22`, where 22 is hexadecimal -for 34. - -The `url_encode()` instruction does this for you -automatically. Using `format=1` will treat the URL as already encoded -and only re-encode characters that don\'t belong in the result. -Otherwise PlainText is treated as part of a query string; in this case -spaces are converted to `+` instead of `%20`, and most characters are -escaped. -### Example: ```dm - mob/verb/Private(M as mob in players, T as text) -if(!client \|\| !M \|\| !M.client \|\| !T) return usr << "\[To -[[M.name]](?msg=%5Burl_encode(M.key)%5D)\] [T]" M << "\[From -[[name]](?msg=%5Burl_encode(key)%5D)\] [T]" -``` +mob/verb/Private(M as mob in players, T as text) + if(!client || !M || !M.client || !T) return + usr << "\[To [M.name]\] [T]" + M << "\[From [name]\] [T]" + +``` -> [!TIP] -> **See also:** -> + [url_decode proc](/ref/proc/url_decode.md) \ No newline at end of file +*** +**Related Pages:** ++ [url_decode proc](/ref/proc/url_decode) diff --git a/ref/proc/values_cut_over.md b/ref/proc/values_cut_over.md new file mode 100644 index 00000000..2f09ce3e --- /dev/null +++ b/ref/proc/values_cut_over.md @@ -0,0 +1,38 @@ + +## values_cut_over (proc) + +**Format:** ++ values_cut_over(Alist, Max, inclusive=0) + +**Arguments:** ++ Alist: An or [list associations](/ref/list/associations) ++ Max: The maximum number allowed ++ inclusive: Also cut items whose value equals Max + +**Returns:** ++ Number of items removed +*** +Removes all items from the list whose associated values are greater than Max, not numbers, or NaN. + +If the optional `inclusive` argument is true, items with associated values equal to Max are removed also. + + +```dm + +var/list/stuff = list("a"=1, "b"=2, "c"=-4) +values_cut_over(stuff, 0) +for(var/k,v in stuff) + usr << "[k] = [v]" +// prints: +// c = -4 + +``` + + +This is a convenience proc for games trying to eke out high performance. + +If Alist is not an associative list, nothing happens. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [values_cut_under proc](/ref/proc/values_cut_under) diff --git a/ref/proc/values_cut_under.md b/ref/proc/values_cut_under.md new file mode 100644 index 00000000..5f7f7cfb --- /dev/null +++ b/ref/proc/values_cut_under.md @@ -0,0 +1,39 @@ + +## values_cut_under (proc) + +**Format:** ++ values_cut_under(Alist, Min, inclusive=0) + +**Arguments:** ++ Alist: An or [list associations](/ref/list/associations) ++ Min: The maximum number allowed ++ inclusive: Also cut items whose value equals Min + +**Returns:** ++ Number of items removed +*** +Removes all items from the list whose associated values are less than Min, not numbers, or NaN. + +If the optional `inclusive` argument is true, items with associated values equal to Min are removed also. + + +```dm + +var/list/stuff = list("a"=1, "b"=2, "c"=-4) +values_cut_under(stuff, 0) +for(var/k,v in stuff) + usr << "[k] = [v]" +// prints: +// a = 1 +// b = 2 + +``` + + +This is a convenience proc for games trying to eke out high performance. + +If Alist is not an associative list, nothing happens. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [values_cut_over proc](/ref/proc/values_cut_over) diff --git a/ref/proc/values_dot.md b/ref/proc/values_dot.md new file mode 100644 index 00000000..e1ba7a0b --- /dev/null +++ b/ref/proc/values_dot.md @@ -0,0 +1,38 @@ + +## values_dot (proc) + +**Format:** ++ values_dot(A, B) + +**Arguments:** ++ A, B: An or [list associations](/ref/list/associations) + +**Returns:** ++ The dot product of all associated numbers in A and B +*** +Returns the dot product of two associative lists. If the same item exists in both lists, the associated values are multiplied together as numbers. All of those multiplications are added together to form the dot product. This is similar to vector dot products. + + +```dm + +var/list/first = list("a"=1, "b"=2, "c"=3) +var/list/second = list("b"=4, "c"=5, "d"=6) +// first["a"] * second["a"] = 1 * 0 = 0 +// first["b"] * second["b"] = 2 * 4 = 8 +// first["c"] * second["c"] = 3 * 5 = 15 +// first["d"] * second["d"] = 0 * 6 = 0 +// total is 23 +usr << values_dot(first, second) // outputs 23 + +``` + + +This is a convenience proc for games trying to eke out high performance. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [values_sum proc](/ref/proc/values_sum) ++ [values_product proc](/ref/proc/values_product) ++ [values_cut_over proc](/ref/proc/values_cut_over) ++ [values_cut_under proc](/ref/proc/values_cut_under) ++ [alist proc](/ref/proc/alist) diff --git a/ref/proc/values_product.md b/ref/proc/values_product.md new file mode 100644 index 00000000..bf28674d --- /dev/null +++ b/ref/proc/values_product.md @@ -0,0 +1,34 @@ + +## values_product (proc) + +**Format:** ++ values_product(Alist) + +**Arguments:** ++ Alist: An or [list associations](/ref/list/associations) + +**Returns:** ++ The product of all associated numbers in Alist, or 1 if no numbers were found +*** +Returns the product of all associated values in this list that are numbers. Other values, including vectors, are not multiplied. + + +```dm + +var/list/stuff = list("foo" = 3, "bar" = -4, "banana" = 5) +usr << values_product(stuff) // outputs -60 + +``` + + +This is a convenience proc for games trying to eke out high performance. + +If Alist is not an associative list or no numbers were found among the associated values, the result is 1. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [values_sum proc](/ref/proc/values_sum) ++ [values_dot proc](/ref/proc/values_dot) ++ [values_cut_over proc](/ref/proc/values_cut_over) ++ [values_cut_under proc](/ref/proc/values_cut_under) ++ [alist proc](/ref/proc/alist) diff --git a/ref/proc/values_sum.md b/ref/proc/values_sum.md new file mode 100644 index 00000000..631d3384 --- /dev/null +++ b/ref/proc/values_sum.md @@ -0,0 +1,34 @@ + +## values_sum (proc) + +**Format:** ++ values_sum(Alist) + +**Arguments:** ++ Alist: An or [list associations](/ref/list/associations) + +**Returns:** ++ The sum of all associated numbers in Alist +*** +Returns the sum of all associated values in this list that are numbers. Other values, including vectors, are not summed. + + +```dm + +var/list/weights = list(/obj/crate = 12, /obj/vase = 1) +usr << values_sum(weights) // outputs 13 + +``` + + +This is a convenience proc for games trying to eke out high performance. + +If Alist is not an associative list, the result is 0. +*** +**Related Pages:** ++ [list associations](/ref/list/associations) ++ [values_product proc](/ref/proc/values_product) ++ [values_dot proc](/ref/proc/values_dot) ++ [values_cut_over proc](/ref/proc/values_cut_over) ++ [values_cut_under proc](/ref/proc/values_cut_under) ++ [alist proc](/ref/proc/alist) diff --git a/ref/proc/var.md b/ref/proc/var.md deleted file mode 100644 index f992530d..00000000 --- a/ref/proc/var.md +++ /dev/null @@ -1,16 +0,0 @@ -## vars (procs) - - - -Built-in proc vars: -proc/var -+ [.](/ref/proc/var/%2e.md) -+ [args](/ref/proc/var/args.md) -+ [callee](/ref/proc/var/callee.md) -+ [caller](/ref/proc/var/caller.md) -+ [src](/ref/proc/var/src.md) -+ [usr](/ref/proc/var/usr.md) - -> [!TIP] -> **See also:** -> + [procs](/ref/proc.md) \ No newline at end of file diff --git a/ref/proc/var/..md b/ref/proc/var/..md index 159dbfdb..3452dcdb 100644 --- a/ref/proc/var/..md +++ b/ref/proc/var/..md @@ -1,18 +1,18 @@ -## . var (proc) +## %2e (var) +*** +This is the default return value. If a proc exits without calling return or if no arguments are specified the value of `.` will be returned. The default value of `.` is null. -This is the default return value. If a proc exits without -calling return or if no arguments are specified the value of `.` will be -returned. The default value of `.` is null. -### Example: ```dm - mob/Login() . = ..() view() << "[src] logs in." -``` +mob/Login() + . = ..() + view() << "[src] logs in." +``` -> [!TIP] -> **See also:** -> + [return statement](/ref/proc/return.md) -> + [vars (procs)](/ref/proc/var.md) \ No newline at end of file +*** +**Related Pages:** ++ [return statement](/ref/proc/return) ++ [vars (procs)](/ref/proc/var) diff --git a/ref/proc/var/args.md b/ref/proc/var/args.md index b3119907..dc26c677 100644 --- a/ref/proc/var/args.md +++ b/ref/proc/var/args.md @@ -1,18 +1,21 @@ -## args list var (proc) - +## args (var) +*** This is a list of the arguments passed to the proc or verb. -### Example: + ```dm - proc/add() var {cur; tot} for(cur in args) tot += cur -return tot + +proc/add() + var {cur; tot} + for(cur in args) + tot += cur + return tot + ``` - -Here, `add()` may be called with any -number of arguments, each accessed through the `args` list. -> [!TIP] -> **See also:** -> + [list](/ref/list.md) \ No newline at end of file +Here, `add()` may be called with any number of arguments, each accessed through the `args` list. +*** +**Related Pages:** ++ [list](/ref/list) diff --git a/ref/proc/var/callee.md b/ref/proc/var/callee.md index 0447556d..81b79056 100644 --- a/ref/proc/var/callee.md +++ b/ref/proc/var/callee.md @@ -1,13 +1,8 @@ -## callee var (proc) -###### BYOND Version 516 - - -Returns a [callee object](/ref/callee.md) representing the current -running proc. This is seldom as useful as the `caller` var, but is -available if it\'s needed. - -> [!TIP] -> **See also:** -> + [callee](/ref/callee.md) -> + [caller var (proc)](/ref/proc/var/caller.md) \ No newline at end of file +## callee (var) +*** +Returns a callee object representing the current running proc. This is seldom as useful as the `caller` var, but is available if it's needed. +*** +**Related Pages:** ++ [callee](/ref/callee) ++ [caller var (proc)](/ref/proc/var/caller) diff --git a/ref/proc/var/caller.md b/ref/proc/var/caller.md index c972154b..fbf223db 100644 --- a/ref/proc/var/caller.md +++ b/ref/proc/var/caller.md @@ -1,26 +1,22 @@ -## caller var (proc) -###### BYOND Version 516 +## caller (var) +*** +Returns a callee object representing the current proc's caller, which can be used to access information like the proc name, line number (if compiled with debug information), arguments, and more. +The main purpose of this is to make it possible to trace the call stack when handling errors. -Returns a [callee object](/ref/callee.md) representing the current -proc\'s caller, which can be used to access information like the proc -name, line number (if compiled with debug information), arguments, and -more. - -The main purpose of this is to make it possible to trace -the call stack when handling errors. -### Example: ```dm - world/Error(err) world.log << "Error [err]:" -for(var/callee/p = caller, p, p = p.caller) world.log << " [p.type] -(src=[p.src], usr=[p.usr])" if(p.file) world.log << " at -[p.file]:[p.line]" -``` +world/Error(err) + world.log << "Error [err]:" + for(var/callee/p = caller, p, p = p.caller) + world.log << " [p.type] (src=[p.src], usr=[p.usr])" + if(p.file) world.log << " at [p.file]:[p.line]" + +``` -> [!TIP] -> **See also:** -> + [callee](/ref/callee.md) -> + [callee var (proc)](/ref/proc/var/callee.md) \ No newline at end of file +*** +**Related Pages:** ++ [callee](/ref/callee) ++ [callee var (proc)](/ref/proc/var/callee) diff --git a/ref/proc/var/global.md b/ref/proc/var/global.md index c7a09590..687b0797 100644 --- a/ref/proc/var/global.md +++ b/ref/proc/var/global.md @@ -1,20 +1,22 @@ -## global var (proc) +## global (var) +*** +This is not really a variable but is used to force treatment of the following variable or proc as global. This may be necessary if a local or src-level variable has the same name. -This is not really a variable but is used to force treatment of -the following variable or proc as global. This may be necessary if a -local or src-level variable has the same name. -### Example: ```dm - var/myvar = "global" mob verb/test() var/myvar = -"local" usr << myvar usr << global.myvar + +var/myvar = "global" +mob + verb/test() + var/myvar = "local" + usr << myvar + usr << global.myvar + ``` - -This -example outputs "local" and then "global". -> [!TIP] -> **See also:** -> + [src var (proc)](/ref/proc/var/src.md) \ No newline at end of file +This example outputs "local" and then "global". +*** +**Related Pages:** ++ [src var (proc)](/ref/proc/var/src) diff --git a/ref/proc/var/index.md b/ref/proc/var/index.md new file mode 100644 index 00000000..0441a71f --- /dev/null +++ b/ref/proc/var/index.md @@ -0,0 +1,7 @@ + +## var (var) +*** +Built-in proc vars: +*** +**Related Pages:** ++ [procs](/ref/proc) diff --git a/ref/proc/var/src.md b/ref/proc/var/src.md index 233d9749..e5d0fa89 100644 --- a/ref/proc/var/src.md +++ b/ref/proc/var/src.md @@ -1,26 +1,23 @@ -## src var (proc) +## src (var) +*** +This is a variable equal to the object containing the proc or verb. It is defined to have the same type as that object. -This is a variable equal to the object containing the proc or -verb. It is defined to have the same type as that object. -### Example: - ```dm - obj/bread verb/eat() world << "[usr] eats [src]" + +obj/bread + verb/eat() + world << "[usr] eats [src]" ``` - -If a player named "Bob" calls "eat bread", the -output will be "Bob eats the bread." -Note that `src` has no -meaning for global procs, derived from `/proc`, unless they are invoked -as verbs (by being attached to a [verb list](/ref/atom/var/verbs.md) . +If a player named "Bob" calls "eat bread", the output will be "Bob eats the bread." -> [!TIP] -> **See also:** -> + [usr var (proc)](/ref/proc/var/src.md) -> + [procs](/ref/proc.md) -> + [verbs](/ref/verb.md) \ No newline at end of file +Note that `src` has no meaning for global procs, derived from `/proc`, unless they are invoked as verbs (by being attached to a verb list). +*** +**Related Pages:** ++ [src var (proc)](/ref/proc/var/src) ++ [procs](/ref/proc) ++ [verbs](/ref/verb) diff --git a/ref/proc/var/usr.md b/ref/proc/var/usr.md index 0a97424c..097c50b1 100644 --- a/ref/proc/var/usr.md +++ b/ref/proc/var/usr.md @@ -1,72 +1,39 @@ -## usr var (proc) +## usr (var) +*** +This is a mob variable (var/mob/usr) containing the mob of the player who executed the current verb, or whose action ultimately called the current proc. -This is a mob variable (var/mob/usr) containing the mob of the -player who executed the current verb, or whose action ultimately called -the current proc. -### Example: - ```dm - obj/bread verb/eat() world << "[usr] eats [src]" + +obj/bread + verb/eat() + world << "[usr] eats [src]" ``` - -If a player named "Bob" calls "eat bread", the -output will be "Bob eats the bread." -Essentially, `usr` is an -implicit parameter that is passed to every proc or verb. Each procedure -inherits the value from its caller. While it can simplify your code in -some situations, it can also lead to subtle problems if you are assuming -that `usr` is automatically assigned the value of `src` when you call a -verb programmatically. It is not. +If a player named "Bob" calls "eat bread", the output will be "Bob eats the bread." + +Essentially, `usr` is an implicit parameter that is passed to every proc or verb. Each procedure inherits the value from its caller. While it can simplify your code in some situations, it can also lead to subtle problems if you are assuming that `usr` is automatically assigned the value of `src` when you call a verb programmatically. It is not. + +The only time `usr` is assigned for you is when a player executes a verb, clicks something with the mouse, clicks a link (see Topic), or any other such action. -The only time `usr` is -assigned for you is when a player executes a verb, clicks something with -the mouse, clicks a link (see [Topic](/ref/client/proc/Topic.md) ), or -any other such action. -Note: **A good rule of thumb is to never put usr in a proc, only -verbs.** Typically `usr` in a proc is an unsafe programming practice. If -`src` would not be the correct choice, it is better to send another -argument to your proc with the information it needs. -Certain -built-in procs such as [atom/Click()](/ref/atom/proc/Click.md) are -called automatically by a client counterpart like -[client/Click()](/ref/client/proc/Click.md) ; usually -[atom/Stat()](/ref/atom/proc/Click.md) is called by -[client/Stat()](/ref/client/proc/Click.md) ; and so on. It is mostly -safe to apply `usr` as directed in those situations, because these procs -are pseudo-verbs. It is mostly *not* safe to apply `usr` in a movement -proc such as [Move()](/ref/atom/movable/proc/Move.md) or -[Enter()](/ref/atom/proc/Enter.md) , because objs and non-player mobs -may move autonomously without setting `usr`. +> [!TIP] +> Note: **A good rule of thumb is to never put usr in a proc, only verbs.** Typically `usr` in a proc is an unsafe programming practice. If `src` would not be the correct choice, it is better to send another argument to your proc with the information it needs. -Although `usr` is -often set in [mob/Login()](/ref/mob/proc/Login.md) when a client first -connects, you should not assume it is valid if `Login()` is called any -other way. Common cases occur when creating a new character, loading a -player\'s mob from a savefile; or explicitly when setting a mob\'s key -or changing the value of [client.mob](/ref/client/var/mob.md) . It is -safest to use `src` in `mob/Login()`, which is always correct, rather -than `usr`. +Certain built-in procs such as atom/Click() are called automatically by a client counterpart like client/Click(); usually atom/Stat() is called by client/Stat(); and so on. It is mostly safe to apply `usr` as directed in those situations, because these procs are pseudo-verbs. It is mostly not safe to apply `usr` in a movement proc such as Move() or Enter(), because objs and non-player mobs may move autonomously without setting `usr`. -`usr` is the default point of reference for several -procs like [view()](/ref/proc/view.md) and -[range()](/ref/proc/range.md) , because of their common use in verbs. It -is also the default recipient for [input()](/ref/proc/input.md) and -[alert()](/ref/proc/alert.md) messages. When using these in procs, be -aware of that so you can change the default reference value to something -more appropriate. +Although `usr` is often set in mob/Login() when a client first connects, you should not assume it is valid if `Login()` is called any other way. Common cases occur when creating a new character, loading a player's mob from a savefile; or explicitly when setting a mob's key or changing the value of client.mob. It is safest to use `src` in `mob/Login()`, which is always correct, rather than `usr`. -> [!TIP] -> **See also:** -> + [src var (proc)](/ref/proc/var/src.md) -> + [verbs](/ref/verb.md) -> + [Topic proc (client)](/ref/client/proc/Topic.md) -> + [range proc](/ref/proc/range.md) -> + [view proc](/ref/proc/view.md) -> + [alert proc](/ref/proc/alert.md) -> + [input proc](/ref/proc/input.md) \ No newline at end of file +`usr` is the default point of reference for several procs like view() and range(), because of their common use in verbs. It is also the default recipient for input() and alert() messages. When using these in procs, be aware of that so you can change the default reference value to something more appropriate. +*** +**Related Pages:** ++ [src var (proc)](/ref/proc/var/src) ++ [verbs](/ref/verb) ++ [Topic proc (client)](/ref/client/proc/Topic) ++ [range proc](/ref/proc/range) ++ [view proc](/ref/proc/view) ++ [alert proc](/ref/proc/alert) ++ [input proc](/ref/proc/input) diff --git a/ref/proc/vector.md b/ref/proc/vector.md index 1fc20eab..7c1ecafa 100644 --- a/ref/proc/vector.md +++ b/ref/proc/vector.md @@ -1,23 +1,26 @@ -## vector proc -###### BYOND Version 516 + +## vector (proc) **Format:** + vector(x,y) + vector(x,y,z) ++ vector(String) + vector(List) + vector(Vector) ++ vector(Pixloc) -**Returns:** -+ A new vector. - -**Args:** +**Arguments:** + x,y,z: Components of the new vector. ++ String: A text string to parse as a vector, where the delimiter between numbers can be a comma or x. + List: A numeric list to copy as a vector. + Vector: A vector to copy. ++ Vector: A pixloc to copy as a vector. - +**Returns:** ++ A new vector. +*** Creates a vector. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) \ No newline at end of file +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [pixloc](/ref/pixloc) diff --git a/ref/proc/view.md b/ref/proc/view.md index 4e815f3d..73aacad3 100644 --- a/ref/proc/view.md +++ b/ref/proc/view.md @@ -1,71 +1,57 @@ -## view proc + +## view (proc) **Format:** + view(Dist=5,Center=usr) +**Arguments:** ++ Dist: A number. ++ Center: An object on the map. + **Returns:** + A list of visible objects within Dist tiles of Center. +*** +A Dist of 0 includes Center, the contents of Center (normally usr.contents), its location (normally the turf a mob is standing on), and any other contents of that location. A value of 1 extends the region to the neighboring squares on the map and so on. Both arguments are optional and may be passed in any order. -**Args:** -+ Dist: A number. -+ Center: An object on the map. +The default range is actually controlled by the size of the map viewport size, which is configured with world.view. Since the default value of that variable is 5, the default range is also 5. You may use any valid view size, so an explicit view size such as "11x17" is also valid. -A Dist of 0 includes Center, the contents of Center (normally -usr.contents), its location (normally the turf a mob is standing on), -and any other contents of that location. A value of 1 extends the region -to the neighboring squares on the map and so on. Both arguments are -optional and may be passed in any order. +```dm -The default range is -actually controlled by the size of the map viewport size, which is -configured with `world.view`. Since the default value of that variable -is 5, the default range is also 5. You may use any valid view size, so -an explicit view size such as "11x17" is also valid. -### Example: +view() << "to all in sight of [usr]" +view(src) << "to all in sight of [src]" +view(1,src.loc) << "to all within reach of [src]" -```dm - view() << "to all in sight of [usr]" view(src) << -"to all in sight of [src]" view(1,src.loc) << "to all within -reach of [src]" ``` - -Be aware of the following -distinctions: + +Be aware of the following distinctions: + + ```dm - view(usr) //objects that usr can see -view(usr.loc) //objects visible from usr\'s position view(usr.client) -//objects visible to player + +view(usr) //objects that usr can see +view(usr.loc) //objects visible from usr's position +view(usr.client) //objects visible to player + ``` - - -In many cases, the three -different statements could produce the same result, but they are not -identical in general. For example, the first statement takes into -account the visual capabilities of usr, which might include such things -as the ability to see in the dark or to see invisible objects. - - -The second statement, since it is from a non-mob would just do -a plain visibility calculation with no special visual capabilities. In -many cases, you would want to use viewers() or hearers() instead. - - -The third statement produces a list of visible objects as the -player sees things, which might be different than how the mob sees -things if `client.eye` and `client.mob` are different. - -> [!TIP] -> **See also:** -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [hearers](/ref/proc/hearers.md) -> + [oview proc](/ref/proc/oview.md) -> + [range proc](/ref/proc/range.md) -> + [see_in_dark var (mob)](/ref/mob/var/see_in_dark.md) -> + [see_infrared var (mob)](/ref/mob/var/see_infrared.md) -> + [see_invisible var (mob)](/ref/mob/var/see_invisible.md) -> + [sight var (mob)](/ref/mob/var/sight.md) -> + [view var (client)](/ref/client/var/view.md) -> + [view var (world)](/ref/world/var/view.md) -> + [viewers](/ref/proc/viewers.md) \ No newline at end of file + + +In many cases, the three different statements could produce the same result, but they are not identical in general. For example, the first statement takes into account the visual capabilities of usr, which might include such things as the ability to see in the dark or to see invisible objects. + +The second statement, since it is from a non-mob would just do a plain visibility calculation with no special visual capabilities. In many cases, you would want to use viewers() or hearers() instead. + +The third statement produces a list of visible objects as the player sees things, which might be different than how the mob sees things if client.eye and client.mob are different. +*** +**Related Pages:** ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [hearers](/ref/proc/hearers) ++ [oview proc](/ref/proc/oview) ++ [range proc](/ref/proc/range) ++ [see_in_dark var (mob)](/ref/mob/var/see_in_dark) ++ [see_infrared var (mob)](/ref/mob/var/see_infrared) ++ [see_invisible var (mob)](/ref/mob/var/see_invisible) ++ [sight var (mob)](/ref/mob/var/sight) ++ [view var (client)](/ref/client/var/view) ++ [view var (world)](/ref/world/var/view) ++ [viewers](/ref/proc/viewers) diff --git a/ref/proc/viewers.md b/ref/proc/viewers.md index 7e0f11f8..a706bd10 100644 --- a/ref/proc/viewers.md +++ b/ref/proc/viewers.md @@ -1,15 +1,12 @@ -## viewers + +## viewers (proc) **Format:** + viewers(Depth=world.view,Center=usr) - - -This is just like `view()`, but it is a list of mobs that can -see the center object, rather than a list of objects visible to the -center object. - -> [!TIP] -> **See also:** -> + [hearers](/ref/proc/hearers.md) -> + [oviewers](/ref/proc/oviewers.md) -> + [view proc](/ref/proc/view.md) \ No newline at end of file +*** +This is just like view(), but it is a list of mobs that can see the center object, rather than a list of objects visible to the center object. +*** +**Related Pages:** ++ [hearers](/ref/proc/hearers) ++ [oviewers](/ref/proc/oviewers) ++ [view proc](/ref/proc/view) diff --git a/ref/proc/walk.md b/ref/proc/walk.md index c76d7218..d2092a5f 100644 --- a/ref/proc/walk.md +++ b/ref/proc/walk.md @@ -1,28 +1,27 @@ -## walk proc + +## walk (proc) **Format:** + walk(Ref,Dir,Lag=0,Speed=0) ++ walk(Ref,Vector,Lag=0) -**Args:** +**Arguments:** + Ref: A mob or obj. -+ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, - SOUTHEAST, SOUTHWEST, or 0 to halt. ++ Dir: One of NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, + SOUTHWEST, or 0 to halt. + Lag: Delay in world ticks between movement. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. ++ Vector: 2D vector to move by, in pixels. +*** +Move Ref in the direction Dir continuously. Each step will be preceded by Lag time of inactivity. +A call to a walking function aborts any previous walking function called on Ref. To halt walking, call walk(Ref,0). -Move Ref in the direction Dir continuously. Each step will be -preceded by Lag time of inactivity. - -A call to a walking -function aborts any previous walking function called on Ref. To halt -walking, call walk(Ref,0). - -This function returns immediately, -but continues to process in the background. +This function returns immediately, but continues to process in the background. -> [!TIP] -> **See also:** -> + [get_step proc](/ref/proc/get_step.md) -> + [step proc](/ref/proc/step.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +The vector version of this proc will make a copy of the vector, so changing the vector afterward won't have an effect on existing walking. +*** +**Related Pages:** ++ [get_step proc](/ref/proc/get_step) ++ [step proc](/ref/proc/step) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/walk_away.md b/ref/proc/walk_away.md index da3e9a0c..195eb421 100644 --- a/ref/proc/walk_away.md +++ b/ref/proc/walk_away.md @@ -1,31 +1,23 @@ -## walk_away proc + +## walk_away (proc) **Format:** + walk_away(Ref,Trg,Max=5,Lag=0,Speed=0) -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. -+ Max: The maximum distance between Ref and Targ before movement - halts. ++ Max: The maximum distance between Ref and Targ before movement halts. + Lag: Delay in world ticks between movement. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +*** +Moves Ref on a path away from Trg continuously, taking obstacles into account. Each step will be preceded by Lag time of inactivity. If Ref is farther than Max steps from Trg, no action will be taken. +A call to a walking function aborts any previous walking function called on Ref. To halt walking, call walk(Ref,0). -Moves Ref on a path away from Trg continuously, taking -obstacles into account. Each step will be preceded by Lag time of -inactivity. If Ref is farther than Max steps from Trg, no action will be -taken. - -A call to a walking function aborts any previous walking -function called on Ref. To halt walking, call walk(Ref,0). - -This -function returns immediately, but continues to process in the -background. - -> [!TIP] -> **See also:** -> + [get_step_away proc](/ref/proc/get_step_away.md) -> + [step_away proc](/ref/proc/step_away.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +This function returns immediately, but continues to process in the background. +*** +**Related Pages:** ++ [get_step_away proc](/ref/proc/get_step_away) ++ [step_away proc](/ref/proc/step_away) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/walk_rand.md b/ref/proc/walk_rand.md index 0a47a2af..e891eeb8 100644 --- a/ref/proc/walk_rand.md +++ b/ref/proc/walk_rand.md @@ -1,26 +1,21 @@ -## walk_rand proc + +## walk_rand (proc) **Format:** + walk_rand(Ref,Lag=0,Speed=0) -**Args:** +**Arguments:** + Ref: A mob or obj. + Lag: Delay in world ticks between movement. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +*** +Moves Ref randomly. Each step will be preceded by Lag time of inactivity. +A call to a walking function aborts any previous walking function called on Ref. To halt walking, call walk(Ref,0). -Moves Ref randomly. Each step will be preceded by Lag time of -inactivity. - -A call to a walking function aborts any previous -walking function called on Ref. To halt walking, call walk(Ref,0). - - -This function returns immediately, but continues to process in -the background. - -> [!TIP] -> **See also:** -> + [get_step_rand proc](/ref/proc/get_step_rand.md) -> + [step_rand proc](/ref/proc/step_rand.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +This function returns immediately, but continues to process in the background. +*** +**Related Pages:** ++ [get_step_rand proc](/ref/proc/get_step_rand) ++ [step_rand proc](/ref/proc/step_rand) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/walk_to.md b/ref/proc/walk_to.md index 22bc636a..6172e624 100644 --- a/ref/proc/walk_to.md +++ b/ref/proc/walk_to.md @@ -1,31 +1,23 @@ -## walk_to proc + +## walk_to (proc) **Format:** + walk_to(Ref,Trg,Min=0,Lag=0,Speed=0) -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. + Min: The minimum distance between Ref and Trg before movement halts. + Lag: Delay in world ticks between movement. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +*** +Move Ref on a path to Trg continuously, taking obstacles into account. Each step will be preceded by Lag time of inactivity. If Ref is within Min steps of Trg, no action will be taken. This is also true if the target is too far away (more than twice world.view steps). +A call to a walking function aborts any previous walking function called on Ref. To halt walking, call walk(Ref,0). -Move Ref on a path to Trg continuously, taking obstacles into -account. Each step will be preceded by Lag time of inactivity. If Ref is -within Min steps of Trg, no action will be taken. This is also true if -the target is too far away (more than twice world.view steps). - - -A call to a walking function aborts any previous walking -function called on Ref. To halt walking, call walk(Ref,0). - -This -function returns immediately, but continues to process in the -background. - -> [!TIP] -> **See also:** -> + [get_step_to proc](/ref/proc/get_step_to.md) -> + [step_to proc](/ref/proc/step_to.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +This function returns immediately, but continues to process in the background. +*** +**Related Pages:** ++ [get_step_to proc](/ref/proc/get_step_to) ++ [step_to proc](/ref/proc/step_to) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/walk_towards.md b/ref/proc/walk_towards.md index 55466d9b..03d3de43 100644 --- a/ref/proc/walk_towards.md +++ b/ref/proc/walk_towards.md @@ -1,27 +1,22 @@ -## walk_towards proc + +## walk_towards (proc) **Format:** + walk_towards(Ref,Trg,Lag=0,Speed=0) -**Args:** +**Arguments:** + Ref: A mob or obj. + Trg: An object on the map. + Lag: Delay in world ticks between movement. + Speed: Speed to move, in pixels. 0 uses Ref.step_size. +*** +Move Ref in the direction of Trg continuously. Each step will be preceded by Lag time of inactivity. +A call to a walking function aborts any previous walking function called on Ref. To halt walking, call walk(Ref,0). -Move Ref in the direction of Trg continuously. Each step will -be preceded by Lag time of inactivity. - -A call to a walking -function aborts any previous walking function called on Ref. To halt -walking, call walk(Ref,0). - -This function returns immediately, -but continues to process in the background. - -> [!TIP] -> **See also:** -> + [get_step_towards proc](/ref/proc/get_step_towards.md) -> + [step_towards proc](/ref/proc/step_towards.md) -> + [step_size var (movable atom)](/ref/atom/movable/var/step_size.md) \ No newline at end of file +This function returns immediately, but continues to process in the background. +*** +**Related Pages:** ++ [get_step_towards proc](/ref/proc/get_step_towards) ++ [step_towards proc](/ref/proc/step_towards) ++ [step_size var (movable atom)](/ref/atom/movable/var/step_size) diff --git a/ref/proc/while.md b/ref/proc/while.md index 88c965a1..8406c021 100644 --- a/ref/proc/while.md +++ b/ref/proc/while.md @@ -1,31 +1,37 @@ -## while proc + +## while (proc) **Format:** + while(E) Statement +*** +If E is true (non-zero) execute Statement. Continue testing E and doing the while block until E becomes false (zero). +Statement may be a block of code or a single statement. -If E is true (non-zero) execute Statement. Continue testing E -and doing the while block until E becomes false (zero). +```dm -Statement may be a block of code or a single statement. -### Example: +var/i = 3 +while(i) + world << i-- -```dm - var/i = 3 while(i) world << i\-- ``` +This outputs: + -This outputs: ```dm - 3 2 1 -``` +3 +2 +1 + +``` -> [!TIP] -> **See also:** -> + [break statement](/ref/proc/break.md) -> + [continue statement](/ref/proc/continue.md) -> + [do proc](/ref/proc/do.md) -> + [for loop proc](/ref/proc/for/loop.md) \ No newline at end of file +*** +**Related Pages:** ++ [break statement](/ref/proc/break) ++ [continue statement](/ref/proc/continue) ++ [do proc](/ref/proc/do) ++ [for loop proc](/ref/proc/for/loop) diff --git a/ref/proc/winclone.md b/ref/proc/winclone.md index 3660b065..9c303416 100644 --- a/ref/proc/winclone.md +++ b/ref/proc/winclone.md @@ -1,77 +1,70 @@ -## winclone proc + +## winclone (proc) **Format:** + winclone(player, window_name, clone_name) -**Args:** +**Arguments:** + player: A mob or client. -+ window_name: The name of a window, pane, menu, or macro set in the - world\'s skin file. -+ clone_name: The name of the new window, pane, menu, or macro set to - create. - ++ window_name: The name of a window, pane, menu, or macro set in the world's skin file. ++ clone_name: The name of the new window, pane, menu, or macro set to create. +*** +Creates a clone of a window, pane, menu, or macro set that exists in the world's skin file. The original object as it exists in the skin file (not its current state) is used as a template to build the clone. The clone will exist only for the player you choose. -Creates a clone of a window, pane, menu, or macro set that -exists in the world\'s skin file. The original object as it exists in -the skin file (not its current state) is used as a template to build the -clone. The clone will exist only for the player you choose. -### Example: ```dm - winset(usr, "templatewindow", "clonedwindow") + +winset(usr, "templatewindow", "clonedwindow") ``` - -If a window is not visible by default, it will have -to be shown with `winset()` or `winshow()`. A pane may be shown by using -it in a Child or Tab control. Menus or macros must be assigned to a -window with `winset()` before they will work. -If window_name is -"window", "pane", "menu", or "macro", and the skin file does not -have a control of that name already, the proc will create a new control -of that type from scratch. -### Example: +If a window is not visible by default, it will have to be shown with `winset()` or `winshow()`. A pane may be shown by using it in a Child or Tab control. Menus or macros must be assigned to a window with `winset()` before they will work. + +If window_name is "window", "pane", "menu", or "macro", and the skin file does not have a control of that name already, the proc will create a new control of that type from scratch. + ```dm - winclone(usr, "menu", "newmenu") winset(usr, -"newmenu_file", "parent=newmenu;name=File") winset(usr, -"newmenu_quit", "parent=newmenu_file;name=Quit;command=.quit") + +winclone(usr, "menu", "newmenu") +winset(usr, "newmenu_file", "parent=newmenu;name=File") +winset(usr, "newmenu_quit", "parent=newmenu_file;name=Quit;command=.quit") ``` - -A new window is invisible by default. For windows -and panes, you should give them a size with `winset()` before adding any -controls so you can set their anchors properly. -### Example: + +A new window is invisible by default. For windows and panes, you should give them a size with `winset()` before adding any controls so you can set their anchors properly. + ```dm - // Create the pane winclone(usr, "pane", "newpane") // -Give it a size so we can figure out where to put controls winset(usr, -"newpane", "size=100x100") // Add controls winset(usr, -"newpane_label", \\ -"parent=newpane;pos=0,0;size=100x100;anchor1=0,0;anchor2=100,100") // -Put the pane in a child control where it can be seen winset(usr, -"a_child", "left=newpane") usr << output("New label", -"newpane_label") + +// Create the pane +winclone(usr, "pane", "newpane") +// Give it a size so we can figure out where to put controls +winset(usr, "newpane", "size=100x100") +// Add controls +winset(usr, "newpane_label", \ + "parent=newpane;pos=0,0;size=100x100;anchor1=0,0;anchor2=100,100") +// Put the pane in a child control where it can be seen +winset(usr, "a_child", "left=newpane") +usr << output("New label", "newpane_label") + ``` - -Once a clone is created, it can -be deleted via a `winset()` call: -### Example: + +Once a clone is created, it can be deleted via a `winset()` call: + ```dm - winset(usr, "clonedwindow", "parent=none") -``` +winset(usr, "clonedwindow", "parent=none") + +``` -> [!TIP] -> **See also:** -> + [winexists proc](/ref/proc/winexists.md) -> + [winget proc](/ref/proc/winget.md) -> + [winset proc](/ref/proc/winset.md) -> + [winshow proc](/ref/proc/winshow.md) -> + [User interface skins](/ref/skin.md) \ No newline at end of file +*** +**Related Pages:** ++ [winexists proc](/ref/proc/winexists) ++ [winget proc](/ref/proc/winget) ++ [winset proc](/ref/proc/winset) ++ [winshow proc](/ref/proc/winshow) ++ [User interface skins](/ref/{skin}) diff --git a/ref/proc/winexists.md b/ref/proc/winexists.md index f54bf13b..1fb39f9d 100644 --- a/ref/proc/winexists.md +++ b/ref/proc/winexists.md @@ -1,29 +1,23 @@ -## winexists proc + +## winexists (proc) **Format:** + winexists(player, control_id) -**Args:** +**Arguments:** + player: A mob or client. -+ control_id: The unique ID of a control in the player\'s skin. - - -Tells if a control exists and if so, what type it is. The -return value is an empty string if the control does not exist, but -otherwise it is the type of control. - -This proc will not tell -you if a control has been defined in the skin file but is not in use -yet. ++ control_id: The unique ID of a control in the player's skin. +*** +Tells if a control exists and if so, what type it is. The return value is an empty string if the control does not exist, but otherwise it is the type of control. -Because the client must be contacted to get this -information, winexists() will sleep the current proc. +This proc will not tell you if a control has been defined in the skin file but is not in use yet. -> [!TIP] -> **See also:** -> + [winclone proc](/ref/proc/winclone.md) -> + [winget proc](/ref/proc/winget.md) -> + [winset proc](/ref/proc/winset.md) -> + [winshow proc](/ref/proc/winshow.md) -> + [User interface skins](/ref/skin.md) -> + [type parameter (skin)](/ref/skin/param/type.md) \ No newline at end of file +Because the client must be contacted to get this information, winexists() will sleep the current proc. +*** +**Related Pages:** ++ [winclone proc](/ref/proc/winclone) ++ [winget proc](/ref/proc/winget) ++ [winset proc](/ref/proc/winset) ++ [winshow proc](/ref/proc/winshow) ++ [User interface skins](/ref/{skin}) ++ [type parameter](/ref/{skin}/param/type) diff --git a/ref/proc/winget.md b/ref/proc/winget.md index 486bb1fd..631248b0 100644 --- a/ref/proc/winget.md +++ b/ref/proc/winget.md @@ -1,99 +1,58 @@ -## winget proc +## winget (proc) **Format:** + winget(player, control_id, params) -**Args:** +**Arguments:** + player: A mob or client. -+ control_id: The unique ID of a control in the player\'s skin. -+ params: The name of a parameter to read, or a semicolon-separated - list of parameters - - -Retrieves info from a player about the current state of their -skin. If `control_id` and `params` are each just a single value, then -the return value will be a simple string with the value of that -parameter. If `control_id` or `params` is a semicolon-separated list -like the kind used in `list2params()`, then the result will be in a -similar format, and can be converted to a list form using -`params2list()`. - -The `control_id` can be a window name, or in a -`"[window].[control]"` format, or just the control\'s ID itself as long -as it is unique. Another valid form is `":[type]"` which selects the -default control of that type, e.g. `":map"` for the main map. As -mentioned above, you can retrieve info on more than one control at once -by separating them with semicolons, like `"button1;button2"`. -### Example: ++ control_id: The unique ID of a control in the player's skin. ++ params: The name of a parameter to read, or a semicolon-separated list of parameters +*** +Retrieves info from a player about the current state of their skin. If `control_id` and `params` are each just a single value, then the return value will be a simple string with the value of that parameter. If `control_id` or `params` is a semicolon-separated list like the kind used in `list2params()`, then the result will be in a similar format, and can be converted to a list form using `params2list()`. + +The `control_id` can be a window name, or in a `"[window].[control]"` format, or just the control's ID itself as long as it is unique. Another valid form is `":[type]"` which selects the default control of that type, e.g. `":map"` for the main map. As mentioned above, you can retrieve info on more than one control at once by separating them with semicolons, like `"button1;button2"`. + ```dm - usr << "mainwindow.is-visible = [winget(usr, -"mainwindow", "is-visible")]" usr << "\\nOther params:" usr -<< winget(usr, "mainwindow", "pos;is-maximized") usr << -"\\nButtons:" usr << winget(usr, "button1;button2", -"is-checked") + +usr << "mainwindow.is-visible = [winget(usr, "mainwindow", "is-visible")]" +usr << "\nOther params:" +usr << winget(usr, "mainwindow", "pos;is-maximized") +usr << "\nButtons:" +usr << winget(usr, "button1;button2", "is-checked") + ``` - -This outputs: + +This outputs: + + ```dm -mainwindow.is-visible = true Other params: pos=0x0;is-maximized=true -Buttons: button1.is-checked=true;button2.is-checked=false +mainwindow.is-visible = true + +Other params: +pos=0x0;is-maximized=true + +Buttons: +button1.is-checked=true;button2.is-checked=false + ``` +If the returned result is actual text for any parameters, the single quote or double quote characters may be escaped with a backslash. An actual backslash will also be escaped with a backslash. + +You can also use a special wildcard format to retrieve info about all the controls in a window, menu, or macro set. If control_id is `"mainwindow.*"` for instance, then any control that is part of `mainwindow`—and `mainwindow` itself—is included in the result if it has the parameter(s) you're looking for. Use `params2list()` to interpret the result. + + +> [!TIP] +> Note: Because the client must be contacted to get this information, `winget()` will sleep the current proc. -If the returned result is actual text for any parameters, the -single quote or double quote characters may be escaped with a backslash. -An actual backslash will also be escaped with a backslash. - -You -can also use a special wildcard format to retrieve info about all the -controls in a window, menu, or macro set. If control_id is -`"mainwindow.*"` for instance, then any control that is part of -`mainwindow`---and `mainwindow` itself---is included in the result if it -has the parameter(s) you\'re looking for. Use `params2list()` to -interpret the result. -Note: Because the client must be contacted to get this information, -`winget()` will sleep the current proc. -### Special wingets - - -Calling `winget()` with a blank or null `control_id` can return -some values that belong to the client as a whole, not to specific -controls. They can also be used for [embedded -wingets](/ref/skin/commands.md) -focus -+ The full ID of the control, if any, that currently has keyboard - focus. -windows -+ The IDs of all windows, separated by semicolons. -panes -+ The IDs of all panes, separated by semicolons. -menus -+ The IDs of all menus, separated by semicolons. -macros -+ The IDs of all macro sets, separated by semicolons. -sound -+ True if sounds are enabled. -hwmode -+ True if the map displays in hardware rendering mode. -url -+ The URL the client is connected to in `IP:port` form. The port is 0 - if connected to a local .dmb file, and either an empty string or - null is returned if Dream Seeker is not connected at all. -num-lock -+ True if Num Lock is on. -caps-lock -+ True if Caps Lock is on. -scroll-lock -+ True if Scroll Lock is on. - -> [!TIP] -> **See also:** -> + [winexists proc](/ref/proc/winexists.md) -> + [winset proc](/ref/proc/winset.md) -> + [User interface skins](/ref/skin.md) -> + [parameters (skin)](/ref/skin/param.md) \ No newline at end of file +Calling `winget()` with a blank or null `control_id` can return some values that belong to the client as a whole, not to specific controls. They can also be used for embedded wingets. +*** +**Related Pages:** ++ [winexists proc](/ref/proc/winexists) ++ [winset proc](/ref/proc/winset) ++ [User interface skins](/ref/{skin}) ++ [parameters](/ref/{skin}/param) diff --git a/ref/proc/winset.md b/ref/proc/winset.md index 87799e1d..2e648eaa 100644 --- a/ref/proc/winset.md +++ b/ref/proc/winset.md @@ -1,134 +1,58 @@ -## winset proc +## winset (proc) **Format:** + winset(player, control_id, params) -**Args:** +**Arguments:** + player: A mob or client. -+ control_id: The unique ID of a control in the player\'s skin. -+ params: A text string with parameters to set, in the format returned - by `list2params()`; *OR* an associative list. - - -Sets parameters for a player\'s skin. The parameter list can be -created by making a list and using `list2params()`, or it can be done -manually by just using a string like -`"is-visible=true;text-color=#f00"`. You can also just use a list -directly, which will be passed to `list2params()` internally. - - -The `control_id` can be a window name, or in a -`"[window].[control]"` format, or just the control ID as long as it is -unique. In some special cases it can also be null. Another valid form is -`":[type]"` which selects the default control of that type, e.g. -`":map"` for the main map. - -If you want to use a text string -that may include spaces, surround the string with double quotes and -escape them using a backslash, e.g. `"text="This is some text.""`. -Backslashes can also be used by preceding them with another backslash. -For filenames, use single quotes around the file. Sometimes escapement -may need to go several levels deep; for example to set up an input -control with a default say command, you will need to escape it twice: -> Desired command: `say "`\ -> Escaped form with quotes: `"`**`say "`**`"`\ -> Final form: `"say \""` -> - -`winset(usr, "mainwindow.input", "command=`**`"say \""`**`")` - - -You can set more than one control\'s parameters at once by -leaving the `control_id` argument null, and including the control as -part of the parameter list: ++ control_id: The unique ID of a control in the player's skin. ++ params: A text string with parameters to set, in the format returned by + ; an associative list. +*** +Sets parameters for a player's skin. The parameter list can be created by making a list and using `list2params()`, or it can be done manually by just using a string like `"is-visible=true;text-color=#f00"`. You can also just use a list directly, which will be passed to `list2params()` internally. + +The `control_id` can be a window name, or in a `"[window].[control]"` format, or just the control ID as long as it is unique. In some special cases it can also be null. Another valid form is `":[type]"` which selects the default control of that type, e.g. `":map"` for the main map. + +If you want to use a text string that may include spaces, surround the string with double quotes and escape them using a backslash, e.g. `"text=\"This is some text.\""`. Backslashes can also be used by preceding them with another backslash. For filenames, use single quotes around the file. Sometimes escapement may need to go several levels deep; for example to set up an input control with a default say command, you will need to escape it twice: + +`winset(usr, "mainwindow.input", "command=**\"say \\\"\"**")` + +You can set more than one control's parameters at once by leaving the `control_id` argument null, and including the control as part of the parameter list: + + ```dm -winset(usr, null, "mainwindow.output.background-color=#ffffff; mainwindow.input.background-color=#ffffff") +winset(usr, null,\ + "mainwindow.output.background-color=#ffffff;mainwindow.input.background-color=#ffffff") ``` -### Special winsets +Some "global" winset options will let you change things that affect the client as a whole, not just specific controls. -Some "global" winset options will let you change things that -affect the client as a whole, not just specific controls. -#### reset -###### BYOND Version 496 +You can reset the skin to its beginning state, removing all runtime-created controls and windows, by calling `winset(player, null, "reset=true")`. +Another use for `winset()` is to send commands to the client that normally can only run from there, like `.profile` or `.quit`. To do this, leave the `control_id` argument null, and just use a parameter called "command": -You can reset the skin to its beginning state, removing all -runtime-created controls and windows, by calling -`winset(player, null, "reset=true")`. -#### command - -Another use for `winset()` is to send commands to the client -that normally can only run from there, like `.profile` or `.quit`. To do -this, leave the `control_id` argument null, and just use a parameter -called "command": ```dm obj/quitbutton name = "Quit" - icon = \'buttons.dmi\' + icon = 'buttons.dmi' icon_state = "quit" + Click() winset(usr, null, list("command"=".quit")) ``` - - -Because many characters -need to be specially encoded for winsets, it\'s best to either use the -list format of `winset()` which handles that encoding for you. If you -want to use the string form, like `winset(usr, null, "command=XYZ")`, -then you should use [url_encode()](/ref/proc/url_encode.md) to encode -your command. -#### browser-options {#browser-options byondver="516"} - - -The "browser-options" global parameter lets you enable or -disable certain browser functionality. This can be a comma-separated -list, or you can precede an option with `+` or `-` to enable or disable -it specifically. -Option -Default -Description -find -❌ -Ctrl+F can open the built-in Find dialog. -devtools -❌ -F12 can open a devtools window, which is useful for debugging scripts. -refresh -❌ -Ctrl+R or F5 can refresh the page. -zoom -❌ -Ctrl with the + or - keys can zoom the browser, and Ctrl+0 can reset it. -byondstorage -❌ -Enables [byondStorage](/ref/skin/control/browser/byondStorage.md) -access. -### Example: -```dm -mob/Login() - ..() - winset(usr, null, "browser-options=devtools,find") -``` - - -If you plan to use -the `+` or `-` modifiers, you should either use the list format of -`winset()` or use [url_encode()](/ref/proc/url_encode.md) to encode the -list of options. - -Browser options are shared across all browser -controls. - -> [!TIP] -> **See also:** -> + [winclone proc](/ref/proc/winclone.md) -> + [winexists proc](/ref/proc/winexists.md) -> + [winget proc](/ref/proc/winget.md) -> + [winshow proc](/ref/proc/winshow.md) -> + [User interface skins](/ref/skin.md) -> + [parameters (skin)](/ref/skin/param.md) + +Because many characters need to be specially encoded for winsets, it's best to either use the list format of `winset()` which handles that encoding for you. If you want to use the string form, like `winset(usr, null, "command=XYZ")`, then you should use url_encode() to encode your command. + +The "browser-options" global parameter lets you enable or disable certain browser functionality. This can be a comma-separated list, or you can precede an option with `+` or `-` to enable or disable it specifically. +*** +**Related Pages:** ++ [winclone proc](/ref/proc/winclone) ++ [winexists proc](/ref/proc/winexists) ++ [winget proc](/ref/proc/winget) ++ [winshow proc](/ref/proc/winshow) ++ [User interface skins](/ref/{skin}) ++ [parameters](/ref/{skin}/param) diff --git a/ref/proc/winshow.md b/ref/proc/winshow.md index 9b4f1b63..3e6b75d1 100644 --- a/ref/proc/winshow.md +++ b/ref/proc/winshow.md @@ -1,21 +1,19 @@ -## winshow proc + +## winshow (proc) **Format:** + winshow(player, window, show=1) -**Args:** +**Arguments:** + player: A mob or client. -+ window: The name of a window in the player\'s skin. ++ window: The name of a window in the player's skin. + show: Use a nonzero value to show the window, zero to hide it. - - -Shows or hides a window in the player\'s skin. This is a -shortcut, equivalent to setting `is-visible` via `winset()`. - -> [!TIP] -> **See also:** -> + [winclone proc](/ref/proc/winclone.md) -> + [winget proc](/ref/proc/winget.md) -> + [winset proc](/ref/proc/winset.md) -> + [User interface skins](/ref/skin.md) -> + [is-visible parameter (skin)](/ref/skin/param/is-visible.md) \ No newline at end of file +*** +Shows or hides a window in the player's skin. This is a shortcut, equivalent to setting `is-visible` via `winset()`. +*** +**Related Pages:** ++ [winclone proc](/ref/proc/winclone) ++ [winget proc](/ref/proc/winget) ++ [winset proc](/ref/proc/winset) ++ [User interface skins](/ref/{skin}) ++ [is-visible parameter](/ref/{skin}/param/is-visible) diff --git a/ref/regex/index.md b/ref/regex/index.md new file mode 100644 index 00000000..4796a3ca --- /dev/null +++ b/ref/regex/index.md @@ -0,0 +1,16 @@ + +## regex (info) +*** +The /regex datum holds a regular expression that can be used for searching and/or replacing text. Rather than searching for a specific piece of text, a regular expression is a *pattern* to search for. This can include things like wildcards. See Regular expressions for more information. + +A new regular expression can be created with regex() or new/regex(). +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex procs](/ref/regex/proc) ++ [regex vars](/ref/regex/var) ++ [regex proc](/ref/proc/regex) ++ [REGEX_QUOTE proc](/ref/proc/REGEX_QUOTE) ++ [findtext proc](/ref/proc/findtext) ++ [splittext proc](/ref/proc/splittext) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) diff --git a/ref/regex/proc.md b/ref/regex/proc.md deleted file mode 100644 index 3df4b386..00000000 --- a/ref/regex/proc.md +++ /dev/null @@ -1,14 +0,0 @@ -## regex procs -###### BYOND Version 510 - - -regex/proc -+ [New](/ref/proc/regex.md) -+ [Find](/ref/regex/proc/Find.md) -+ [Replace](/ref/regex/proc/Replace.md) - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [regex vars](/ref/regex/var.md) -> + [regex proc](/ref/proc/regex.md) \ No newline at end of file diff --git a/ref/regex/proc/Find.md b/ref/regex/proc/Find.md index f53afcfc..748b2b50 100644 --- a/ref/regex/proc/Find.md +++ b/ref/regex/proc/Find.md @@ -1,48 +1,27 @@ -## Find proc (regex) -###### BYOND Version 510 + +## Find (proc) **Format:** + Find(haystack, Start=1, End=0) -**Returns:** -+ The position of the matched text, or 0 if no match was found. - -**Args:** +**Arguments:** + haystack: The text to be searched -+ Start: The start position (in bytes) to search; defaults to 1, or to - src.next if this is a global pattern -+ End: The position of the byte after the end of the search; 0 is the - end. The actual match is allowed to extend past End. - - -Finds the regular expression pattern within the "haystack" -text. The following vars are set by the match: -- text: The text that was searched. -- index: The index where the match was found (same as the return - value) -- match: The actual matched text -- group: If the expression contains capturing groups with the ( ) - parentheses operator, this is a list that holds the text found in - those groups. group[1] is the first group, and so on. -- next: If the "g" flag was used to create thie expression, this is - the next index to begin searching. ++ Start: The start position (in bytes) to search; defaults to 1, or to src.next if this is a global pattern ++ End: The position of the byte after the end of the search; 0 is the end. The actual match is allowed to extend past End. - -In a global expression (using the "g" flag), Find() can be -called repeatedly on the same piece of text and the Start position will -be advanced automatically unless you specify it. - -Note: In -strings containing non-ASCII characters, byte position and character -position are not the same thing. Use `Find_char()` to work with -character counts instead of bytes, at a performance cost. See the -[Unicode](@/notes/Unicode) section for more information. - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex datum](/ref/regex.md) -> + [Replace proc (regex)](/ref/regex/proc/Replace.md) -> + [regex vars](/ref/regex/var.md) -> + [regex proc](/ref/proc/regex.md) -> + [findtext proc](/ref/proc/findtext.md) \ No newline at end of file +**Returns:** ++ The position of the matched text, or 0 if no match was found. +*** +Finds the regular expression pattern within the "haystack" text. The following vars are set by the match: + +In a global expression (using the "g" flag), Find() can be called repeatedly on the same piece of text and the Start position will be advanced automatically unless you specify it. + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `Find_char()` to work with character counts instead of bytes, at a performance cost. See the Unicode section for more information. +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex datum](/ref/regex) ++ [Replace proc (regex)](/ref/regex/proc/Replace) ++ [regex vars](/ref/regex/var) ++ [regex proc](/ref/proc/regex) ++ [findtext proc](/ref/proc/findtext) diff --git a/ref/regex/proc/New.md b/ref/regex/proc/New.md index 920ee81b..1c551715 100644 --- a/ref/regex/proc/New.md +++ b/ref/regex/proc/New.md @@ -1,22 +1,18 @@ -## New proc (regex) -###### BYOND Version 510 + +## New (proc) **Format:** + regex(pattern, flags) + regex(Regex) -**Args:** +**Arguments:** + pattern: The pattern string to search for -+ flags: (optional) A text string containing any combination of - modifier flags ++ flags: (optional) A text string containing any combination of modifier flags + Regex: an existing /regex datum to copy - - -Calling new/regex() is the same as calling regex(). It will -create a new /regex datum. - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex datum](/ref/regex.md) -> + [regex proc](/ref/proc/regex.md) \ No newline at end of file +*** +Calling new/regex() is the same as calling regex(). It will create a new /regex datum. +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex datum](/ref/regex) ++ [regex proc](/ref/proc/regex) diff --git a/ref/regex/proc/Replace.md b/ref/regex/proc/Replace.md index 814a0254..18888acf 100644 --- a/ref/regex/proc/Replace.md +++ b/ref/regex/proc/Replace.md @@ -1,78 +1,30 @@ -## Replace proc (regex) -###### BYOND Version 510 +## Replace (proc) **Format:** + Replace(haystack, replacement, Start=1, End=0) -**Returns:** -+ The original haystack string with the first match replaced. If using - the "g" flag, all matches are replaced. - -**Args:** +**Arguments:** + haystack: The text to be searched -+ replacement: A piece of text, OR a proc, that will be used to - replace the match -+ Start: The start position (in bytes) to search; defaults to 1, or to - src.next if this is a global pattern -+ End: The position of the byte after the end of the search; 0 is the - end. The actual match is allowed to extend past End. - - -Finds the regular expression pattern within the "haystack" -text, and replaces the match with the given replacement value. - - -In a non-global expression (not using the "g" flag), the -values of src.index and src.next are set as they would be in a global -Find(). See the Find() proc for more info. - -Note: In strings -containing non-ASCII characters, byte position and character position -are not the same thing. Use `Replace_char()` to work with character -counts instead of bytes. See the [Unicode](/ref/notes/Unicode.md) section for more information. -### Replacing with text ++ replacement: A piece of text, OR a proc, that will be used to replace the match ++ Start: The start position (in bytes) to search; defaults to 1, or to src.next if this is a global pattern ++ End: The position of the byte after the end of the search; 0 is the end. The actual match is allowed to extend past End. - -If the replacement value is text, the \$ character is treated -as special. If you want to use the actual dollar sign, it must be -escaped with a second dollar sign. Otherwise, the \$ character is one of -these special values: - Replacement Value - ------------------- ----------------------------------------------------------------------------------------- - \$1 *through* \$9 `$1`tt> is whatever was in the first parentheses group, `$2` is the second, and so on. - \$\` The text that came before the match - \$\' The text that came after the match - \$0 *or* \$& The whole match itself -### Replacing with a proc - - -If replacing matches with a proc, then the proc will be called -with the match as its first argument, and any capturing groups as the -following arguments. Whatever the proc returns will be used as the -replacement text in place of the match. -### Example - -```dm - var/regex/vowels = new("[aeiou]", "i") // match any -word of 2 letters or more var/regex/piglatin = -new("\\\\b(\\\\l)(\\\\l+)\\\\b", "ig") // group1 is the first -letter, and group2 is everything else proc/word2piglatin(match, group1, -group2) // If the word starts with a vowel, just add "ay" -if(vowels.Find(group1)) return "[match]ay" // If the word was -capitalized, capitalize the replacement if(group1 == uppertext(group1)) -group1 = lowertext(group1) group2 = uppertext(copytext(group2,1,2)) + -lowertext(copytext(group2,2)) return "[group2][group1]ay" -mob/verb/PigSay(msg as text) msg = html_encode(msg) world << -piglatin.Replace(msg, /proc/word2piglatin) -``` - - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [regex vars](/ref/regex/var.md) -> + [regex proc](/ref/proc/regex.md) -> + [replacetext proc](/ref/proc/replacetext.md) \ No newline at end of file +**Returns:** ++ The original haystack string with the first match replaced. If using the "g" flag, all matches are replaced. +*** +Finds the regular expression pattern within the "haystack" text, and replaces the match with the given replacement value. + +In a non-global expression (not using the "g" flag), the values of src.index and src.next are set as they would be in a global Find(). See the Find() proc for more info. + +Note: In strings containing non-ASCII characters, byte position and character position are not the same thing. Use `Replace_char()` to work with character counts instead of bytes. See the Unicode section for more information. + +If the replacement value is text, the $ character is treated as special. If you want to use the actual dollar sign, it must be escaped with a second dollar sign. Otherwise, the $ character is one of these special values: +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [regex vars](/ref/regex/var) ++ [regex proc](/ref/proc/regex) ++ [replacetext proc](/ref/proc/replacetext) diff --git a/ref/regex/proc/index.md b/ref/regex/proc/index.md new file mode 100644 index 00000000..029012ce --- /dev/null +++ b/ref/regex/proc/index.md @@ -0,0 +1,7 @@ + +## proc (proc) +****** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [regex vars](/ref/regex/var) ++ [regex proc](/ref/proc/regex) diff --git a/ref/regex/regex.md b/ref/regex/regex.md deleted file mode 100644 index b4f5d4d5..00000000 --- a/ref/regex/regex.md +++ /dev/null @@ -1,24 +0,0 @@ -## regex datum -###### BYOND Version 510 - - - -The /regex datum holds a regular expression that can be used -for searching and/or replacing text. Rather than searching for a -specific piece of text, a regular expression is a *pattern* to search -for. This can include things like wildcards. See [Regular -expressions](/ref/notes/regex.md) for more information. - -A new -regular expression can be created with regex() or new/regex(). - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex procs](/ref/regex/proc.md) -> + [regex vars](/ref/regex/var.md) -> + [regex proc](/ref/proc/regex.md) -> + [REGEX_QUOTE proc](/ref/proc/REGEX_QUOTE.md) -> + [findtext proc](/ref/proc/findtext.md) -> + [splittext proc](/ref/proc/splittext.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) \ No newline at end of file diff --git a/ref/regex/var.md b/ref/regex/var.md deleted file mode 100644 index 96f380e3..00000000 --- a/ref/regex/var.md +++ /dev/null @@ -1,18 +0,0 @@ -## regex vars -###### BYOND Version 510 - - -regex/var -+ [flags](/ref/regex/var/flags.md) -+ [group](/ref/regex/var/group.md) -+ [index](/ref/regex/var/index.md) -+ [match](/ref/regex/var/match.md) -+ [name](/ref/regex/var/name.md) -+ [next](/ref/regex/var/next.md) -+ [text](/ref/regex/var/text.md) - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [regex procs](/ref/regex/proc.md) -> + [regex proc](/ref/proc/regex.md) \ No newline at end of file diff --git a/ref/regex/var/flags.md b/ref/regex/var/flags.md index 23eb929d..5699979f 100644 --- a/ref/regex/var/flags.md +++ b/ref/regex/var/flags.md @@ -1,13 +1,9 @@ -## flags var (regex) -###### BYOND Version 510 - -The flags that were used to create this regular expression. -Changing this value after the datum is created will not change how the -expression behaves. - -> [!TIP] -> **See also:** -> + [Regular expressions](/ref/notes/regex.md) -> + [regex datum](/ref/regex.md) -> + [name var (regex)](/ref/regex/var/name.md) \ No newline at end of file +## flags (var) +*** +The flags that were used to create this regular expression. Changing this value after the datum is created will not change how the expression behaves. +*** +**Related Pages:** ++ [Regular expressions](/ref/{notes}/regex) ++ [regex datum](/ref/regex) ++ [name var (regex)](/ref/regex/var/name) diff --git a/ref/regex/var/group.md b/ref/regex/var/group.md index 42911c19..b05f8a03 100644 --- a/ref/regex/var/group.md +++ b/ref/regex/var/group.md @@ -1,22 +1,19 @@ -## group var (regex) -###### BYOND Version 510 +## group (var) +*** +After a call to Find(), if this regular expression had any parentheses groups, whatever text was matched in those groups is stored here in a list. -After a call to Find(), if this regular expression had any -parentheses groups, whatever text was matched in those groups is stored -here in a list. -### Example ```dm - var/regex/R = new("B(.)(.)(.)D") R.Find("BYOND") // -find this pattern in "BYOND" + +var/regex/R = new("B(.)(.)(.)D") +R.Find("BYOND") // find this pattern in "BYOND" + ``` - The result of the example is -that R.group is list("Y","O","N"). -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [index var (regex)](/ref/regex/var/index.md) -> + [match var (regex)](/ref/regex/var/match.md) \ No newline at end of file +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [index var (regex)](/ref/regex/var/index) ++ [match var (regex)](/ref/regex/var/match) diff --git a/ref/regex/var/index.md b/ref/regex/var/index.md index 4d35f271..e9a9e176 100644 --- a/ref/regex/var/index.md +++ b/ref/regex/var/index.md @@ -1,17 +1,13 @@ -## index var (regex) -###### BYOND Version 510 - -After a call to Find(), this var contains the index where the -match was found. - -Replace() on a non-global pattern will also -store the index of the match here. - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [Replace proc (regex)](/ref/regex/proc/Replace.md) -> + [match var (regex)](/ref/regex/var/match.md) -> + [next var (regex)](/ref/regex/var/next.md) \ No newline at end of file +## index (var) +*** +After a call to Find(), this var contains the index where the match was found. + +Replace() on a non-global pattern will also store the index of the match here. +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [Replace proc (regex)](/ref/regex/proc/Replace) ++ [match var (regex)](/ref/regex/var/match) ++ [next var (regex)](/ref/regex/var/next) diff --git a/ref/regex/var/match.md b/ref/regex/var/match.md index 9d5f42d3..3d04b6b8 100644 --- a/ref/regex/var/match.md +++ b/ref/regex/var/match.md @@ -1,13 +1,10 @@ -## match var (regex) -###### BYOND Version 510 - -After a call to Find(), this var contains the text that was -matched. - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [group var (regex)](/ref/regex/var/group.md) -> + [index var (regex)](/ref/regex/var/index.md) \ No newline at end of file +## match (var) +*** +After a call to Find(), this var contains the text that was matched. +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [group var (regex)](/ref/regex/var/group) ++ [index var (regex)](/ref/regex/var/index) diff --git a/ref/regex/var/name.md b/ref/regex/var/name.md index 2a3eaac2..ee8a02bd 100644 --- a/ref/regex/var/name.md +++ b/ref/regex/var/name.md @@ -1,12 +1,8 @@ -## name var (regex) -###### BYOND Version 510 - -The pattern that was used to create this regular expression. -Changing this value after the datum is created will not change how the -expression behaves. - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [flags var (regex)](/ref/regex/var/flags.md) \ No newline at end of file +## name (var) +*** +The pattern that was used to create this regular expression. Changing this value after the datum is created will not change how the expression behaves. +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [flags var (regex)](/ref/regex/var/flags) diff --git a/ref/regex/var/next.md b/ref/regex/var/next.md index 8f377f7f..818b85bf 100644 --- a/ref/regex/var/next.md +++ b/ref/regex/var/next.md @@ -1,19 +1,13 @@ -## next var (regex) -###### BYOND Version 510 - -If this is a global pattern (using the "g" flag), then after -a call to Find() this var contains the index where next Find() should -begin. - -Replace() on a non-global pattern will also store the -index of the next place to begin a search here. The position to search -will be based on the replaced text, which is stored in the text var. - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [Replace proc (regex)](/ref/regex/proc/Replace.md) -> + [index var (regex)](/ref/regex/var/index.md) -> + [match var (regex)](/ref/regex/var/match.md) \ No newline at end of file +## next (var) +*** +If this is a global pattern (using the "g" flag), then after a call to Find() this var contains the index where next Find() should begin. + +Replace() on a non-global pattern will also store the index of the next place to begin a search here. The position to search will be based on the replaced text, which is stored in the text var. +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [Replace proc (regex)](/ref/regex/proc/Replace) ++ [index var (regex)](/ref/regex/var/index) ++ [match var (regex)](/ref/regex/var/match) diff --git a/ref/regex/var/text.md b/ref/regex/var/text.md index bddd1f81..04089eb0 100644 --- a/ref/regex/var/text.md +++ b/ref/regex/var/text.md @@ -1,19 +1,13 @@ -## text var (regex) -###### BYOND Version 510 - -If this is a global pattern (using the "g" flag), then after -a call to Find() this var contains the text that was searched. If that -same text is searched again, the next var is the default starting -position. - -Replace() on a non-global pattern will store the text -*after* replacement here. - -> [!TIP] -> **See also:** -> + [regex datum](/ref/regex.md) -> + [Find proc (regex)](/ref/regex/proc/Find.md) -> + [index var (regex)](/ref/regex/var/index.md) -> + [match var (regex)](/ref/regex/var/match.md) -> + [next var (regex)](/ref/regex/var/next.md) \ No newline at end of file +## text (var) +*** +If this is a global pattern (using the "g" flag), then after a call to Find() this var contains the text that was searched. If that same text is searched again, the next var is the default starting position. + +Replace() on a non-global pattern will store the text *after* replacement here. +*** +**Related Pages:** ++ [regex datum](/ref/regex) ++ [Find proc (regex)](/ref/regex/proc/Find) ++ [index var (regex)](/ref/regex/var/index) ++ [match var (regex)](/ref/regex/var/match) ++ [next var (regex)](/ref/regex/var/next) diff --git a/ref/savefile/index.md b/ref/savefile/index.md new file mode 100644 index 00000000..20ddb1a4 --- /dev/null +++ b/ref/savefile/index.md @@ -0,0 +1,26 @@ + +## savefile (info) +*** +Savefiles are easy to use, but you should always plan what you're going to save and what you don't want to save. Use `/tmp` to avoid saving anything you don't need, and you can avoid a lot of trouble. + +In particular you should be careful that if you're saving a player's mob, you don't accidentally save any other mobs. If you save a turf, you should avoid saving its contents unless you know there are no mobs standing on it (but usually it's better to save x,y,z coordinates than the turf itself). This is explained further in the tmp vars entry. + +Currently, overlays and underlays also save by combining each list into a single icon that saves its full icon data in the file. This may not be desired, so you can remove that data. Usually you'll want to rebuild any overlay/underlay lists during Read(). + +A database file in DM is called a "savefile". All of the contents of a savefile reside in a single file. The contents of the file are stored in database directories. These should not be confused with real directories in the external file system. The database directories are all contained inside the one file. + +Each database directory contains a list of sub-directories and a buffer in which data may be written. The absolute path to a directory has the following format: "/Dir1/Dir2/...". The current directory may be set by assigning its absolute path name to savefile.cd. A relative path (one that doesn't begin with "/") may also be used, in which case the new path starts at the current directory. The path "." stands for the current directory, ".." for its parent, "../.." for its parent's parent, etc. + +A savefile may be created with new/savefile(name). The optional name argument may be an external file name (existing or to be created) in double quotes or a file from the resource cache in single quotes. Of course, a variable containing either of these types of values may also be used. If no name is specified, a temporary file will be created, which will be destroyed when the savefile is no longer in use. If a resource cache is specified, a temporary file will be created and the contents of the cached file will be copied into it. Changes will therefore only be temporary. +*** +**Related Pages:** ++ [>> operator (savefile)](/ref/savefile/operator/%3e%3e) ++ [<< operator (savefile)](/ref/savefile/operator/%3c%3c) ++ [Export proc (client)](/ref/client/proc/Export) ++ [New proc (client)](/ref/client/proc/New) ++ [procs (savefile)](/ref/savefile/proc) ++ [vars (savefile)](/ref/savefile/var) ++ [tmp vars](/ref/var/tmp) ++ [issaved proc](/ref/proc/issaved) ++ [Read](/ref/datum/proc/Read) ++ [Write](/ref/datum/proc/Write) diff --git a/ref/savefile/operator.md b/ref/savefile/operator.md deleted file mode 100644 index 86b42838..00000000 --- a/ref/savefile/operator.md +++ /dev/null @@ -1,7 +0,0 @@ -## operators (savefile) - - -Built-in savefile operators: -savefile/operator -+ [<<](/ref/savefile/operator/%3c%3c.md) -+ [>>](/ref/savefile/operator/%3e%3e.md) \ No newline at end of file diff --git a/ref/savefile/operator/LEFTLEFT.md b/ref/savefile/operator/LEFTLEFT.md index c8546316..ac8fb5c1 100644 --- a/ref/savefile/operator/LEFTLEFT.md +++ b/ref/savefile/operator/LEFTLEFT.md @@ -1,37 +1,17 @@ -## << operator (savefile) + +## %3c%3c (info) **Format:** + F << Val + F["Path"] << Val +*** +Writes Val to a buffer. If Path is not specified, the current buffer will be used. Otherwise, the buffer at the specified path will be written to. Whenever the current directory is set, writing starts at the beginning of that buffer (replacing any previous contents). For this reason, when the Path parameter is given, the specified buffer is always overwritten. +If Val is an object, a separate directory will be created for the object and the object's Write proc will be called. In addition to data that may be written by the Write() proc, the type of the object is stored in a buffer called "type". In the case of turfs, the location of the turf is also recorded so that it can be recreated at the same position. All other objects must be repositioned after the object is recreated (like in the object's Read() proc). -Writes Val to a buffer. If Path is not specified, the current -buffer will be used. Otherwise, the buffer at the specified path will be -written to. Whenever the current directory is set, writing starts at the -beginning of that buffer (replacing any previous contents). For this -reason, when the Path parameter is given, the specified buffer is always -overwritten. - -If Val is an object, a separate directory will be -created for the object and the object\'s Write proc will be called. In -addition to data that may be written by the Write() proc, the type of -the object is stored in a buffer called "type". In the case of turfs, -the location of the turf is also recorded so that it can be recreated at -the same position. All other objects must be repositioned after the -object is recreated (like in the object\'s Read() proc). - -Single -operations that write multiple values (such as saving an object) are -handled somewhat specially to avoid two references to the same object -creating duplicate entries in the savefile. After the object being -referenced is written once, successive references to the same object -will be saved simply as references rather than as full objects. If this -was not done, two references to the same object would be read back in as -two separate objects. This also avoids infinite loops that would result -when objects contain references back to themselves. - -> [!TIP] -> **See also:** -> + [>> operator (savefile)](/ref/savefile/operator/%3e%3e.md) -> + [<< output operator](/ref/operator/%3c%3c/output.md) -> + [Write proc (datum)](/ref/datum/proc/Write.md) \ No newline at end of file +Single operations that write multiple values (such as saving an object) are handled somewhat specially to avoid two references to the same object creating duplicate entries in the savefile. After the object being referenced is written once, successive references to the same object will be saved simply as references rather than as full objects. If this was not done, two references to the same object would be read back in as two separate objects. This also avoids infinite loops that would result when objects contain references back to themselves. +*** +**Related Pages:** ++ [>> operator (savefile)](/ref/savefile/operator/%3e%3e) ++ [<< output operator](/ref/operator/%3c%3c/output) ++ [Write](/ref/datum/proc/Write) diff --git a/ref/savefile/operator/RIGHTRIGHT.md b/ref/savefile/operator/RIGHTRIGHT.md index 67c0e341..5c2f8f73 100644 --- a/ref/savefile/operator/RIGHTRIGHT.md +++ b/ref/savefile/operator/RIGHTRIGHT.md @@ -1,39 +1,31 @@ -## >> operator (savefile) + +## %3e%3e (info) **Format:** + F >> Var + F["Path"] >> Var +*** +Reads a value from a buffer into a variable. If Path is not specified, the current buffer will be used. Otherwise, the buffer at the specified path will be accessed. Whenever the current directory is set, reading starts at the beginning of that buffer (replacing any previous contents). For this reason, when the Path parameter is given, the first value in the specified buffer is always read. If there is no data in the buffer or the end of the buffer has been reached, null is returned. +If the value read is a previously written object, its own directory will be opened and the object's Read proc will be called to load any data that was written in the object's Write proc. -Reads a value from a buffer into a variable. If Path is not -specified, the current buffer will be used. Otherwise, the buffer at the -specified path will be accessed. Whenever the current directory is set, -reading starts at the beginning of that buffer (replacing any previous -contents). For this reason, when the Path parameter is given, the first -value in the specified buffer is always read. If there is no data in the -buffer or the end of the buffer has been reached, null is returned. - +If the value read is a savefile (ie a savefile inside of a savefile), it is treated a little differently. Instead of returning a savefile object, it returns data cached in the world's rsc file. This is to give you control over what file this data is copied into before it is opened as a savefile. If you want to just open it up in a temporary file, do something like this: -If the value read is a previously written object, its own -directory will be opened and the object\'s Read proc will be called to -load any data that was written in the object\'s Write proc. -If -the value read is a savefile (ie a savefile inside of a savefile), it is -treated a little differently. Instead of returning a savefile object, it -returns data cached in the world\'s rsc file. This is to give you -control over what file this data is copied into before it is opened as a -savefile. If you want to just open it up in a temporary file, do -something like this: ```dm - obj var savefile/myfile Read() . = -..() //do the normal stuff if(myfile) //load data into a temporary file -and create savefile object myfile = new/savefile(myfile) -``` +obj + var + savefile/myfile + Read() + . = ..() //do the normal stuff + if(myfile) //load data into a temporary file and create savefile object + myfile = new/savefile(myfile) + +``` -> [!TIP] -> **See also:** -> + [>> input operator](/ref/operator/%3e%3e/input.md) -> + [<< operator (savefile)](/ref/savefile/operator/%3c%3c.md) -> + [Read proc (datum)](/ref/datum/proc/Read.md) \ No newline at end of file +*** +**Related Pages:** ++ [>> input operator](/ref/operator/%3e%3e/input) ++ [<< operator (savefile)](/ref/savefile/operator/%3c%3c) ++ [Read](/ref/datum/proc/Read) diff --git a/ref/savefile/operator/index.md b/ref/savefile/operator/index.md new file mode 100644 index 00000000..3ca37e31 --- /dev/null +++ b/ref/savefile/operator/index.md @@ -0,0 +1,5 @@ + +## operator (info) +*** +Built-in savefile operators: +*** \ No newline at end of file diff --git a/ref/savefile/proc.md b/ref/savefile/proc.md deleted file mode 100644 index e763c7fe..00000000 --- a/ref/savefile/proc.md +++ /dev/null @@ -1,8 +0,0 @@ -## procs (savefile) -savefile/proc -+ [ExportText](/ref/savefile/proc/ExportText.md) -+ [Flush](/ref/savefile/proc/Flush.md) -+ [ImportText](/ref/savefile/proc/ImportText.md) -+ [Lock](/ref/savefile/proc/Lock.md) -+ [Unlock](/ref/savefile/proc/Unlock.md) -+ [New](/ref/savefile/proc/New.md) \ No newline at end of file diff --git a/ref/savefile/proc/ExportText.md b/ref/savefile/proc/ExportText.md index 223c6ef8..9cef725b 100644 --- a/ref/savefile/proc/ExportText.md +++ b/ref/savefile/proc/ExportText.md @@ -1,37 +1,41 @@ -## ExportText proc (savefile) +## ExportText (proc) **Format:** + savefile.ExportText(path=cd,file) -**Args:** +**Arguments:** + path: the path to export + file: optional file to write to +*** +Converts all or part of a savefile to a human readable text format, similar in syntax to DM. If no file is specified, the savefile text is returned as a text string instead of being written to a file. +The following example shows how to export and later import a savefile. The user's mob is written into a directory with the same name as their ckey and the result is written to a text file. -Converts all or part of a savefile to a human readable text -format, similar in syntax to DM. If no file is specified, the savefile -text is returned as a text string instead of being written to a file. +```dm -The following example shows how to export and later import a -savefile. The user\'s mob is written into a directory with the same name -as their [ckey](/ref/mob/var/ckey.md) and the result is written to a text -file. -### Example: +mob/verb/write() + var/savefile/F = new() + var/txtfile = file("players/[ckey].txt") -```dm - mob/verb/write() var/savefile/F = new() var/txtfile = -file("players/[ckey].txt") F[ckey] << usr fdel(txtfile) -F.ExportText("/",txtfile) usr << "Your savefile looks like this:" -usr << " - [html_encode(file2text(txtfile))] -" mob/verb/read() var/savefile/F = new() var/txtfile = -file("players/[ckey].txt") F.ImportText("/",txtfile) F[ckey] ->> usr -``` + F[ckey] << usr + + fdel(txtfile) + F.ExportText("/",txtfile) + usr << "Your savefile looks like this:" + usr << "[html_encode(file2text(txtfile))]" + +mob/verb/read() + var/savefile/F = new() + var/txtfile = file("players/[ckey].txt") + + F.ImportText("/",txtfile) + F[ckey] >> usr + +``` -> [!TIP] -> **See also:** -> + [ImportText proc (savefile)](/ref/savefile/proc/ImportText.md) \ No newline at end of file +*** +**Related Pages:** ++ [ImportText proc (savefile)](/ref/savefile/proc/ImportText) diff --git a/ref/savefile/proc/Flush.md b/ref/savefile/proc/Flush.md index fb8e32c6..ef803f55 100644 --- a/ref/savefile/proc/Flush.md +++ b/ref/savefile/proc/Flush.md @@ -1,7 +1,8 @@ -# Flush proc (savefile) -###### BYOND Version 510 -**Format:** -+ savefile.Flush() +## Flush (proc) -Flushes any pending write operations for this savefile. \ No newline at end of file +**Format:** ++ savefile.Flush() +*** +Flushes any pending write operations for this savefile. +*** \ No newline at end of file diff --git a/ref/savefile/proc/ImportText.md b/ref/savefile/proc/ImportText.md index ad1ebc39..c8f53dd0 100644 --- a/ref/savefile/proc/ImportText.md +++ b/ref/savefile/proc/ImportText.md @@ -1,22 +1,16 @@ -## ImportText proc (savefile) +## ImportText (proc) **Format:** + savefile.ImportText(path=cd,source) -**Args:** +**Arguments:** + path: the path at which to write the imported data + source: a file or text string to import +*** +Reads a text file or string and writes it into a savefile. See ExportText for an example. - -Reads a text file or string and writes it into a savefile. See -[ExportText](/ref/savefile/proc/ExportText.md) for an example. - -If -`source` is an ordinary string, it will be treated as savefile contents -to be parsed. If it\'s a `file()` reference, it will be treated as a -filename and the file\'s contents will be loaded. - -> [!TIP] -> **See also:** -> + [ExportText proc (savefile)](/ref/savefile/proc/ExportText.md) \ No newline at end of file +If `source` is an ordinary string, it will be treated as savefile contents to be parsed. If it's a `file()` reference, it will be treated as a filename and the file's contents will be loaded. +*** +**Related Pages:** ++ [ExportText proc (savefile)](/ref/savefile/proc/ExportText) diff --git a/ref/savefile/proc/Lock.md b/ref/savefile/proc/Lock.md index 87178c4e..cb7a00c8 100644 --- a/ref/savefile/proc/Lock.md +++ b/ref/savefile/proc/Lock.md @@ -1,43 +1,25 @@ -## Lock proc (savefile) + +## Lock (proc) **Format:** + Lock(timeout) -**Args:** +**Arguments:** + timeout: seconds to wait; -1 for no timeout **Returns:** + 1 on success; 0 on failure +*** +In order to modify a savefile, exclusive access to the file must be guaranteed, so that other processes reading or writing to the file do not experience data corruption. This is known as "locking" the file. While the file is locked, only the world that obtained the lock may access it. +Normally, you do not need to worry about this, because a lock is automatically obtained upon the first attempt to write to the file. In a CGI application, where many instances of the program might be running simultaneously, the normal locking, which just tries once and crashes the proc on failure, would not be ideal. -In order to modify a savefile, exclusive access to the file -must be guaranteed, so that other processes reading or writing to the -file do not experience data corruption. This is known as "locking" the -file. While the file is locked, only the world that obtained the lock -may access it. - -Normally, you do not need to worry about this, -because a lock is automatically obtained upon the first attempt to write -to the file. In a CGI application, where many instances of the program -might be running simultaneously, the normal locking, which just tries -once and crashes the proc on failure, would not be ideal. - - -Explicitly calling Lock() allows you to specify a timeout and -it also allows you to handle the case in which no lock could be -obtained. If you want it to wait indefinitely, use -1. Just be careful -if there are several files read by multiple processes that it is not -possible for deadlock to occur. - -Obtaining a lock will fail if -the file is locked by another world or if it is even open by any other -world. +Explicitly calling Lock() allows you to specify a timeout and it also allows you to handle the case in which no lock could be obtained. If you want it to wait indefinitely, use -1. Just be careful if there are several files read by multiple processes that it is not possible for deadlock to occur. -If you are using Lock(), then you probably also want to -specify a timeout when you open the savefile, since that too can fail -due to the file being locked by another process. +Obtaining a lock will fail if the file is locked by another world or if it is even open by any other world. -> [!TIP] -> **See also:** -> + [New proc (savefile)](/ref/savefile/proc/New.md) -> + [Unlock proc (savefile)](/ref/savefile/proc/Unlock.md) \ No newline at end of file +If you are using Lock(), then you probably also want to specify a timeout when you open the savefile, since that too can fail due to the file being locked by another process. +*** +**Related Pages:** ++ [New proc (savefile)](/ref/savefile/proc/New) ++ [Unlock proc (savefile)](/ref/savefile/proc/Unlock) diff --git a/ref/savefile/proc/New.md b/ref/savefile/proc/New.md index fd2b9bd0..d3e0805b 100644 --- a/ref/savefile/proc/New.md +++ b/ref/savefile/proc/New.md @@ -1,26 +1,17 @@ -## New proc (savefile) + +## New (proc) **Format:** + New(filename,timeout) -**Args:** +**Arguments:** + filename: name of file or empty for temporary file + timeout: seconds to wait; -1 for no timeout +*** +You call this via new/savefile(filename,timeout). The timeout is used to determine how long to wait if the file is locked. Normally (timeout=0), if the file is locked, the proc crashes with a runtime error. If you specify a timeout, then it will keep trying to open the file and if this fails, it will simply return with savefile.name being empty (ie a false value). - -You call this via new/savefile(filename,timeout). The timeout -is used to determine how long to wait if the file is locked. Normally -(timeout=0), if the file is locked, the proc crashes with a runtime -error. If you specify a timeout, then it will keep trying to open the -file and if this fails, it will simply return with savefile.name being -empty (ie a false value). - -If the first argument is an entry in -the world\'s rsc cache, the data will be copied into a temporary file -and accessed from there. Changes to this, and any other temporary file, -are not saved. When you close the file, it simply gets deleted. - -> [!TIP] -> **See also:** -> + [Lock proc (savefile)](/ref/savefile/proc/Lock.md) -> + [Unlock proc (savefile)](/ref/savefile/proc/Unlock.md) \ No newline at end of file +If the first argument is an entry in the world's rsc cache, the data will be copied into a temporary file and accessed from there. Changes to this, and any other temporary file, are not saved. When you close the file, it simply gets deleted. +*** +**Related Pages:** ++ [Lock proc (savefile)](/ref/savefile/proc/Lock) ++ [Unlock proc (savefile)](/ref/savefile/proc/Unlock) diff --git a/ref/savefile/proc/Unlock.md b/ref/savefile/proc/Unlock.md index f7c173e7..c56058c8 100644 --- a/ref/savefile/proc/Unlock.md +++ b/ref/savefile/proc/Unlock.md @@ -1,19 +1,13 @@ -## Unlock proc (savefile) + +## Unlock (proc) **Format:** + Unlock() - - -Exclusive locks are automatically released when the savefile is -closed, but if you want to keep reading the file and allow other -processes to do the same, then you can explicitly unlock it. - - -Note that this does not allow other processes to lock the file. -It only allows them to read from it. As long as the file is open by more -than one process, no lock may be obtained. - -> [!TIP] -> **See also:** -> + [Lock proc (savefile)](/ref/savefile/proc/Lock.md) -> + [New proc (savefile)](/ref/savefile/proc/New.md) \ No newline at end of file +*** +Exclusive locks are automatically released when the savefile is closed, but if you want to keep reading the file and allow other processes to do the same, then you can explicitly unlock it. + +Note that this does not allow other processes to lock the file. It only allows them to read from it. As long as the file is open by more than one process, no lock may be obtained. +*** +**Related Pages:** ++ [Lock proc (savefile)](/ref/savefile/proc/Lock) ++ [New proc (savefile)](/ref/savefile/proc/New) diff --git a/ref/savefile/proc/index.md b/ref/savefile/proc/index.md new file mode 100644 index 00000000..0f0159fe --- /dev/null +++ b/ref/savefile/proc/index.md @@ -0,0 +1,3 @@ + +## proc (proc) +****** \ No newline at end of file diff --git a/ref/savefile/savefile.md b/ref/savefile/savefile.md deleted file mode 100644 index 1d9ee82b..00000000 --- a/ref/savefile/savefile.md +++ /dev/null @@ -1,63 +0,0 @@ -## savefile - -::: {.sidebar .note} - - -Savefiles are easy to use, but you should always plan what -you\'re going to save and what you don\'t want to save. Use `/tmp` to -avoid saving anything you don\'t need, and you can avoid a lot of -trouble. - -In particular you should be careful that if you\'re -saving a player\'s mob, you don\'t accidentally save any other mobs. If -you save a turf, you should avoid saving its contents unless you know -there are no mobs standing on it (but usually it\'s better to save x,y,z -coordinates than the turf itself). This is explained further in the [tmp -vars](/ref/var/tmp.md) entry. - -Currently, overlays and underlays also -save by combining each list into a single icon that saves its full icon -data in the file. This may not be desired, so you can remove that data. -Usually you\'ll want to rebuild any overlay/underlay lists during -[Read()](/ref/datum/proc/Read.md). -::: - - -A database file in DM is called a "savefile". All of the -contents of a savefile reside in a single file. The contents of the file -are stored in database directories. These should not be confused with -real directories in the external file system. The database directories -are all contained inside the one file. - -Each database directory -contains a list of sub-directories and a buffer in which data may be -written. The absolute path to a directory has the following format: -"/Dir1/Dir2/...". The current directory may be set by assigning its -absolute path name to `savefile.cd`. A relative path (one that doesn\'t -begin with "/") may also be used, in which case the new path starts at -the current directory. The path "." stands for the current directory, -".." for its parent, "../.." for its parent\'s parent, etc. - - -A savefile may be created with `new/savefile(name)`. The -optional name argument may be an external file name (existing or to be -created) in double quotes or a file from the resource cache in single -quotes. Of course, a variable containing either of these types of values -may also be used. If no name is specified, a temporary file will be -created, which will be destroyed when the savefile is no longer in use. -If a resource cache is specified, a temporary file will be created and -the contents of the cached file will be copied into it. Changes will -therefore only be temporary. - -> [!TIP] -> **See also:** -> + [>> operator (savefile)](/ref/savefile/operator/%3e%3e.md) -> + [<< operator (savefile)](/ref/savefile/operator/%3c%3c.md) -> + [Export proc (client)](/ref/client/proc/Export.md) -> + [New proc (client)](/ref/client/proc/New.md) -> + [procs (savefile)](/ref/savefile/proc.md) -> + [vars (savefile)](/ref/savefile/var.md) -> + [tmp vars](/ref/var/tmp.md) -> + [issaved proc](/ref/proc/issaved.md) -> + [Read proc (datum)](/ref/datum/proc/Read.md) -> + [Write proc (datum)](/ref/datum/proc/Write.md) \ No newline at end of file diff --git a/ref/savefile/var.md b/ref/savefile/var.md deleted file mode 100644 index c6845331..00000000 --- a/ref/savefile/var.md +++ /dev/null @@ -1,11 +0,0 @@ -## vars (savefile) - - -savefile vars: -savefile/var -+ [byond_build](/ref/savefile/var/byond_build.md) -+ [byond_version](/ref/savefile/var/byond_version.md) -+ [cd](/ref/savefile/var/cd.md) -+ [dir](/ref/savefile/var/dir.md) -+ [eof](/ref/savefile/var/eof.md) -+ [name](/ref/savefile/var/name.md) \ No newline at end of file diff --git a/ref/savefile/var/byond_build.md b/ref/savefile/var/byond_build.md index 33b2fc4a..0eea8319 100644 --- a/ref/savefile/var/byond_build.md +++ b/ref/savefile/var/byond_build.md @@ -1,36 +1,25 @@ -## byond_build var (savefile) -###### BYOND Version 515 -**Default value:** -+ 0 +## byond_build (var) +**Default Value:** ++ 0 +*** +Sometimes when transitioning between BYOND versions you'll want to keep a savefile in a condition where it can be read by older versions. The `byond_version` var tells it to avoid using newer savefile features (unless forced to) above a certain build number. (The build number changes more often than the BYOND version number.) A value of 0 means not to worry about it. -Sometimes when transitioning between BYOND versions you\'ll -want to keep a savefile in a condition where it can be read by older -versions. The `byond_version` var tells it to avoid using newer savefile -features (unless forced to) above a certain build number. (The build -number changes more often than the BYOND version number.) A value of 0 -means not to worry about it. +This can be changed on a per-savefile basis so that you can use newer features in some files and avoid changing others. For instance, character saves might want to go on using older features for a while, but for saving parts of the map you might prefer to allow newer features to be used. -This can be changed on a -per-savefile basis so that you can use newer features in some files and -avoid changing others. For instance, character saves might want to go on -using older features for a while, but for saving parts of the map you -might prefer to allow newer features to be used. +The default savefile compatibility version can be set at compile-time: -The default -savefile compatibility version can be set at compile-time: -### Example: ```dm - savefile/byond_build = 1600 // do not use savefile -features from BYOND build 1601 onward -``` +savefile/byond_build = 1600 // do not use savefile features from BYOND build 1601 onward + +``` -> [!TIP] -> **See also:** -> + [savefile](/ref/savefile.md) -> + [byond_version var (savefile)](/ref/savefile/var/byond_version.md) -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [byond_build var (world)](/ref/world/var/byond_build.md) \ No newline at end of file +*** +**Related Pages:** ++ [savefile](/ref/savefile) ++ [byond_version var (savefile)](/ref/savefile/var/byond_version) ++ [byond_version var (world)](/ref/world/var/byond_version) ++ [byond_build var (world)](/ref/world/var/byond_build) diff --git a/ref/savefile/var/byond_version.md b/ref/savefile/var/byond_version.md index a735ba69..0c88e3a9 100644 --- a/ref/savefile/var/byond_version.md +++ b/ref/savefile/var/byond_version.md @@ -1,38 +1,27 @@ -## byond_version var (savefile) -###### BYOND Version 515 -**Default value:** -+ 0 +## byond_version (var) +**Default Value:** ++ 0 +*** +Sometimes when transitioning between BYOND versions you'll want to keep a savefile in a condition where it can be read by older versions. The `byond_version` var tells it to avoid using newer savefile features (unless forced to) above a certain version number. A value of 0 means not to worry about it. -Sometimes when transitioning between BYOND versions you\'ll -want to keep a savefile in a condition where it can be read by older -versions. The `byond_version` var tells it to avoid using newer savefile -features (unless forced to) above a certain version number. A value of 0 -means not to worry about it. +This can be changed on a per-savefile basis so that you can use newer features in some files and avoid changing others. For instance, character saves might want to go on using older features for a while, but for saving parts of the map you might prefer to allow newer features to be used. -This can be changed on a -per-savefile basis so that you can use newer features in some files and -avoid changing others. For instance, character saves might want to go on -using older features for a while, but for saving parts of the map you -might prefer to allow newer features to be used. +The default savefile compatibility version can be set at compile-time: -The default -savefile compatibility version can be set at compile-time: -### Example: ```dm - savefile/byond_version = 514 // do not use savefile -features from BYOND 515 onward + +savefile/byond_version = 514 // do not use savefile features from BYOND 515 onward + ``` - -Note: By default, -worlds compiled before BYOND 515 will set this value to 514. -> [!TIP] -> **See also:** -> + [savefile](/ref/savefile.md) -> + [byond_build var (savefile)](/ref/savefile/var/byond_build.md) -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [byond_build var (world)](/ref/world/var/byond_build.md) \ No newline at end of file +Note: By default, worlds compiled before BYOND 515 will set this value to 514. +*** +**Related Pages:** ++ [savefile](/ref/savefile) ++ [byond_build var (savefile)](/ref/savefile/var/byond_build) ++ [byond_version var (world)](/ref/world/var/byond_version) ++ [byond_build var (world)](/ref/world/var/byond_build) diff --git a/ref/savefile/var/cd.md b/ref/savefile/var/cd.md index 169d349c..a7a7bc66 100644 --- a/ref/savefile/var/cd.md +++ b/ref/savefile/var/cd.md @@ -1,21 +1,19 @@ -## cd var (savefile) +## cd (var) +*** +This is the path name of the current directory. Setting it causes the current directory to change. (We are talking about the current database directory inside the savefile. It is not a real directory on the filesystem.) It is perfectly legal to change to a non-existent directory. This new directory will not be saved to disk unless its buffer (or one of its children) is modified, however. -This is the path name of the current directory. Setting it -causes the current directory to change. (We are talking about the -current *database* directory inside the savefile. It is not a real -directory on the filesystem.) It is perfectly legal to change to a -non-existent directory. This new directory will not be saved to disk -unless its buffer (or one of its children) is modified, however. -### Example: ```dm - var/savefile/F = new() // temporary file F.cd = -"/MyDir/Icon" F.cd = ".." // change to /MyDir F.cd = "Icon" // -change to /MyDir/Icon -``` +var/savefile/F = new() // temporary file + +F.cd = "/MyDir/Icon" +F.cd = ".." // change to /MyDir +F.cd = "Icon" // change to /MyDir/Icon + +``` -> [!TIP] -> **See also:** -> + [savefile](/ref/savefile.md) \ No newline at end of file +*** +**Related Pages:** ++ [savefile](/ref/savefile) diff --git a/ref/savefile/var/dir.md b/ref/savefile/var/dir.md index 2f51fb57..1f66981f 100644 --- a/ref/savefile/var/dir.md +++ b/ref/savefile/var/dir.md @@ -1,18 +1,10 @@ -## dir list var (savefile) +## dir (var) +*** +The name of each child directory of the current data directory is stored in the list savefile.dir. New directories may be created with savefile.dir.Add() and removed with savefile.dir.Remove(). To test for the existence of a directory, use savefile.dir.Find(). (Note that these are database directories inside the savefile—not real directories on the filesystem.) -The name of each child directory of the current data directory -is stored in the list savefile.dir. New directories may be created with -savefile.dir.Add() and removed with savefile.dir.Remove(). To test for -the existence of a directory, use savefile.dir.Find(). (Note that these -are *database* directories inside the savefile---not real directories on -the filesystem.) - -The order of directories is not necessarily -preserved, so do not assume, for example, that newer directories will be -at the end of the list. - -> [!TIP] -> **See also:** -> + [list](/ref/list.md) -> + [savefile](/ref/savefile.md) \ No newline at end of file +The order of directories is not necessarily preserved, so do not assume, for example, that newer directories will be at the end of the list. +*** +**Related Pages:** ++ [list](/ref/list) ++ [savefile](/ref/savefile) diff --git a/ref/savefile/var/eof.md b/ref/savefile/var/eof.md index 890acaac..bdd0dc29 100644 --- a/ref/savefile/var/eof.md +++ b/ref/savefile/var/eof.md @@ -1,6 +1,5 @@ -# eof var (savefile) - -If there is more data to read in the current buffer, eof is 0; -otherwise it is 1. Setting eof to 1 moves to the end of the buffer and 0 -moves to the beginning. Setting it to -1 deletes the current buffer. \ No newline at end of file +## eof (var) +*** +If there is more data to read in the current buffer, eof is 0; otherwise it is 1. Setting eof to 1 moves to the end of the buffer and 0 moves to the beginning. Setting it to -1 deletes the current buffer. +*** \ No newline at end of file diff --git a/ref/savefile/var/index.md b/ref/savefile/var/index.md new file mode 100644 index 00000000..3427498c --- /dev/null +++ b/ref/savefile/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +savefile vars: +*** \ No newline at end of file diff --git a/ref/savefile/var/name.md b/ref/savefile/var/name.md index 285d4b21..3907243e 100644 --- a/ref/savefile/var/name.md +++ b/ref/savefile/var/name.md @@ -1,18 +1,22 @@ -## name var (savefile) +## name (var) +*** +The external "real" filename is stored in file.name. It is initialized when creating a new file. If none is specified, a temporary file with a random name will be created. -The external "real" filename is stored in file.name. It is -initialized when creating a new file. If none is specified, a temporary -file with a random name will be created. -### Example: ```dm - var/savefile/F1 var/savefile/F2 F1 = new() // create a -temp file F2 = new("myfile") // open "myfile" world << "F1.name = -[F1]" world << "F2.name = [F2]" -``` +var/savefile/F1 +var/savefile/F2 + +F1 = new() // create a temp file +F2 = new("myfile") // open "myfile" + +world << "F1.name = [F1]" +world << "F2.name = [F2]" + +``` -> [!TIP] -> **See also:** -> + [savefile](/ref/savefile.md) \ No newline at end of file +*** +**Related Pages:** ++ [savefile](/ref/savefile) diff --git a/ref/skin/.output.md b/ref/skin/.output.md deleted file mode 100644 index 3b8237a4..00000000 --- a/ref/skin/.output.md +++ /dev/null @@ -1,22 +0,0 @@ -## .output (client command) -###### BYOND Version 514 - - -**Format:** -+ .output *control* *text* - - -Sends output to a control. The text does not need quotes, but -any backslashes, newlines, and tabs should be escaped with a backslash. -This works similarly to the [`output()` proc](/ref/proc/output.md) . If text is -omitted, the control is cleared. - -Here is an example of using a -map control\'s [on-status](/ref/skin/params/on-status.md) event -to set a label rather than using the window\'s own statusbar. - .output statuslabel [[* as escaped]] - -> [!TIP] -> **See also:** -> + [output proc](/ref/proc/output.md) -> + [client commands](/ref/skin/commands.md) \ No newline at end of file diff --git a/ref/skin/.sound.md b/ref/skin/.sound.md deleted file mode 100644 index ef384f94..00000000 --- a/ref/skin/.sound.md +++ /dev/null @@ -1,50 +0,0 @@ -## .sound (client command) -###### BYOND Version 516 - - -**Format:** -+ .sound *file* *options* -+ .sound none *options* - - -Plays, stops, or modifies a sound. This command can be used for -instance to play a click sound when using mouse macros, for instance, -without waiting for the server to initiate the sound which would -introduce a small delay. - .sound 'click.ogg' - - -The file can be `none` or `-` when updating or stopping a -sound. Any options should be separated by spaces; most are in a -`name=value` format, as seen below. - -Supported options are: -update -+ This action is updating a channel rather than playing a new sound. - It corresponds to the [SOUND_UPDATE](/ref/sound/var/status.md) - status flag. -channel=*N* -+ Specifies a channel. -volume=*N* -+ Sets the volume. -mute\ -mute=*T* -+ Mutes the sound; the `update` option is implied. -pause\ -pause=*T* -+ Pauses the sound; the `update` option is implied. -wait -+ The new sound will queue up in the specified channel, and play after - the current sound is done. -repeat\ -repeat=*T*\ -repeat=once/infinite/rewind -+ Specifies whether, and how, the sound repeats. -**T* represents a true/false value. True values include `true`, `on`, -or 1. False would be `false`, `off`, or 0. - -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [sound datum](/ref/sound.md) -> + [client commands](/ref/skin/commands.md) \ No newline at end of file diff --git a/ref/skin/.winset.md b/ref/skin/.winset.md deleted file mode 100644 index 42f41f6d..00000000 --- a/ref/skin/.winset.md +++ /dev/null @@ -1,43 +0,0 @@ -## .winset (client command) - - -**Format:** -+ .winset "*[control.param=value;...]*" - - -Sets skin parameters like the [`winset()` proc](/ref/proc/winset.md) -You can set more than one parameter by separating them with semicolons. - - -This command also allows you to use conditional expressions, -like so: - condition ? choice1 : choice2 - - -The condition is the same as any other parameter you might use -in `.winset`, but instead of setting the parameter, it checks to see if -it\'s true. If so, then the parameters in `choice1` will be set. -Otherwise, the parameters in `choice2` are set. This example makes the -window background red if bigbutton is checked. - .winset "bigbutton.is-checked=true ? window.background-color=#ff0000 : window.background-color=none" - - -If you want to look for values that don\'t match instead of -values that do, use `!=` instead of `=` in the condition. - .winset "bigbutton.is-checked!=false ? window.background-color=#f00 : window.background-color=none" - - -The `choice2` item is optional. - .winset "bigbutton.is-checked=true ? window.background-color=#f00" - - -Because it\'s often useful to do more than one thing at a time, -`choice1` and `choice2` don\'t have to be just one parameter. You can -use multiple parameters, but they are separated with a space instead of -a semicolon. (A semicolon indicates the conditional expression is over.) - .winset "bigbutton.is-checked=true ? window.text-color=#fff window.background-color=#f00 : window.text-color=none window.background-color=none" - -> [!TIP] -> **See also:** -> + [winset proc](/ref/proc/winset.md) -> + [client commands](/ref/skin/commands.md) \ No newline at end of file diff --git a/ref/skin/align.md b/ref/skin/align.md deleted file mode 100644 index 09320ca8..00000000 --- a/ref/skin/align.md +++ /dev/null @@ -1,29 +0,0 @@ -## align parameter (skin) - - -**Applies to:** -+ [Label](/ref/skin/control/label.md) -**Possible values:** -+ center -+ left -+ right -+ top -+ bottom -+ top-left -+ top-right -+ bottom-left -+ bottom-right - -**Default value:** -+ center - - -Default alignment of text/image, both horizontal and vertical. - - -A BYOND direction flag like `WEST` may be assigned to this -parameter, or 0 for center alignment. - -> [!TIP] -> **See also:** -> + [allow-html parameter](/ref/skin/param/allow-html.md) \ No newline at end of file diff --git a/ref/skin/allow-html.md b/ref/skin/allow-html.md deleted file mode 100644 index d77e823f..00000000 --- a/ref/skin/allow-html.md +++ /dev/null @@ -1,19 +0,0 @@ -## allow-html parameter (skin) -**Applies to:** -+ [Label](/ref/skin/control/label.md) -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -Info control: Allow HTML tags to be used in -[stat()](/ref/proc/stat.md) info. The same limitations apply as to the -[Grid control](/ref/skin/control/grid.md) - -Label control: -Currently, the label control will not actually use the HTML; it will -simply strip it out. Full support may appear in a later version. \ No newline at end of file diff --git a/ref/skin/alpha.md b/ref/skin/alpha.md deleted file mode 100644 index 2a0753a6..00000000 --- a/ref/skin/alpha.md +++ /dev/null @@ -1,18 +0,0 @@ -## alpha parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ number - -**Default value:** -+ 255 - - -Opacity of the window, from 0 (invisible) to 255 (opaque). - -> [!TIP] -> **See also:** -> + [transparent-color parameter](/ref/skin/param/transparent-color.md) \ No newline at end of file diff --git a/ref/skin/anchor.md b/ref/skin/anchor.md deleted file mode 100644 index 00bd63eb..00000000 --- a/ref/skin/anchor.md +++ /dev/null @@ -1,33 +0,0 @@ -## anchor1, anchor2 parameters (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) (except - [Main](/ref/skin/control/main.md) - -**Format:** -+ none -+ *x*,*y* - -**Default value:** -+ none - - -Anchors the control within the window or pane. If the anchor is -not `none`, it is expressed as pecentages of the container\'s width and -height. For example, an anchor of 100,100 means that the X and Y -position are tied to the lower right of the container, and 50,0 is tied -to the top center. - -Setting only `anchor1` will control the -position of the control but won\'t affect its size. - -Setting -`anchor2` as well will allow you to stretch the control as the -container\'s size changes. You can think of this `anchor1` controlling -the top left corner, and `anchor2` the bottom right corner. - -> [!TIP] -> **See also:** -> + [pos parameter](/ref/skin/param/pos.md) -> + [size parameter](/ref/skin/param/size.md) \ No newline at end of file diff --git a/ref/skin/angle.md b/ref/skin/angle.md deleted file mode 100644 index 7ae90e56..00000000 --- a/ref/skin/angle.md +++ /dev/null @@ -1,24 +0,0 @@ -## angle1, angle2 parameters (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) - -**Format:** -+ number - -**Default value:** -+ `angle1`: 0 -+ `angle2`: 180 - - -The angle of the bar control\'s arc when its -[dir](/ref/skin/param/dir.md) is `clockwise` or -`counterclockwise`. Angles are measured clockwise from due north, so 0 -is north, 90 is east, and so on. `angle1` is the beginning of the arc, -and `angle2` is the end. - -> [!TIP] -> **See also:** -> + [dir parameter](/ref/skin/param/dir.md) -> + [width parameter](/ref/skin/param/width.md) \ No newline at end of file diff --git a/ref/skin/auto-format.md b/ref/skin/auto-format.md deleted file mode 100644 index 36da92ee..00000000 --- a/ref/skin/auto-format.md +++ /dev/null @@ -1,11 +0,0 @@ -## auto-format parameter (skin) -###### BYOND Version ormat parameter (skin) {#auto-format-parameter-skin deprecated="508 -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -**Format:** -+ true/false - -**Default value:** -+ false (was once true in old versions) -This parameter only existed to inject compatibility scripts into very -old versions of the embedded browser. It is no longer used. \ No newline at end of file diff --git a/ref/skin/background-color.md b/ref/skin/background-color.md deleted file mode 100644 index 4c2b56ca..00000000 --- a/ref/skin/background-color.md +++ /dev/null @@ -1,18 +0,0 @@ -## background-color parameter (skin) - - parameter](/ref/skin/param/tab-background-color.md) - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - - -The control\'s background color. The exact way this applies -depends on the control. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [tab-background-color \ No newline at end of file diff --git a/ref/skin/bar-color.md b/ref/skin/bar-color.md deleted file mode 100644 index da13a534..00000000 --- a/ref/skin/bar-color.md +++ /dev/null @@ -1,16 +0,0 @@ -## bar-color parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - - -The color of the bar or slider. - -> [!TIP] -> **See also:** -> + [background-color parameter](/ref/skin/param/background-color.md) -> + [is-transparent parameter](/ref/skin/param/is-transparent.md) \ No newline at end of file diff --git a/ref/skin/bar.md b/ref/skin/bar.md deleted file mode 100644 index 4f6c2f58..00000000 --- a/ref/skin/bar.md +++ /dev/null @@ -1,14 +0,0 @@ -## bar control (skin) - - -A progress bar or interactive slider. This can be made to use -several different orientations. Its `value` can be read or set as a -percentage from 0 to 100. -**Bar-specific parameters:** -+ [angle1, angle2](/ref/skin/param/angle.md) -+ [bar-color](/ref/skin/param/bar-color.md) -+ [dir](/ref/skin/param/dir.md) -+ [is-slider](/ref/skin/param/is-slider.md) -+ [on-change](/ref/skin/param/bar-color.md) -+ [value](/ref/skin/param/value.md) -+ [width](/ref/skin/param/width.md) \ No newline at end of file diff --git a/ref/skin/border.md b/ref/skin/border.md deleted file mode 100644 index ff0b16f3..00000000 --- a/ref/skin/border.md +++ /dev/null @@ -1,14 +0,0 @@ -## border parameter (skin) -**Applies to:** -+ [All](/ref/skin/control.md) -**Possible values:** -+ none -+ line -+ sunken - -**Default value:** -+ none - - -Border type around the control or window. May not work the same -in all controls. \ No newline at end of file diff --git a/ref/skin/browser.md b/ref/skin/browser.md deleted file mode 100644 index 7b200b91..00000000 --- a/ref/skin/browser.md +++ /dev/null @@ -1,58 +0,0 @@ -## browser control (skin) - - -A browser panel integrated into the skin. -**Browser-specific parameters:** -+ [auto-format](/ref/skin/param/auto-format.md) -+ [on-hide](/ref/skin/param/on-hide.md) -+ [on-show](/ref/skin/param/on-show.md) -+ [show-history](/ref/skin/param/show-history.md) -+ [show-url](/ref/skin/param/show-url.md) -+ [use-title](/ref/skin/param/use-title.md) - - -Browsers are capable of displaying HTML documents, and can also -interact with the skin. -### Browsers and popups - - -A longstanding behavior of BYOND is the ability to create a new -browser window by sending an extra argument to the -[browse()](/ref/proc/browse.md) proc. Since the advent of skins in -BYOND 4.0, this behavior was kept. When you create a new browser popup, -the window name you specify for the popup is used for the name of a new -[window control](/ref/skin/control/main.md) , and within that window -there will be a new browser control simply called `browser`. - -If -you want to interact with the new browser, its full "decorated" -[id](/ref/skin/param/id.md) is *`windowname`*`.browser`. -### Running JavaScript from DM - - -Sending [output()](/ref/proc/output.md) to a browser will send -a document to display there, but if you follow the browser\'s control -name with a colon and a function name, you can call a JavaScript -function in the document displayed within that browser. -### Example: - -```dm - var/list/info = list("name"="fridge", "power"=12) // -send {"name":"fridge","power":12} to a JavaScript function usr -<< output(url_encode(json_encode(info)), "mybrowser:myJSfunction") - -``` - - -The text that you send as output will be parsed like -URL parameters, where mutliple arguments to the function are separated -by `&` or `;`, which is why [url_encode()](/ref/proc/url_encode.md) is -wrapped around the [json_encode()](/ref/proc/json_encode.md) call in -this example. -### More browser options - - -These topics cover more advanced uses of the browser control. -[winset and winget (JavaScript)](/ref/skin/control/browser/winset.md) -+ Interact with the skin via JavaScript -[byondStorage (browser control)](/ref/skin/control/browser/byondStorage.md) : Provides persistent storage options for small data \ No newline at end of file diff --git a/ref/skin/button-type.md b/ref/skin/button-type.md deleted file mode 100644 index 77420f02..00000000 --- a/ref/skin/button-type.md +++ /dev/null @@ -1,22 +0,0 @@ -## button-type parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -**Possible values:** -+ pushbutton: press once -+ pushbox: press to toggle -+ checkbox: press to toggle, and displays a checkmark if checked -+ radio: press to check, and other buttons with the same `group` will - be unchecked - -**Default value:** -+ pushbutton - - -Changes the type of button. - -> [!TIP] -> **See also:** -> + [group parameter](/ref/skin/param/group.md) -> + [is-checked parameter](/ref/skin/param/is-checked.md) \ No newline at end of file diff --git a/ref/skin/button.md b/ref/skin/button.md deleted file mode 100644 index b966b1fb..00000000 --- a/ref/skin/button.md +++ /dev/null @@ -1,13 +0,0 @@ -## button control (skin) - - -A button that can be pressed to run a -[command](/ref/skin/commands.md) , or possibly toggled. -**Button-specific parameters:** -+ [button-type](/ref/skin/param/button-type.md) -+ [command](/ref/skin/param/command.md) -+ [group](/ref/skin/param/group.md) -+ [image](/ref/skin/param/image.md) -+ [is-checked](/ref/skin/param/is-checked.md) -+ [is-flat](/ref/skin/param/is-flat.md) -+ [text](/ref/skin/param/text.md) \ No newline at end of file diff --git a/ref/skin/byondStorage.md b/ref/skin/byondStorage.md deleted file mode 100644 index cda40692..00000000 --- a/ref/skin/byondStorage.md +++ /dev/null @@ -1,30 +0,0 @@ -## byondStorage (browser control) - - - -A replacement for `localStorage` that can be used to hold -information that can be used in later sessions of the same game. (This -must be enabled via `browser-options` with the [`winset()` -proc](/ref/proc/winset.md) .) - -There are three actual storage objects -you can use: - --------------- ---------------------------------------------------------------------------------------------------- - hubStorage Stores info that can be shared for all games falling under this same [hub entry](/ref/world/var/hub.md) - serverStorage Stores info that can be shared for all games using this same server address. - domainStorage Same as serverStorage, but ignores the connection port. - --------------- ---------------------------------------------------------------------------------------------------- - - -Interacting with these storage objects is done in JavaScript, -the same way you would use `localStorage` or `sessionStorage`. - - -Note: Technically `localStorage` does work, but because of the -way BYOND handles browser controls it acts more like `sessionStorage` in -practice. - -> [!TIP] -> **See also:** -> + [browser control (skin)](/ref/skin/control/browser.md) -> + [winset proc](/ref/proc/winset.md) \ No newline at end of file diff --git a/ref/skin/can-check.md b/ref/skin/can-check.md deleted file mode 100644 index 88235e2d..00000000 --- a/ref/skin/can-check.md +++ /dev/null @@ -1,19 +0,0 @@ -## can-check parameter (skin) - - -**Applies to:** -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -If true, this menu item is toggled like a checkbox or radio -button when clicked. - -> [!TIP] -> **See also:** -> + [group parameter](/ref/skin/param/group.md) -> + [is-checked parameter](/ref/skin/param/is-checked.md) \ No newline at end of file diff --git a/ref/skin/can-close.md b/ref/skin/can-close.md deleted file mode 100644 index aa7f7ac8..00000000 --- a/ref/skin/can-close.md +++ /dev/null @@ -1,21 +0,0 @@ -## can-close parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ true - - -Allow the window to be closed, and also shows a system menu for -the window. - -> [!TIP] -> **See also:** -> + [on-close parameter](/ref/skin/param/on-close.md) -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) \ No newline at end of file diff --git a/ref/skin/can-minimize.md b/ref/skin/can-minimize.md deleted file mode 100644 index 80b52766..00000000 --- a/ref/skin/can-minimize.md +++ /dev/null @@ -1,19 +0,0 @@ -## can-minimize parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ true - - -Allow the window to be minimized. - -> [!TIP] -> **See also:** -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) \ No newline at end of file diff --git a/ref/skin/can-resize.md b/ref/skin/can-resize.md deleted file mode 100644 index e366a7d7..00000000 --- a/ref/skin/can-resize.md +++ /dev/null @@ -1,26 +0,0 @@ -## can-resize parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ true - - -Allow the window to be resized or maximized. - -If -`is-fullscreen` is true, `can-resize` is ignored, so this value -represents the state of the window when `is-fullscreen` is turned off -again. - -> [!TIP] -> **See also:** -> + [on-size parameter](/ref/skin/param/on-size.md) -> + [can-minimize parameter](/ref/skin/param/can-minimize.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) -> + [is-fullscreen parameter](/ref/skin/param/is-fullscreen.md) \ No newline at end of file diff --git a/ref/skin/can-scroll.md b/ref/skin/can-scroll.md deleted file mode 100644 index f9d8fe04..00000000 --- a/ref/skin/can-scroll.md +++ /dev/null @@ -1,24 +0,0 @@ -## can-scroll parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (pane only) - -**Possible values:** -+ none -+ horizontal -+ vertical -+ both - -**Default value:** -+ none - - -Allow this pane to retain its horizontal and/or vertical size -and show scrollbars if necessary, instead of shrinking to fit the -container. - -> [!TIP] -> **See also:** -> + [on-size parameter](/ref/skin/param/on-size.md) -> + [size parameter](/ref/skin/param/size.md) \ No newline at end of file diff --git a/ref/skin/cell-span.md b/ref/skin/cell-span.md deleted file mode 100644 index be6bd901..00000000 --- a/ref/skin/cell-span.md +++ /dev/null @@ -1,19 +0,0 @@ -## cell-span parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -**Format:** -+ *columns*,*rows* - -**Default value:** -+ 1x1 - - -The span of the current grid cell; it can be merged with cells -to the right and down. If `is-list` is true, this setting is ignored. -This setting is only available at runtime. - -> [!TIP] -> **See also:** -> + [cells parameter](/ref/skin/param/cells.md) \ No newline at end of file diff --git a/ref/skin/cells.md b/ref/skin/cells.md deleted file mode 100644 index 527831b4..00000000 --- a/ref/skin/cells.md +++ /dev/null @@ -1,26 +0,0 @@ -## cells parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) - -**Format:** -+ *columns*,*rows* -+ *items* - -**Default value:** -+ 0x0 - - -The number of columns and rows in the grid. Using -1 for either -columns or rows will leave that value unchanged. - -If -[is-list](/ref/skin/param/is-list.md) is true, this value can be -set to a single number. - -> [!TIP] -> **See also:** -> + [cell-span parameter](/ref/skin/param/cell-span.md) -> + [current-cell parameter](/ref/skin/param/current-cell.md) -> + [is-list parameter](/ref/skin/param/is-list.md) \ No newline at end of file diff --git a/ref/skin/child.md b/ref/skin/child.md deleted file mode 100644 index bae857d3..00000000 --- a/ref/skin/child.md +++ /dev/null @@ -1,14 +0,0 @@ -## child control (skin) - - -A container that can hold one or two -[panes](/ref/skin/control/main.md) . If it holds two panes, a splitter -may appear between them. This control can therefore be used to subdivide -a window or pane into smaller units. -**Child-specific parameters:** -+ [is-vert](/ref/skin/param/is-vert.md) -+ [left, top](/ref/skin/param/left.md) -+ [lock](/ref/skin/param/lock.md) -+ [right, bottom](/ref/skin/param/right.md) -+ [show-splitter](/ref/skin/param/show-splitter.md) -+ [splitter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/command.md b/ref/skin/command.md deleted file mode 100644 index e54e1837..00000000 --- a/ref/skin/command.md +++ /dev/null @@ -1,24 +0,0 @@ -## command parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -+ [Input](/ref/skin/control/input.md) -+ [Macro](/ref/skin/control/macro.md) -+ [Menu](/ref/skin/control/menu.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when this control is -activated. - -For the Input control, whatever the user types in -follows this command. If your command starts with an exclamation point -`!`, everything after the `!` is shown as a default prompt that may be -cleared by the user. - -> [!TIP] -> **See also:** -> + [client commands](/ref/skin/commands.md) \ No newline at end of file diff --git a/ref/skin/commands.md b/ref/skin/commands.md deleted file mode 100644 index 2e4d29e5..00000000 --- a/ref/skin/commands.md +++ /dev/null @@ -1,107 +0,0 @@ -## client commands - - -Several commands can be executed on the client that are not -verbs, but instructions for Dream Seeker. Some of these commands have -detailed syntax described in their own reference entries. -[.winset](/ref/skin/.winset.md) -+ Sets skin parameters, and includes special syntax for conditional - actions. -[.output](/ref/skin/.output.md) -+ Sends output to a control. -.options -+ Shows the Options & Messages box. -.reboot -+ Reboots the world, when Dream Seeker is also acting as a server. -.reconnect -+ Reconnects to the same world. -.host -+ Opens hosting options box, when Dream Seeker is also acting as a - server. -.profile -+ Opens the profiler. On a remote connection you may not have access - to profile server procs, but you can look at the client and network - profilers. -.screenshot -+ Saves a screenshot of the map. If there\'s more than one map - control, the default map is used. -.screenshot auto -+ Saves a screenshot of the map, but does not prompt for a filename. - The file will be saved in the client\'s user directory in - BYOND/screenshots. -.gamepad-mapping -+ Opens the gamepad mapping dialog. Helpful if the user\'s gamepad is - not supported or not configured to their liking. -.command -+ Prompts the user to enter a command, which can be one of these - commands as well. -[.sound](/ref/skin/.sound.md) -+ Play, stop, or update sound. -.configure *option* *value* -+ Toggle certain Dream Seeker config options, such as - `.configure graphics-hwmode on`. The only supported options you can - use are `graphics-hwmode`, `sound`, and `delay` which is an old - mechanism for dynamically adapting to network delay. (Usually the - `delay` is reset to 0.) -.quit -+ Closes Dream Seeker. -### Embedded Winget - - -Commands that are initiated by the skin (like button.command, -map.on-show, etc.) have a special syntax that allows you to include -information that would normally require a winget call. By including -`[[`*`something`*`]]` in the command, the double-bracketed text will be -replaced by the result of running a winget on that parameter. - -A -value of `[[id.parameter]]` will run a winget on the control with the -given ID. Just using `[[parameter]]` will run a winget for the control -that initiated this command. You can also use `parent` in place of the -ID to do something with the parent of the control, or `parent.id` for -access to a sibling control. Position and size parameters can be further -broken down by appending `.x` or `.y` to get at the numbers directly. - - -Several commands already support some special cases like -`[[*]]` or `[[width]]` or such, where the special-case values are -relevant to the command. An example is that in `on-size` the value of -`[[*]]` is a size value. The Any macro, gamepad macros, and mouse -macros, also support this syntax; see [macros](/ref/skin/macros.md) for -more info. - -You can choose how embedded wingets get formatted by -following the value with `as` and a type, such as -`[[window.size as string]]`. There are several types you can use, and -different types of parameters get formatted differently: -arg -+ Value is formatted as if it\'s an argument on a command line. - Numbers are left alone; booleans are 0 or 1; size and position have - their X and Y values separated by a space; pretty much everything - else is DM-escaped and enclosed in quotes. -escaped -+ DM-escape the value as if it\'s in a quoted string but do not - include the quotes. Size and position values both use `,` to - separate their X and Y values. -string -+ Value is formatted as a DM-escaped string with surrounding quotes. -params -+ Format value for a URL-encoded parameter list (see - [list2params](/ref/proc/list2params.md)), escaping characters as - needed. -json -+ JSON formatting. Numbers are left unchanged; size or position values - are turned into objects with x and y items; boolean values are - `true` or `false`. -json-dm -+ JSON formatting, but DM-escaped so it can be included in a quoted - string. Quotes are not included. -raw -+ Does not change the value\'s text representation in any way; assumes - it\'s already formatted correctly for the purpose. This is similar - to `as arg` but does no escaping and no quotes. - - -The `arg` type is the default, unless the `[[`*...*`]]` -expression has double quotes on both sides, in which case `escaped` is -the default. \ No newline at end of file diff --git a/ref/skin/commands/.add-particles.md b/ref/skin/commands/.add-particles.md new file mode 100644 index 00000000..bf591578 --- /dev/null +++ b/ref/skin/commands/.add-particles.md @@ -0,0 +1,11 @@ + +## %2eadd-particles (info) +*** +Immediately spawns a batch of particles for a known particle set. + +The object parameter is a reference string for the object that holds the particles. + +A negative count is allowed, which will absorb some ordinary particle spawns. + +If the object isn't known to the client, nothing will happen. +*** \ No newline at end of file diff --git a/ref/skin/commands/.output.md b/ref/skin/commands/.output.md new file mode 100644 index 00000000..4f88a385 --- /dev/null +++ b/ref/skin/commands/.output.md @@ -0,0 +1,7 @@ + +## %2eoutput (info) +*** +Sends output to a control. The text does not need quotes, but any backslashes, newlines, and tabs should be escaped with a backslash. This works similarly to the `output()` proc. If text is omitted, the control is cleared. + +Here is an example of using a map control's on-status event to set a label rather than using the window's own statusbar. +*** \ No newline at end of file diff --git a/ref/skin/commands/.sound.md b/ref/skin/commands/.sound.md new file mode 100644 index 00000000..164dc901 --- /dev/null +++ b/ref/skin/commands/.sound.md @@ -0,0 +1,11 @@ + +## %2esound (info) +*** +Plays, stops, or modifies a sound. This command can be used for instance to play a click sound when using mouse macros, for instance, without waiting for the server to initiate the sound which would introduce a small delay. + +The file can be `none` or `-` when updating or stopping a sound. Any options should be separated by spaces; most are in a `name=value` format, as seen below. + +Supported options are: + +**T* represents a true/false value. True values include `true`, `on`, or 1. False would be `false`, `off`, or 0. +*** \ No newline at end of file diff --git a/ref/skin/commands/.winset.md b/ref/skin/commands/.winset.md new file mode 100644 index 00000000..66ae8af3 --- /dev/null +++ b/ref/skin/commands/.winset.md @@ -0,0 +1,15 @@ + +## %2ewinset (info) +*** +Sets skin parameters like the `winset()` proc. You can set more than one parameter by separating them with semicolons. + +This command also allows you to use conditional expressions, like so: + +The condition is the same as any other parameter you might use in `.winset`, but instead of setting the parameter, it checks to see if it's true. If so, then the parameters in `choice1` will be set. Otherwise, the parameters in `choice2` are set. This example makes the window background red if bigbutton is checked. + +If you want to look for values that don't match instead of values that do, use `!=` instead of `=` in the condition. + +The `choice2` item is optional. + +Because it's often useful to do more than one thing at a time, `choice1` and `choice2` don't have to be just one parameter. You can use multiple parameters, but they are separated with a space instead of a semicolon. (A semicolon indicates the conditional expression is over.) +*** \ No newline at end of file diff --git a/ref/skin/commands/embed.md b/ref/skin/commands/embed.md new file mode 100644 index 00000000..e9a9f1b9 --- /dev/null +++ b/ref/skin/commands/embed.md @@ -0,0 +1,13 @@ + +## embed (info) +*** +Commands that are initiated by the skin (like button.command, map.on-show, etc.) have a special syntax that allows you to include information that would normally require a winget call. By including `[[*something*]]` in the command, the double-bracketed text will be replaced by the result of running a winget on that parameter. + +A value of `[[id.parameter]]` will run a winget on the control with the given ID. Just using `[[parameter]]` will run a winget for the control that initiated this command. You can also use `parent` in place of the ID to do something with the parent of the control, or `parent.id` for access to a sibling control. Position and size parameters can be further broken down by appending `.x` or `.y` to get at the numbers directly. + +Several commands already support some special cases like `[[*]]` or `[[width]]` or such, where the special-case values are relevant to the command. An example is that in `on-size` the value of `[[*]]` is a size value. The Any macro, gamepad macros, and mouse macros, also support this syntax; see macros for more info. + +You can choose how embedded wingets get formatted by following the value with `as` and a type, such as `[[window.size as string]]`. There are several types you can use, and different types of parameters get formatted differently: + +The `arg` type is the default, unless the `[[`*...*`]]` expression has double quotes on both sides, in which case `escaped` is the default. +*** \ No newline at end of file diff --git a/ref/skin/commands/index.md b/ref/skin/commands/index.md new file mode 100644 index 00000000..bb28be52 --- /dev/null +++ b/ref/skin/commands/index.md @@ -0,0 +1,7 @@ + +## commands (info) +*** +Several commands can be executed on the client that are not verbs, but instructions for Dream Seeker. Some of these commands have detailed syntax described in their own reference entries. + +Client commands have a special syntax that allows you to query information from the skin and include it directly in the command, as if you had called winget(). Embedded expressions look like `[[*expression*]]` in your command text. Some commands have built-in data that gets filled in via `[[*]]`. See embedded winget for more information. +*** \ No newline at end of file diff --git a/ref/skin/control.md b/ref/skin/control.md deleted file mode 100644 index 537d21d2..00000000 --- a/ref/skin/control.md +++ /dev/null @@ -1,68 +0,0 @@ -## controls (skin) -**Control types:** -+ [Bar](/ref/skin/control/bar.md) : A progress bar or slider -+ [Browser](/ref/skin/control/browser.md) : A browser -+ [Button](/ref/skin/control/button.md) : A pushbutton or toggle button -+ [Child](/ref/skin/control/child.md) : A container holding one or two - panes, with a movable splitter -+ [Grid](/ref/skin/control/grid.md) : For table-like or list-like - output -+ [Info](/ref/skin/control/info.md) : Classic BYOND statpanel -+ [Input](/ref/skin/control/input.md) : Command input or other - user-entered text -+ [Label](/ref/skin/control/label.md) : Non-interactive text label -+ [Main](/ref/skin/control/main.md) : A window or pane that holds other - controls -+ [Macro](/ref/skin/control/macro.md) : A [keyboard/gamepad/mouse - macro](/ref/skin/macros.md) -+ [Map](/ref/skin/control/map.md) : The game map display -+ [Menu](/ref/skin/control/menu.md) : An item in a drop-down menu -+ [Output](/ref/skin/control/output.md) : Text output -+ [Tab](/ref/skin/control/tab.md) : A tab control holding multiple - panes, showing one at a time - -**Parameters common to all controls:** -+ [id](/ref/skin/param/id.md) -+ [is-disabled](/ref/skin/param/is-disabled.md) -+ [parent](/ref/skin/param/parent.md) -+ [saved-params](/ref/skin/param/saved-params.md) -+ [type](/ref/skin/param/type.md) -**Positionable controls only (not Macro or Menu):** -+ [anchor1, anchor2](/ref/skin/param/anchor.md) -+ [background-color](/ref/skin/param/background-color.md) -+ [border](/ref/skin/param/border.md) -+ [drop-zone](/ref/skin/param/drop-zone.md) -+ [flash](/ref/skin/param/flash.md) -+ [focus](/ref/skin/param/focus.md) -+ [font-family](/ref/skin/param/font-family.md) -+ [font-size](/ref/skin/param/font-size.md) -+ [font-style](/ref/skin/param/font-style.md) -+ [is-visible](/ref/skin/param/is-visible.md) -+ [is-transparent](/ref/skin/param/is-transparent.md) -+ [on-size](/ref/skin/param/on-size.md) -+ [pos](/ref/skin/param/pos.md) -+ [right-click](/ref/skin/param/right-click.md) -+ [size](/ref/skin/param/size.md) -+ [text-color](/ref/skin/param/text-color.md) -### Creating/Destroying at runtime - - -Controls can be created or deleted at runtime. (Only controls -you created during runtime may be deleted.) To create a control, call -[winset()](/ref/proc/winset.md) using the -[id](/ref/skin/param/id.md) of the new control, and the parameter -list should include [type](/ref/skin/param/type.md) , -[parent](/ref/skin/param/parent.md) , and probably also -[pos](/ref/skin/param/pos.md) , -[size](/ref/skin/param/size.md) , and any -[anchors](/ref/skin/param/anchor.md) . - -To delete the control -again, set its `parent` to a blank value. - -Menu items and macros -work similarly, except they have no positional info. For those, the -[name](/ref/skin/param/name.md) parameter is important when you -create them, and you will either need -[command](/ref/skin/param/command.md) or (for macros) -[map-to](/ref/skin/param/map-to.md) to do anything with them. \ No newline at end of file diff --git a/ref/skin/control/bar.md b/ref/skin/control/bar.md new file mode 100644 index 00000000..73c8716e --- /dev/null +++ b/ref/skin/control/bar.md @@ -0,0 +1,5 @@ + +## bar (info) +*** +A progress bar or interactive slider. This can be made to use several different orientations. Its `value` can be read or set as a percentage from 0 to 100. +*** \ No newline at end of file diff --git a/ref/skin/control/browser/BYOND.md b/ref/skin/control/browser/BYOND.md new file mode 100644 index 00000000..ac674312 --- /dev/null +++ b/ref/skin/control/browser/BYOND.md @@ -0,0 +1,43 @@ + +## BYOND (info) +*** +The BYOND object is a built-in shortcut for interacting with the client via JavaScript in a browser control. It contains the following methods: + +Performs a winset, where `id` is the ID of the control to change (or null for global settings), and `params` is an object with parameter,value pairs such as `{"text-color": "red"}`. Parameters can use camelCase, where a capital letter indicates where a hyphen would normally go, e.g. `"textColor"` and `"text-color"` are the same. + + +```dm + +// uncheck a button from JavaScript +BYOND.winset("inventory_button", {isChecked: false}); + +``` + + +Sends a winget, where `id` is the ID of the control to retrieve (or null for global settings), and `props` is a single property or an array of properties to retrieve. As with `winset`, camelCase is allowed, but the result will not use camelCase. + +Returns a Promise object, so this call can be used with the `await` keyword or followed by `then()`. The result inside the promise is an object with parameter,value pairs, such as `{"background-color": {value: "#ff0000", red: 255, green: 0, blue: 0, isDefault: false}}`. + + +```dm + +// get a button's status JavaScript +let buttonData = await BYOND.winget("inventory_button", "isChecked"); +if(buttonData["is-checked"]) { + alert("The button is checked!"); +} + +``` + + +Initiates a client command. This is basically just a shortcut for using `winset` to run a command. + + +```dm + +// play a sound +BYOND.command(".sound 'ding.ogg'"); + +``` + +*** \ No newline at end of file diff --git a/ref/skin/control/browser/byondStorage.md b/ref/skin/control/browser/byondStorage.md new file mode 100644 index 00000000..772aebea --- /dev/null +++ b/ref/skin/control/browser/byondStorage.md @@ -0,0 +1,7 @@ + +## byondStorage (info) +*** +A replacement for `localStorage` that can be used to hold information for reuse in later sessions of the same game. (This must be enabled via `browser-options` with the `winset()` proc.) + +There are three actual storage objects you can use: +*** \ No newline at end of file diff --git a/ref/skin/control/browser/index.md b/ref/skin/control/browser/index.md new file mode 100644 index 00000000..cd4298d7 --- /dev/null +++ b/ref/skin/control/browser/index.md @@ -0,0 +1,27 @@ + +## browser (info) +*** +A browser panel integrated into the skin. + +Browsers are capable of displaying HTML documents, and can also interact with the skin. + +A longstanding behavior of BYOND is the ability to create a new browser window by sending an extra argument to the browse() proc. Since the advent of skins in BYOND 4.0, this behavior was kept. When you create a new browser popup, the window name you specify for the popup is used for the name of a new window control, and within that window there will be a new browser control simply called `browser`. + +If you want to interact with the new browser, its full "decorated" id is `*windowname*.browser`. + +Sending output() to a browser will send a document to display there, but if you follow the browser's control name with a colon and a function name, you can call a JavaScript function in the document displayed within that browser. + + +```dm + +var/list/info = list("name"="fridge", "power"=12) +// send {"name":"fridge","power":12} to a JavaScript function +usr << output(url_encode(json_encode(info)), "mybrowser:myJSfunction") + +``` + + +The text that you send as output will be parsed like URL parameters, where mutliple arguments to the function are separated by `&` or `;`, which is why url_encode() is wrapped around the json_encode() call in this example. + +These topics cover more advanced uses of the browser control. +*** \ No newline at end of file diff --git a/ref/skin/control/browser/winset.md b/ref/skin/control/browser/winset.md new file mode 100644 index 00000000..755ddbe9 --- /dev/null +++ b/ref/skin/control/browser/winset.md @@ -0,0 +1,17 @@ + +## winset (info) +*** +Browser controls can interact with the skin via JavaScript, by setting `window.location` to a special URL. + +This works like an ordinary winset() call from the server. If `id` is omitted, it's the same as a winset with a null ID. You can also leave the `id` blank if you use "fully decorated" property names such as `mybutton.is-checked` instead of just `is-checked`. + +Any text you use other than letters, numbers, hyphens, commas, and periods should be encoded via the `encodeURIComponent()` function in JavaScript. + +In this winget, the IDs and properties you want can be separated by commas if you want to retrieve more than one. The winget operation works via a callback function you must define in JavaScript. The callback is given just one argument, a JavaScript object with all of the properties you requested. For example, this URL: + +...might send this to the callback function `wgcb`: + +The property names will be in the same format you would expect from winget(), so when you're looking at multiple elements' properties, you'll get the full names in `id.property` format. The values are always sent back in a convenient form for JavaScript to work with; in the case of size, position, and color these will always be objects. + +An optional `control` parameter for the winget call can be used if you want to send data to a callback in a different browser control. +*** \ No newline at end of file diff --git a/ref/skin/control/button.md b/ref/skin/control/button.md new file mode 100644 index 00000000..23aa95ae --- /dev/null +++ b/ref/skin/control/button.md @@ -0,0 +1,5 @@ + +## button (info) +*** +A button that can be pressed to run a command, or possibly toggled. +*** \ No newline at end of file diff --git a/ref/skin/control/child.md b/ref/skin/control/child.md new file mode 100644 index 00000000..57075a76 --- /dev/null +++ b/ref/skin/control/child.md @@ -0,0 +1,5 @@ + +## child (info) +*** +A container that can hold one or two panes. If it holds two panes, a splitter may appear between them. This control can therefore be used to subdivide a window or pane into smaller units. +*** \ No newline at end of file diff --git a/ref/skin/control/grid.md b/ref/skin/control/grid.md new file mode 100644 index 00000000..2c7437b3 --- /dev/null +++ b/ref/skin/control/grid.md @@ -0,0 +1,27 @@ + +## grid (info) +*** +A grid that contains multiple cells that can show various kinds of output data. + +Sending output to a grid looks like this: + + +```dm + +// output to column 3, row 2 +winset(usr, "thegrid", "current-cell=3,2") +usr << output("Text", "thegrid") + +// or even easier: +usr << output("Text", "thegrid:3,2") + +// when is-list is true: +usr << output("5th item", "thegrid:5") + +``` + + +You can output an atom to the grid, which can be clicked, dragged, etc. However, you should make sure that atom is *not* temporary and will persist until you no longer need it, or else the server may recycle it and the object in the cell will either disappear or be impossible to interact with anymore. + +There are some limitations to output in grid controls: +*** \ No newline at end of file diff --git a/ref/skin/control/index.md b/ref/skin/control/index.md new file mode 100644 index 00000000..8cf71479 --- /dev/null +++ b/ref/skin/control/index.md @@ -0,0 +1,9 @@ + +## control (info) +*** +Controls can be created or deleted at runtime. (Only controls you created during runtime may be deleted.) To create a control, call winset() using the id of the new control, and the parameter list should include type, parent, and probably also pos, size, and any anchors. + +To delete the control again, set its `parent` to a blank value. + +Menu items and macros work similarly, except they have no positional info. For those, the name parameter is important when you create them, and you will either need command or (for macros) map-to to do anything with them. +*** \ No newline at end of file diff --git a/ref/skin/control/info.md b/ref/skin/control/info.md new file mode 100644 index 00000000..c26eb774 --- /dev/null +++ b/ref/skin/control/info.md @@ -0,0 +1,11 @@ + +## info (info) +*** +The classic BYOND statpanel, which contains both stat and verb tabs. This is technically a 3-column grid with a variable number of rows. + +Output to a statpanel is done via the stat() and statpanel() procs, during mob/Stat(). + +The same limitations that apply to grid output apply here. + +Info controls can now be split so that one displays stats and another handles verbs. +*** \ No newline at end of file diff --git a/ref/skin/control/input.md b/ref/skin/control/input.md new file mode 100644 index 00000000..e1df601b --- /dev/null +++ b/ref/skin/control/input.md @@ -0,0 +1,7 @@ + +## input (info) +*** +A text box into which the user can type. By default this is used for sending client commands, but it can be used for other purposes as well. + +Note that when in "standard" mode of accepting user commands, built-in verbs like `.click`, or local commands like `.winset`, are not accepted when typed in. This kind of command can still be entered manually through the Client menu of the Options & Messages window. +*** \ No newline at end of file diff --git a/ref/skin/control/label.md b/ref/skin/control/label.md new file mode 100644 index 00000000..8d31a295 --- /dev/null +++ b/ref/skin/control/label.md @@ -0,0 +1,5 @@ + +## label (info) +*** +A text label that appears on the skin. +*** \ No newline at end of file diff --git a/ref/skin/control/macro.md b/ref/skin/control/macro.md new file mode 100644 index 00000000..12dd5868 --- /dev/null +++ b/ref/skin/control/macro.md @@ -0,0 +1,5 @@ + +## macro (info) +*** +A keyboard/gamepad/mouse macro, usually designed to run a command. The control is a means of interacting with the macro as an object, allowing some of its properties to be changed at runtime. +*** \ No newline at end of file diff --git a/ref/skin/control/main.md b/ref/skin/control/main.md new file mode 100644 index 00000000..b7d4c4a1 --- /dev/null +++ b/ref/skin/control/main.md @@ -0,0 +1,9 @@ + +## main (info) +*** +A container for other controls. The Main control takes two forms: a window or a pane. + +A window exists independently and can be moved around on the screen. A pane has to be used within another container control such as a Child or Tab control. + +The font parameters have no impact on a window's statusbar or titlebar; those are drawn by the operating system. +*** \ No newline at end of file diff --git a/ref/skin/control/map.md b/ref/skin/control/map.md new file mode 100644 index 00000000..5887cf1f --- /dev/null +++ b/ref/skin/control/map.md @@ -0,0 +1,5 @@ + +## map (info) +*** +A map that will display icons from the game. +*** \ No newline at end of file diff --git a/ref/skin/control/menu.md b/ref/skin/control/menu.md new file mode 100644 index 00000000..e97afe1f --- /dev/null +++ b/ref/skin/control/menu.md @@ -0,0 +1,5 @@ + +## menu (info) +*** +A menu item, that when activate will run a command. +*** \ No newline at end of file diff --git a/ref/skin/control/output.md b/ref/skin/control/output.md new file mode 100644 index 00000000..127d2776 --- /dev/null +++ b/ref/skin/control/output.md @@ -0,0 +1,5 @@ + +## output (info) +*** +Displays text output. +*** \ No newline at end of file diff --git a/ref/skin/control/tab.md b/ref/skin/control/tab.md new file mode 100644 index 00000000..ea8ad673 --- /dev/null +++ b/ref/skin/control/tab.md @@ -0,0 +1,5 @@ + +## tab (info) +*** +A tab control, where each tab holds a different pane. +*** \ No newline at end of file diff --git a/ref/skin/current-cell.md b/ref/skin/current-cell.md deleted file mode 100644 index b36ddff8..00000000 --- a/ref/skin/current-cell.md +++ /dev/null @@ -1,26 +0,0 @@ -## current-cell parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) - -**Format:** -+ *columns*,*rows* -+ *items* - -**Default value:** -+ 0x0 - - -The active cell. Any output sent to the grid, that is not sent -to a specific cell, will go into this cell. - -If -[is-list](/ref/skin/param/is-list.md) is true, this value can be -set to a single number. - -> [!TIP] -> **See also:** -> + [cell-span parameter](/ref/skin/param/cell-span.md) -> + [cells parameter](/ref/skin/param/cells.md) -> + [is-list parameter](/ref/skin/param/is-list.md) \ No newline at end of file diff --git a/ref/skin/current-tab.md b/ref/skin/current-tab.md deleted file mode 100644 index 580b03ee..00000000 --- a/ref/skin/current-tab.md +++ /dev/null @@ -1,18 +0,0 @@ -## current-tab parameter (skin) - - -**Applies to:** -+ [Tab](/ref/skin/control/tab.md) - -**Format:** -+ string - - -The name of the [pane](/ref/skin/control/main.md) in the -active/default tab. If set to a pane that is not currently in this tab -control, the pane by that name will be added as another tab. - -> [!TIP] -> **See also:** -> + [on-tab parameter](/ref/skin/param/on-tab.md) -> + [tabs parameter](/ref/skin/param/tabs.md) \ No newline at end of file diff --git a/ref/skin/dir.md b/ref/skin/dir.md deleted file mode 100644 index 090a08d3..00000000 --- a/ref/skin/dir.md +++ /dev/null @@ -1,30 +0,0 @@ -## dir parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) - -**Possible values:** -+ north -+ south -+ east -+ west -+ clockwise -+ counterclockwise - -**Default value:** -+ east - - -The direction/orientation of the bar. As the -[value](/ref/skin/param/value.md) increases the bar will move -further in this direction. - -Shorthand values like `cw` and `ccw` -can be used, or also numerical BYOND directions. - -> [!TIP] -> **See also:** -> + [value parameter](/ref/skin/param/angle.md) -> + [angle1, angle2 parameters](/ref/skin/param/angle.md) -> + [width parameter](/ref/skin/param/width.md) \ No newline at end of file diff --git a/ref/skin/drop-zone.md b/ref/skin/drop-zone.md deleted file mode 100644 index 158e71fe..00000000 --- a/ref/skin/drop-zone.md +++ /dev/null @@ -1,33 +0,0 @@ -## drop-zone parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ true/false - -**Default value:** -+ `true` for [Grid](/ref/skin/control/grid.md) , - [Info](/ref/skin/control/info.md) , [Map](/ref/skin/control/map.md) -+ `false` for everything else - - -True if dragged objects may be dropped here. Default is true -for Map, Info, and Grid controls, false for others. When in use, this -will be the value of the `over_control` argument in -[MouseDrop()](/ref/client/proc/MouseDrop.md) if you drop an atom here. - - -Grids can also add `drag-cell` and `drop-cell` to mouse proc -parameters. The mouse procs\' `src_location` and `over_location` -arguments are in the form `"[column],[row]"` (or `"[item"]` if -[is-list](/ref/skin/param/is-list.md) is true) when dragging -to/from a grid cell. - -In Info controls, `src_location` and -`over_location` in mouse procs will be the name of the statpanel tab. - -> [!TIP] -> **See also:** -> + [mouse handling](/ref/DM/mouse.md) \ No newline at end of file diff --git a/ref/skin/enable-http-images.md b/ref/skin/enable-http-images.md deleted file mode 100644 index 1362e4c9..00000000 --- a/ref/skin/enable-http-images.md +++ /dev/null @@ -1,20 +0,0 @@ -## enable-http-images parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -+ [Output](/ref/skin/control/output.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Allows images to be pulled from the Web when using the `` -tag; otherwise only locally stored images can be shown. - -> [!TIP] -> **See also:** -> + [small-icons parameter](/ref/skin/param/small-icons.md) -> + [style parameter](/ref/skin/param/style.md) \ No newline at end of file diff --git a/ref/skin/flash.md b/ref/skin/flash.md deleted file mode 100644 index 86c6731a..00000000 --- a/ref/skin/flash.md +++ /dev/null @@ -1,13 +0,0 @@ -## flash parameter (skin) -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ number - -**Default value:** -+ 0 - - -Set to a positive number to make the window flash that many -times, -1 to flash forever, and 0 to stop flashing. \ No newline at end of file diff --git a/ref/skin/focus.md b/ref/skin/focus.md deleted file mode 100644 index 85d082bf..00000000 --- a/ref/skin/focus.md +++ /dev/null @@ -1,25 +0,0 @@ -## focus parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -This parameter is true if this control currently has focus. - - -This is also a special read-only global parameter. Calling -[winget()](/ref/proc/winget.md) with no `id` and `focus` as the -parameter will return the [id](/ref/skin/param/id.md) of the -currently focused control, if any. - -> [!TIP] -> **See also:** -> + [id parameter](/ref/skin/param/id.md) -> + [winget proc](/ref/proc/winget.md) \ No newline at end of file diff --git a/ref/skin/font-family.md b/ref/skin/font-family.md deleted file mode 100644 index 148e4f62..00000000 --- a/ref/skin/font-family.md +++ /dev/null @@ -1,27 +0,0 @@ -## font-family parameter (skin) - - parameters](/ref/skin/param/tab-font.md) - -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ string - - -Leave blank to use the default font. This can be used for -CSS-style fallback fonts, e.g. "Arial,Helvetica". - -You can -include fonts in your resource file, making them available to the -client, like so: -```dm - var/list/extra_resources = list(\\ -\'myfont.ttf\', \'myfont_bold.ttf\') -``` - - -> [!TIP] -> **See also:** -> + [font-size parameter](/ref/skin/param/font-size.md) -> + [font-style parameter](/ref/skin/param/font-style.md) -> + [tab-font-family, tab-font-size, tab-font-style \ No newline at end of file diff --git a/ref/skin/font-size.md b/ref/skin/font-size.md deleted file mode 100644 index 3946d443..00000000 --- a/ref/skin/font-size.md +++ /dev/null @@ -1,26 +0,0 @@ -## font-size parameter (skin) - - parameters](/ref/skin/param/tab-font.md) - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ number - -**Default value:** -+ 0 - - -Point size of the font, or leave at 0 for the default size. - - -The [Output control](/ref/skin/control/output.md) behaves -differently for legacy reasons, unless -[legacy-size](/ref/skin/param/legacy-size.md) is false. - -> [!TIP] -> **See also:** -> + [font-family parameter](/ref/skin/param/font-family.md) -> + [font-style parameter](/ref/skin/param/font-style.md) -> + [tab-font-family, tab-font-size, tab-font-style \ No newline at end of file diff --git a/ref/skin/font-style.md b/ref/skin/font-style.md deleted file mode 100644 index 2850787a..00000000 --- a/ref/skin/font-style.md +++ /dev/null @@ -1,25 +0,0 @@ -## font-style parameter (skin) - - parameters](/ref/skin/param/tab-font.md) - -**Applies to:** -+ [All](/ref/skin/control.md) -**Possible values:** -+ bold -+ italic -+ underline -+ strike - -**Default value:** -+ *empty* - - -Sets the font style. Any combination of the above values may be -used, or none of them. Multiple values may be separated by spaces or -commas. - -> [!TIP] -> **See also:** -> + [font-family parameter](/ref/skin/param/font-family.md) -> + [font-size parameter](/ref/skin/param/font-size.md) -> + [tab-font-family, tab-font-size, tab-font-style \ No newline at end of file diff --git a/ref/skin/grid.md b/ref/skin/grid.md deleted file mode 100644 index 05ecfca4..00000000 --- a/ref/skin/grid.md +++ /dev/null @@ -1,52 +0,0 @@ -## grid control (skin) - - -A grid that contains multiple cells that can show various kinds -of output data. -**Grid-specific parameters:** -+ [cell-span](/ref/skin/param/cell-span.md) -+ [cells](/ref/skin/param/cells.md) -+ [current-cell](/ref/skin/param/current-cell.md) -+ [enable-http-images](/ref/skin/param/enable-http-images.md) -+ [highlight-color](/ref/skin/param/highlight-color.md) -+ [is-list](/ref/skin/param/is-list.md) -+ [line-color](/ref/skin/param/line-color.md) -+ [link-color](/ref/skin/param/link-color.md) -+ [show-lines](/ref/skin/param/show-lines.md) -+ [show-names](/ref/skin/param/show-names.md) -+ [small-icons](/ref/skin/param/small-icons.md) -+ [style](/ref/skin/param/style.md) -+ [visited-color](/ref/skin/param/visited-color.md) - - -Sending output to a grid looks like this: -### Example: - -```dm - // output to column 3, row 2 winset(usr, "thegrid", -"current-cell=3,2") usr << output("Text", "thegrid") // or even -easier: usr << output("Text", "thegrid:3,2") // when is-list is -true: usr << output("5th item", "thegrid:5") -``` - - - -You can output an atom to the grid, which can be clicked, -dragged, etc. However, you should make sure that atom is *not* temporary -and will persist until you no longer need it, or else the server may -recycle it and the object in the cell will either disappear or be -impossible to interact with anymore. - -There are some limitations -to output in grid controls: -- Only one character style (font, color, bold, etc.) may appear within - a single cell. -- A cell is either a link, or not. -- One image is allowed per cell. -- A cell can hold an object (atom), sent to it via the [`output()` - proc](/ref/proc/output.md) which can be clicked, dragged, etc.; it will - not act as a link. -- The same margin is used all around the cell, not different margins - for left, right, top, bottom. -- There will always be a 1-pixel space for grid lines, whether - they\'re shown or not. \ No newline at end of file diff --git a/ref/skin/group.md b/ref/skin/group.md deleted file mode 100644 index 077f7aa7..00000000 --- a/ref/skin/group.md +++ /dev/null @@ -1,23 +0,0 @@ -## group parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ string - - -Used for "radio" buttons and menu items, where only one of -them in the same group may be checked at a time. This value is a text -string, or may be left empty. - -Buttons in different -windows/panes, or menu items in another menu/submenu, are always treated -as a different group. - -> [!TIP] -> **See also:** -> + [button-type parameter](/ref/skin/param/button-type.md) -> + [can-check parameter](/ref/skin/param/can-check.md) -> + [is-checked parameter](/ref/skin/param/is-checked.md) \ No newline at end of file diff --git a/ref/skin/has-stats.md b/ref/skin/has-stats.md deleted file mode 100644 index 9ca32bdf..00000000 --- a/ref/skin/has-stats.md +++ /dev/null @@ -1,18 +0,0 @@ -##### BYOND Version 516 - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ true/false - -**Default value:** -+ true - -True if this info control contains the statpanels created via -[stat()](/ref/proc/stat.md) and [statpanel()](/ref/proc/statpanel.md) -Only one info control can have statpanels. - -> [!TIP] -> **See also:** -> + [has-verbs parameter](/ref/skin/param/has-verbs.md) \ No newline at end of file diff --git a/ref/skin/has-verbs.md b/ref/skin/has-verbs.md deleted file mode 100644 index 0cb63e0c..00000000 --- a/ref/skin/has-verbs.md +++ /dev/null @@ -1,17 +0,0 @@ -##### BYOND Version 516 - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ true/false - -**Default value:** -+ true - -True if this info control contains the verbs used in the game. -Currently only one info control can have verbs. - -> [!TIP] -> **See also:** -> + [has-stats parameter](/ref/skin/param/has-stats.md) \ No newline at end of file diff --git a/ref/skin/highlight-color.md b/ref/skin/highlight-color.md deleted file mode 100644 index aa79b479..00000000 --- a/ref/skin/highlight-color.md +++ /dev/null @@ -1,21 +0,0 @@ -## highlight-color parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - -**Default value:** -+ #00ff00 - - -The color used to highlight moused-over statpanel items or -verbs. In grids, this color is used when hovering over objects or links. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [background-color parameter](/ref/skin/param/background-color.md) \ No newline at end of file diff --git a/ref/skin/icon-size.md b/ref/skin/icon-size.md deleted file mode 100644 index d0892a21..00000000 --- a/ref/skin/icon-size.md +++ /dev/null @@ -1,23 +0,0 @@ -## icon-size parameter (skin) -###### BYOND Version ize parameter (skin) {#icon-size-parameter-skin deprecated="1 - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) - -**Format:** -+ number - -**Default value:** -+ 0 - - -Size, in pixels, of icons on the map. A size of 0 stretches to -fit available space. -This parameter has been deprecated. Use -[zoom](/ref/skin/param/zoom.md) instead. - -> [!TIP] -> **See also:** -> + [zoom parameter](/ref/skin/param/zoom.md) -> + [zoom-mode parameter](/ref/skin/param/zoom-mode.md) \ No newline at end of file diff --git a/ref/skin/icon.md b/ref/skin/icon.md deleted file mode 100644 index 9432b080..00000000 --- a/ref/skin/icon.md +++ /dev/null @@ -1,27 +0,0 @@ -## icon parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ \'*file*\' - -**Default value:** -+ *empty* - - -Custom icon used for the window. If no icon is specified, the -Dream Seeker icon is used by windows by default. - -If this -control is a pane, its icon will appear on the tab if the pane is inside -a tab control. Lack of an icon will mean no icon appears in the tab. - - -Note: The Windows `.ico` format is not used. Only image formats -BYOND can already use are supported. - -> [!TIP] -> **See also:** -> + [title parameter](/ref/skin/param/title.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) \ No newline at end of file diff --git a/ref/skin/id.md b/ref/skin/id.md deleted file mode 100644 index 04a5a246..00000000 --- a/ref/skin/id.md +++ /dev/null @@ -1,24 +0,0 @@ -## id parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ string - - -The name of this control. Read-only. - -If this is a -[Main control](/ref/skin/control/main.md) , the name should always be -unique. For others, it is usually still a good idea to use a unique -name, but they can be referenced by *window*.*id* at runtime. -You can use a colon in front of the -[type](/ref/skin/param/type.md) to refer to the default control -of a certain type, if one exists, e.g. `:map` is the default map. - -> [!TIP] -> **See also:** -> + [parent parameter](/ref/skin/param/parent.md) -> + [type parameter](/ref/skin/param/type.md) \ No newline at end of file diff --git a/ref/skin/image-mode.md b/ref/skin/image-mode.md deleted file mode 100644 index a1784655..00000000 --- a/ref/skin/image-mode.md +++ /dev/null @@ -1,21 +0,0 @@ -## image-mode parameter (skin) - - -**Applies to:** -+ [Label](/ref/skin/control/label.md) -+ [Main](/ref/skin/control/main.md) -**Possible values:** -+ center -+ stretch -+ tile - -**Default value:** -+ center - - -Determines how the background image is displayed. - -> [!TIP] -> **See also:** -> + [image parameter](/ref/skin/param/image.md) -> + [keep-aspect parameter](/ref/skin/param/keep-aspect.md) \ No newline at end of file diff --git a/ref/skin/image.md b/ref/skin/image.md deleted file mode 100644 index a953a3b8..00000000 --- a/ref/skin/image.md +++ /dev/null @@ -1,32 +0,0 @@ -## image parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -+ [Label](/ref/skin/control/label.md) -+ [Main](/ref/skin/control/main.md) -+ [Output](/ref/skin/control/output.md) - -**Format:** -+ \'*file*\' - - -A background image to show in this control. - -In the -Output control this image is always tiled. - -Note: Icons -displayed in the output control will not show the background image -underneath their transparent parts, but will instead show the background -color. - - -For Label and Main, use -[image-mode](/ref/skin/param/image-mode.md) to control how the -image is displayed. - -> [!TIP] -> **See also:** -> + [image-mode parameter](/ref/skin/param/image-mode.md) -> + [keep-aspect parameter](/ref/skin/param/keep-aspect.md) \ No newline at end of file diff --git a/ref/skin/index.md b/ref/skin/index.md index 030476b7..469d0a79 100644 --- a/ref/skin/index.md +++ b/ref/skin/index.md @@ -1,12 +1,9 @@ -## index parameter (skin) -**Applies to:** -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ number -**Default value:** -+ 1000 +## {skin} (info) +*** +BYOND games used to have very limited interface options, all effectively sharing the same layout. In BYOND 4.0, skins were introduced, allowing developers more control over the layout. +A skin consists of macro sets for keyboard/gamepad input, menus, and windows and/or panes. All of these are considered controls that a game can interact with via winset(), winget(), output(), and a few other procs. -Moves the menu item to the *N*th position among its siblings. 0 -or less is no change. Write-only. \ No newline at end of file +About the simplest possible skin is a single window with a single map control, and a single macro set. +*** \ No newline at end of file diff --git a/ref/skin/info.md b/ref/skin/info.md deleted file mode 100644 index 8f65b92e..00000000 --- a/ref/skin/info.md +++ /dev/null @@ -1,30 +0,0 @@ -## info control (skin) - - -The classic BYOND statpanel, which contains both stat and verb -tabs. This is technically a 3-column grid with a variable number of -rows. -**Info-specific parameters:** -+ [allow-html](/ref/skin/param/allow-html.md) -+ [has-stats](/ref/skin/param/has-stats.md) -+ [has-verbs](/ref/skin/param/has-verbs.md) -+ [highlight-color](/ref/skin/param/highlight-color.md) -+ [multi-line](/ref/skin/param/multi-line.md) -+ [on-hide](/ref/skin/param/on-hide.md) -+ [on-show](/ref/skin/param/on-show.md) -+ [on-tab](/ref/skin/param/on-tab.md) -+ [prefix-color](/ref/skin/param/prefix-color.md) -+ [suffix-color](/ref/skin/param/suffix-color.md) -+ [tab-background-color](/ref/skin/param/tab-background-color.md) -+ [tab-font-family, tab-font-size, - tab-font-style](/ref/skin/param/tab-font.md) -+ [tab-text-color](/ref/skin/param/tab-text-color.md) - - -Output to a statpanel is done via the -[stat()](/ref/proc/stat.md) and [statpanel()](/ref/proc/statpanel.md) -procs, during [mob/Stat()](/ref/atom/proc/stat.md) . - -The same -limitations that apply to [grid](/ref/skin/control/grid.md) output apply -here. \ No newline at end of file diff --git a/ref/skin/inner-pos.md b/ref/skin/inner-pos.md deleted file mode 100644 index 8093babb..00000000 --- a/ref/skin/inner-pos.md +++ /dev/null @@ -1,22 +0,0 @@ -## inner-pos parameter (skin) -###### BYOND Version 515 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ *x*,*y* - - -Read-only. - -Reads the position where the window\'s -interior contents begin (i.e., not counting titlebar, statusbar, -borders, etc.), relative to its `outer-pos`. - -> [!TIP] -> **See also:** -> + [pos parameter](/ref/skin/param/pos.md) -> + [outer-pos parameter](/ref/skin/param/outer-pos.md) -> + [inner-size parameter](/ref/skin/param/inner-size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) \ No newline at end of file diff --git a/ref/skin/inner-size.md b/ref/skin/inner-size.md deleted file mode 100644 index c22103eb..00000000 --- a/ref/skin/inner-size.md +++ /dev/null @@ -1,28 +0,0 @@ -## inner-size parameter (skin) -###### BYOND Version 513 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) - -**Format:** -+ *width*x*height* - - -Read-only. - -If the control is a window, this refers to -its current interior size: i.e., not counting titlebar, statusbar, -borders, etc. If it\'s maximized, this will be the true size of the -window interior, as opposed to `size` which is the interior size once -this window is no longer maximized. - -If this control is a pane -and [can-scroll](/ref/skin/param/can-scroll.md) is true, this is -the size of the display area not including the scrollbars. - -> [!TIP] -> **See also:** -> + [size parameter](/ref/skin/param/size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) -> + [inner-pos parameter](/ref/skin/param/inner-pos.md) \ No newline at end of file diff --git a/ref/skin/input.md b/ref/skin/input.md deleted file mode 100644 index 8267d862..00000000 --- a/ref/skin/input.md +++ /dev/null @@ -1,19 +0,0 @@ -## input control (skin) - - -A text box into which the user can type. By default this is -used for sending [client commands](/ref/skin/commands.md) , but it can be -used for other purposes as well. -**Input-specific parameters:** -+ [command](/ref/skin/param/command.md) -+ [is-password](/ref/skin/param/is-password.md) -+ [multi-line](/ref/skin/param/multi-line.md) -+ [no-command](/ref/skin/param/no-command.md) -+ [on-blur](/ref/skin/param/on-blur.md) -+ [on-focus](/ref/skin/param/on-focus.md) -+ [text](/ref/skin/param/text.md) - -Note that when in "standard" mode of accepting user commands, -built-in verbs like `.click`, or local commands like `.winset`, are not -accepted when typed in. This kind of command can still be entered -manually through the Client menu of the Options & Messages window. \ No newline at end of file diff --git a/ref/skin/is-checked.md b/ref/skin/is-checked.md deleted file mode 100644 index ed59744d..00000000 --- a/ref/skin/is-checked.md +++ /dev/null @@ -1,22 +0,0 @@ -## is-checked parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -+ [Menu](/ref/skin/control/menu.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -True if the button or menu item is checked. Menu items can set -this even if [can-check](/ref/skin/param/can-check.md) is false. - -> [!TIP] -> **See also:** -> + [button-type parameter](/ref/skin/param/button-type.md) -> + [can-check parameter](/ref/skin/param/can-check.md) -> + [group parameter](/ref/skin/param/group.md) \ No newline at end of file diff --git a/ref/skin/is-default.md b/ref/skin/is-default.md deleted file mode 100644 index 3fc56d4d..00000000 --- a/ref/skin/is-default.md +++ /dev/null @@ -1,30 +0,0 @@ -## is-default parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -Specifies that this is a default control. This should be true -for your main window, and for your primary map, info, output, input, and -browser controls. - -The default control of a given type can be -referenced in [winset()](/ref/proc/winset.md) and other skin-related -procs by the name `":`*`type`*`"`, e.g. `":map"`. - -Changing this -value at runtime should be avoided, especially for windows. Results may -be unpredictable. - -> [!TIP] -> **See also:** -> + [id parameter](/ref/skin/param/id.md) -> + [parent parameter](/ref/skin/param/parent.md) -> + [type parameter](/ref/skin/param/type.md) \ No newline at end of file diff --git a/ref/skin/is-disabled.md b/ref/skin/is-disabled.md deleted file mode 100644 index 7a2dfe77..00000000 --- a/ref/skin/is-disabled.md +++ /dev/null @@ -1,20 +0,0 @@ -## is-disabled parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -+ [Macro](/ref/skin/control/macro.md) -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Disables the control, menu item, or macro. - -> [!TIP] -> **See also:** -> + [is-checked parameter](/ref/skin/param/is-checked.md) -> + [is-visible parameter](/ref/skin/param/is-visible.md) \ No newline at end of file diff --git a/ref/skin/is-flat.md b/ref/skin/is-flat.md deleted file mode 100644 index 7da68da1..00000000 --- a/ref/skin/is-flat.md +++ /dev/null @@ -1,18 +0,0 @@ -## is-flat parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Gives this button a flat appearance instead of pseudo-3D -highlights. - -> [!TIP] -> **See also:** -> + [button-type parameter](/ref/skin/param/button-type.md) \ No newline at end of file diff --git a/ref/skin/is-fullscreen.md b/ref/skin/is-fullscreen.md deleted file mode 100644 index a156bfce..00000000 --- a/ref/skin/is-fullscreen.md +++ /dev/null @@ -1,29 +0,0 @@ -## is-fullscreen parameter (skin) -###### BYOND Version 515 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ false - - -True if the window should be in fullscreen mode. This -suppresses `can-resize`, `titlebar`, `is-maximized`, and `is-minimized`. -They will continue to return the values that would apply if fullscreen -mode were turned off. - -> [!TIP] -> **See also:** -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) -> + [is-maximized parameter](/ref/skin/param/is-maximized.md) -> + [is-minimized parameter](/ref/skin/param/is-minimized.md) -> + [size parameter](/ref/skin/param/size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) -> + [screen-pos parameter](/ref/skin/param/screen-pos.md) -> + [screen-size parameter](/ref/skin/param/screen-size.md) \ No newline at end of file diff --git a/ref/skin/is-list.md b/ref/skin/is-list.md deleted file mode 100644 index 9f0e9161..00000000 --- a/ref/skin/is-list.md +++ /dev/null @@ -1,20 +0,0 @@ -## is-list parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -True if the grid is used for a flexible list of items; the -number of columns and rows may change to fit them. - -> [!TIP] -> **See also:** -> + [cells parameter](/ref/skin/param/cells.md) -> + [current-cell parameter](/ref/skin/param/current-cell.md) - diff --git a/ref/skin/is-maximized.md b/ref/skin/is-maximized.md deleted file mode 100644 index a255a3c9..00000000 --- a/ref/skin/is-maximized.md +++ /dev/null @@ -1,26 +0,0 @@ -## is-maximized parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ false - - -True if the window is maximized. - -If `is-fullscreen` is -true, this value represents the state of the window when `is-fullscreen` -is turned off again. - -> [!TIP] -> **See also:** -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [is-minimized parameter](/ref/skin/param/is-minimized.md) -> + [is-fullscreen parameter](/ref/skin/param/is-fullscreen.md) -> + [size parameter](/ref/skin/param/size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) \ No newline at end of file diff --git a/ref/skin/is-minimized.md b/ref/skin/is-minimized.md deleted file mode 100644 index 711a7684..00000000 --- a/ref/skin/is-minimized.md +++ /dev/null @@ -1,25 +0,0 @@ -## is-minimized parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ false - - -True if the window is minimized. - -If `is-fullscreen` is -true, this value represents the state of the window when `is-fullscreen` -is turned off again. - -> [!TIP] -> **See also:** -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [is-maximized parameter](/ref/skin/param/is-maximized.md) -> + [is-fullscreen parameter](/ref/skin/param/is-fullscreen.md) -> + [size parameter](/ref/skin/param/size.md) \ No newline at end of file diff --git a/ref/skin/is-pane.md b/ref/skin/is-pane.md deleted file mode 100644 index c82543cc..00000000 --- a/ref/skin/is-pane.md +++ /dev/null @@ -1,20 +0,0 @@ -## is-pane parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -True if this is a pane that will be used in other container -controls, instead of an independent window. Read-only. - -> [!TIP] -> **See also:** -> + [id parameter](/ref/skin/param/id.md) -> + [Child control](/ref/skin/control/child.md) -> + [Tab control](/ref/skin/control/tab.md) \ No newline at end of file diff --git a/ref/skin/is-password.md b/ref/skin/is-password.md deleted file mode 100644 index 5bba2e19..00000000 --- a/ref/skin/is-password.md +++ /dev/null @@ -1,24 +0,0 @@ -## is-password parameter (skin) - - -**Applies to:** -+ [Input](/ref/skin/control/input.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -Hide text with asterisks. Copy to clipboard is not available in -this mode, but the [text](/ref/skin/param/text.md) parameter can -still read the control\'s contents. -Note: For obvious reasons, you should never use the same password in a -game that you would use anywhere else. - -> [!TIP] -> **See also:** -> + [command parameter](/ref/skin/param/command.md) -> + [multi-line parameter](/ref/skin/param/multi-line.md) -> + [no-command parameter](/ref/skin/param/no-command.md) \ No newline at end of file diff --git a/ref/skin/is-slider.md b/ref/skin/is-slider.md deleted file mode 100644 index c4e559f5..00000000 --- a/ref/skin/is-slider.md +++ /dev/null @@ -1,18 +0,0 @@ -## is-slider parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Make this an adjustable slider capable of being changed by the -user, instead of a progress bar. - -> [!TIP] -> **See also:** -> + [value parameter](/ref/skin/param/value.md) \ No newline at end of file diff --git a/ref/skin/is-transparent.md b/ref/skin/is-transparent.md deleted file mode 100644 index 72b317be..00000000 --- a/ref/skin/is-transparent.md +++ /dev/null @@ -1,19 +0,0 @@ -## is-transparent parameter (skin) -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Make this control transparent. - -Transparency support is -extremely limited. Only some controls can actually use it, and only when -on top of certain other controls. - -Bars and labels handle -transparency reasonably well, when not on top of other controls (or only -on top of other conrols of these types). \ No newline at end of file diff --git a/ref/skin/is-vert.md b/ref/skin/is-vert.md deleted file mode 100644 index 09082c44..00000000 --- a/ref/skin/is-vert.md +++ /dev/null @@ -1,20 +0,0 @@ -## is-vert parameter (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -The splitter between the two panes in this control is vertical. - -> [!TIP] -> **See also:** -> + [left parameter](/ref/skin/param/left.md) -> + [right parameter](/ref/skin/param/right.md) -> + [show-splitter parameter](/ref/skin/param/show-splitter.md) -> + [splitter parameter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/is-visible.md b/ref/skin/is-visible.md deleted file mode 100644 index b7057281..00000000 --- a/ref/skin/is-visible.md +++ /dev/null @@ -1,18 +0,0 @@ -## is-visible parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ true/false - -**Default value:** -+ true - - -True if this control can be seen. The main window should -usually be made visible. - -> [!TIP] -> **See also:** -> + [is-disabled parameter](/ref/skin/param/is-disabled.md) \ No newline at end of file diff --git a/ref/skin/keep-aspect.md b/ref/skin/keep-aspect.md deleted file mode 100644 index ad9d7dba..00000000 --- a/ref/skin/keep-aspect.md +++ /dev/null @@ -1,19 +0,0 @@ -## keep-aspect parameter (skin) - - -**Applies to:** -+ [Label](/ref/skin/control/label.md) -+ [Main](/ref/skin/control/main.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -If stretching a background image, preserve its aspect ratio. - -> [!TIP] -> **See also:** -> + [image parameter](/ref/skin/param/image.md) -> + [image-mode parameter](/ref/skin/param/image-mode.md) \ No newline at end of file diff --git a/ref/skin/label.md b/ref/skin/label.md deleted file mode 100644 index d32587c7..00000000 --- a/ref/skin/label.md +++ /dev/null @@ -1,12 +0,0 @@ -## label control (skin) - - -A text label that appears on the skin. -**Label-specific parameters:** -+ [align](/ref/skin/param/align.md) -+ [allow-html](/ref/skin/param/allow-html.md) -+ [image](/ref/skin/param/image.md) -+ [image-mode](/ref/skin/param/image-mode.md) -+ [keep-aspect](/ref/skin/param/keep-aspect.md) -+ [text](/ref/skin/param/text.md) -+ [text-wrap](/ref/skin/param/text-wrap.md) \ No newline at end of file diff --git a/ref/skin/left.md b/ref/skin/left.md deleted file mode 100644 index 7995bf06..00000000 --- a/ref/skin/left.md +++ /dev/null @@ -1,24 +0,0 @@ -## left, top parameters (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) - -**Format:** -+ string -+ none - -**Default value:** -+ none - - -The [id](/ref/skin/param/id.md) of the left/top pane in -this control. The parameter names `left` and `top` can be used -interchangeably. - -> [!TIP] -> **See also:** -> + [right parameter](/ref/skin/param/right.md) -> + [is-vert parameter](/ref/skin/param/is-vert.md) -> + [show-splitter parameter](/ref/skin/param/show-splitter.md) -> + [splitter parameter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/legacy-size.md b/ref/skin/legacy-size.md deleted file mode 100644 index 3b5f6fa0..00000000 --- a/ref/skin/legacy-size.md +++ /dev/null @@ -1,20 +0,0 @@ -## legacy-size parameter (skin) -###### BYOND Version 512 - - -**Applies to:** -+ [Output](/ref/skin/control/output.md) -**Format:** -+ true/false - -**Default value:** -+ true - - -When true, font sizes are scaled slightly larger for -readability, which is legacy (and default) BYOND behavior. Set to false -for exact font sizing. - -> [!TIP] -> **See also:** -> + [font-size parameter](/ref/skin/param/font-size.md) \ No newline at end of file diff --git a/ref/skin/letterbox.md b/ref/skin/letterbox.md deleted file mode 100644 index 1932f191..00000000 --- a/ref/skin/letterbox.md +++ /dev/null @@ -1,27 +0,0 @@ -## letterbox parameter (skin) -###### BYOND Version 500 - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) - -**Format:** -+ true/false - -**Default value:** -+ true - - -If map auto-scales its icons -([zoom](/ref/skin/param/zoom.md) is 0), make sure the entire map -fits, and fill excess space with the background color. - -If -`letterbox` is not enabled, auto-zoom will fill all available space, and -any excess will be cut off. - -> [!TIP] -> **See also:** -> + [view-size parameter](/ref/skin/param/view-size.md) -> + [zoom parameter](/ref/skin/param/zoom.md) -> + [zoom-mode parameter](/ref/skin/param/zoom-mode.md) \ No newline at end of file diff --git a/ref/skin/line-color.md b/ref/skin/line-color.md deleted file mode 100644 index 984133f4..00000000 --- a/ref/skin/line-color.md +++ /dev/null @@ -1,19 +0,0 @@ -## line-color parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - -**Default value:** -+ #c0c0c0 - - -The color of grid lines. - -> [!TIP] -> **See also:** -> + [background-color parameter](/ref/skin/param/background-color.md) -> + [show-lines parameter](/ref/skin/param/show-lines.md) \ No newline at end of file diff --git a/ref/skin/link-color.md b/ref/skin/link-color.md deleted file mode 100644 index 481e442e..00000000 --- a/ref/skin/link-color.md +++ /dev/null @@ -1,22 +0,0 @@ -## link-color parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -+ [Output](/ref/skin/control/output.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) -+ none - -**Default value:** -+ #0000ff - - -The color used for links. In some controls [visited -links](/ref/skin/param/visited-color.md) may have a different color. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [visited-color parameter](/ref/skin/param/visited-color.md) \ No newline at end of file diff --git a/ref/skin/lock.md b/ref/skin/lock.md deleted file mode 100644 index 7705e123..00000000 --- a/ref/skin/lock.md +++ /dev/null @@ -1,24 +0,0 @@ -## lock parameter (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) -**Possible values:** -+ left -+ right -+ none - -**Default value:** -+ none - - -Allows one pane to "lock" the splitter so if this Child -control is resized, the splitter will stay put on that side. - -> [!TIP] -> **See also:** -> + [left parameter](/ref/skin/param/left.md) -> + [right parameter](/ref/skin/param/right.md) -> + [is-vert parameter](/ref/skin/param/is-vert.md) -> + [show-splitter parameter](/ref/skin/param/show-splitter.md) -> + [splitter parameter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/macro.md b/ref/skin/macro.md deleted file mode 100644 index 926d7b97..00000000 --- a/ref/skin/macro.md +++ /dev/null @@ -1,18 +0,0 @@ -## macro parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ string - - -The [id](/ref/skin/param/id.md) of the macro set this -window will use, if any, when it\'s active. - -> [!TIP] -> **See also:** -> + [Keyboard/gamepad macros](/ref/skin/menu.md) -> + [menu parameter](/ref/skin/param/menu.md) -> + [id parameter](/ref/skin/param/id.md) \ No newline at end of file diff --git a/ref/skin/macros.md b/ref/skin/macros.md index b3ac0051..d920be3c 100644 --- a/ref/skin/macros.md +++ b/ref/skin/macros.md @@ -1,388 +1,31 @@ -## macros (skin) +## macros (info) +*** +Macros are used to convert keyboard and gamepad events into actions. There are two ways this works: A macro can run a command, or in some cases (such as gamepad controls) it can be used to remap one control to another. -Macros are used to convert keyboard and gamepad events into -actions. There are two ways this works: A macro can run a command, or in -some cases (such as gamepad controls) it can be used to remap one -control to another. +A collection of macros is called a macro set, and the window currently in use defines which macro set will be used via its macro parameter. -A collection of macros is called a macro -set, and the window currently in use defines which macro set will be -used via its [macro](/ref/skin/param/macro.md) parameter. +Macros can be changed at runtime. If a macro does not have an id, you can refer to it by its key combination (name). If you have a macro set named `macro1` and have a `Ctrl+E` macro for instance, you could use winset() with `"macro1.Ctrl+E"`. See the Macro control for information on which parameters you can change with `winset()`. +The `name` of the macro is actually the full key combination as it would appear in the macro editor, like `CTRL+E`, `Space+REP`, or `Alt+Shift+F1`. This is not case-specific and it doesn't matter where you put modifiers like `CTRL+`, `SHIFT+`, etc. -Macros can be changed at runtime. If a macro does not have an -[id](/ref/skin/param/id.md) , you can refer to it by its key -combination ([name](/ref/skin/param/name.md) ). If you have a -macro set named `macro1` and have a `Ctrl+E` macro for instance, you -could use [winset()](/ref/proc/winset.md) with `"macro1.Ctrl+E"`. See -the [Macro control](/ref/skin/control/macro.md) for information on which -parameters you can change with `winset()`. +Oftentimes it's desirable to keep track of key presses yourself rather than have a hundred different macros defined. BYOND makes this possible via the `Any` and `Any+UP` macros, which respond to any key or gamepad button. `UP` is the only allowed modifier for this macro, since other modifier keys are handled by this same macro. -The `name` of the -macro is actually the full key combination as it would appear in the -macro editor, like `CTRL+E`, `Space+REP`, or `Alt+Shift+F1`. This is not -case-specific and it doesn\'t matter where you put modifiers like -`CTRL+`, `SHIFT+`, etc. -### The Any macro -###### BYOND Version 511 +Typically, you will want to use set instant=1 on the verbs that will be tied to the Any macro, so that keyboard input doesn't queue up and lag behind. +In the command that goes with this macro, `[[*]]` will be replaced with the name of the key or gamepad button that was pressed/released. (See embedded winget for more details on the `[[...]]` format.) -Oftentimes it\'s desirable to keep track of key presses -yourself rather than have a hundred different macros defined. BYOND -makes this possible via the `Any` and `Any+UP` macros, which respond to -any key or gamepad button. `UP` is the only allowed modifier for this -macro, since other modifier keys are handled by this same macro. +The map-to parameter is used by **mappings**, which are like macros but are used to convert gamepad inputs easily and quickly to keyboard inputs. E.g., `GamepadLeft` can map to `West` which is the left arrow key. A set of default mappings will be added automatically at runtime if you don't include any gamepad mapping in your project. +BYOND will support up to four gamepads, and breaks up their input into the following categories: -Typically, you will want to use [set -instant=1](/ref/verb/set/instant.md) on the verbs that will be tied to -the Any macro, so that keyboard input doesn\'t queue up and lag behind. +See the list of available macros below for information on how to harness these inputs. +To let a user configure their gamepad, you need to call the client-side `.gamepad-mapping` command. Or, if they have access to the Options & Messages window and Dream Seeker's default menus, they can reach it from there. However it's a good idea to make this easy for them to find. Several common gamepads are already known by BYOND. -In the [command](/ref/skin/param/command.md) that goes -with this macro, `[[*]]` will be replaced with the name of the key or -gamepad button that was pressed/released. (See "Embedded Winget" in -[client commands](/ref/skin/commands.md) for more details on the -`[[...]]` format.) -### Mapping {#mapping byondver="511"} +There is also the `GamepadRaw` macro, which is similar to `Any` in some ways and will avoid doing any processing (e.g. checking for dead zones on the analog sticks) so you can handle all input yourself. `GamepadRaw` does not rely on BYOND's controller configuration, so it will not, for instance, know that button 0 should be `GamepadFace1`. See below for more information on how to use this macro. +You can add macros (not local player-defined ones) for any of the mouse input commands, thereby bypassing the normal mouse verbs. This can be helpful for designing custom setups where you don't want to have to parse the normal parameter string that provides most of the info, and instead want to provide data directly to the verb. You will want `set instant=1` on any such verb. -The [map-to](/ref/skin/param/map-to.md) parameter is -used by **mappings**, which are like macros but are used to convert -gamepad inputs easily and quickly to keyboard inputs. E.g., -`GamepadLeft` can map to `West` which is the left arrow key. A set of -default mappings will be added automatically at runtime if you don\'t -include any gamepad mapping in your project. -### Gamepads {#gamepads byondver="511"} - - -BYOND will support up to four gamepads, and breaks up their -input into the following categories: -- **Buttons:** Buttons on the controller that are either pressed or - not pressed. -- **Directions:** Directions pressed on the D-pad, which act like - buttons. Diagonals are also included. -- **D-pad:** The D-pad itself, which can be used to read a - [dir](/ref/atom/var/dir.md) number. -- **Analog:** The analog sticks (BYOND supports left and right). - - -See the list of available macros below for information on how -to harness these inputs. - -To let a user configure their gamepad, -you need to call the client-side `.gamepad-mapping` -[command](/ref/skin/commands.md) . Or, if they have access to the Options -& Messages window and Dream Seeker\'s default menus, they can reach it -from there. However it\'s a good idea to make this easy for them to -find. Several common gamepads are already known by BYOND. - -There -is also the `GamepadRaw` macro, which is similar to `Any` in some ways -and will avoid doing any processing (e.g. checking for dead zones on the -analog sticks) so you can handle all input yourself. `GamepadRaw` does -not rely on BYOND\'s controller configuration, so it will not, for -instance, know that button 0 should be `GamepadFace1`. See below for -more information on how to use this macro. -### Mouse macros {#mouse-macros byondver="514"} - - -You can add macros (not local player-defined ones) for any of -the mouse input commands, thereby bypassing the normal mouse verbs. This -can be helpful for designing custom setups where you don\'t want to have -to parse the normal parameter string that provides most of the info, and -instead want to provide data directly to the verb. You will want -`set instant=1` on any such verb. - -Mouse macro commands use the -`[[...]]` syntax to embed values, just like [embedded -wingets](/ref/skin/commands.md) . These are the values you can include in -a mouse macro: - Embedded keyword Meaning - ------------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------------------- - `action` Name of the mouse action (e.g. MouseDown, MouseMove, etc.). - `src` Object the mouse is touching, or dragging/dropping. - `loc` Turf or statpanel that `src` is over; in a drag-drop you should split this into `src.loc` and `over.loc`. - `button` Mouse button used for this action, if any: `left`, `middle`, or `right`. - `drag` Mouse button currently used for dragging. - `buttons` Mouse buttons currently down or involved in this action, separated by commas. - `keys` Modifier keys currently held (`shift`, `ctrl`, `alt`), separated by commas. - `over` Object the mouse is over in a drag/drop operation. - `id` Control ID; in a drag-drop you should split this into `src.id` and `over.id`. - `icon` The icon offset (starting from 1,1 at the lower left) where the mouse action occurred.^*^ - `tile` The tile where the mouse action occurred, if relevant.^*^ - `vis` Pixel coordinates relative to the icon\'s position on screen (same as `icon` but without taking transform into account).^*^ - `screen_loc` The regular `screen_loc` cordinate string.^*^ - `screen` `screen_loc` coordinates but entirely in pixels starting at 0,0 from lower left.^*^ - `screen_tile` `screen_loc` coordinates but only the tile number starting at 1,1.^*^ - `screen_offset` `screen_loc` coordinates but only the pixel offset from the tile, starting at 0,0.^*^ - `delta` Wheel changes in a mouse wheel command.^*^ - `left`, `right`, `middle` 1 if this button is down or involved in this action, 0 otherwise - `shift`, `ctrl`, `alt` 1 if this modifier key is held, 0 otherwise - `link` 1 if the mouse is over a maptext link, 0 otherwise - `cell` Grid cell involved in a mouse action. In a drag/drop action, `src.cell` is the dragging cell and `over.cell` is the drop cell. - `drag-cell` Alias for `src.cell`. - `drop-cell` Alias for `over.cell`. - ^*^ Coordinate values are comma-separated, but you can follow them with `.x` or `.y` to get the individual X and Y numbers. - - -An example mouse macro command might look like this: -> my-mousedown-verb [[src]] [[button]] "keys=[[keys as params]];drag=[[drag as params]]" - - -And the verb to go with it looks like this: -```dm - -client // "in src" is the same as "in usr.client" here -verb/my_mousedown_verb(object as anything in src, button as text, params -as text) -``` - - -In the example, the `src` value is a -reference such as you would get with the [`ref()` proc](/ref/proc/ref.md) . It -can be used as a verb argument directly and won\'t be enclosed by quotes -by default. The `button` value is a string and the default formatting -will put quotes around it. The `keys` and `drag` values were given the -`as params` format specifier so they would behave as part of a -[parameter list](/ref/proc/list2params.md) - -In drag/drop actions, you -can precede any value with `src` or `over` if there may be different -information for the dragged object and the mouseover object/location. -This also applies to things like `keys`, which by default will be the -currently held keys but you can use `src.keys` to refer to the values -from when the drag began. -### Available macros - - -This is a list of all keys and gamepad events that can be used -in macros. -**Macro modifiers** are part of the macro name, and control the -conditions in which the macro will fire. -Modifier -Meaning -`SHIFT+` -This macro only counts if either Shift key is pressed. -`CTRL+` -This macro only counts if either Ctrl key is pressed. -`ALT+` -This macro only counts if either Alt key is pressed. -`+REP` -If a key/button is held down, this macro repeats. -`+UP` -This macro fires when the key/button is released. -**Keyboard keys** are the garden-variety macros. (This list is abridged -to exclude keys probably no one has.) -Key -Description -`A` - `Z` -Letter key -`0` - `9` -Number key -`Numpad0` - `Numpad9` -Numpad numbers -`North` -Up arrow -`South` -Down arrow -`East` -Right arrow -`West` -Left arrow -`Northwest` -Home key -`Southwest` -End key -`Northeast` -Page Up key -`Southeast` -Page Down key -`Center` -Center key (numpad) -`Return` -Enter / Return key -`Escape` -Esc key -`Tab` -Tab key -`Space` -Space bar -`Back` -Backspace key -`Insert` -Ins key -`Delete` -Del key -`Pause` -Pause key -`Snapshot` -Snapshot / Print Screen key -`LWin` -Left Windows key -`RWin` -Right Windows key -`Apps` -Apps key -`Multiply` -Multiply key -`Add` -Add key -`Subtract` -Subtract key -`Divide` -Divide / Slash key -`Separator` -Separator / Backslash key -`Shift` -Shift key (when not used as a modifier) -`Ctrl` -Ctrl key (when not used as a modifier) -`Alt` -Alt key (when not used as a modifier) -`VolumeMute` -Mute key -`VolumeUp` -Volume up key -`VolumeDown` -Volume down key -`MediaPlayPause` -Play/pause media key -`MediaStop` -Stop media key -`MediaNext` -Next track key -`MediaPrev` -Previous track key -**Special macros** -**`Any`** -A special macro that can run a command on press/release of any key or -gamepad button. `UP` is the only modifier allowed. In the command, -`[[*]]` is replaced with the key/button name.^*^ -**`GamepadRaw`**^*^ -Captures raw input from a gamepad, without regard to the adjustments -done by the Gamepad Setup dialog. In the command, `[[id]]` is replaced -by the name of the button or axis changed ("Button0" through -"Button15" and "Axis0" through "Axis11"), `[[value]]` is replaced -with the value of the button or axis, and `[[*]]` is equivalent to -`[[id]] [[value]]`. - - -^*^ If no gamepad mappings are included in a game\'s -interface, the default mappings are used instead, which will map the -Dpad buttons to the arrow keys. This will cause the Any macro to -register both a gamepad directional button and the mapped key on the -same press. If you plan on using macros to capture gamepad input, you -may wish instead to map any one of the directional buttons to "None", -which will override the default gamepad mappings completely. -**Gamepad buttons**^†^ can use another gamepad button as a modifier (but -not CTRL, SHIFT, ALT), and can be mapped to one or two keyboard keys or -mouse buttons. -Button -Description -`GamepadFace1` -A (Xbox), X (PS), bottom of diamond -`GamepadFace2` -B (Xbox), Circle (PS), right of diamond -`GamepadFace3` -X (Xbox), Square (PS), left of diamond -`GamepadFace4` -Y (Xbox), Triangle (PS), top of diamond -`GamepadL1` -Left top shoulder -`GamepadR1` -Right top shoulder -`GamepadL2` -Left bottom shoulder -`GamepadR2` -Right bottom shoulder -`GamepadSelect` -Select / Back -`GamepadStart` -Start / Forward -`GamepadL3` -Left analog click -`GamepadR3` -Right analog click -Directional buttons: only one can pressed at a time, and the diagonal -buttons are virtual. -`GamepadUp` -Up button -`GamepadDown` -Down button -`GamepadLeft` -Left button -`GamepadRight` -Right button -`GamepadUpLeft` -Up+left virtual button -`GamepadUpRight` -Up+right virtual button -`GamepadDownLeft` -Down+left virtual button -`GamepadDownRight` -Down+right virtual button -**Gamepad analog sticks**^†^ can have commands and/or map to -`GamepadDir`, `GamepadDir4`, or `Mouse`. They can use a gamepad button -as a modifier. In a command, `[[x]]` and `[[y]]` are replaced by -coordinates, and `[[*]]` is replaced by both with a comma for -separation. -`GamepadLeftAnalog` -Left analog stick -`GamepadRightAnalog` -Left analog stick -**Gamepad Dpads**^†‡^ can have commands or are used as mapping targets -for analog sticks. A gamepad button can be used as a modifier. In a -command, `[[*]]` is replaced by a direction number, which can be 0. -`GamepadDir` -Dpad, converted to one of the eight standard directions. -`GamepadDir4` -Dpad, converted to a cardinal direction. - - -^†^ All of the gamepad macros defined above apply to the first -gamepad. BYOND can now support up to four gamepads, and you can replace -Gamepad in the names above with Gamepad2, Gamepad3, or Gamepad4 to -access them. Each gamepad also has its own raw macro (i.e., -Gamepad2Raw). - - -^‡^ If you use a Dpad macro like GamepadDir as a `map-to` -target, you don\'t have to specify gamepad 2-4 in map-to; the mapping -will automatically know that when Gamepad2LeftAnalog is mapped to -GamepadDir, it means Gamepad2Dir. -**Mouse macros** can have commands but not be used as mapping targets. -`MouseDown` -Mouse button pressed (replaces MouseDown verb) -`MouseUp` -Mouse button released (replaces MouseUp verb) -`MouseClick` -A click action has occurred (replaces Click verb) -`MouseDblClick` -A double-click action has occurred (replaces DblClick verb) -`MouseOver` -Mouse has moved over a new icon or entered/exited a control (replaces -MouseEntered and MouseExited verbs) -`MouseMove` -Mouse has moved to a new pixel of the same icon (replaces MouseMove -verb) -`MouseDrag` -Mouse has begin dragging or is over a new drop target (replaces -MouseDrag verb) -`MouseDragMove` -Mouse is dragging and is over a new pixel of the same drop target -(replaces MouseDrag verb in situations where MouseMove would apply) -`MouseDrop` -Mouse drag has been released over a target (replaces MouseDrop verb) -`MouseWheel` -A wheel movement has occurred (replaces MouseWheel verb) -**Mouse targets** can only be used as mapping targets for another macro. -`Mouse` -The mouse cursor, mappable by a gamepad analog stick. -`MouseLeftButton` -Left button, mappable by a gamepad button. -`MouseRightButton` -Right button, mappable by a gamepad button. -`MouseMiddleButton` -Middle button, mappable by a gamepad button. \ No newline at end of file +Mouse macro commands use the `[[...]]` syntax to embed values, just like embedded wingets. These are the values you can include in a mouse macro: +*** \ No newline at end of file diff --git a/ref/skin/main.md b/ref/skin/main.md deleted file mode 100644 index 65054e9b..00000000 --- a/ref/skin/main.md +++ /dev/null @@ -1,43 +0,0 @@ -## main control (skin) - - -A container for other controls. The Main control takes two -forms: a window or a pane. - -A window exists independently and -can be moved around on the screen. A pane has to be used within another -container control such as a [Child](/ref/skin/control/child.md) or [Tab -control](/ref/skin/control/tab.md) . -**Main-specific parameters:** -+ [icon](/ref/skin/param/icon.md) -+ [image](/ref/skin/param/image.md) -+ [image-mode](/ref/skin/param/image-mode.md) -+ [inner-pos](/ref/skin/param/inner-size.md) -+ [inner-size](/ref/skin/param/inner-size.md) -+ [is-pane](/ref/skin/param/is-pane.md) -+ [keep-aspect](/ref/skin/param/keep-aspect.md) -+ [outer-pos](/ref/skin/param/outer-pos.md) -+ [outer-size](/ref/skin/param/outer-size.md) -+ [title](/ref/skin/param/title.md) -+ [on-status](/ref/skin/param/on-status.md) -**Windows only:** -+ [alpha](/ref/skin/param/alpha.md) -+ [can-close](/ref/skin/param/can-close.md) -+ [can-minimize](/ref/skin/param/can-minimize.md) -+ [can-resize](/ref/skin/param/can-resize.md) -+ [is-fullscreen](/ref/skin/param/is-fullscreen.md) -+ [is-maximized](/ref/skin/param/is-maximized.md) -+ [is-minimized](/ref/skin/param/is-minimized.md) -+ [macro](/ref/skin/param/macro.md) -+ [menu](/ref/skin/param/menu.md) -+ [on-close](/ref/skin/param/on-close.md) -+ [screen-pos](/ref/skin/param/screen-pos.md) -+ [screen-size](/ref/skin/param/screen-size.md) -+ [statusbar](/ref/skin/param/statusbar.md) -+ [titlebar](/ref/skin/param/titlebar.md) -+ [transparent-color](/ref/skin/param/transparent-color.md) -**Panes only:** -+ [can-scroll](/ref/skin/param/can-scroll.md) - -The font parameters have no impact on a window\'s statusbar or -titlebar; those are drawn by the operating system. \ No newline at end of file diff --git a/ref/skin/map-to.md b/ref/skin/map-to.md deleted file mode 100644 index 76a8695d..00000000 --- a/ref/skin/map-to.md +++ /dev/null @@ -1,20 +0,0 @@ -## map-to parameter (skin) -###### BYOND Version 511 - - -**Applies to:** -+ [Macro](/ref/skin/control/macro.md) - -**Format:** -+ string - - -The [macro name](/ref/skin/macros.md) (e.g., "SOUTH") of a -key combo, Dpad, mouse button, etc. that this macro maps to. - -> [!TIP] -> **See also:** -> + [macros (skin)](/ref/skin/macros.md) -> + [command parameter](/ref/skin/param/command.md) -> + [id parameter](/ref/skin/param/id.md) -> + [name parameter](/ref/skin/param/name.md) \ No newline at end of file diff --git a/ref/skin/map.md b/ref/skin/map.md deleted file mode 100644 index ae3ab692..00000000 --- a/ref/skin/map.md +++ /dev/null @@ -1,14 +0,0 @@ -## map control (skin) - - -A map that will display icons from the game. -**Map-specific parameters:** -+ [icon-size](/ref/skin/param/icon-size.md) -+ [letterbox](/ref/skin/param/letterbox.md) -+ [on-hide](/ref/skin/param/on-hide.md) -+ [on-show](/ref/skin/param/on-show.md) -+ [style](/ref/skin/param/style.md) -+ [text-mode](/ref/skin/param/text-mode.md) -+ [view-size](/ref/skin/param/view-size.md) -+ [zoom](/ref/skin/param/zoom.md) -+ [zoom-mode](/ref/skin/param/zoom-mode.md) \ No newline at end of file diff --git a/ref/skin/max-lines.md b/ref/skin/max-lines.md deleted file mode 100644 index b6d03323..00000000 --- a/ref/skin/max-lines.md +++ /dev/null @@ -1,15 +0,0 @@ -## max-lines parameter (skin) -**Applies to:** -+ [Output](/ref/skin/control/output.md) -**Format:** -+ number - -**Default value:** -+ 1000 - - -Maximum number of lines before the control drops old text to -make room for more. 0 is no limit. - -An overflow of 5% is -allowed, to reduce flicker. \ No newline at end of file diff --git a/ref/skin/menu.md b/ref/skin/menu.md deleted file mode 100644 index 95688dca..00000000 --- a/ref/skin/menu.md +++ /dev/null @@ -1,17 +0,0 @@ -## menu parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ string - - -The [id](/ref/skin/param/id.md) of the menu this window -will use, if any, when it\'s active. - -> [!TIP] -> **See also:** -> + [macro parameter](/ref/skin/param/macro.md) -> + [id parameter](/ref/skin/param/id.md) \ No newline at end of file diff --git a/ref/skin/multi-line.md b/ref/skin/multi-line.md deleted file mode 100644 index 0d1d5b96..00000000 --- a/ref/skin/multi-line.md +++ /dev/null @@ -1,18 +0,0 @@ -## multi-line parameter (skin) -**Applies to:** -+ [Info](/ref/skin/control/info.md) -+ [Input](/ref/skin/control/input.md) -+ [Tab](/ref/skin/control/tab.md) -**Format:** -+ true/false - -**Default value:** -+ `false`: Input control -+ `true`: Info and Tab controls - - -Input control: Create a multi-line input control. Read-only for -this control. - -Info and Tab controls: Show tabs in multiple rows -if there are too many to fit in a single row. \ No newline at end of file diff --git a/ref/skin/name.md b/ref/skin/name.md deleted file mode 100644 index b0cc83d0..00000000 --- a/ref/skin/name.md +++ /dev/null @@ -1,23 +0,0 @@ -## name parameter (skin) - - -**Applies to:** -+ [Macro](/ref/skin/control/macro.md) -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ string - - -Macro control: The key/gamepad combination such as `R+REP`, -`CTRL+Northwest`, `GamepadLeft`. - -Menu control: This is the menu -item label. A tab character can be used between the name and a keyboard -shortcut, like "Help\\tF1". (Keyboard shortcuts must be implemented as -macros in order to work. This is just a label.) A blank name shows just -a separator. - -> [!TIP] -> **See also:** -> + [macros (skin)](/ref/skin/macros.md) -> + [id parameter](/ref/skin/param/id.md) \ No newline at end of file diff --git a/ref/skin/no-command.md b/ref/skin/no-command.md deleted file mode 100644 index e48ee181..00000000 --- a/ref/skin/no-command.md +++ /dev/null @@ -1,20 +0,0 @@ -## no-command parameter (skin) - - -**Applies to:** -+ [Input](/ref/skin/control/input.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -True if this input control is for typing only; hitting Enter -will not run a command. - -> [!TIP] -> **See also:** -> + [command parameter](/ref/skin/param/command.md) -> + [is-password parameter](/ref/skin/param/is-password.md) -> + [multi-line parameter](/ref/skin/param/multi-line.md) \ No newline at end of file diff --git a/ref/skin/on-blur.md b/ref/skin/on-blur.md deleted file mode 100644 index 406b2200..00000000 --- a/ref/skin/on-blur.md +++ /dev/null @@ -1,17 +0,0 @@ -## on-blur parameter (skin) - - -**Applies to:** -+ [Input](/ref/skin/control/input.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the control -loses focus. - -> [!TIP] -> **See also:** -> + [focus parameter](/ref/skin/param/focus.md) -> + [on-focus parameter](/ref/skin/param/on-focus.md) \ No newline at end of file diff --git a/ref/skin/on-change.md b/ref/skin/on-change.md deleted file mode 100644 index 9499920e..00000000 --- a/ref/skin/on-change.md +++ /dev/null @@ -1,23 +0,0 @@ -## on-change parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the -[value](/ref/skin/param/value.md) of the bar/slider is changed. -If you drag the slider around, the command will not run until you let -go. - -If you include `[[*]]` in the command, it will be replaced -by the control\'s new `value`. (See "Embedded Winget" in [client -commands](/ref/skin/commands.md) for more details on the `[[...]]` -format.) - -> [!TIP] -> **See also:** -> + [value parameter](/ref/skin/param/value.md) \ No newline at end of file diff --git a/ref/skin/on-close.md b/ref/skin/on-close.md deleted file mode 100644 index 3acb0f8d..00000000 --- a/ref/skin/on-close.md +++ /dev/null @@ -1,17 +0,0 @@ -## on-close parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the window is -closed. - -> [!TIP] -> **See also:** -> + [can-close parameter](/ref/skin/param/can-close.md) -> + [on-size parameter](/ref/skin/param/on-size.md) \ No newline at end of file diff --git a/ref/skin/on-focus.md b/ref/skin/on-focus.md deleted file mode 100644 index eb381bd6..00000000 --- a/ref/skin/on-focus.md +++ /dev/null @@ -1,17 +0,0 @@ -## on-focus parameter (skin) - - -**Applies to:** -+ [Input](/ref/skin/control/input.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the control -gains focus. - -> [!TIP] -> **See also:** -> + [focus parameter](/ref/skin/param/focus.md) -> + [on-blur parameter](/ref/skin/param/on-blur.md) \ No newline at end of file diff --git a/ref/skin/on-hide.md b/ref/skin/on-hide.md deleted file mode 100644 index 664cade9..00000000 --- a/ref/skin/on-hide.md +++ /dev/null @@ -1,21 +0,0 @@ -## on-hide parameter (skin) - - -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -+ [Info](/ref/skin/control/info.md) -+ [Map](/ref/skin/control/map.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) xecuted when this control is -hidden by the game. Must be the default control for the game to -show/hide it. - -Currently not editable in Dream Maker. - -> [!TIP] -> **See also:** -> + [on-show parameter](/ref/skin/param/on-show.md) \ No newline at end of file diff --git a/ref/skin/on-show.md b/ref/skin/on-show.md deleted file mode 100644 index 52cbb7d6..00000000 --- a/ref/skin/on-show.md +++ /dev/null @@ -1,21 +0,0 @@ -## on-show parameter (skin) - - -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -+ [Info](/ref/skin/control/info.md) -+ [Map](/ref/skin/control/map.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when this control is -shown by the game. Must be the default control for the game to show/hide -it. - -Currently not editable in Dream Maker. - -> [!TIP] -> **See also:** -> + [on-hide parameter](/ref/skin/param/on-hide.md) \ No newline at end of file diff --git a/ref/skin/on-size.md b/ref/skin/on-size.md deleted file mode 100644 index 1bbc622b..00000000 --- a/ref/skin/on-size.md +++ /dev/null @@ -1,29 +0,0 @@ -## on-size parameter (skin) -###### BYOND Version 482 - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when this control is -resized. If you are dragging a window edge or splitter, the command -won\'t run until you finish. - -No command will be sent in -response to size or splitter changes made by -[winset()](/ref/proc/winset.md) . - -If you include `[[*]]` in the -command, it will be replaced by the control\'s new size. Likewise, -`[[width]]` will be replaced with the width and `[[height]]` with the -height. (See "Embedded Winget" in [client -commands](/ref/skin/commands.md) for more details on the `[[...]]` -format.) - -> [!TIP] -> **See also:** -> + [size parameter](/ref/skin/param/size.md) \ No newline at end of file diff --git a/ref/skin/on-status.md b/ref/skin/on-status.md deleted file mode 100644 index eaa6d2bf..00000000 --- a/ref/skin/on-status.md +++ /dev/null @@ -1,28 +0,0 @@ -## on-status parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the text that -would go in the statusbar is changed. This applies even if this control -is a pane and not a window, or is a window without a statusbar. It -applies to all panes and windows that directly or indirectly contain -whatever control generated the statusbar text (e.g., a map). - -If -you include `[[*]]` in the command, it will be replaced by the new text. -(See "Embedded Winget" in [client commands](/ref/skin/commands.md) for -more details on the `[[...]]` format.) - -`[[from]]` can be used -to reference the control (if any) that generated the next text. You can -also use expressions like `[[from.type]]`, `[[from.parent.pos.x]]`, etc. - -> [!TIP] -> **See also:** -> + [statusbar parameter](/ref/skin/param/statusbar.md) \ No newline at end of file diff --git a/ref/skin/on-tab.md b/ref/skin/on-tab.md deleted file mode 100644 index 099d4556..00000000 --- a/ref/skin/on-tab.md +++ /dev/null @@ -1,23 +0,0 @@ -## on-tab parameter (skin) - - -**Applies to:** -+ [Info](/ref/skin/control/info.md) -+ [Tab](/ref/skin/control/tab.md) - -**Format:** -+ string - - -[Command](/ref/skin/commands.md) executed when the current tab -is changed. - -If you include `[[*]]` in the command, it will be -replaced by the new tab\'s [id](/ref/skin/param/id.md) . (See -"Embedded Winget" in [client commands](/ref/skin/commands.md) for more -details on the `[[...]]` format.) - -> [!TIP] -> **See also:** -> + [current-tab parameter](/ref/skin/param/current-tab.md) -> + [tabs parameter](/ref/skin/param/tabs.md) \ No newline at end of file diff --git a/ref/skin/outer-pos.md b/ref/skin/outer-pos.md deleted file mode 100644 index a9459581..00000000 --- a/ref/skin/outer-pos.md +++ /dev/null @@ -1,21 +0,0 @@ -## outer-pos parameter (skin) -###### BYOND Version 515 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ *x*,*y* - - -Read-only. - -Reads the control\'s current exterior -position *including* titlebar, statusbar, borders, etc. If the window is -not minimized or maximized, this is identical to `pos`. - -> [!TIP] -> **See also:** -> + [pos parameter](/ref/skin/param/pos.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) -> + [inner-pos parameter](/ref/skin/param/inner-pos.md) \ No newline at end of file diff --git a/ref/skin/outer-size.md b/ref/skin/outer-size.md deleted file mode 100644 index bbb63247..00000000 --- a/ref/skin/outer-size.md +++ /dev/null @@ -1,25 +0,0 @@ -## outer-size parameter (skin) -###### BYOND Version 513 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) - -**Format:** -+ *width*x*height* - - -Read-only. - -If the control is a window, this refers to -its current exterior size *including* titlebar, statusbar, borders, etc. -If the window is maximized, this is the maximized size. - -If this -control is a pane and [can-scroll](/ref/skin/param/can-scroll.md) -is true, this is the size of the display area including the scrollbars. - -> [!TIP] -> **See also:** -> + [size parameter](/ref/skin/param/size.md) -> + [inner-size parameter](/ref/skin/param/inner-size.md) \ No newline at end of file diff --git a/ref/skin/output.md b/ref/skin/output.md deleted file mode 100644 index 19a0aa52..00000000 --- a/ref/skin/output.md +++ /dev/null @@ -1,12 +0,0 @@ -## output control (skin) - - -Displays text output. -**Output-specific parameters:** -+ [enable-http-images](/ref/skin/param/enable-http-images.md) -+ [image](/ref/skin/param/image.md) -+ [legacy-size](/ref/skin/param/legacy-size.md) -+ [link-color](/ref/skin/param/link-color.md) -+ [max-lines](/ref/skin/param/max-lines.md) -+ [style](/ref/skin/param/style.md) -+ [visited-color](/ref/skin/param/visited-color.md) \ No newline at end of file diff --git a/ref/skin/param.md b/ref/skin/param.md deleted file mode 100644 index e3c3186e..00000000 --- a/ref/skin/param.md +++ /dev/null @@ -1,26 +0,0 @@ -## parameters (skin) - - -Controls can be interacted with via -[winset()](/ref/proc/winset.md) and [winget()](/ref/proc/winset.md) to -change or read various parameters. - -Parameters come in a few -different formats: -- Boolean: `true` or `false` -- Numeric: any number, sometimes allowing decimal or negative numbers -- String: text -- Position: *x*`,`*y* -- Size: *width*`x`*height* -- Enumerated: one of several text choices, sometimes accepting numbers - or true/false values as shortcuts - - -The list of [all controls](/ref/skin/control.md) which shows -which parameters are universal, and each individual control type lists -additional parameters that apply to that type specifically. - - -Note: In any parameter\'s "Applies to" section, "all" -refers to positionable controls only, not Macro or Menu controls. Macro -and Menu will be listed separately if supported. \ No newline at end of file diff --git a/ref/skin/param/align.md b/ref/skin/param/align.md new file mode 100644 index 00000000..d4476220 --- /dev/null +++ b/ref/skin/param/align.md @@ -0,0 +1,7 @@ + +## align (info) +*** +Default alignment of text/image, both horizontal and vertical. + +A BYOND direction flag like `WEST` may be assigned to this parameter, or 0 for center alignment. +*** \ No newline at end of file diff --git a/ref/skin/param/allow-html.md b/ref/skin/param/allow-html.md new file mode 100644 index 00000000..62b723f5 --- /dev/null +++ b/ref/skin/param/allow-html.md @@ -0,0 +1,7 @@ + +## allow-html (info) +*** +Info control: Allow HTML tags to be used in stat() info. The same limitations apply as to the Grid control. + +Label control: Currently, the label control will not actually use the HTML; it will simply strip it out. Full support may appear in a later version. +*** \ No newline at end of file diff --git a/ref/skin/param/alpha.md b/ref/skin/param/alpha.md new file mode 100644 index 00000000..b38a4326 --- /dev/null +++ b/ref/skin/param/alpha.md @@ -0,0 +1,5 @@ + +## alpha (info) +*** +Opacity of the window, from 0 (invisible) to 255 (opaque). +*** \ No newline at end of file diff --git a/ref/skin/param/anchor.md b/ref/skin/param/anchor.md new file mode 100644 index 00000000..529e4c26 --- /dev/null +++ b/ref/skin/param/anchor.md @@ -0,0 +1,9 @@ + +## anchor (info) +*** +Anchors the control within the window or pane. If the anchor is not `none`, it is expressed as pecentages of the container's width and height. For example, an anchor of 100,100 means that the X and Y position are tied to the lower right of the container, and 50,0 is tied to the top center. + +Setting only `anchor1` will control the position of the control but won't affect its size. + +Setting `anchor2` as well will allow you to stretch the control as the container's size changes. You can think of this `anchor1` controlling the top left corner, and `anchor2` the bottom right corner. +*** \ No newline at end of file diff --git a/ref/skin/param/angle.md b/ref/skin/param/angle.md new file mode 100644 index 00000000..9876fcd6 --- /dev/null +++ b/ref/skin/param/angle.md @@ -0,0 +1,5 @@ + +## angle (info) +*** +The angle of the bar control's arc when its dir is `clockwise` or `counterclockwise`. Angles are measured clockwise from due north, so 0 is north, 90 is east, and so on. `angle1` is the beginning of the arc, and `angle2` is the end. +*** \ No newline at end of file diff --git a/ref/skin/param/auto-format.md b/ref/skin/param/auto-format.md new file mode 100644 index 00000000..c3ac48e5 --- /dev/null +++ b/ref/skin/param/auto-format.md @@ -0,0 +1,9 @@ + +## auto-format (info) +*** + +> [!WARNING] +> +> > [!NOTE] +> > This parameter only existed to inject compatibility scripts into very old versions of the embedded browser. It is no longer used. +*** \ No newline at end of file diff --git a/ref/skin/param/background-color.md b/ref/skin/param/background-color.md new file mode 100644 index 00000000..495462f3 --- /dev/null +++ b/ref/skin/param/background-color.md @@ -0,0 +1,5 @@ + +## background-color (info) +*** +The control's background color. The exact way this applies depends on the control. +*** \ No newline at end of file diff --git a/ref/skin/param/bar-color.md b/ref/skin/param/bar-color.md new file mode 100644 index 00000000..9ae221d5 --- /dev/null +++ b/ref/skin/param/bar-color.md @@ -0,0 +1,5 @@ + +## bar-color (info) +*** +The color of the bar or slider. +*** \ No newline at end of file diff --git a/ref/skin/param/border.md b/ref/skin/param/border.md new file mode 100644 index 00000000..ddede249 --- /dev/null +++ b/ref/skin/param/border.md @@ -0,0 +1,5 @@ + +## border (info) +*** +Border type around the control or window. May not work the same in all controls. +*** \ No newline at end of file diff --git a/ref/skin/param/button-type.md b/ref/skin/param/button-type.md new file mode 100644 index 00000000..c36c1f2d --- /dev/null +++ b/ref/skin/param/button-type.md @@ -0,0 +1,5 @@ + +## button-type (info) +*** +Changes the type of button. +*** \ No newline at end of file diff --git a/ref/skin/param/can-check.md b/ref/skin/param/can-check.md new file mode 100644 index 00000000..d74d1fa6 --- /dev/null +++ b/ref/skin/param/can-check.md @@ -0,0 +1,5 @@ + +## can-check (info) +*** +If true, this menu item is toggled like a checkbox or radio button when clicked. +*** \ No newline at end of file diff --git a/ref/skin/param/can-close.md b/ref/skin/param/can-close.md new file mode 100644 index 00000000..5878587d --- /dev/null +++ b/ref/skin/param/can-close.md @@ -0,0 +1,5 @@ + +## can-close (info) +*** +Allow the window to be closed, and also shows a system menu for the window. +*** \ No newline at end of file diff --git a/ref/skin/param/can-minimize.md b/ref/skin/param/can-minimize.md new file mode 100644 index 00000000..70396262 --- /dev/null +++ b/ref/skin/param/can-minimize.md @@ -0,0 +1,5 @@ + +## can-minimize (info) +*** +Allow the window to be minimized. +*** \ No newline at end of file diff --git a/ref/skin/param/can-resize.md b/ref/skin/param/can-resize.md new file mode 100644 index 00000000..343a17b1 --- /dev/null +++ b/ref/skin/param/can-resize.md @@ -0,0 +1,7 @@ + +## can-resize (info) +*** +Allow the window to be resized or maximized. + +If `is-fullscreen` is true, `can-resize` is ignored, so this value represents the state of the window when `is-fullscreen` is turned off again. +*** \ No newline at end of file diff --git a/ref/skin/param/can-scroll.md b/ref/skin/param/can-scroll.md new file mode 100644 index 00000000..e879d66d --- /dev/null +++ b/ref/skin/param/can-scroll.md @@ -0,0 +1,5 @@ + +## can-scroll (info) +*** +Allow this pane to retain its horizontal and/or vertical size and show scrollbars if necessary, instead of shrinking to fit the container. +*** \ No newline at end of file diff --git a/ref/skin/param/cell-span.md b/ref/skin/param/cell-span.md new file mode 100644 index 00000000..86ffb563 --- /dev/null +++ b/ref/skin/param/cell-span.md @@ -0,0 +1,5 @@ + +## cell-span (info) +*** +The span of the current grid cell; it can be merged with cells to the right and down. If `is-list` is true, this setting is ignored. This setting is only available at runtime. +*** \ No newline at end of file diff --git a/ref/skin/param/cells.md b/ref/skin/param/cells.md new file mode 100644 index 00000000..974dd37c --- /dev/null +++ b/ref/skin/param/cells.md @@ -0,0 +1,7 @@ + +## cells (info) +*** +The number of columns and rows in the grid. Using -1 for either columns or rows will leave that value unchanged. + +If is-list is true, this value can be set to a single number. +*** \ No newline at end of file diff --git a/ref/skin/param/command.md b/ref/skin/param/command.md new file mode 100644 index 00000000..c514f577 --- /dev/null +++ b/ref/skin/param/command.md @@ -0,0 +1,7 @@ + +## command (info) +*** +Command executed when this control is activated. + +For the Input control, whatever the user types in follows this command. If your command starts with an exclamation point `!`, everything after the `!` is shown as a default prompt that may be cleared by the user. +*** \ No newline at end of file diff --git a/ref/skin/param/current-cell.md b/ref/skin/param/current-cell.md new file mode 100644 index 00000000..593bcbb8 --- /dev/null +++ b/ref/skin/param/current-cell.md @@ -0,0 +1,7 @@ + +## current-cell (info) +*** +The active cell. Any output sent to the grid, that is not sent to a specific cell, will go into this cell. + +If is-list is true, this value can be set to a single number. +*** \ No newline at end of file diff --git a/ref/skin/param/current-tab.md b/ref/skin/param/current-tab.md new file mode 100644 index 00000000..bdb28e87 --- /dev/null +++ b/ref/skin/param/current-tab.md @@ -0,0 +1,5 @@ + +## current-tab (info) +*** +The name of the pane in the active/default tab. If set to a pane that is not currently in this tab control, the pane by that name will be added as another tab. +*** \ No newline at end of file diff --git a/ref/skin/param/dir.md b/ref/skin/param/dir.md new file mode 100644 index 00000000..5237ac46 --- /dev/null +++ b/ref/skin/param/dir.md @@ -0,0 +1,7 @@ + +## dir (info) +*** +The direction/orientation of the bar. As the value increases the bar will move further in this direction. + +Shorthand values like `cw` and `ccw` can be used, or also numerical BYOND directions. +*** \ No newline at end of file diff --git a/ref/skin/param/dpi.md b/ref/skin/param/dpi.md new file mode 100644 index 00000000..732f4c71 --- /dev/null +++ b/ref/skin/param/dpi.md @@ -0,0 +1,9 @@ + +## dpi (info) +*** +Read-only and unlisted parameter that returns the DPI scaling factor. A value of 1 indicates 100%. This is currently system-wide for the whole application and won't vary by window, but is implemented for windows in case future scaling changes allow them to differ. + +This is also a special global parameter. Calling winget() with no `id` and `dpi` as the parameter will return the system DPI scaling. + +Note: The DPI scale is currently set at the time Dream Seeker starts, and does not change after that. +*** \ No newline at end of file diff --git a/ref/skin/param/drop-zone.md b/ref/skin/param/drop-zone.md new file mode 100644 index 00000000..c1c977d3 --- /dev/null +++ b/ref/skin/param/drop-zone.md @@ -0,0 +1,9 @@ + +## drop-zone (info) +*** +True if dragged objects may be dropped here. Default is true for Map, Info, and Grid controls, false for others. When in use, this will be the value of the `over_control` argument in MouseDrop() if you drop an atom here. + +Grids can also add `drag-cell` and `drop-cell` to mouse proc parameters. The mouse procs' `src_location` and `over_location` arguments are in the form `"[column],[row]"` (or `"[item"]` if is-list is true) when dragging to/from a grid cell. + +In Info controls, `src_location` and `over_location` in mouse procs will be the name of the statpanel tab. +*** \ No newline at end of file diff --git a/ref/skin/param/enable-http-images.md b/ref/skin/param/enable-http-images.md new file mode 100644 index 00000000..352ae65c --- /dev/null +++ b/ref/skin/param/enable-http-images.md @@ -0,0 +1,5 @@ + +## enable-http-images (info) +*** +Allows images to be pulled from the Web when using the `<img>` tag; otherwise only locally stored images can be shown. +*** \ No newline at end of file diff --git a/ref/skin/param/flash.md b/ref/skin/param/flash.md new file mode 100644 index 00000000..52d8ce87 --- /dev/null +++ b/ref/skin/param/flash.md @@ -0,0 +1,5 @@ + +## flash (info) +*** +Set to a positive number to make the window flash that many times, -1 to flash forever, and 0 to stop flashing. +*** \ No newline at end of file diff --git a/ref/skin/param/focus.md b/ref/skin/param/focus.md new file mode 100644 index 00000000..4a6b6783 --- /dev/null +++ b/ref/skin/param/focus.md @@ -0,0 +1,7 @@ + +## focus (info) +*** +This parameter is true if this control currently has focus. + +This is also a special read-only global parameter. Calling winget() with no `id` and `focus` as the parameter will return the id of the currently focused control, if any. +*** \ No newline at end of file diff --git a/ref/skin/param/font-family.md b/ref/skin/param/font-family.md new file mode 100644 index 00000000..308aa609 --- /dev/null +++ b/ref/skin/param/font-family.md @@ -0,0 +1,17 @@ + +## font-family (info) +*** +Leave blank to use the default font. This can be used for CSS-style fallback fonts, e.g. "Arial,Helvetica". + +You can include fonts in your resource file, making them available to the client, like so: + + +```dm + +var/list/extra_resources = list(\ + 'myfont.ttf', + 'myfont_bold.ttf') + +``` + +*** \ No newline at end of file diff --git a/ref/skin/param/font-size.md b/ref/skin/param/font-size.md new file mode 100644 index 00000000..bf7dd2fc --- /dev/null +++ b/ref/skin/param/font-size.md @@ -0,0 +1,7 @@ + +## font-size (info) +*** +Point size of the font, or leave at 0 for the default size. + +The Output control behaves differently for legacy reasons, unless legacy-size is false. +*** \ No newline at end of file diff --git a/ref/skin/param/font-style.md b/ref/skin/param/font-style.md new file mode 100644 index 00000000..23adf1a8 --- /dev/null +++ b/ref/skin/param/font-style.md @@ -0,0 +1,5 @@ + +## font-style (info) +*** +Sets the font style. Any combination of the above values may be used, or none of them. Multiple values may be separated by spaces or commas. +*** \ No newline at end of file diff --git a/ref/skin/param/group.md b/ref/skin/param/group.md new file mode 100644 index 00000000..128bcd70 --- /dev/null +++ b/ref/skin/param/group.md @@ -0,0 +1,7 @@ + +## group (info) +*** +Used for "radio" buttons and menu items, where only one of them in the same group may be checked at a time. This value is a text string, or may be left empty. + +Buttons in different windows/panes, or menu items in another menu/submenu, are always treated as a different group. +*** \ No newline at end of file diff --git a/ref/skin/param/has-stats.md b/ref/skin/param/has-stats.md new file mode 100644 index 00000000..7c2a6e0e --- /dev/null +++ b/ref/skin/param/has-stats.md @@ -0,0 +1,7 @@ + +## has-stats (info) +*** +True if this info control contains the statpanels created via stat() and statpanel(). + +Only one info control can have statpanels. +*** \ No newline at end of file diff --git a/ref/skin/param/has-verbs.md b/ref/skin/param/has-verbs.md new file mode 100644 index 00000000..2f8b0342 --- /dev/null +++ b/ref/skin/param/has-verbs.md @@ -0,0 +1,7 @@ + +## has-verbs (info) +*** +True if this info control contains the verbs used in the game. + +Currently only one info control can have verbs. +*** \ No newline at end of file diff --git a/ref/skin/param/highlight-color.md b/ref/skin/param/highlight-color.md new file mode 100644 index 00000000..2cb732a0 --- /dev/null +++ b/ref/skin/param/highlight-color.md @@ -0,0 +1,5 @@ + +## highlight-color (info) +*** +The color used to highlight moused-over statpanel items or verbs. In grids, this color is used when hovering over objects or links. +*** \ No newline at end of file diff --git a/ref/skin/param/icon-size.md b/ref/skin/param/icon-size.md new file mode 100644 index 00000000..05614982 --- /dev/null +++ b/ref/skin/param/icon-size.md @@ -0,0 +1,11 @@ + +## icon-size (info) +*** +Size, in pixels, of icons on the map. A size of 0 stretches to fit available space. + + +> [!WARNING] +> +> > [!NOTE] +> > This parameter has been deprecated. Use zoom instead. +*** \ No newline at end of file diff --git a/ref/skin/param/icon.md b/ref/skin/param/icon.md new file mode 100644 index 00000000..73d3eb75 --- /dev/null +++ b/ref/skin/param/icon.md @@ -0,0 +1,9 @@ + +## icon (info) +*** +Custom icon used for the window. If no icon is specified, the Dream Seeker icon is used by windows by default. + +If this control is a pane, its icon will appear on the tab if the pane is inside a tab control. Lack of an icon will mean no icon appears in the tab. + +Note: The Windows `.ico` format is not used. Only image formats BYOND can already use are supported. +*** \ No newline at end of file diff --git a/ref/skin/param/id.md b/ref/skin/param/id.md new file mode 100644 index 00000000..73b7942c --- /dev/null +++ b/ref/skin/param/id.md @@ -0,0 +1,9 @@ + +## id (info) +*** +The name of this control. Read-only. + +If this is a Main control, the name should always be unique. For others, it is usually still a good idea to use a unique name, but they can be referenced by *window*.*id* at runtime. + +You can use a colon in front of the type to refer to the default control of a certain type, if one exists, e.g. `:map` is the default map. +*** \ No newline at end of file diff --git a/ref/skin/param/image-mode.md b/ref/skin/param/image-mode.md new file mode 100644 index 00000000..c7de0289 --- /dev/null +++ b/ref/skin/param/image-mode.md @@ -0,0 +1,5 @@ + +## image-mode (info) +*** +Determines how the background image is displayed. +*** \ No newline at end of file diff --git a/ref/skin/param/image.md b/ref/skin/param/image.md new file mode 100644 index 00000000..1bb712b4 --- /dev/null +++ b/ref/skin/param/image.md @@ -0,0 +1,11 @@ + +## image (info) +*** +A background image to show in this control. + +In the Output control this image is always tiled. + +Note: Icons displayed in the output control will not show the background image underneath their transparent parts, but will instead show the background color. + +For Label and Main, use image-mode to control how the image is displayed. +*** \ No newline at end of file diff --git a/ref/skin/param/index.md b/ref/skin/param/index.md new file mode 100644 index 00000000..f29b7ec9 --- /dev/null +++ b/ref/skin/param/index.md @@ -0,0 +1,5 @@ + +## index (info) +*** +Moves the menu item to the *N*th position among its siblings. 0 or less is no change. Write-only. +*** \ No newline at end of file diff --git a/ref/skin/param/inner-mouse-pos.md b/ref/skin/param/inner-mouse-pos.md new file mode 100644 index 00000000..e5ad87d5 --- /dev/null +++ b/ref/skin/param/inner-mouse-pos.md @@ -0,0 +1,11 @@ + +## inner-mouse-pos (info) +*** +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, not including the control's borders. + +`mouse-pos` is an alias for `inner-mouse-pos`. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending `*` as the parameter in winget(). +*** \ No newline at end of file diff --git a/ref/skin/param/inner-pos.md b/ref/skin/param/inner-pos.md new file mode 100644 index 00000000..14071046 --- /dev/null +++ b/ref/skin/param/inner-pos.md @@ -0,0 +1,7 @@ + +## inner-pos (info) +*** +Read-only. + +Reads the position where the window's interior contents begin (i.e., not counting titlebar, statusbar, borders, etc.), relative to its `outer-pos`. +*** \ No newline at end of file diff --git a/ref/skin/param/inner-size.md b/ref/skin/param/inner-size.md new file mode 100644 index 00000000..cca6a4e3 --- /dev/null +++ b/ref/skin/param/inner-size.md @@ -0,0 +1,9 @@ + +## inner-size (info) +*** +Read-only. + +If the control is a window, this refers to its current interior size: i.e., not counting titlebar, statusbar, borders, etc. If it's maximized, this will be the true size of the window interior, as opposed to `size` which is the interior size once this window is no longer maximized. + +If this control is a pane and can-scroll is true, this is the size of the display area not including the scrollbars. +*** \ No newline at end of file diff --git a/ref/skin/param/is-checked.md b/ref/skin/param/is-checked.md new file mode 100644 index 00000000..705e51a5 --- /dev/null +++ b/ref/skin/param/is-checked.md @@ -0,0 +1,5 @@ + +## is-checked (info) +*** +True if the button or menu item is checked. Menu items can set this even if can-check is false. +*** \ No newline at end of file diff --git a/ref/skin/param/is-default.md b/ref/skin/param/is-default.md new file mode 100644 index 00000000..a9866d92 --- /dev/null +++ b/ref/skin/param/is-default.md @@ -0,0 +1,9 @@ + +## is-default (info) +*** +Specifies that this is a default control. This should be true for your main window, and for your primary map, info, output, input, and browser controls. + +The default control of a given type can be referenced in winset() and other skin-related procs by the name `":*type*"`, e.g. `":map"`. + +Changing this value at runtime should be avoided, especially for windows. Results may be unpredictable. +*** \ No newline at end of file diff --git a/ref/skin/param/is-disabled.md b/ref/skin/param/is-disabled.md new file mode 100644 index 00000000..0c132d4d --- /dev/null +++ b/ref/skin/param/is-disabled.md @@ -0,0 +1,5 @@ + +## is-disabled (info) +*** +Disables the control, menu item, or macro. +*** \ No newline at end of file diff --git a/ref/skin/param/is-flat.md b/ref/skin/param/is-flat.md new file mode 100644 index 00000000..cc15637c --- /dev/null +++ b/ref/skin/param/is-flat.md @@ -0,0 +1,5 @@ + +## is-flat (info) +*** +Gives this button a flat appearance instead of pseudo-3D highlights. +*** \ No newline at end of file diff --git a/ref/skin/param/is-fullscreen.md b/ref/skin/param/is-fullscreen.md new file mode 100644 index 00000000..c0c78f2e --- /dev/null +++ b/ref/skin/param/is-fullscreen.md @@ -0,0 +1,5 @@ + +## is-fullscreen (info) +*** +True if the window should be in fullscreen mode. This suppresses `can-resize`, `titlebar`, `is-maximized`, and `is-minimized`. They will continue to return the values that would apply if fullscreen mode were turned off. +*** \ No newline at end of file diff --git a/ref/skin/param/is-list.md b/ref/skin/param/is-list.md new file mode 100644 index 00000000..8f5ef837 --- /dev/null +++ b/ref/skin/param/is-list.md @@ -0,0 +1,5 @@ + +## is-list (info) +*** +True if the grid is used for a flexible list of items; the number of columns and rows may change to fit them. +*** \ No newline at end of file diff --git a/ref/skin/param/is-maximized.md b/ref/skin/param/is-maximized.md new file mode 100644 index 00000000..eac902ec --- /dev/null +++ b/ref/skin/param/is-maximized.md @@ -0,0 +1,7 @@ + +## is-maximized (info) +*** +True if the window is maximized. + +If `is-fullscreen` is true, this value represents the state of the window when `is-fullscreen` is turned off again. +*** \ No newline at end of file diff --git a/ref/skin/param/is-minimized.md b/ref/skin/param/is-minimized.md new file mode 100644 index 00000000..2770c44e --- /dev/null +++ b/ref/skin/param/is-minimized.md @@ -0,0 +1,7 @@ + +## is-minimized (info) +*** +True if the window is minimized. + +If `is-fullscreen` is true, this value represents the state of the window when `is-fullscreen` is turned off again. +*** \ No newline at end of file diff --git a/ref/skin/param/is-pane.md b/ref/skin/param/is-pane.md new file mode 100644 index 00000000..c00c857d --- /dev/null +++ b/ref/skin/param/is-pane.md @@ -0,0 +1,5 @@ + +## is-pane (info) +*** +True if this is a pane that will be used in other container controls, instead of an independent window. Read-only. +*** \ No newline at end of file diff --git a/ref/skin/param/is-password.md b/ref/skin/param/is-password.md new file mode 100644 index 00000000..980a66e4 --- /dev/null +++ b/ref/skin/param/is-password.md @@ -0,0 +1,9 @@ + +## is-password (info) +*** +Hide text with asterisks. Copy to clipboard is not available in this mode, but the text parameter can still read the control's contents. + + +> [!CAUTION] +> Note: For obvious reasons, you should never use the same password in a game that you would use anywhere else. +*** \ No newline at end of file diff --git a/ref/skin/param/is-slider.md b/ref/skin/param/is-slider.md new file mode 100644 index 00000000..b3cd8d21 --- /dev/null +++ b/ref/skin/param/is-slider.md @@ -0,0 +1,5 @@ + +## is-slider (info) +*** +Make this an adjustable slider capable of being changed by the user, instead of a progress bar. +*** \ No newline at end of file diff --git a/ref/skin/param/is-transparent.md b/ref/skin/param/is-transparent.md new file mode 100644 index 00000000..e951b330 --- /dev/null +++ b/ref/skin/param/is-transparent.md @@ -0,0 +1,9 @@ + +## is-transparent (info) +*** +Make this control transparent. + +Transparency support is extremely limited. Only some controls can actually use it, and only when on top of certain other controls. + +Bars and labels handle transparency reasonably well, when not on top of other controls (or only on top of other conrols of these types). +*** \ No newline at end of file diff --git a/ref/skin/param/is-vert.md b/ref/skin/param/is-vert.md new file mode 100644 index 00000000..e404f564 --- /dev/null +++ b/ref/skin/param/is-vert.md @@ -0,0 +1,5 @@ + +## is-vert (info) +*** +The splitter between the two panes in this control is vertical. +*** \ No newline at end of file diff --git a/ref/skin/param/is-visible.md b/ref/skin/param/is-visible.md new file mode 100644 index 00000000..a75a398d --- /dev/null +++ b/ref/skin/param/is-visible.md @@ -0,0 +1,5 @@ + +## is-visible (info) +*** +True if this control can be seen. The main window should usually be made visible. +*** \ No newline at end of file diff --git a/ref/skin/param/keep-aspect.md b/ref/skin/param/keep-aspect.md new file mode 100644 index 00000000..405e1579 --- /dev/null +++ b/ref/skin/param/keep-aspect.md @@ -0,0 +1,5 @@ + +## keep-aspect (info) +*** +If stretching a background image, preserve its aspect ratio. +*** \ No newline at end of file diff --git a/ref/skin/param/left.md b/ref/skin/param/left.md new file mode 100644 index 00000000..45bc5f4c --- /dev/null +++ b/ref/skin/param/left.md @@ -0,0 +1,5 @@ + +## left (info) +*** +The id of the left/top pane in this control. The parameter names `left` and `top` can be used interchangeably. +*** \ No newline at end of file diff --git a/ref/skin/param/legacy-size.md b/ref/skin/param/legacy-size.md new file mode 100644 index 00000000..feab4b8a --- /dev/null +++ b/ref/skin/param/legacy-size.md @@ -0,0 +1,5 @@ + +## legacy-size (info) +*** +When true, font sizes are scaled slightly larger for readability, which is legacy (and default) BYOND behavior. Set to false for exact font sizing. +*** \ No newline at end of file diff --git a/ref/skin/param/letterbox.md b/ref/skin/param/letterbox.md new file mode 100644 index 00000000..1fc3b17a --- /dev/null +++ b/ref/skin/param/letterbox.md @@ -0,0 +1,7 @@ + +## letterbox (info) +*** +If map auto-scales its icons (zoom is 0), make sure the entire map fits, and fill excess space with the background color. + +If `letterbox` is not enabled, auto-zoom will fill all available space, and any excess will be cut off. +*** \ No newline at end of file diff --git a/ref/skin/param/line-color.md b/ref/skin/param/line-color.md new file mode 100644 index 00000000..c4f35bc9 --- /dev/null +++ b/ref/skin/param/line-color.md @@ -0,0 +1,5 @@ + +## line-color (info) +*** +The color of grid lines. +*** \ No newline at end of file diff --git a/ref/skin/param/link-color.md b/ref/skin/param/link-color.md new file mode 100644 index 00000000..7786c391 --- /dev/null +++ b/ref/skin/param/link-color.md @@ -0,0 +1,5 @@ + +## link-color (info) +*** +The color used for links. In some controls visited links may have a different color. +*** \ No newline at end of file diff --git a/ref/skin/param/lock.md b/ref/skin/param/lock.md new file mode 100644 index 00000000..7bb176ef --- /dev/null +++ b/ref/skin/param/lock.md @@ -0,0 +1,5 @@ + +## lock (info) +*** +Allows one pane to "lock" the splitter so if this Child control is resized, the splitter will stay put on that side. +*** \ No newline at end of file diff --git a/ref/skin/param/macro.md b/ref/skin/param/macro.md new file mode 100644 index 00000000..67bb3210 --- /dev/null +++ b/ref/skin/param/macro.md @@ -0,0 +1,5 @@ + +## macro (info) +*** +The id of the macro set this window will use, if any, when it's active. +*** \ No newline at end of file diff --git a/ref/skin/param/map-to.md b/ref/skin/param/map-to.md new file mode 100644 index 00000000..41cb56f4 --- /dev/null +++ b/ref/skin/param/map-to.md @@ -0,0 +1,5 @@ + +## map-to (info) +*** +The macro name (e.g., "SOUTH") of a key combo, Dpad, mouse button, etc. that this macro maps to. +*** \ No newline at end of file diff --git a/ref/skin/param/max-lines.md b/ref/skin/param/max-lines.md new file mode 100644 index 00000000..4b8b4fd8 --- /dev/null +++ b/ref/skin/param/max-lines.md @@ -0,0 +1,7 @@ + +## max-lines (info) +*** +Maximum number of lines before the control drops old text to make room for more. 0 is no limit. + +An overflow of 5% is allowed, to reduce flicker. +*** \ No newline at end of file diff --git a/ref/skin/param/menu.md b/ref/skin/param/menu.md new file mode 100644 index 00000000..e53f135f --- /dev/null +++ b/ref/skin/param/menu.md @@ -0,0 +1,5 @@ + +## menu (info) +*** +The id of the menu this window will use, if any, when it's active. +*** \ No newline at end of file diff --git a/ref/skin/param/multi-line.md b/ref/skin/param/multi-line.md new file mode 100644 index 00000000..75ca3284 --- /dev/null +++ b/ref/skin/param/multi-line.md @@ -0,0 +1,7 @@ + +## multi-line (info) +*** +Input control: Create a multi-line input control. Read-only for this control. + +Info and Tab controls: Show tabs in multiple rows if there are too many to fit in a single row. +*** \ No newline at end of file diff --git a/ref/skin/param/name.md b/ref/skin/param/name.md new file mode 100644 index 00000000..a487a9e6 --- /dev/null +++ b/ref/skin/param/name.md @@ -0,0 +1,7 @@ + +## name (info) +*** +Macro control: The key/gamepad combination such as `R+REP`, `CTRL+Northwest`, `GamepadLeft`. + +Menu control: This is the menu item label. A tab character can be used between the name and a keyboard shortcut, like "Help\tF1". (Keyboard shortcuts must be implemented as macros in order to work. This is just a label.) A blank name shows just a separator. +*** \ No newline at end of file diff --git a/ref/skin/param/no-command.md b/ref/skin/param/no-command.md new file mode 100644 index 00000000..94b57d7f --- /dev/null +++ b/ref/skin/param/no-command.md @@ -0,0 +1,5 @@ + +## no-command (info) +*** +True if this input control is for typing only; hitting Enter will not run a command. +*** \ No newline at end of file diff --git a/ref/skin/param/on-blur.md b/ref/skin/param/on-blur.md new file mode 100644 index 00000000..535d70de --- /dev/null +++ b/ref/skin/param/on-blur.md @@ -0,0 +1,5 @@ + +## on-blur (info) +*** +Command executed when the control loses focus. +*** \ No newline at end of file diff --git a/ref/skin/param/on-change.md b/ref/skin/param/on-change.md new file mode 100644 index 00000000..aba22b9d --- /dev/null +++ b/ref/skin/param/on-change.md @@ -0,0 +1,7 @@ + +## on-change (info) +*** +Command executed when the value of the bar/slider is changed. If you drag the slider around, the command will not run until you let go. + +If you include `[[*]]` in the command, it will be replaced by the control's new `value`. (See embedded winget for more details on the `[[...]]` format.) +*** \ No newline at end of file diff --git a/ref/skin/param/on-close.md b/ref/skin/param/on-close.md new file mode 100644 index 00000000..d9977556 --- /dev/null +++ b/ref/skin/param/on-close.md @@ -0,0 +1,5 @@ + +## on-close (info) +*** +Command executed when the window is closed. +*** \ No newline at end of file diff --git a/ref/skin/param/on-focus.md b/ref/skin/param/on-focus.md new file mode 100644 index 00000000..662c4dc5 --- /dev/null +++ b/ref/skin/param/on-focus.md @@ -0,0 +1,5 @@ + +## on-focus (info) +*** +Command executed when the control gains focus. +*** \ No newline at end of file diff --git a/ref/skin/param/on-hide.md b/ref/skin/param/on-hide.md new file mode 100644 index 00000000..931b5f98 --- /dev/null +++ b/ref/skin/param/on-hide.md @@ -0,0 +1,7 @@ + +## on-hide (info) +*** +Commandexecuted when this control is hidden by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. +*** \ No newline at end of file diff --git a/ref/skin/param/on-show.md b/ref/skin/param/on-show.md new file mode 100644 index 00000000..0710d9c7 --- /dev/null +++ b/ref/skin/param/on-show.md @@ -0,0 +1,7 @@ + +## on-show (info) +*** +Command executed when this control is shown by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. +*** \ No newline at end of file diff --git a/ref/skin/param/on-size.md b/ref/skin/param/on-size.md new file mode 100644 index 00000000..5164b18b --- /dev/null +++ b/ref/skin/param/on-size.md @@ -0,0 +1,9 @@ + +## on-size (info) +*** +Command executed when this control is resized. If you are dragging a window edge or splitter, the command won't run until you finish. + +No command will be sent in response to size or splitter changes made by winset(). + +If you include `[[*]]` in the command, it will be replaced by the control's new size. Likewise, `[[width]]` will be replaced with the width and `[[height]]` with the height. (See embedded winget for more details on the `[[...]]` format.) +*** \ No newline at end of file diff --git a/ref/skin/param/on-status.md b/ref/skin/param/on-status.md new file mode 100644 index 00000000..3fde8c30 --- /dev/null +++ b/ref/skin/param/on-status.md @@ -0,0 +1,9 @@ + +## on-status (info) +*** +Command executed when the text that would go in the statusbar is changed. This applies even if this control is a pane and not a window, or is a window without a statusbar. It applies to all panes and windows that directly or indirectly contain whatever control generated the statusbar text (e.g., a map). + +If you include `[[*]]` in the command, it will be replaced by the new text. (See embedded winget for more details on the `[[...]]` format.) + +`[[from]]` can be used to reference the control (if any) that generated the next text. You can also use expressions like `[[from.type]]`, `[[from.parent.pos.x]]`, etc. +*** \ No newline at end of file diff --git a/ref/skin/param/on-tab.md b/ref/skin/param/on-tab.md new file mode 100644 index 00000000..27388cc5 --- /dev/null +++ b/ref/skin/param/on-tab.md @@ -0,0 +1,7 @@ + +## on-tab (info) +*** +Command executed when the current tab is changed. + +If you include `[[*]]` in the command, it will be replaced by the new tab's id. (See embedded winget for more details on the `[[...]]` format.) +*** \ No newline at end of file diff --git a/ref/skin/param/outer-mouse-pos.md b/ref/skin/param/outer-mouse-pos.md new file mode 100644 index 00000000..29d77b15 --- /dev/null +++ b/ref/skin/param/outer-mouse-pos.md @@ -0,0 +1,9 @@ + +## outer-mouse-pos (info) +*** +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, including the control's borders. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending `*` as the parameter in winget(). +*** \ No newline at end of file diff --git a/ref/skin/param/outer-pos.md b/ref/skin/param/outer-pos.md new file mode 100644 index 00000000..b516ffbc --- /dev/null +++ b/ref/skin/param/outer-pos.md @@ -0,0 +1,7 @@ + +## outer-pos (info) +*** +Read-only. + +Reads the control's current exterior position *including* titlebar, statusbar, borders, etc. If the window is not minimized or maximized, this is identical to `pos`. +*** \ No newline at end of file diff --git a/ref/skin/param/outer-size.md b/ref/skin/param/outer-size.md new file mode 100644 index 00000000..32bb453c --- /dev/null +++ b/ref/skin/param/outer-size.md @@ -0,0 +1,9 @@ + +## outer-size (info) +*** +Read-only. + +If the control is a window, this refers to its current exterior size *including* titlebar, statusbar, borders, etc. If the window is maximized, this is the maximized size. + +If this control is a pane and can-scroll is true, this is the size of the display area including the scrollbars. +*** \ No newline at end of file diff --git a/ref/skin/param/parent.md b/ref/skin/param/parent.md new file mode 100644 index 00000000..be078af7 --- /dev/null +++ b/ref/skin/param/parent.md @@ -0,0 +1,5 @@ + +## parent (info) +*** +The id of this control's parent. Write-only, used when creating a new control at runtime or deleting a control that was created this way. +*** \ No newline at end of file diff --git a/ref/skin/param/pass-through.md b/ref/skin/param/pass-through.md new file mode 100644 index 00000000..2a6b1f54 --- /dev/null +++ b/ref/skin/param/pass-through.md @@ -0,0 +1,7 @@ + +## pass-through (info) +*** +Sends default action for this input after the user macro. Currently this applies only to mouse macros. + +An example of this is if you want to override MouseDown with new functionality in your own verb, but still handle default mouse processing. +*** \ No newline at end of file diff --git a/ref/skin/param/pos.md b/ref/skin/param/pos.md new file mode 100644 index 00000000..f0447b42 --- /dev/null +++ b/ref/skin/param/pos.md @@ -0,0 +1,5 @@ + +## pos (info) +*** +Position of this control's upper left corner, relative to its container. (Not applicable to panes.) +*** \ No newline at end of file diff --git a/ref/skin/param/prefix-color.md b/ref/skin/param/prefix-color.md new file mode 100644 index 00000000..c9e340c3 --- /dev/null +++ b/ref/skin/param/prefix-color.md @@ -0,0 +1,7 @@ + +## prefix-color (info) +*** +The color used for the prefix/header column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was red. +*** \ No newline at end of file diff --git a/ref/skin/param/right-click.md b/ref/skin/param/right-click.md new file mode 100644 index 00000000..dceb6b96 --- /dev/null +++ b/ref/skin/param/right-click.md @@ -0,0 +1,5 @@ + +## right-click (info) +*** +True if this control should allow right-clicks to behave like any other click instead of opening up popup menus or similar special behavior. +*** \ No newline at end of file diff --git a/ref/skin/param/right.md b/ref/skin/param/right.md new file mode 100644 index 00000000..52afe71d --- /dev/null +++ b/ref/skin/param/right.md @@ -0,0 +1,5 @@ + +## right (info) +*** +The id of the right/bottom pane in this control. The parameter names `top` and `bottom` can be used interchangeably. +*** \ No newline at end of file diff --git a/ref/skin/param/saved-params.md b/ref/skin/param/saved-params.md new file mode 100644 index 00000000..7cd24e95 --- /dev/null +++ b/ref/skin/param/saved-params.md @@ -0,0 +1,7 @@ + +## saved-params (info) +*** +A semicolon-separated list of parameters that get saved with this control. This is often used for things a user might set, like zoom level for a map. + +Currently not editable in Dream Maker. +*** \ No newline at end of file diff --git a/ref/skin/param/screen-pos.md b/ref/skin/param/screen-pos.md new file mode 100644 index 00000000..e32dffd3 --- /dev/null +++ b/ref/skin/param/screen-pos.md @@ -0,0 +1,9 @@ + +## screen-pos (info) +*** +Read-only. + +For windows, this is the upper left corner of the nearest monitor's area. + +This is also a special read-only global parameter, which returns the position for the main monitor. +*** \ No newline at end of file diff --git a/ref/skin/param/screen-size.md b/ref/skin/param/screen-size.md new file mode 100644 index 00000000..cf8f4df4 --- /dev/null +++ b/ref/skin/param/screen-size.md @@ -0,0 +1,9 @@ + +## screen-size (info) +*** +Read-only. + +For windows, this is the size of the nearest monitor's area (minus taskbar). + +This is also a special read-only global parameter, which returns the size (minus taskbar) for the main monitor. +*** \ No newline at end of file diff --git a/ref/skin/param/show-history.md b/ref/skin/param/show-history.md new file mode 100644 index 00000000..10cd354c --- /dev/null +++ b/ref/skin/param/show-history.md @@ -0,0 +1,5 @@ + +## show-history (info) +*** +Show forward/back navigation buttons. +*** \ No newline at end of file diff --git a/ref/skin/param/show-lines.md b/ref/skin/param/show-lines.md new file mode 100644 index 00000000..ff71f461 --- /dev/null +++ b/ref/skin/param/show-lines.md @@ -0,0 +1,5 @@ + +## show-lines (info) +*** +Determines which grid lines to display. +*** \ No newline at end of file diff --git a/ref/skin/param/show-names.md b/ref/skin/param/show-names.md new file mode 100644 index 00000000..c91619a4 --- /dev/null +++ b/ref/skin/param/show-names.md @@ -0,0 +1,7 @@ + +## show-names (info) +*** +When atoms are output to the grid, show the atom's name next to its icon. + +If the atom has no icon and `show-names` is false, the grid cell will be blank. +*** \ No newline at end of file diff --git a/ref/skin/param/show-splitter.md b/ref/skin/param/show-splitter.md new file mode 100644 index 00000000..e1d9866b --- /dev/null +++ b/ref/skin/param/show-splitter.md @@ -0,0 +1,5 @@ + +## show-splitter (info) +*** +Show a splitter if both the left and right (or top and bottom) panes are in use. The splitter can be dragged to resize the panes. +*** \ No newline at end of file diff --git a/ref/skin/param/show-url.md b/ref/skin/param/show-url.md new file mode 100644 index 00000000..152730d4 --- /dev/null +++ b/ref/skin/param/show-url.md @@ -0,0 +1,5 @@ + +## show-url (info) +*** +Shows an address bar for this browser control. +*** \ No newline at end of file diff --git a/ref/skin/param/size.md b/ref/skin/param/size.md new file mode 100644 index 00000000..a28c5788 --- /dev/null +++ b/ref/skin/param/size.md @@ -0,0 +1,11 @@ + +## size (info) +*** +The size of this control. + +Setting 0 for width or height uses up any available space right/downward. + +If the control is a window, this refers to its *interior size when not maximized or minimized*. That is, it does not count borders, titlebar, menu, or statusbar, and if the window is minimized/maximized, this refers to the window's normal size when it is restored. See the inner-size and outer-size params for comparison. + +If this control is a pane and can-scroll is true, `size` refers to the total scrollable size of the pane, NOT the smaller size displayed. In this case, `outer-size` and `inner-size` refer to the display area with and without scrollbars, respectively. +*** \ No newline at end of file diff --git a/ref/skin/param/small-icons.md b/ref/skin/param/small-icons.md new file mode 100644 index 00000000..f6f64608 --- /dev/null +++ b/ref/skin/param/small-icons.md @@ -0,0 +1,5 @@ + +## small-icons (info) +*** +When output(object,grid) is sent, show smaller icons in this control instead of larger ones. +*** \ No newline at end of file diff --git a/ref/skin/param/splitter.md b/ref/skin/param/splitter.md new file mode 100644 index 00000000..da4fe089 --- /dev/null +++ b/ref/skin/param/splitter.md @@ -0,0 +1,5 @@ + +## splitter (info) +*** +Position of the splitter when two panes are in use, whether show-splitter is true or not. This value is a percentage. Specifically, it is the percentage of the available width/height that is given to the left/top pane. +*** \ No newline at end of file diff --git a/ref/skin/param/statusbar.md b/ref/skin/param/statusbar.md new file mode 100644 index 00000000..4121ed77 --- /dev/null +++ b/ref/skin/param/statusbar.md @@ -0,0 +1,5 @@ + +## statusbar (info) +*** +Shows a status bar at the bottom of the window. This will show the name of an atom when you hover over it with the mouse. +*** \ No newline at end of file diff --git a/ref/skin/param/stretch.md b/ref/skin/param/stretch.md new file mode 100644 index 00000000..ce678d4b --- /dev/null +++ b/ref/skin/param/stretch.md @@ -0,0 +1,11 @@ + +## stretch (info) +*** +Stretch the background image. + + +> [!WARNING] +> +> > [!NOTE] +> > Deprecated; use image-mode instead. +*** \ No newline at end of file diff --git a/ref/skin/param/style.md b/ref/skin/param/style.md new file mode 100644 index 00000000..3edb0d69 --- /dev/null +++ b/ref/skin/param/style.md @@ -0,0 +1,7 @@ + +## style (info) +*** +Custom stylesheet used for the control. Changes made at runtime will usually not impact any existing text. + +For Map controls, this affects any maptext drawn, and changes to the style should appear on the next refresh. +*** \ No newline at end of file diff --git a/ref/skin/param/suffix-color.md b/ref/skin/param/suffix-color.md new file mode 100644 index 00000000..7a3fbd48 --- /dev/null +++ b/ref/skin/param/suffix-color.md @@ -0,0 +1,7 @@ + +## suffix-color (info) +*** +The color used for the suffix column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was blue. +*** \ No newline at end of file diff --git a/ref/skin/param/tab-background-color.md b/ref/skin/param/tab-background-color.md new file mode 100644 index 00000000..369ac6e5 --- /dev/null +++ b/ref/skin/param/tab-background-color.md @@ -0,0 +1,5 @@ + +## tab-background-color (info) +*** +Affects the background color for tabs. The regular background-color is used for the content area. +*** \ No newline at end of file diff --git a/ref/skin/param/tab-font.md b/ref/skin/param/tab-font.md new file mode 100644 index 00000000..2b139f69 --- /dev/null +++ b/ref/skin/param/tab-font.md @@ -0,0 +1,5 @@ + +## tab-font (info) +*** +Affects the font for tabs. The regular versions of these without the `tab-` prefix are used for the content area. +*** \ No newline at end of file diff --git a/ref/skin/param/tab-text-color.md b/ref/skin/param/tab-text-color.md new file mode 100644 index 00000000..be66dc99 --- /dev/null +++ b/ref/skin/param/tab-text-color.md @@ -0,0 +1,5 @@ + +## tab-text-color (info) +*** +Affects the text color for tabs. The regular text-color is used for the content area. +*** \ No newline at end of file diff --git a/ref/skin/param/tabs.md b/ref/skin/param/tabs.md new file mode 100644 index 00000000..3c723e5b --- /dev/null +++ b/ref/skin/param/tabs.md @@ -0,0 +1,9 @@ + +## tabs (info) +*** +A comma-separated list of id values for the panes included as tabs in this control. + +When setting this value, you can put `+` in front of the list to add tabs to the existing control, without affecting current tabs. You can likewise use `-` in front of the list to remove tabs. + +Note: When using this with winset(), remember you will need to escape `+` as `%2B` via url_encode() or list2params(). +*** \ No newline at end of file diff --git a/ref/skin/param/text-color.md b/ref/skin/param/text-color.md new file mode 100644 index 00000000..a975cda9 --- /dev/null +++ b/ref/skin/param/text-color.md @@ -0,0 +1,5 @@ + +## text-color (info) +*** +The control's foreground text color. +*** \ No newline at end of file diff --git a/ref/skin/param/text-mode.md b/ref/skin/param/text-mode.md new file mode 100644 index 00000000..1e5b2ff8 --- /dev/null +++ b/ref/skin/param/text-mode.md @@ -0,0 +1,5 @@ + +## text-mode (info) +*** +Show text mode even if icons are available. Text mode will be used if no icons are present, regardless of this setting. +*** \ No newline at end of file diff --git a/ref/skin/param/text-wrap.md b/ref/skin/param/text-wrap.md new file mode 100644 index 00000000..d5325259 --- /dev/null +++ b/ref/skin/param/text-wrap.md @@ -0,0 +1,5 @@ + +## text-wrap (info) +*** +Wrap text that is too long for the width of the label. +*** \ No newline at end of file diff --git a/ref/skin/param/text.md b/ref/skin/param/text.md new file mode 100644 index 00000000..c7873fdd --- /dev/null +++ b/ref/skin/param/text.md @@ -0,0 +1,5 @@ + +## text (info) +*** +Text shown in this control. For Input controls this setting is only available at runtime. +*** \ No newline at end of file diff --git a/ref/skin/param/title.md b/ref/skin/param/title.md new file mode 100644 index 00000000..17703015 --- /dev/null +++ b/ref/skin/param/title.md @@ -0,0 +1,7 @@ + +## title (info) +*** +The title of this window or pane. For a window, the title will appear in the titlebar if present. For a pane, this will be displayed on the tab if this pane is in a Tab control. + +If this is the default window, world.name takes precedence over the window title. +*** \ No newline at end of file diff --git a/ref/skin/param/titlebar.md b/ref/skin/param/titlebar.md new file mode 100644 index 00000000..7f77661d --- /dev/null +++ b/ref/skin/param/titlebar.md @@ -0,0 +1,7 @@ + +## titlebar (info) +*** +Show a titlebar for this window. This is also required for the close, minimize, and maximize buttons to appear. + +If `is-fullscreen` is true, `titlebar` is ignored, so this value represents the state of the window when `is-fullscreen` is turned off again. +*** \ No newline at end of file diff --git a/ref/skin/param/transparent-color.md b/ref/skin/param/transparent-color.md new file mode 100644 index 00000000..a7a18a86 --- /dev/null +++ b/ref/skin/param/transparent-color.md @@ -0,0 +1,5 @@ + +## transparent-color (info) +*** +A color that will be turned into transparency wherever it appears in this window. Overall, this method of transparency comes with many limitations, so it is considered deprecated. +*** \ No newline at end of file diff --git a/ref/skin/param/type.md b/ref/skin/param/type.md new file mode 100644 index 00000000..2c2d5e42 --- /dev/null +++ b/ref/skin/param/type.md @@ -0,0 +1,5 @@ + +## type (info) +*** +The type of this control. Read-only. +*** \ No newline at end of file diff --git a/ref/skin/param/use-title.md b/ref/skin/param/use-title.md new file mode 100644 index 00000000..36ef7c8f --- /dev/null +++ b/ref/skin/param/use-title.md @@ -0,0 +1,5 @@ + +## use-title (info) +*** +Use the browser's document title to override the title of the window or pane it appears in. +*** \ No newline at end of file diff --git a/ref/skin/param/value.md b/ref/skin/param/value.md new file mode 100644 index 00000000..7c83ad06 --- /dev/null +++ b/ref/skin/param/value.md @@ -0,0 +1,5 @@ + +## value (info) +*** +The "fullness" of this bar/slider, as a percentage. +*** \ No newline at end of file diff --git a/ref/skin/param/view-size.md b/ref/skin/param/view-size.md new file mode 100644 index 00000000..a4724a4b --- /dev/null +++ b/ref/skin/param/view-size.md @@ -0,0 +1,9 @@ + +## view-size (info) +*** +The size, in pixels, of the map after `zoom` has been applied. + +For instance, if the client view has 10×10 tiles (this includes any extended tiles caused by HUD objects) and `world.icon_size` is 32x32, the map has a native size of 320×320 pixels. If the map has a zoom level of 2, then `view-size` will be 640x640. + +With a `zoom` value of 0, which is the default for most projects, the actual zoom level is automatically determined by the size of the map control, the map's native pixel size as explained above, and the value of the letterbox parameter. +*** \ No newline at end of file diff --git a/ref/skin/param/visited-color.md b/ref/skin/param/visited-color.md new file mode 100644 index 00000000..38cc934a --- /dev/null +++ b/ref/skin/param/visited-color.md @@ -0,0 +1,5 @@ + +## visited-color (info) +*** +The color used for visited links. +*** \ No newline at end of file diff --git a/ref/skin/param/width.md b/ref/skin/param/width.md new file mode 100644 index 00000000..7e49d383 --- /dev/null +++ b/ref/skin/param/width.md @@ -0,0 +1,5 @@ + +## width (info) +*** +Width, in pixels, of the bar or slider. A value of 0 uses all available width. +*** \ No newline at end of file diff --git a/ref/skin/param/zoom-mode.md b/ref/skin/param/zoom-mode.md new file mode 100644 index 00000000..17732e99 --- /dev/null +++ b/ref/skin/param/zoom-mode.md @@ -0,0 +1,5 @@ + +## zoom-mode (info) +*** +Controls the way the map is upscaled. +*** \ No newline at end of file diff --git a/ref/skin/param/zoom.md b/ref/skin/param/zoom.md new file mode 100644 index 00000000..74dcc521 --- /dev/null +++ b/ref/skin/param/zoom.md @@ -0,0 +1,5 @@ + +## zoom (info) +*** +Zoom factor for icons on the map. 1 means to show the icons at their original size, 2 is 200%, 0.5 is 50%, and so on. A value of 0 stretches to fit available space. +*** \ No newline at end of file diff --git a/ref/skin/parent.md b/ref/skin/parent.md deleted file mode 100644 index 0193b3bb..00000000 --- a/ref/skin/parent.md +++ /dev/null @@ -1,21 +0,0 @@ -## parent parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -+ [Macro](/ref/skin/control/macro.md) -+ [Menu](/ref/skin/control/menu.md) - -**Format:** -+ string - - -The [id](/ref/skin/param/id.md) of this control\'s -parent. Write-only, used when creating a new control at runtime or -deleting a control that was created this way. - -> [!TIP] -> **See also:** -> + [id parameter](/ref/skin/param/id.md) -> + [type parameter](/ref/skin/param/type.md) -> + [name parameter](/ref/skin/param/name.md) \ No newline at end of file diff --git a/ref/skin/pos.md b/ref/skin/pos.md deleted file mode 100644 index 0aaa0f37..00000000 --- a/ref/skin/pos.md +++ /dev/null @@ -1,21 +0,0 @@ -## pos parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ *x*,*y* -+ none - -**Default value:** -+ *x*,*y* -+ none - - -Position of this control\'s upper left corner, relative to its -container. (Not applicable to panes.) - -> [!TIP] -> **See also:** -> + [anchor1, anchor2 parameters](/ref/skin/param/anchor.md) -> + [size parameter](/ref/skin/param/size.md) \ No newline at end of file diff --git a/ref/skin/prefix-color.md b/ref/skin/prefix-color.md deleted file mode 100644 index 1c9bedfa..00000000 --- a/ref/skin/prefix-color.md +++ /dev/null @@ -1,25 +0,0 @@ -## prefix-color parameter (skin) - - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) -+ none - -**Default value:** -+ none - - -The color used for the prefix/header column of statpanel -displays. No color means the default -[text-color](/ref/skin/param/text-color.md) will be used. - - -In BYOND 3.0, this color was red. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [suffix-color parameter](/ref/skin/param/suffix-color.md) \ No newline at end of file diff --git a/ref/skin/right-click.md b/ref/skin/right-click.md deleted file mode 100644 index 94cecb9f..00000000 --- a/ref/skin/right-click.md +++ /dev/null @@ -1,21 +0,0 @@ -## right-click parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -True if this control should allow right-clicks to behave like -any other click instead of opening up popup menus or similar special -behavior. - -> [!TIP] -> **See also:** -> + [mouse handling](/ref/DM/mose.md) -> + [popup_menu setting (verb)](/ref/set/popup_menu.md) -> + [drop-zone parameter](/ref/skin/param/drop-zone.md) \ No newline at end of file diff --git a/ref/skin/right.md b/ref/skin/right.md deleted file mode 100644 index 264eff02..00000000 --- a/ref/skin/right.md +++ /dev/null @@ -1,24 +0,0 @@ -## right, bottom parameters (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) - -**Format:** -+ string -+ none - -**Default value:** -+ none - - -The [id](/ref/skin/param/id.md) of the right/bottom pane -in this control. The parameter names `top` and `bottom` can be used -interchangeably. - -> [!TIP] -> **See also:** -> + [left parameter](/ref/skin/param/left.md) -> + [is-vert parameter](/ref/skin/param/is-vert.md) -> + [show-splitter parameter](/ref/skin/param/show-splitter.md) -> + [splitter parameter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/saved-params.md b/ref/skin/saved-params.md deleted file mode 100644 index e6bdd436..00000000 --- a/ref/skin/saved-params.md +++ /dev/null @@ -1,15 +0,0 @@ -## saved-params parameter (skin) -**Applies to:** -+ [All](/ref/skin/control.md) -**Format:** -+ string - -**Default value:** -+ *varies* - - -A semicolon-separated list of parameters that get saved with -this control. This is often used for things a user might set, like zoom -level for a map. - -Currently not editable in Dream Maker. \ No newline at end of file diff --git a/ref/skin/screen-pos.md b/ref/skin/screen-pos.md deleted file mode 100644 index baf154b3..00000000 --- a/ref/skin/screen-pos.md +++ /dev/null @@ -1,19 +0,0 @@ -## screen-pos parameter (skin) -###### BYOND Version 515 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ *x*,*y* - - -Read-only. - -For windows, this is the upper left corner -of the nearest monitor\'s area. - -> [!TIP] -> **See also:** -> + [pos parameter](/ref/skin/param/pos.md) -> + [outer-pos parameter](/ref/skin/param/outer-pos.md) \ No newline at end of file diff --git a/ref/skin/screen-size.md b/ref/skin/screen-size.md deleted file mode 100644 index fde5fc8d..00000000 --- a/ref/skin/screen-size.md +++ /dev/null @@ -1,19 +0,0 @@ -## screen-size parameter (skin) -###### BYOND Version 515 - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) -**Format:** -+ *width*x*height* - - -Read-only. - -For windows, this is the size of the -nearest monitor\'s area. - -> [!TIP] -> **See also:** -> + [size parameter](/ref/skin/param/size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) \ No newline at end of file diff --git a/ref/skin/show-history.md b/ref/skin/show-history.md deleted file mode 100644 index a2256aee..00000000 --- a/ref/skin/show-history.md +++ /dev/null @@ -1,18 +0,0 @@ -## show-history parameter (skin) - - -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Show forward/back navigation buttons. - -> [!TIP] -> **See also:** -> + [show-url parameter](/ref/skin/param/show-url.md) -> + [use-title parameter](/ref/skin/param/use-title.md) \ No newline at end of file diff --git a/ref/skin/show-lines.md b/ref/skin/show-lines.md deleted file mode 100644 index 34e3d7a9..00000000 --- a/ref/skin/show-lines.md +++ /dev/null @@ -1,20 +0,0 @@ -## show-lines parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -**Possible values:** -+ none -+ horizontal -+ vertical -+ both - -**Default value:** -+ both - - -Determines which grid lines to display. - -> [!TIP] -> **See also:** -> + [line-color parameter](/ref/skin/param/line-color.md) \ No newline at end of file diff --git a/ref/skin/show-names.md b/ref/skin/show-names.md deleted file mode 100644 index 00d9f494..00000000 --- a/ref/skin/show-names.md +++ /dev/null @@ -1,22 +0,0 @@ -## show-names parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -**Format:** -+ true/false - -**Default value:** -+ true - - -When atoms are output to the grid, show the atom\'s name next -to its icon. - -If the atom has no icon and `show-names` is false, -the grid cell will be blank. - -> [!TIP] -> **See also:** -> + [name var (atom)](/ref/atom/var/name.md) -> + [small-icons parameter](/ref/skin/param/small-icons.md) \ No newline at end of file diff --git a/ref/skin/show-splitter.md b/ref/skin/show-splitter.md deleted file mode 100644 index 17aba8e4..00000000 --- a/ref/skin/show-splitter.md +++ /dev/null @@ -1,21 +0,0 @@ -## show-splitter parameter (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) -**Format:** -+ true/false - -**Default value:** -+ true - - -Show a splitter if both the left and right (or top and bottom) -panes are in use. The splitter can be dragged to resize the panes. - -> [!TIP] -> **See also:** -> + [left parameter](/ref/skin/param/left.md) -> + [right parameter](/ref/skin/param/right.md) -> + [is-vert parameter](/ref/skin/param/is-vert.md) -> + [splitter parameter](/ref/skin/param/splitter.md) \ No newline at end of file diff --git a/ref/skin/show-url.md b/ref/skin/show-url.md deleted file mode 100644 index e8585029..00000000 --- a/ref/skin/show-url.md +++ /dev/null @@ -1,18 +0,0 @@ -## show-url parameter (skin) - - -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Shows an address bar for this browser control. - -> [!TIP] -> **See also:** -> + [show-history parameter](/ref/skin/param/show-history.md) -> + [use-title parameter](/ref/skin/param/use-title.md) \ No newline at end of file diff --git a/ref/skin/size.md b/ref/skin/size.md deleted file mode 100644 index 201ec0c0..00000000 --- a/ref/skin/size.md +++ /dev/null @@ -1,37 +0,0 @@ -## size parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ *width*x*height* - - -The size of this control. - -Setting 0 for width or -height uses up any available space right/downward. - -If the -control is a window, this refers to its *interior size when not -maximized or minimized*. That is, it does not count borders, titlebar, -menu, or statusbar, and if the window is minimized/maximized, this -refers to the window\'s normal size when it is restored. See the -[inner-size](/ref/skin/param/inner-size.md) and -[outer-size](/ref/skin/param/outer-size.md) params for -comparison. - -If this control is a pane and -[can-scroll](/ref/skin/param/can-scroll.md) is true, `size` -refers to the total scrollable size of the pane, NOT the smaller size -displayed. In this case, `outer-size` and `inner-size` refer to the -display area with and without scrollbars, respectively. - -> [!TIP] -> **See also:** -> + [pos parameter](/ref/skin/param/pos.md) -> + [anchor1, anchor2 parameters](/ref/skin/param/anchor.md) -> + [on-size parameter](/ref/skin/param/on-size.md) -> + [inner-size parameter](/ref/skin/param/inner-size.md) -> + [outer-size parameter](/ref/skin/param/outer-size.md) \ No newline at end of file diff --git a/ref/skin/skin.md b/ref/skin/skin.md deleted file mode 100644 index 4b5fd4ed..00000000 --- a/ref/skin/skin.md +++ /dev/null @@ -1,31 +0,0 @@ -## User interface skins - - - -BYOND games used to have very limited interface options, all -effectively sharing the same layout. In BYOND 4.0, skins were -introduced, allowing developers more control over the layout. - -A -skin consists of [macro sets](/ref/skin/macros.md) for keyboard/gamepad -input, menus, and windows and/or panes. All of these are considered -[controls](/ref/skin/control.md) that a game can interact with via -[winset()](/ref/proc/winset.md) , [winget()](/ref/proc/winget.md) , -[output()](/ref/proc/output.md) , and a few other procs. - -About -the simplest possible skin is a single window with a single [map -control](/ref/skin/control/map.md) and a single macro set. - -> [!TIP] -> **See also:** -> + [winset proc](/ref/proc/winset.md) -> + [winget proc](/ref/proc/winget.md) -> + [output proc](/ref/proc/output.md) -> + [winclone proc](/ref/proc/winclone.md) -> + [winexists proc](/ref/proc/winexists.md) -> + [winshow proc](/ref/proc/winshow.md) -> + [controls](/ref/skin/control.md) -> + [parameters](/ref/skin/param.md) -> + [macros (skin)](/ref/skin/macros.md) -> + [client commands](/ref/skin/commands.md) \ No newline at end of file diff --git a/ref/skin/small-icons.md b/ref/skin/small-icons.md deleted file mode 100644 index 0e30d4cf..00000000 --- a/ref/skin/small-icons.md +++ /dev/null @@ -1,18 +0,0 @@ -## small-icons parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -When output(object,grid) is sent, show smaller icons in this -control instead of larger ones. - -> [!TIP] -> **See also:** -> + [show-names parameter](/ref/skin/param/show-names.md) \ No newline at end of file diff --git a/ref/skin/splitter.md b/ref/skin/splitter.md deleted file mode 100644 index 46be4652..00000000 --- a/ref/skin/splitter.md +++ /dev/null @@ -1,24 +0,0 @@ -## splitter parameter (skin) - - -**Applies to:** -+ [Child](/ref/skin/control/child.md) - -**Format:** -+ number (0 to 100) - -**Default value:** -+ 50 - - -Position of the splitter when two panes are in use, whether -[show-splitter](/ref/skin/param/show-splitter.md) is true or not. -This value is a percentage. Specifically, it is the percentage of the -available width/height that is given to the left/top pane. - -> [!TIP] -> **See also:** -> + [left parameter](/ref/skin/param/left.md) -> + [right parameter](/ref/skin/param/right.md) -> + [is-vert parameter](/ref/skin/param/is-vert.md) -> + [show-splitter parameter](/ref/skin/param/show-splitter.md) \ No newline at end of file diff --git a/ref/skin/statusbar.md b/ref/skin/statusbar.md deleted file mode 100644 index 3dc3cd67..00000000 --- a/ref/skin/statusbar.md +++ /dev/null @@ -1,20 +0,0 @@ -## statusbar parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ true - - -Shows a status bar at the bottom of the window. This will show -the name of an atom when you hover over it with the mouse. - -> [!TIP] -> **See also:** -> + [titlebar parameter](/ref/skin/param/titlebar.md) -> + [on-status parameter](/ref/skin/param/on-status.md) \ No newline at end of file diff --git a/ref/skin/stretch.md b/ref/skin/stretch.md deleted file mode 100644 index 9c69f367..00000000 --- a/ref/skin/stretch.md +++ /dev/null @@ -1,22 +0,0 @@ -## stretch parameter (skin) -###### BYOND Version h parameter (skin) {#stretch-parameter-skin deprecated="1 - - -**Applies to:** -+ [Label](/ref/skin/control/label.md) - -**Format:** -+ true/false - -**Default value:** -+ false - - -Stretch the background image. -Deprecated; use [image-mode](/ref/skin/param/image-mode.md) -instead. - -> [!TIP] -> **See also:** -> + [image parameter](/ref/skin/param/image.md) -> + [image-mode parameter](/ref/skin/param/image-mode.md) \ No newline at end of file diff --git a/ref/skin/style.md b/ref/skin/style.md deleted file mode 100644 index 28891db6..00000000 --- a/ref/skin/style.md +++ /dev/null @@ -1,16 +0,0 @@ -## style parameter (skin) -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -+ [Map](/ref/skin/control/map.md) -+ [Output](/ref/skin/control/output.md) - -**Format:** -+ string - - -Custom stylesheet used for the control. Changes made at runtime -will usually not impact any existing text. - -For Map controls, -this affects any [maptext](/ref/atom/var/maptext.md) drawn, and changes to the -style should appear on the next refresh. \ No newline at end of file diff --git a/ref/skin/suffix-color.md b/ref/skin/suffix-color.md deleted file mode 100644 index ec7209e7..00000000 --- a/ref/skin/suffix-color.md +++ /dev/null @@ -1,25 +0,0 @@ -## suffix-color parameter (skin) - - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) -+ none - -**Default value:** -+ none - - -The color used for the suffix column of statpanel displays. No -color means the default -[text-color](/ref/skin/param/text-color.md) will be used. - - -In BYOND 3.0, this color was blue. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [prefix-color parameter](/ref/skin/param/prefix-color.md) \ No newline at end of file diff --git a/ref/skin/tab-background-color.md b/ref/skin/tab-background-color.md deleted file mode 100644 index e28d90d9..00000000 --- a/ref/skin/tab-background-color.md +++ /dev/null @@ -1,24 +0,0 @@ -## tab-background-color parameter (skin) - - parameters](/ref/skin/param/tab-font.md) - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) -+ none - -**Default value:** -+ none - - -Affects the background color for tabs. The regular -[background-color](/ref/skin/param/background-color.md) is used -for the content area. - -> [!TIP] -> **See also:** -> + [background-color parameter](/ref/skin/param/background-color.md) -> + [tab-text-color parameter](/ref/skin/param/tab-text-color.md) -> + [tab-font-family, tab-font-size, tab-font-style \ No newline at end of file diff --git a/ref/skin/tab-fon.md b/ref/skin/tab-fon.md deleted file mode 100644 index d04164fa..00000000 --- a/ref/skin/tab-fon.md +++ /dev/null @@ -1,18 +0,0 @@ -toc="tab-font-family, tab-font-size, tab-font-style"} -## tab-font-family, tab-font-size, tab-font-style parameters (skin) - - parameter](/ref/skin/param/tab-background-color.md) - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -Affects the font for tabs. The regular versions of these -without the `tab-` prefix are used for the content area. - -> [!TIP] -> **See also:** -> + [font-family parameter](/ref/skin/param/font-family.md) -> + [font-size parameter](/ref/skin/param/font-size.md) -> + [font-style parameter](/ref/skin/param/font-style.md) -> + [tab-text-color parameter](/ref/skin/param/tab-text-color.md) -> + [tab-background-color \ No newline at end of file diff --git a/ref/skin/tab-text-color.md b/ref/skin/tab-text-color.md deleted file mode 100644 index c8af499a..00000000 --- a/ref/skin/tab-text-color.md +++ /dev/null @@ -1,25 +0,0 @@ -## tab-text-color parameter (skin) - - parameter](/ref/skin/param/tab-background-color.md) -+ [tab-font-family, tab-font-size, tab-font-style - parameters](/ref/skin/param/tab-font.md) - -**Applies to:** -+ [Info](/ref/skin/control/info.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) -+ none - -**Default value:** -+ none - - -Affects the text color for tabs. The regular -[text-color](/ref/skin/param/text-color.md) is used for the -content area. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [tab-background-color \ No newline at end of file diff --git a/ref/skin/tab.md b/ref/skin/tab.md deleted file mode 100644 index a827b442..00000000 --- a/ref/skin/tab.md +++ /dev/null @@ -1,10 +0,0 @@ -## tab control (skin) - - -A tab control, where each tab holds a different -[pane](/ref/skin/control/main.md) . -**Tab-specific parameters:** -+ [current-tab](/ref/skin/param/current-tab.md) -+ [multi-line](/ref/skin/param/multi-line.md) -+ [on-tab](/ref/skin/param/on-tab.md) -+ [tabs](/ref/skin/param/tabs.md) \ No newline at end of file diff --git a/ref/skin/tabs.md b/ref/skin/tabs.md deleted file mode 100644 index 7212c93e..00000000 --- a/ref/skin/tabs.md +++ /dev/null @@ -1,28 +0,0 @@ -## tabs parameter (skin) - - -**Applies to:** -+ [Tab](/ref/skin/control/tab.md) - -**Format:** -+ string - - -A comma-separated list of [id](/ref/skin/param/id.md) -values for the panes included as tabs in this control. - -When -setting this value, you can put `+` in front of the list to add tabs to -the existing control, without affecting current tabs. You can likewise -use `-` in front of the list to remove tabs. - -Note: When using -this with [winset()](/ref/proc/winset.md) , remember you will need to -escape `+` as `%2B` via [url_encode()](/ref/proc/url_encode.md) or -[list2params()](/ref/proc/list2params.md). - -> [!TIP] -> **See also:** -> + [current-tab parameter](/ref/skin/param/current-tab.md) -> + [id parameter](/ref/skin/param/id.md) -> + [multi-line parameter](/ref/skin/param/multi-line.md) \ No newline at end of file diff --git a/ref/skin/text-color.md b/ref/skin/text-color.md deleted file mode 100644 index c39a0f89..00000000 --- a/ref/skin/text-color.md +++ /dev/null @@ -1,18 +0,0 @@ -## text-color parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - - -The control\'s foreground text color. - -> [!TIP] -> **See also:** -> + [background-color parameter](/ref/skin/param/background-color.md) -> + [font-family parameter](/ref/skin/param/font-family.md) -> + [font-size parameter](/ref/skin/param/font-size.md) -> + [font-style parameter](/ref/skin/param/font-style.md) \ No newline at end of file diff --git a/ref/skin/text-mode.md b/ref/skin/text-mode.md deleted file mode 100644 index 8e8ad0b0..00000000 --- a/ref/skin/text-mode.md +++ /dev/null @@ -1,19 +0,0 @@ -## text-mode parameter (skin) - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Show text mode even if icons are available. Text mode will be -used if no icons are present, regardless of this setting. - -> [!TIP] -> **See also:** -> + [zoom parameter](/ref/skin/param/zoom.md) -> + [zoom-mode parameter](/ref/skin/param/zoom-mode.md) \ No newline at end of file diff --git a/ref/skin/text-wrap.md b/ref/skin/text-wrap.md deleted file mode 100644 index d8e50f77..00000000 --- a/ref/skin/text-wrap.md +++ /dev/null @@ -1,17 +0,0 @@ -## text-wrap parameter (skin) - - -**Applies to:** -+ [Label](/ref/skin/control/label.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Wrap text that is too long for the width of the label. - -> [!TIP] -> **See also:** -> + [text parameter](/ref/skin/param/text.md) \ No newline at end of file diff --git a/ref/skin/text.md b/ref/skin/text.md deleted file mode 100644 index e372ca4f..00000000 --- a/ref/skin/text.md +++ /dev/null @@ -1,20 +0,0 @@ -## text parameter (skin) - - -**Applies to:** -+ [Button](/ref/skin/control/button.md) -+ [Input](/ref/skin/control/input.md) -+ [Label](/ref/skin/control/label.md) -**Format:** -+ string - - -Text shown in this control. For Input controls this setting is -only available at runtime. - -> [!TIP] -> **See also:** -> + [font-family parameter](/ref/skin/param/font-family.md) -> + [font-size parameter](/ref/skin/param/font-size.md) -> + [font-style parameter](/ref/skin/param/font-style.md) -> + [text-wrap parameter](/ref/skin/param/text-wrap.md) \ No newline at end of file diff --git a/ref/skin/title.md b/ref/skin/title.md deleted file mode 100644 index 43b798f5..00000000 --- a/ref/skin/title.md +++ /dev/null @@ -1,23 +0,0 @@ -## title parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) - -**Format:** -+ string - - -The title of this window or pane. For a window, the title will -appear in the titlebar if present. For a pane, this will be displayed on -the tab if this pane is in a [Tab control](/ref/skin/control/tab.md) . - - -If this is the default window, -[world.name](/ref/world/var/name.md) takes precedence over the window -title. - -> [!TIP] -> **See also:** -> + [name var (world)](/ref/world/var/name.md) -> + [icon parameter](/ref/skin/param/icon.md) \ No newline at end of file diff --git a/ref/skin/titlebar.md b/ref/skin/titlebar.md deleted file mode 100644 index a8c30d8e..00000000 --- a/ref/skin/titlebar.md +++ /dev/null @@ -1,31 +0,0 @@ -## titlebar parameter (skin) - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ true/false - -**Default value:** -+ true - - -Show a titlebar for this window. This is also required for the -close, minimize, and maximize buttons to appear. - -If -`is-fullscreen` is true, `titlebar` is ignored, so this value represents -the state of the window when `is-fullscreen` is turned off again. - -> [!TIP] -> **See also:** -> + [can-close parameter](/ref/skin/param/can-close.md) -> + [can-minimize parameter](/ref/skin/param/can-minimize.md) -> + [can-resize parameter](/ref/skin/param/can-resize.md) -> + [icon parameter](/ref/skin/param/icon.md) -> + [title parameter](/ref/skin/param/title.md) -> + [use-title parameter](/ref/skin/param/use-title.md) -> + [statusbar parameter](/ref/skin/param/statusbar.md) -> + [is-fullscreen parameter](/ref/skin/param/is-fullscreen.md) -> + [name var (world)](/ref/world/var/name.md) \ No newline at end of file diff --git a/ref/skin/transparent-color.md b/ref/skin/transparent-color.md deleted file mode 100644 index b1a976b0..00000000 --- a/ref/skin/transparent-color.md +++ /dev/null @@ -1,21 +0,0 @@ -## transparent-color parameter (skin) -###### deprecated - - -**Applies to:** -+ [Main](/ref/skin/control/main.md) (window only) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - -**Default value:** -+ none - - -A color that will be turned into transparency wherever it -appears in this window. Overall, this method of transparency comes with -many limitations, so it is considered deprecated. - -> [!TIP] -> **See also:** -> + [alpha parameter](/ref/skin/param/alpha.md) \ No newline at end of file diff --git a/ref/skin/type.md b/ref/skin/type.md deleted file mode 100644 index 3b74ea93..00000000 --- a/ref/skin/type.md +++ /dev/null @@ -1,17 +0,0 @@ -## type parameter (skin) - - -**Applies to:** -+ [All](/ref/skin/control.md) -+ [Macro](/ref/skin/control/macro.md) -+ [Menu](/ref/skin/control/menu.md) -**Format:** -+ string - - -The type of this control. Read-only. - -> [!TIP] -> **See also:** -> + [id parameter](/ref/skin/param/id.md) -> + [parent parameter](/ref/skin/param/parent.md) \ No newline at end of file diff --git a/ref/skin/use-title.md b/ref/skin/use-title.md deleted file mode 100644 index bae705c9..00000000 --- a/ref/skin/use-title.md +++ /dev/null @@ -1,21 +0,0 @@ -## use-title parameter (skin) - - -**Applies to:** -+ [Browser](/ref/skin/control/browser.md) -**Format:** -+ true/false - -**Default value:** -+ false - - -Use the browser\'s document title to override the title of the -window or pane it appears in. - -> [!TIP] -> **See also:** -> + [show-history parameter](/ref/skin/param/show-history.md) -> + [show-url parameter](/ref/skin/param/show-url.md) -> + [title parameter](/ref/skin/param/title.md) -> + [titlebar parameter](/ref/skin/param/titlebar.md) \ No newline at end of file diff --git a/ref/skin/value.md b/ref/skin/value.md deleted file mode 100644 index 755618f9..00000000 --- a/ref/skin/value.md +++ /dev/null @@ -1,18 +0,0 @@ -## value parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) -**Format:** -+ number - -**Default value:** -+ 0 - - -The "fullness" of this bar/slider, as a percentage. - -> [!TIP] -> **See also:** -> + [is-slider parameter](/ref/skin/param/is-slider.md) -> + [dir parameter](/ref/skin/param/dir.md) \ No newline at end of file diff --git a/ref/skin/view-size.md b/ref/skin/view-size.md deleted file mode 100644 index 59f0d017..00000000 --- a/ref/skin/view-size.md +++ /dev/null @@ -1,33 +0,0 @@ -## view-size parameter (skin) - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) (window only) - -**Format:** -+ *width*x*height* - - -The size, in pixels, of the map after `zoom` has been applied. - - -For instance, if the client view has 10×10 tiles (this includes -any extended tiles caused by HUD objects) and `world.icon_size` is -32x32, the map has a native size of 320×320 pixels. If the map has a -zoom level of 2, then `view-size` will be 640x640. - -With a -`zoom` value of 0, which is the default for most projects, the actual -zoom level is automatically determined by the size of the map control, -the map\'s native pixel size as explained above, and the value of the -[letterbox](/ref/skin/param/letterbox.md) parameter. - -> [!TIP] -> **See also:** -> + [letterbox parameter](/ref/skin/param/letterbox.md) -> + [zoom parameter](/ref/skin/param/zoom.md) -> + [zoom-mode parameter](/ref/skin/param/zoom-mode.md) -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [view var (world)](/ref/world/var/view.md) -> + [view var (client)](/ref/client/var/view.md) -> + [HUD / screen objects](/ref/notes/HUD.md) \ No newline at end of file diff --git a/ref/skin/visited-color.md b/ref/skin/visited-color.md deleted file mode 100644 index 469f7da8..00000000 --- a/ref/skin/visited-color.md +++ /dev/null @@ -1,20 +0,0 @@ -## visited-color parameter (skin) - - -**Applies to:** -+ [Grid](/ref/skin/control/grid.md) -+ [Output](/ref/skin/control/output.md) - -**Format:** -+ [#rrggbb](/ref/appendix/html-colors.md) : none - -**Default value:** -+ #0000ff - - -The color used for visited links. - -> [!TIP] -> **See also:** -> + [text-color parameter](/ref/skin/param/text-color.md) -> + [link-color parameter](/ref/skin/param/link-color.md) \ No newline at end of file diff --git a/ref/skin/width.md b/ref/skin/width.md deleted file mode 100644 index 4c463d17..00000000 --- a/ref/skin/width.md +++ /dev/null @@ -1,19 +0,0 @@ -## width parameter (skin) - - -**Applies to:** -+ [Bar](/ref/skin/control/bar.md) -**Format:** -+ number - -**Default value:** -+ 10 - - -Width, in pixels, of the bar or slider. A value of 0 uses all -available width. - -> [!TIP] -> **See also:** -> + [dir parameter](/ref/skin/param/dir.md) -> + [is-slider parameter](/ref/skin/param/is-slider.md) \ No newline at end of file diff --git a/ref/skin/winset.md b/ref/skin/winset.md deleted file mode 100644 index b2e9544a..00000000 --- a/ref/skin/winset.md +++ /dev/null @@ -1,66 +0,0 @@ -## winset and winget (JavaScript) - - - -Browser controls can interact with the skin via JavaScript, by -setting `window.location` to a special URL. -### Winset -`byond://winset?id=`*`[control ID]`*`&`*`[property]`*`=`*`[value]`*`&...` - - -This works like an ordinary [winset()](/ref/proc/winset.md) -call from the server. If `id` is omitted, it\'s the same as a winset -with a null ID. You can also leave the `id` blank if you use "fully -decorated" property names such as `mybutton.is-checked` instead of just -`is-checked`. - -Any text you use other than letters, numbers, -hyphens, commas, and periods should be encoded via the -`encodeURIComponent()` function in JavaScript. -### Winget -`byond://winget?callback=`*`[callback function]`*`&id=`*`[control ID/list]`*`&property=`*`[property/list]`* - - -In this winget, the IDs and properties you want can be -separated by commas if you want to retrieve more than one. The winget -operation works via a callback function you must define in JavaScript. -The callback is given just one argument, a JavaScript object with all of -the properties you requested. For example, this URL: - byond://winget?callback=wgcb&id=button1&property=is-checked,size,background-color - - -...might send this to the callback function `wgcb`: - { - "is-checked": true, - "size": { - "x": 60, - "y": 20 - }, - "background-color": { - "value": "none", - "isDefault": true, - "red": 236, - "green": 233, - "blue": 216, - "alpha": 255, - "css": "#ece9d8" - } - } - - -The property names will be in the same format you would expect -from [winget()](/ref/proc/winget.md), so when you\'re looking at -multiple elements\' properties, you\'ll get the full names in -`id.property` format. The values are always sent back in a convenient -form for JavaScript to work with; in the case of size, position, and -color these will always be objects. - -An optional `control` -parameter for the winget call can be used if you want to send data to a -callback in a different browser control. - -> [!TIP] -> **See also:** -> + [browser control (skin)](/ref/skin/control/browser.md) -> + [winset proc](/ref/proc/winset.md) -> + [winget proc](/ref/proc/winget.md) \ No newline at end of file diff --git a/ref/skin/zoom-mode.md b/ref/skin/zoom-mode.md deleted file mode 100644 index 1f94bd86..00000000 --- a/ref/skin/zoom-mode.md +++ /dev/null @@ -1,33 +0,0 @@ -## zoom-mode parameter (skin) -###### BYOND Version 511 - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) -**Posisble values:** -+ normal -+ distort -+ blur - -**Default value:** -+ normal - - -Controls the way the map is upscaled. -normal -Preserves a pixelated look, but does some blending between adjacent -pixels when the zoom factor is not an integer. This is equivalent to -upscaling by the next highest integer, then downscaling. -distort -Uses nearest-neighbor sampling to upscale. This may look odd if the zoom -factor is not an integer, since for instance some pixels might scale up -to be 2 pixels wide, others 3 pixels wide. Some users prefer it anyway. -blur -Uses bilinear sampling to upscale. This will cause a blurry appearance -if the zoom factor is high, but it may be desired in some cases. - -> [!TIP] -> **See also:** -> + [letterbox parameter](/ref/skin/param/letterbox.md) -> + [view-size parameter](/ref/skin/param/view-size.md) -> + [zoom parameter](/ref/skin/param/zoom.md) \ No newline at end of file diff --git a/ref/skin/zoom.md b/ref/skin/zoom.md deleted file mode 100644 index 854239a1..00000000 --- a/ref/skin/zoom.md +++ /dev/null @@ -1,21 +0,0 @@ -## zoom parameter (skin) - - -**Applies to:** -+ [Map](/ref/skin/control/map.md) -**Format:** -+ number - -**Default value:** -+ 0 - - -Zoom factor for icons on the map. 1 means to show the icons at -their original size, 2 is 200%, 0.5 is 50%, and so on. A value of 0 -stretches to fit available space. - -> [!TIP] -> **See also:** -> + [letterbox parameter](/ref/skin/param/letterbox.md) -> + [view-size parameter](/ref/skin/param/view-size.md) -> + [zoom-mode parameter](/ref/skin/param/zoom-mode.md) \ No newline at end of file diff --git a/ref/sound/index.md b/ref/sound/index.md new file mode 100644 index 00000000..1278b5dd --- /dev/null +++ b/ref/sound/index.md @@ -0,0 +1,21 @@ + +## sound (info) +*** +A `/sound` datum is created by the `sound()` proc or by `new/sound()`. It can be used to change the way a sound file will play. When you're ready to play the sound, just send it to a player like so: + + +```dm + +var/sound/S = sound('bubbles.wav') +usr << S + +``` + + +The sound file can be supplied as a list of choices, in which case the client will play the first compatible sound in the list. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [sound proc](/ref/proc/sound) ++ [stddef.dm file](/ref/{{appendix}}/stddef%2edm) ++ [load_resource proc](/ref/proc/load_resource) diff --git a/ref/sound/sound.md b/ref/sound/sound.md deleted file mode 100644 index 40116bbc..00000000 --- a/ref/sound/sound.md +++ /dev/null @@ -1,22 +0,0 @@ -## sound datum - - -A `/sound` datum is created by the `sound()` proc or by -`new/sound()`. It can be used to change the way a sound file will play. -When you\'re ready to play the sound, just send it to a player like so: - -```dm - var/sound/S = sound(\'bubbles.wav\') usr << S -``` - - - -The sound file can be supplied as a list of choices, in which -case the client will play the first compatible sound in the list. - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [sound proc](/ref/proc/sound.md) -> + [stddef.dm file](/ref/appendix/stddef%2edm.md) -> + [load_resource proc](/ref/proc/load_resource.md) \ No newline at end of file diff --git a/ref/sound/var.md b/ref/sound/var.md deleted file mode 100644 index 8e6baac8..00000000 --- a/ref/sound/var.md +++ /dev/null @@ -1,22 +0,0 @@ -## vars (sound) - - -Built-in sound vars: -sound/var -+ [file](/ref/sound/var/file.md) -+ [repeat](/ref/sound/var/repeat.md) -+ [wait](/ref/sound/var/wait.md) -+ [channel](/ref/sound/var/channel.md) -+ [volume](/ref/sound/var/volume.md) -+ [frequency](/ref/sound/var/frequency.md) -+ [len](/ref/sound/var/len.md) -+ [offset](/ref/sound/var/offset.md) -+ [pan](/ref/sound/var/pan.md) -+ [params](/ref/sound/var/params.md) -+ [pitch](/ref/sound/var/pitch.md) -+ [priority](/ref/sound/var/priority.md) -+ [status](/ref/sound/var/status.md) -+ [x, y, z](/ref/sound/var/xyz.md) -+ [falloff](/ref/sound/var/falloff.md) -+ [environment](/ref/sound/var/environment.md) -+ [echo](/ref/sound/var/echo.md) \ No newline at end of file diff --git a/ref/sound/var/atom.md b/ref/sound/var/atom.md new file mode 100644 index 00000000..f503d2ff --- /dev/null +++ b/ref/sound/var/atom.md @@ -0,0 +1,17 @@ + +## atom (var) + +**Default Value:** ++ null +*** +Links this sound to an atom, whose position relative to the vitual eye (center of view), in tiles, is transformed and added to the 3D x,y,z coordinates. As you move relative to the atom, the sound's apparent position in 3D space will change without the server needing to update this sound manually. + +This is usually used in conjunction with the transform var, which converts the 2D x,y offset into 3D coordinates. This can scale or rotate the 2D coordinates however you need. + +Note: The atom must remain "in range", meaning the server has to think it's close enough within visual range to send updates to the client, for the sound to be heard. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [x, y, or z](/ref/sound/var/xyz) ++ [transform](/ref/sound/var/transform) ++ [falloff](/ref/sound/var/falloff) diff --git a/ref/sound/var/channel.md b/ref/sound/var/channel.md index 4d3b9af9..640ee2ac 100644 --- a/ref/sound/var/channel.md +++ b/ref/sound/var/channel.md @@ -1,30 +1,21 @@ -## channel var (sound) -**Default value:** -+ 0 (any channel) +## channel (var) +**Default Value:** ++ 0 (any channel) +*** +For sound effects, set to 1 through 1024 to choose a specific sound channel. For values of 0 or less, any available channel will be chosen. If you play a null sound (no file) on channel 0, the settings for the datum will affect all channels. -For sound effects, set to 1 through 1024 to choose a specific -sound channel. For values of 0 or less, any available channel will be -chosen. If you play a null sound (no file) on channel 0, the settings -for the datum will affect all channels. +If you want to make any changes to your sound later on via the `SOUND_UPDATE` status flag, you *must* specify a channel for it. -If you want to make any -changes to your sound later on via the `SOUND_UPDATE` status flag, you -*must* specify a channel for it. +This var may be filled in by the `SoundQuery` proc, but only for sounds that had a specified channel to begin with. -This var may be filled in by -the `SoundQuery` proc, but only for sounds that had a specified channel -to begin with. -Note: If you don\'t specify a channel to play a sound, the client will -choose a channel automatically but it will *not* conflict with any -specific channels you choose for other sounds later. This means if you -play some sounds with channel 0 but then later want to play something on -channel 1, you don\'t have to worry about channel 1 being taken. -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [status var (sound)](/ref/sound/var/status.md) -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +> [!TIP] +> Note: If you don't specify a channel to play a sound, the client will choose a channel automatically but it will *not* conflict with any specific channels you choose for other sounds later. This means if you play some sounds with channel 0 but then later want to play something on channel 1, you don't have to worry about channel 1 being taken. +*** +**Related Pages:** ++ [sound proc](/ref/proc/sound) ++ [SOUND_UPDATE](/ref/sound/var/status) ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/echo.md b/ref/sound/var/echo.md index b6c18572..f36df74a 100644 --- a/ref/sound/var/echo.md +++ b/ref/sound/var/echo.md @@ -1,68 +1,15 @@ -## echo var (sound) -**Default value:** -+ null - - -If set to an 18-element list, this value customizes -reverbration settings for this sound only. A null or non-numeric value -for any setting will select its default. Please see the EAX2 -documentation at http://developer.creative.com/ for indepth information -about these settings. +## echo (var) -Here\'s a rundown of some of the terms: -**Direct** refers to the amount of effect when the sound is on a direct -path to the listener. **Obstruction** is when an object is blocking the -direct path but there are other ways for the sound to reach the -listener. **Occlusion** means the sound is on the other side of a wall, -and mostly blocked. **Exclusion** means the sound is on the other side -of a wall, but a doorway or window is allowing it to pass through to the -listener. You can use a little of each of these effects to increase -realism. -1 Direct (-10,000 to 1,000) default = 0 -+ direct path level (at low and mid frequencies) -2 DirectHF (-10,000 to 0) default = 0 -+ relative direct path level at high frequencies -3 Room (-10,000 to 1,000) default = 0 -+ room effect level (at low and mid frequencies) -4 Room HF (-10,000 to 0) default = 0 -+ relative room effect level at high frequencies -5 Obstruction (-10,000 to 0) default = 0 -+ main obstruction control (attenuation at high frequencies) -6 ObstructionLFRatio (0.0 to 1.0) default = 0.0 -+ obstruction low-frequency level re. main control -7 Occlusion (-10,000 to 0) default = 0 -+ main occlusion control (attenuation at high frequencies) -8 OcclusionLFRatio (0.0 to 1.0) default = 0.25 -+ occlusion low-frequency level re. main control -9 OcclusionRoomRatio (0.0 to 10.0) default = 1.5 -+ relative occlusion control for room effect -10 OcclusionDirectRatio (0.0 to 10.0) default = 1.0 -+ relative occlusion control for direct path -11 Exclusion (-10,000 to 0) default = 0 -+ main exlusion control (attenuation at high frequencies) -12 ExclusionLFRatio (0.0 to 1.0) default = 1.0 -+ exclusion low-frequency level re. main control -13 OutsideVolumeHF (-10,000 to 0) default = 0 -+ outside sound cone level at high frequencies -14 DopplerFactor (0.0 to 10.0) default = 0.0 -+ like DS3D flDopplerFactor but per source -15 RolloffFactor (0.0 to 10.0) default = 0.0 -+ like DS3D flRolloffFactor but per source -16 RoomRolloffFactor (0.0 to 10.0) default = 0.0 -+ like DS3D flRolloffFactor but for room effect -17 AirAbsorptionFactor (0.0 to 10.0) default = 1.0 -+ multiplies AirAbsorptionHF member of environment reverb properties. -18 Flags default = 7 -+ Bit flags that modify the behavior of properties - - 1 - Automatic setting of \'Direct\' due to distance from - listener - - 2 - Automatic setting of \'Room\' due to distance from listener - - 4 - Automatic setting of \'RoomHF\' due to distance from - listener - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [x, y, z vars (sound)](/ref/sound/var/xyz.md) -> + [environment var (sound)](/ref/sound/var/environment.md) \ No newline at end of file +**Default Value:** ++ null +*** +If set to an 18-element list, this value customizes reverbration settings for this sound only. A null or non-numeric value for any setting will select its default. Please see the EAX2 documentation at http://developer.creative.com/ for indepth information about these settings. + +Here's a rundown of some of the terms: **Direct** refers to the amount of effect when the sound is on a direct path to the listener. **Obstruction** is when an object is blocking the direct path but there are other ways for the sound to reach the listener. **Occlusion** means the sound is on the other side of a wall, and mostly blocked. **Exclusion** means the sound is on the other side of a wall, but a doorway or window is allowing it to pass through to the listener. You can use a little of each of these effects to increase realism. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [x, y, or z](/ref/sound/var/xyz) ++ [atom-linked](/ref/sound/var/atom) ++ [environment var (sound)](/ref/sound/var/environment) diff --git a/ref/sound/var/environment.md b/ref/sound/var/environment.md index 0349dd4e..4d1ebc17 100644 --- a/ref/sound/var/environment.md +++ b/ref/sound/var/environment.md @@ -1,113 +1,19 @@ -## environment var (sound) -**Default value:** -+ -1 - - -Changes the environmental reverb for all 3D sounds until -another environment is specified. Only 3D sounds react to the -environment. Detailed information about these -settings can be found [here](https://opentk.net/api/OpenTK.Audio.OpenAL.Extensions.Creative.EFX.EffectFloat.html). - -This value may be a number which selects a preset, or -a list to choose settings manually. The default value (-1) specifies no -change in environment. A numeric value from 0 to 25 specifies a set of -reverb presets for the environment. The environment presets are: -0. generic -1. padded cell -2. room -3. bathroom -4. livingroom -5. stoneroom -6. auditorium -7. concert hall -8. cave -9. arena -10. hangar -11. carpeted hallway -12. hallway -13. stone corridor -14. alley -15. forest -16. city -17. mountains -18. quarry -19. plain -20. parking lot -21. sewer pipe -22. underwater -23. drugged -24. dizzy -25. psychotic +## environment (var) +**Default Value:** ++ -1 +*** +Changes the environmental reverb for all 3D sounds until another environment is specified. Only 3D sounds react to the environment. Please see the EAX2 documentation at http://developer.creative.com/ for detailed information about these settings. -As of BYOND 515, setting environment to a negative number below --1 will turn the environment off. The generic environment is not the -same as off. +This value may be a number which selects a preset, or a list to choose settings manually. The default value (-1) specifies no change in environment. A numeric value from 0 to 25 specifies a set of reverb presets for the environment. The environment presets are: -A 23-element list represents a custom environment -with the following reverbration settings. A null or non-numeric value -for any setting will select its default. -1 EnvSize (1.0 to 100.0) default = 7.5 -+ environment size in meters -2 EnvDiffusion (0.0 to 1.0) default = 1.0 -+ environment diffusion -3 Room (-10000 to 0) default = -1000 -+ room effect level (at mid frequencies) -4 RoomHF (-10000 to 0) default = -100 -+ relative room effect level at high frequencies -5 RoomLF (-10000 to 0) default = 0 -+ relative room effect level at low frequencies -6 DecayTime (0.1 to 20.0) default = 1.49 -+ reverberation decay time at mid frequencies -7 DecayHFRatio (0.1 to 2.0) default = 0.83 -+ high-frequency to mid-frequency decay time ratio -8 DecayLFRatio (0.1 to 2.0) default = 1.0 -+ low-frequency to mid-frequency decay time ratio -9 Reflections (-10000 to 1000) default = -2602 -+ early reflections level relative to room effect -10 ReflectionsDelay (0.0 to 0.3) default = 0.007 -+ initial reflection delay time -11 Reverb (-10000 to 2000) default = 200 -+ late reverberation level relative to room effect -12 ReverbDelay (0.0 to 0.1) default = 0.011 -+ late reverberation delay time relative to initial reflection -13 EchoTime (0.075 to 0.250) default = 0.25 -+ echo time -14 EchoDepth (0.0 to 1.0) default = 0.0 -+ echo depth -15 ModulationTime (0.04 to 4.0) default = 0.25 -+ modulation time -16 ModulationDepth (0.0 to 1.0) default = 0.0 -+ modulation depth -17 AirAbsorptionHF (-100 to 0.0) default = -5.0 -+ change in level per meter at high frequencies -18 HFReference (1000.0 to 20000) default = 5000.0 -+ reference high frequency (hz) -19 LFReference (20.0 to 1000.0) default = 250.0 -+ reference low frequency (hz) -20 RoomRolloffFactor (0.0 to 10.0) default = 0.0 -+ like rolloffscale in System::set3DSettings but for reverb room size - effect -21 Diffusion (0.0 to 100.0) default = 100.0 -+ Value that controls the echo density in the late reverberation - decay. -22 Density (0.0 to 100.0) default = 100.0 -+ Value that controls the modal density in the late reverberation - decay -23 Flags default = 63 -+ Bit flags that modify the behavior of above properties - - 1 - \'EnvSize\' affects reverberation decay time - - 2 - \'EnvSize\' affects reflection level - - 4 - \'EnvSize\' affects initial reflection delay time - - 8 - \'EnvSize\' affects reflections level - - 16 - \'EnvSize\' affects late reverberation delay time - - 32 - AirAbsorptionHF affects DecayHFRatio - - 64 - \'EnvSize\' affects echo time - - 128 - \'EnvSize\' affects modulation time +As of BYOND 515, setting environment to a negative number below -1 will turn the environment off. The generic environment is not the same as off. -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [x, y, z vars (sound)](/ref/sound/var/xyz.md) -> + [echo var (sound)](/ref/sound/var/echo.md) \ No newline at end of file +A 23-element list represents a custom environment with the following reverbration settings. A null or non-numeric value for any setting will select its default. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [x, y, or z](/ref/sound/var/xyz) ++ [atom-linked](/ref/sound/var/atom) ++ [echo var (sound)](/ref/sound/var/echo) diff --git a/ref/sound/var/falloff.md b/ref/sound/var/falloff.md index 597f88f9..e4a65b99 100644 --- a/ref/sound/var/falloff.md +++ b/ref/sound/var/falloff.md @@ -1,18 +1,15 @@ -## falloff var (sound) -**Default value:** -+ 1 - - -Within the falloff distance a 3D sound stays at the constant -loudest volume possible. Outside of this distance it attenuates at a -rate determined by the falloff. +## falloff (var) -Higher values will make sounds -fade out more slowly as they get farther away. The distance of a sound -is set by `x`, `y`, and `z`. - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [x, y, z vars (sound)](/ref/sound/var/xyz.md) \ No newline at end of file +**Default Value:** ++ 1 +*** +Within the falloff distance a 3D sound stays at the constant loudest volume possible. Outside of this distance it attenuates at a rate determined by the falloff. + +Higher values will make sounds fade out more slowly as they get farther away. The distance of a sound is set by `x`, `y`, and `z`. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [x, y, or z](/ref/sound/var/xyz) ++ [atom-linked](/ref/sound/var/atom) ++ [transform](/ref/sound/var/transform) diff --git a/ref/sound/var/file.md b/ref/sound/var/file.md index 5398175c..59f45eec 100644 --- a/ref/sound/var/file.md +++ b/ref/sound/var/file.md @@ -1,19 +1,13 @@ -## file var (sound) +## file (var) +*** +This is the file that will be played when the sound is sent to a player. -This is the file that will be played when the sound is sent to -a player. +If this value is a list of files rather than a single file, the client will play the first compatible sound in the list. This can be useful for developing webclient games, where .ogg is preferred by most browsers for audio, but .mp3 is needed for others. -If this value is a list of files rather than a single -file, the client will play the first compatible sound in the list. This -can be useful for developing webclient games, where .ogg is preferred by -most browsers for audio, but .mp3 is needed for others. - -This -var may be filled in by the `SoundQuery` proc. - -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +This var may be filled in by the `SoundQuery` proc. +*** +**Related Pages:** ++ [sound proc](/ref/proc/sound) ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/frequency.md b/ref/sound/var/frequency.md index ba2d8311..b666a8ea 100644 --- a/ref/sound/var/frequency.md +++ b/ref/sound/var/frequency.md @@ -1,31 +1,17 @@ -## frequency var (sound) - -**Default value:** -+ 0 +## frequency (var) -Any value from -100 to 100 will play this sound at a multiple -of its normal frequency. Set to 2 to play at double speed, for example, -or -1 to play backwards. A value of 0 or 1 will play the sound at its -normal frequency. +**Default Value:** ++ 0 +*** +Any value from -100 to 100 will play this sound at a multiple of its normal frequency. Set to 2 to play at double speed, for example, or -1 to play backwards. A value of 0 or 1 will play the sound at its normal frequency. -Set to a specific frequency (in Hz) outside -of the -100 to 100 range to change the playback rate of the sound. A -negative value is also allowed. The value 0 means that the sound should -be played as-is. This value will take effect when the sound is sent to a -player. +Set to a specific frequency (in Hz) outside of the -100 to 100 range to change the playback rate of the sound. A negative value is also allowed. The value 0 means that the sound should be played as-is. This value will take effect when the sound is sent to a player. -CD-quality sound is sampled at 44.1 KHz, which is a -value of 44100. Other common sample rates for .wav files are 8000, -11025, and 22050. (11025 is usually a good quality for most sound -effects without making file size too large.) If you know the file\'s -sample rate, doubling the value will play it at a higher pitch and twice -as fast; halving it will play it at a lower pitch and twice as slow. -To make a sound play at a different speed but keep its pitch intact, set -`frequency` to the speed multiple you want (e.g., 1.2 for 20% faster) -and set `pitch` to the inverse (e.g., 1/1.2). +CD-quality sound is sampled at 44.1 KHz, which is a value of 44100. Other common sample rates for .wav files are 8000, 11025, and 22050. (11025 is usually a good quality for most sound effects without making file size too large.) If you know the file's sample rate, doubling the value will play it at a higher pitch and twice as fast; halving it will play it at a lower pitch and twice as slow. -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [pitch var (sound)](/ref/sound/var/pitch.md) \ No newline at end of file +To make a sound play at a different speed but keep its pitch intact, set `frequency` to the speed multiple you want (e.g., 1.2 for 20% faster) and set `pitch` to the inverse (e.g., 1/1.2). +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [pitch var (sound)](/ref/sound/var/pitch) diff --git a/ref/sound/var/index.md b/ref/sound/var/index.md new file mode 100644 index 00000000..80edd9d3 --- /dev/null +++ b/ref/sound/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in sound vars: +*** \ No newline at end of file diff --git a/ref/sound/var/len.md b/ref/sound/var/len.md index eb7a2987..ed340cea 100644 --- a/ref/sound/var/len.md +++ b/ref/sound/var/len.md @@ -1,16 +1,10 @@ -## len var (sound) -###### BYOND Version 513 +## len (var) +*** +This value is set by the `SoundQuery` proc and represents the length, in seconds, of a sound playing on the client. Frequency is taken into into consideration, so a higher frequency means the sound takes a shorter time to play and therefore has a shorter length. -This value is set by the `SoundQuery` proc and represents the -length, in seconds, of a sound playing on the client. Frequency is taken -into into consideration, so a higher frequency means the sound takes a -shorter time to play and therefore has a shorter length. - -Other -uses for this var may be considered in the future. - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +Other uses for this var may be considered in the future. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/offset.md b/ref/sound/var/offset.md index e9f81f1c..250c85a1 100644 --- a/ref/sound/var/offset.md +++ b/ref/sound/var/offset.md @@ -1,14 +1,11 @@ -## offset var (sound) -###### BYOND Version 513 -alter the current time index when using the `SOUND_UPDATE` flag. +## offset (var) +*** +Can be used to set a starting time, in seconds, for a sound. It can also alter the current time index when using the `SOUND_UPDATE` flag. - -This value is also set by the `SoundQuery` proc and represents -the current time index of a sound playing on the client. - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [status var (sound)](/ref/sound/var/status.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) Can be used to set a starting time, in seconds, for a sound. It can also \ No newline at end of file +This value is also set by the `SoundQuery` proc and represents the current time index of a sound playing on the client. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [SOUND_UPDATE](/ref/sound/var/status) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/pan.md b/ref/sound/var/pan.md index cba26fc0..4c0acdb8 100644 --- a/ref/sound/var/pan.md +++ b/ref/sound/var/pan.md @@ -1,16 +1,12 @@ -## pan var (sound) - -**Default value:** -+ 0 +## pan (var) -Alter the panning of a sound. -100 is full left, 100 is full -right, and 0 is at the center. This value will take effect when the -sound is sent to a player. - -For music, `pan` can range from -100 -(no pan separation) to 0 (full separation). +**Default Value:** ++ 0 +*** +Alter the panning of a sound. -100 is full left, 100 is full right, and 0 is at the center. This value will take effect when the sound is sent to a player. -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) \ No newline at end of file +For music, `pan` can range from -100 (no pan separation) to 0 (full separation). +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) diff --git a/ref/sound/var/params.md b/ref/sound/var/params.md index 3876ec67..4c4a264c 100644 --- a/ref/sound/var/params.md +++ b/ref/sound/var/params.md @@ -1,33 +1,27 @@ -## params var (sound) -###### BYOND Version 515 +## params (var) -**Default value:** +**Default Value:** + null +*** +Used to set client skin information related to this sound. This can be set to an associative list or a parameter string such as you would get from list2params(). +These are the parameters currently defined: -Used to set client skin information related to this sound. This -can be set to an [associative list](/ref/list/associations.md) or a parameter -string such as you would get from -[list2params()](/ref/proc/list2params.md). - -These are the -parameters currently defined: -on-end -+ Plays when the sound ends or is stopped. -on-preempt -+ Plays when the sound is preempted by another sound. If this isn\'t - present, `on-end` still applies if the sound is preempted. -### Example: ```dm - mob/proc/PlayIntro() var/sound/S = sound(\'intro.ogg\') -S.params = list("on-end" = ".intro-ended") src << S -mob/verb/\_Intro_Ended() set name = ".intro-ended" src << "The -intro has concluded." -``` +mob/proc/PlayIntro() + var/sound/S = sound('intro.ogg') + S.params = list("on-end" = ".intro-ended") + src << S + +mob/verb/_Intro_Ended() + set name = ".intro-ended" + src << "The intro has concluded." + +``` -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) \ No newline at end of file +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) diff --git a/ref/sound/var/pitch.md b/ref/sound/var/pitch.md index a320c488..87cb903b 100644 --- a/ref/sound/var/pitch.md +++ b/ref/sound/var/pitch.md @@ -1,39 +1,38 @@ -## pitch var (sound) -###### BYOND Version 515 -**Default value:** -+ 0 +## pitch (var) +**Default Value:** ++ 0 +*** +Can be used to shift the pitch of a sound up or down. This works similarly to frequency except that it doesn't impact playback speed. -Can be used to shift the pitch of a sound up or down. This -works similarly to frequency except that it doesn\'t impact playback -speed. +The value of this var should be a multiple relative to 1, so for instance to go up a full octave, the value would be 2; to go down an octave, use 0.5. -The value of this var should be a multiple relative to -1, so for instance to go up a full octave, the value would be 2; to go -down an octave, use 0.5. +Note: The filter that handles pitch shifting only goes from 0.5 to 2. The player will stack up to three filters if it has to, so the range is really from 0.125 to 8. You will however hear much poorer quality at more extreme values. -Note: The filter that handles pitch -shifting only goes from 0.5 to 2. The player will stack up to three -filters if it has to, so the range is really from 0.125 to 8. You will -however hear much poorer quality at more extreme values. +To make a sound play at a different speed but keep its pitch intact, set `frequency` to the speed multiple you want (e.g., 1.2 for 20% faster) and set `pitch` to the inverse (e.g., 1/1.2). -To -make a sound play at a different speed but keep its pitch intact, set -`frequency` to the speed multiple you want (e.g., 1.2 for 20% faster) -and set `pitch` to the inverse (e.g., 1/1.2). -### Example: ```dm - client var/sound/music // music currently playing -proc/PlayMusic(music) music = new(music) music.channel = 100 src << -music proc/UpTempo(amount = 0.1) // 10% faster if(!music) return -music.frequency = (music.frequency \|\| 1) + amount music.pitch = 1 / -music.frequency music.status \|= SOUND_UPDATE src << music -``` +client + var/sound/music // music currently playing + + proc/PlayMusic(music) + music = new(music) + music.channel = 100 + src << music + + proc/UpTempo(amount = 0.1) // 10% faster + if(!music) return + music.frequency = (music.frequency || 1) + amount + music.pitch = 1 / music.frequency + music.status |= SOUND_UPDATE + src << music + +``` -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [frequency var (sound)](/ref/sound/var/frequency.md) \ No newline at end of file +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [frequency var (sound)](/ref/sound/var/frequency) diff --git a/ref/sound/var/priority.md b/ref/sound/var/priority.md index 98c19a40..61f158a5 100644 --- a/ref/sound/var/priority.md +++ b/ref/sound/var/priority.md @@ -1,12 +1,10 @@ -## priority var (sound) - -**Default value:** -+ 0 +## priority (var) -Sounds with higher priority may steal channels from sounds of -lower priority. The maximum value is 255. 0 is the lowest. - -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) \ No newline at end of file +**Default Value:** ++ 0 +*** +Sounds with higher priority may steal channels from sounds of lower priority. The maximum value is 255. 0 is the lowest. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) diff --git a/ref/sound/var/repeat.md b/ref/sound/var/repeat.md index 633d98ab..f610cc05 100644 --- a/ref/sound/var/repeat.md +++ b/ref/sound/var/repeat.md @@ -1,17 +1,14 @@ -## repeat var (sound) -**Default value:** -+ 0 (do not repeat) - - -Set to 1 to repeat the sound indefinitely once it begins -playing, 2 to repeat it forwards and backwards. +## repeat (var) -This var may be -filled in by the `SoundQuery` proc. - -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +**Default Value:** ++ 0 (do not repeat) +*** +Set to 1 to repeat the sound indefinitely once it begins playing, 2 to repeat it forwards and backwards. + +This var may be filled in by the `SoundQuery` proc. +*** +**Related Pages:** ++ [sound proc](/ref/proc/sound) ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/status.md b/ref/sound/var/status.md index db70e4df..fd9cd264 100644 --- a/ref/sound/var/status.md +++ b/ref/sound/var/status.md @@ -1,47 +1,34 @@ -## status var (sound) -**Default value:** +## status (var) + +**Default Value:** + 0 +*** +Alter the way the sound is heard by affecting several different on/off values which combine as bit flags. -Alter the way the sound is heard by affecting several different -on/off values which combine as bit flags. ```dm - SOUND_MUTE // do -not play the sound SOUND_PAUSED // pause sound SOUND_STREAM // create as -a stream SOUND_UPDATE // update a playing sound -``` - -Use -the `|` operator to combine these values. The setting you choose will -take effect when the sound is sent to a player. +SOUND_MUTE // do not play the sound +SOUND_PAUSED // pause sound +SOUND_STREAM // create as a stream +SOUND_UPDATE // update a playing sound + +``` -`SOUND_MUTE | SOUND_UPDATE` will mute a sound, but it will -continue to play. It can be unmuted while still playing by resending it -with `status=SOUND_UPDATE`. +Use the `|` operator to combine these values. The setting you choose will take effect when the sound is sent to a player. -`SOUND_PAUSED | SOUND_UPDATE` will -pause a sound. It can be restarted from its current position by -resending it with `status=SOUND_UPDATE`. +`SOUND_MUTE | SOUND_UPDATE` will mute a sound, but it will continue to play. It can be unmuted while still playing by resending it with `status=SOUND_UPDATE`. -`SOUND_STREAM` will -create this sound as a stream. Streams take less memory, but can not -play multiple times at once, nor can they play in reverse. This flag is -only valid the first time that a sound is played in a particular mode -(normal vs. 3D). Changing the flag later will not change the stream -status of the sound in that mode. +`SOUND_PAUSED | SOUND_UPDATE` will pause a sound. It can be restarted from its current position by resending it with `status=SOUND_UPDATE`. -`SOUND_UPDATE` updates the -settings for the sound currently playing on the specified channel. If -this flag is not set or no channel is specified, the sound will start -again from the beginning. +`SOUND_STREAM` will create this sound as a stream. Streams take less memory, but can not play multiple times at once, nor can they play in reverse. This flag is only valid the first time that a sound is played in a particular mode (normal vs. 3D). Changing the flag later will not change the stream status of the sound in that mode. -Some of the flags for this value may -be filled in by the `SoundQuery` proc. +`SOUND_UPDATE` updates the settings for the sound currently playing on the specified channel. If this flag is not set or no channel is specified, the sound will start again from the beginning. -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +Some of the flags for this value may be filled in by the `SoundQuery` proc. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/transform.md b/ref/sound/var/transform.md new file mode 100644 index 00000000..5bd507a8 --- /dev/null +++ b/ref/sound/var/transform.md @@ -0,0 +1,44 @@ + +## transform (var) + +**Default Value:** ++ null (same as ) +*** +A 3x3 matrix for converting the 2D position of an atom, relative to the center of view, into 3D sound coordinates. (This value is meaningless if you don't link the sound to an atom via the atom var.) The transformed vector is added to the sound's x,y,z values to get a 3D position. + +The value of `transform` should be a list with 9 elements, in row-major order. The default list is `list(1,0,0, 0,1,0, 0,0,0)`. If you use a list shorter than 9 elements, the defaults will be filled in for you. + +In easier-to-understand terms, this is how the result is calculated: + + +```dm + +new_x = x * xx + y * yx + cx +new_y = x * xy + y * yy + cy +new_z = x * xz + y * yz + cz + +``` + + +It is helpful to think of each row in the matrix as what each component of the original vector will become. The first row of the matrix is the output x,y,z you'll get for an input x of 1. + + +```dm + +obj/fire + proc/HearMe(mob/player) + var/sound/S = new('fire.ogg', channel=10, repeat=1) + S.atom = src + S.transform = list(1,0,0, 0,sqrt(0.5),sqrt(0.5), 0,0,0) + player << S + +``` + + +The transform in this example rotates the fire's position by 45° forward, so positive y values get split between y and z. This gives the player the impression that an object higher up on their screen is both forward of and above them, as if they're looking down at the map from a 45° angle. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [atom-linked](/ref/sound/var/atom) ++ [x, y, or z](/ref/sound/var/xyz) ++ [falloff](/ref/sound/var/falloff) diff --git a/ref/sound/var/volume.md b/ref/sound/var/volume.md index a8afacc1..83bd7f0a 100644 --- a/ref/sound/var/volume.md +++ b/ref/sound/var/volume.md @@ -1,13 +1,11 @@ -## volume var (sound) - -**Default value:** -+ 100 (full volume) +## volume (var) -Set to a percentage from 0 to 100 of the sound\'s full volume. -It will play at that volume when it is sent to a player. - -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [vars (sound)](/ref/sound/var.md) \ No newline at end of file +**Default Value:** ++ 100 (full volume) +*** +Set to a percentage from 0 to 100 of the sound's full volume. It will play at that volume when it is sent to a player. +*** +**Related Pages:** ++ [sound proc](/ref/proc/sound) ++ [vars (sound)](/ref/sound/var) diff --git a/ref/sound/var/wait.md b/ref/sound/var/wait.md index a9312957..376d57d1 100644 --- a/ref/sound/var/wait.md +++ b/ref/sound/var/wait.md @@ -1,18 +1,14 @@ -## wait var (sound) -**Default value:** -+ 0 (do not wait) - - -Set to 1 to wait for other sounds in this channel to finish -before playing this one. +## wait (var) -The `SoundQuery` proc fills in this -value with the total duration of sounds that are queued to be played on -this channel. - -> [!TIP] -> **See also:** -> + [sound proc](/ref/proc/sound.md) -> + [vars (sound)](/ref/sound/var.md) -> + [SoundQuery proc (client)](/ref/client/proc/SoundQuery.md) \ No newline at end of file +**Default Value:** ++ 0 (do not wait) +*** +Set to 1 to wait for other sounds in this channel to finish before playing this one. + +The `SoundQuery` proc fills in this value with the total duration of sounds that are queued to be played on this channel. +*** +**Related Pages:** ++ [sound proc](/ref/proc/sound) ++ [vars (sound)](/ref/sound/var) ++ [SoundQuery proc (client)](/ref/client/proc/SoundQuery) diff --git a/ref/sound/var/xyz.md b/ref/sound/var/xyz.md index c8c8744d..befeb9ef 100644 --- a/ref/sound/var/xyz.md +++ b/ref/sound/var/xyz.md @@ -1,27 +1,19 @@ -## x, y, and z vars (sound) - -**Default value:** -+ all 0 +## xyz (var) -Set to different values to give your sound a 3D effect which -will be applied when it is played. Positive values for `x` will sound as -if they come from the right, positive `y` sounds like it is above the -player\'s head, and positive `z` sounds like it is directly ahead. The -effect of 3D sound depends on the player\'s computer\'s sound card, and -is greatly enhanced when wearing headphones. +**Default Value:** ++ all 0 +*** +Set to different values to give your sound a 3D effect which will be applied when it is played. Positive values for `x` will sound as if they come from the right, positive `y` sounds like it is above the player's head, and positive `z` sounds like it is directly ahead. The effect of 3D sound depends on the player's computer's sound card, and is greatly enhanced when wearing headphones. -Depending on the -value of `falloff`, the settings for the location of the sound can also -affect its volume. Once the distance passes the value of `falloff`, the -volume will diminish. +Depending on the value of `falloff`, the settings for the location of the sound can also affect its volume. Once the distance passes the value of `falloff`, the volume will diminish. -If these values are all set to 0, you -should set `environment` if you want to treat it as a 3D sound. -Otherwise BYOND will assume this is meant to be a non-3D sound such as -music or the interface. +If these values are all set to 0, you should set `environment` if you want to treat it as a 3D sound. Otherwise BYOND will assume this is meant to be a non-3D sound such as music or the interface. -> [!TIP] -> **See also:** -> + [vars (sound)](/ref/sound/var.md) -> + [falloff var (sound)](/ref/sound/var/falloff.md) \ No newline at end of file +If the atom var is set to an atom that's visible on the map (that is, if it's close enough to the center of view to be sent by the server), its relative x and y coordinates are fed through the transform matrix, if present, and added to the x,y,z coordinates. This way, a sound's 3D position can change in real time. A sound is considered 3D if the `atom` var is set, even if the base x,y,z coordinates are all 0. +*** +**Related Pages:** ++ [vars (sound)](/ref/sound/var) ++ [atom-linked](/ref/sound/var/atom) ++ [transform](/ref/sound/var/transform) ++ [falloff](/ref/sound/var/falloff) diff --git a/ref/turf/index.md b/ref/turf/index.md new file mode 100644 index 00000000..31e63447 --- /dev/null +++ b/ref/turf/index.md @@ -0,0 +1,36 @@ + +## turf (info) +*** +Turfs cover the surface of the map. They are derived from `/turf` which derives from `/atom`. + +This example defines the turf prototype `/turf/floor` and `/turf/wall`. + + +```dm + +turf + floor + desc = "A wood plank floor." + wall + desc = "A stone wall." + density = 1 + +``` + + +Turfs cannot be moved. They can only be created or destroyed by changing `world.maxx`, `world.maxy`, or `world.maxz`. When you create a new turf with `new()`, it always replaces the old one. + + +```dm + +// replace old_turf with a wall +var/turf/wall/T = new(old_turf) + +``` + +*** +**Related Pages:** ++ [atom](/ref/atom) ++ [procs (turf)](/ref/turf/proc) ++ [vars (turf)](/ref/turf/var) ++ [Map](/ref/map) diff --git a/ref/turf/proc.md b/ref/turf/proc.md index 202e1039..8891e87f 100644 --- a/ref/turf/proc.md +++ b/ref/turf/proc.md @@ -1,29 +1,5 @@ -## procs (turf) - +## proc (proc) +*** Built-in turf procs: -turf/proc -+ [Click](/ref/atom/proc/Click.md) -+ [Cross proc](/ref/atom/proc/Cross.md) -+ [Crossed proc](/ref/atom/proc/Crossed.md) -+ [DblClick](/ref/atom/proc/DblClick.md) -+ [Del](/ref/datum/proc/Del.md) -+ [Enter](/ref/atom/proc/Enter.md) -+ [Entered](/ref/atom/proc/Entered.md) -+ [Exit](/ref/atom/proc/Exit.md) -+ [Exited](/ref/atom/proc/Exited.md) -+ [MouseDown](/ref/atom/proc/MouseDown.md) -+ [MouseDrag](/ref/atom/proc/MouseDrag.md) -+ [MouseDrop](/ref/atom/proc/MouseDrop.md) -+ [MouseEntered](/ref/atom/proc/MouseEntered.md) -+ [MouseExited](/ref/atom/proc/MouseExited.md) -+ [MouseMove](/ref/atom/proc/MouseMove.md) -+ [MouseUp](/ref/atom/proc/MouseUp.md) -+ [MouseWheel](/ref/atom/proc/MouseWheel.md) -+ [New](/ref/atom/proc/New.md) -+ [Read](/ref/datum/proc/Read.md) -+ [Stat](/ref/atom/proc/Stat.md) -+ [Topic](/ref/datum/proc/Topic.md) -+ [Write](/ref/datum/proc/Write.md) -+ [Uncross proc](/ref/atom/proc/Uncross.md) -+ [Uncrossed proc](/ref/atom/proc/Uncrossed.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/turf/turf.md b/ref/turf/turf.md deleted file mode 100644 index 7257ee31..00000000 --- a/ref/turf/turf.md +++ /dev/null @@ -1,34 +0,0 @@ -## turf - - -Turfs cover the surface of the map. They are derived from -`/turf` which derives from `/atom`. - -This example defines the -turf prototype `/turf/floor` and `/turf/wall`. -### Example: - -```dm - turf floor desc = "A wood plank floor." wall desc = "A -stone wall." density = 1 -``` - - -Turfs cannot be moved. -They can only be created or destroyed by changing `world.maxx`, -`world.maxy`, or `world.maxz`. When you create a new turf with `new()`, -it always replaces the old one. -### Example: - -```dm - // replace old_turf with a wall var/turf/wall/T = -new(old_turf) -``` - - -> [!TIP] -> **See also:** -> + [atom](/ref/atom.md) -> + [procs (turf)](/ref/turf/proc.md) -> + [vars (turf)](/ref/turf/var.md) -> + [Map](/ref/map.md) \ No newline at end of file diff --git a/ref/turf/var.md b/ref/turf/var.md deleted file mode 100644 index bf46e260..00000000 --- a/ref/turf/var.md +++ /dev/null @@ -1,54 +0,0 @@ -## vars (turf) - - -Built-in turf vars: -turf/var -+ [alpha](/ref/atom/var/alpha.md) -+ [appearance](/ref/atom/var/appearance.md) -+ [appearance_flags](/ref/atom/var/appearance_flags.md) -+ [blend_mode](/ref/atom/var/blend_mode.md) -+ [color](/ref/atom/var/color.md) -+ [contents](/ref/atom/var/contents.md) -+ [density](/ref/atom/var/density.md) -+ [desc](/ref/atom/var/desc.md) -+ [dir](/ref/atom/var/dir.md) -+ [filters](/ref/atom/var/filters.md) -+ [gender](/ref/atom/var/gender.md) -+ [icon](/ref/atom/var/icon.md) -+ [icon_state](/ref/atom/var/icon_state.md) -+ [icon_w](/ref/atom/var/icon_w.md) -+ [icon_z](/ref/atom/var/icon_z.md) -+ [invisibility](/ref/atom/var/invisibility.md) -+ [underlays](/ref/atom/var/underlays.md) -+ [overlays](/ref/atom/var/overlays.md) -+ [loc](/ref/atom/var/loc.md) -+ [layer](/ref/atom/var/layer.md) -+ [luminosity](/ref/atom/var/luminosity.md) -+ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -+ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -+ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) -+ [mouse_drop_zone var](/ref/atom/var/mouse_drop_zone.md) -+ [mouse_opacity var](/ref/atom/var/mouse_opacity.md) -+ [name](/ref/atom/var/name.md) -+ [opacity](/ref/atom/var/opacity.md) -+ [parent_type](/ref/turf/var/parent_type.md) -+ [pixel_x](/ref/atom/var/pixel_x.md) -+ [pixel_y](/ref/atom/var/pixel_y.md) -+ [pixel_w](/ref/atom/var/pixel_w.md) -+ [pixel_z](/ref/atom/var/pixel_z.md) -+ [plane](/ref/atom/var/plane.md) -+ [render_source](/ref/atom/var/render_source.md) -+ [render_target](/ref/atom/var/render_target.md) -+ [suffix](/ref/atom/var/suffix.md) -+ [tag](/ref/datum/var/tag.md) -+ [text](/ref/atom/var/text.md) -+ [transform](/ref/atom/var/transform.md) -+ [type](/ref/datum/var/type.md) -+ [vars](/ref/datum/var/vars.md) -+ [verbs](/ref/atom/var/verbs.md) -+ [vis_contents](/ref/atom/var/vis_contents.md) -+ [vis_flags](/ref/atom/var/vis_flags.md) -+ [vis_locs](/ref/atom/var/vis_locs.md) -+ [x](/ref/atom/var/x.md) -+ [y](/ref/atom/var/y.md) -+ [z](/ref/atom/var/z.md) \ No newline at end of file diff --git a/ref/turf/var/index.md b/ref/turf/var/index.md new file mode 100644 index 00000000..2963893b --- /dev/null +++ b/ref/turf/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in turf vars: +*** \ No newline at end of file diff --git a/ref/turf/var/parent_type.md b/ref/turf/var/parent_type.md index 8b0377d9..1de2cf45 100644 --- a/ref/turf/var/parent_type.md +++ b/ref/turf/var/parent_type.md @@ -1,9 +1,7 @@ -## parent_type var (turf) - - -The default parent_type of [/turf](/ref/turf.md) is [/atom](/ref/atom.md) - -> [!TIP] -> **See also:** -> + [parent_type var](/ref/datum/var/parent_type.md) \ No newline at end of file +## parent_type (var) +*** +The default parent_type of /turf is /atom. +*** +**Related Pages:** ++ [parent_type](/ref/datum/var/parent_type) diff --git a/ref/var/const.md b/ref/var/const.md index e0f10983..ca752937 100644 --- a/ref/var/const.md +++ b/ref/var/const.md @@ -1,23 +1,23 @@ -## const vars +## const (var) +*** +The const type modifier defines a constant value. This may be useful for centralizing the location of a value that is used repeatedly so that it can be easily configured. It has the advantage over #define macros of obeying the normal scope rules for variables. This means, for example, that a const variable declared inside a proc will not conflict with other variables declared elsewhere. -The const type modifier defines a constant value. This may be -useful for centralizing the location of a value that is used repeatedly -so that it can be easily configured. It has the advantage over #define -macros of obeying the normal scope rules for variables. This means, for -example, that a const variable declared inside a proc will not conflict -with other variables declared elsewhere. -### Example: ```dm - mob var/const/max_items = 100 Enter(O) if(src.contents.len ->= src.max_items) return 0 return ..() + +mob + var/const/max_items = 100 + + Enter(O) + if(src.contents.len >= src.max_items) + return 0 + return ..() + ``` - -This example -defines an upper limit on the number of items a mob may carry. -> [!TIP] -> **See also:** -> + [vars](/ref/var.md) \ No newline at end of file +This example defines an upper limit on the number of items a mob may carry. +*** +**Related Pages:** ++ [vars](/ref/var) diff --git a/ref/var/final.md b/ref/var/final.md index 52323e33..74b518c6 100644 --- a/ref/var/final.md +++ b/ref/var/final.md @@ -1,17 +1,12 @@ -## final vars -###### BYOND Version 515 - -The final type modifier indicates that a variable should not be -overridden by a subtype or another compile-time assignment statement. - - -This modifier also applies to procs. A final proc may not be -overridden. - -> [!TIP] -> **See also:** -> + [vars](/ref/var.md) -> + [const vars](/ref/var/const.md) -> + [global vars](/ref/var/global.md) -> + [tmp vars](/ref/var/tmp.md) \ No newline at end of file +## final (var) +*** +The final type modifier indicates that a variable should not be overridden by a subtype or another compile-time assignment statement. + +This modifier also applies to procs. A final proc may not be overridden. +*** +**Related Pages:** ++ [vars](/ref/var) ++ [const vars](/ref/var/const) ++ [global vars](/ref/var/global) ++ [tmp vars](/ref/var/tmp) diff --git a/ref/var/global.md b/ref/var/global.md index 616c91f7..c20bcfb2 100644 --- a/ref/var/global.md +++ b/ref/var/global.md @@ -1,23 +1,19 @@ -## global/static vars +## global (var) +*** +The global type modifier makes a var permanent and shared. This means only one copy of the var is maintained. Otherwise, separate copies of the var are maintained for each instance containing the var (be it a proc, mob, obj, etc.) -The global type modifier makes a var permanent and shared. This -means only one copy of the var is maintained. Otherwise, separate copies -of the var are maintained for each instance containing the var (be it a -proc, mob, obj, etc.) The 'static' keyword can also be used, they both do the same thing. -### Example: ```dm - mob/proc/Counter() var/global/count src << "Count = -[++count]" + +mob/proc/Counter() + var/global/count + src << "Count = [++count]" + ``` - -This example increases the count each -time the proc is called. If count were not declared global, the -displayed count would be 1 every time. -> [!TIP] -> **See also:** -> + [vars](/ref/var.md) -> + [Forum discussion](https://web.archive.org/web/20250301052813/https://www.byond.com/forum/post/137782#comment936991) +This example increases the count each time the proc is called. If count were not declared global, the displayed count would be 1 every time. +*** +**Related Pages:** ++ [vars](/ref/var) diff --git a/ref/var/index.md b/ref/var/index.md new file mode 100644 index 00000000..f47d31ce --- /dev/null +++ b/ref/var/index.md @@ -0,0 +1,15 @@ + +## var (var) +*** +Variables are derived from var. + +Value defaults to null. + +User types may be derived from anything except for `/world`, `/list`, `/client`, and `/savefile`. +*** +**Related Pages:** ++ [path operators](/ref/operator/path) ++ [vars (atom)](/ref/atom/var) ++ [vars (client)](/ref/client/var) ++ [vars (datum)](/ref/datum/var) ++ [vars (mob)](/ref/mob/var) diff --git a/ref/var/tmp.md b/ref/var/tmp.md index 7ee303c1..adbb9195 100644 --- a/ref/var/tmp.md +++ b/ref/var/tmp.md @@ -1,73 +1,29 @@ -## tmp vars +## tmp (var) +*** +The tmp type modifier indicates that an object variable should not be automatically written to the save file. This could mean that the variable is transient—that is, it is calculated at run-time and need not be saved. It could also indicated that the designer will handle saving of that variable specially and wishes to bypass the automated routine. +It is especially important to use tmp when you have references to external objects that should not be saved along with the object. For example, suppose players have a `leader` variable which indicates who or what they are following. You would not necessarily want the leader to be saved in the player's savefile. Therefore, you would need to use tmp when defining the variable. -The tmp type modifier indicates that an object variable should -not be automatically written to the save file. This could mean that the -variable is transient---that is, it is calculated at run-time and need -not be saved. It could also indicated that the designer will handle -saving of that variable specially and wishes to bypass the automated -routine. - -It is especially important to use tmp when you have -references to external objects that should not be saved along with the -object. For example, suppose players have a `leader` variable -which indicates who or what they are following. You would not -necessarily want the leader to be saved in the player\'s savefile. -Therefore, you would need to use `tmp` when defining the variable. -### Example: ```dm - mob var/tmp leader verb follow(mob/M) leader = M - -``` -::: {.sidebar .note} +mob + var/tmp + leader + verb + follow(mob/M) + leader = M +``` -Accidentally saving another mob in your savefile can be -disastrous. This can happen if you save a turf that the mob is standing -on, or if you save an obj with a non-tmp var that points to that mob, -and many other ways. - -The reason this is a problem is that -another player\'s mob will have the `key` var set already. When that mob -is loaded, if they are already logged into the game they will be -immediately reassigned to that just-loaded, older mob with a `Login()` -call, while the mob they\'re supposed to be using will have `Logout()` -called. Thus they\'ll appear to "rollback" to an earlier state. +Accidentally saving another mob in your savefile can be disastrous. This can happen if you save a turf that the mob is standing on, or if you save an obj with a non-tmp var that points to that mob, and many other ways. -If your game accidentally falls into this trap, don\'t panic! -You can look at your savefiles via -[ImportText()](/ref/savefile/ImportText.md) or in an editor to see -which var is the problem. Once you change that var to `/tmp`, you can -override [Read()](/ref/datum/proc/Read.md) so if that var is present, -you can remove it before calling `..()` to finish loading. -::: -The following built-in variables are defined as tmp vars: -+ [type](/ref/datum/var/type.md) -+ [parent_type](/ref/datum/var/parent_type.md) -+ [vars](/ref/datum/var/vars.md) -+ [verbs](/ref/atom/var/verbs.md) -+ [group](/ref/mob/var/group.md) -+ [loc](/ref/atom/var/loc.md) -+ [locs](/ref/atom/var/locs.md) -+ [vis_locs](/ref/atom/var/vis_locs.md) -+ [x](/ref/atom/var/x.md) -+ [y](/ref/atom/var/y.md) -+ [z](/ref/atom/var/z.md) -+ [ckey](/ref/mob/var/ckey.md) -+ [visibility](/ref/atom/var/visibility.md) -+ [bound_x](/ref/atom/movable/var/bound_x.md) -+ [bound_y](/ref/atom/movable/var/bound_y.md) -+ [bound_width](/ref/atom/movable/var/bound_width.md) -+ [bound_height](/ref/atom/movable/var/bound_height.md) -+ [mouse_over_pointer](/ref/atom/var/mouse_over_pointer.md) -+ [mouse_drag_pointer](/ref/atom/var/mouse_drag_pointer.md) -+ [mouse_drop_pointer](/ref/atom/var/mouse_drop_pointer.md) +The reason this is a problem is that another player's mob will have the `key` var set already. When that mob is loaded, if they are already logged into the game they will be immediately reassigned to that just-loaded, older mob with a `Login()` call, while the mob they're supposed to be using will have `Logout()` called. Thus they'll appear to "rollback" to an earlier state. -> [!TIP] -> **See also:** -> + [savefile](/ref/savefile.md) -> + [vars](/ref/var.md) \ No newline at end of file +If your game accidentally falls into this trap, don't panic! You can look at your savefiles via ImportText() or in an editor to see which var is the problem. Once you change that var to `/tmp`, you can override Read() so if that var is present, you can remove it before calling `..()` to finish loading. +*** +**Related Pages:** ++ [savefile](/ref/savefile) ++ [vars](/ref/var) diff --git a/ref/var/var.md b/ref/var/var.md deleted file mode 100644 index 8c3d3c44..00000000 --- a/ref/var/var.md +++ /dev/null @@ -1,40 +0,0 @@ -## vars - - - -Variables are derived from var. -**Variable Declaration Format:** -+ var/Type/Name = Value -+ var Type/Name = Value - - -Value defaults to null. -The hard-coded types are: -+ [datum](/ref/datum.md) (ancestor of all objects) -+ [atom](/ref/atom.md) (all mappable objects) -+ [atom/movable](/ref/atom/movable.md) (objs and mobs) -+ [obj](/ref/obj.md) -+ [mob](/ref/mob.md) -+ [turf](/ref/turf.md) -+ [area](/ref/area.md) -+ [savefile](/ref/savefile.md) -+ [client](/ref/client.md) -+ [list](/ref/list.md) -+ [world](/ref/world.md) - -Type modifiers: -+ [global](/ref/var/global.md) -+ [const](/ref/var/const.md) -+ [tmp](/ref/var/tmp.md) -+ [final](/ref/var/final.md) - -User types may be derived from anything except for `/world`, -`/list`, `/client`, and `/savefile`. - -> [!TIP] -> **See also:** -> + [path operators](/ref/operator/path.md) -> + [vars (atom)](/ref/atom/var.md) -> + [vars (client)](/ref/client/var.md) -> + [vars (datum)](/ref/datum/var.md) -> + [vars (mob)](/ref/mob/var.md) \ No newline at end of file diff --git a/ref/vector/index.md b/ref/vector/index.md new file mode 100644 index 00000000..dcd5e936 --- /dev/null +++ b/ref/vector/index.md @@ -0,0 +1,22 @@ + +## vector (info) +*** +A primitive value representing a numeric vector in 2 or 3 dimensions. That is, a 2D vector has x and y components, and a 3D vector has x, y, and z components. + +Vectors are primarily useful for physics and distance calculations. + +Vectors can be treated as a list for purposes of using the indexing `[]` operator, or a for loop. The `len` var is the number of components in the list, just like a regular list. + +Vectors support most math operations. Multiplication and division can be done with either a single number or a vector; the latter will act piecewise on each component, just like addition and subtraction do. + +When doing math on two vectors of different dimensions, the result will use the highest dimensionality. E.g., adding a 2D and 3D vector produces a 3D vector. + +Other supported procs for vectors include: +*** +**Related Pages:** ++ [vector proc](/ref/proc/vector) ++ [procs (vector)](/ref/vector/proc) ++ [vars (vector)](/ref/vector/var) ++ [pixloc](/ref/pixloc) ++ [operators](/ref/operator) ++ [matrix](/ref/matrix) diff --git a/ref/vector/proc.md b/ref/vector/proc.md deleted file mode 100644 index b55b4c2e..00000000 --- a/ref/vector/proc.md +++ /dev/null @@ -1,18 +0,0 @@ -## procs (vector) -###### BYOND Version 516 - - - -Built-in vector procs: -vector/proc -+ [Cross](/ref/vector/proc/Cross.md) -+ [Dot](/ref/vector/proc/Dot.md) -+ [Interpolate](/ref/vector/proc/Interpolate.md) -+ [Normalize](/ref/vector/proc/Normalize.md) -+ [Turn](/ref/vector/proc/Turn.md) - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file diff --git a/ref/vector/proc/Cross.md b/ref/vector/proc/Cross.md index 2e7bd1d8..1b8ba5f8 100644 --- a/ref/vector/proc/Cross.md +++ b/ref/vector/proc/Cross.md @@ -1,25 +1,21 @@ -## Cross proc (vector) -###### BYOND Version 516 + +## Cross (proc) **Format:** + A.Cross(vector/B) **Returns:** + The cross product of the two vectors, which is another vector. +*** +This proc treats both vectors as 3D. +The cross product of two 3D vectors is a third vector that is orthogonal to them both. The length is the product of the length of both vectors and the sine of the angle between them. -This proc treats both vectors as 3D. - -The cross product -of two 3D vectors is a third vector that is orthogonal to them both. The -length is the product of the length of both vectors and the sine of the -angle between them. - -The cross product depends on the order of -the two vectors. If you switch their order, you get the negative result. +The cross product depends on the order of the two vectors. If you switch their order, you get the negative result. -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +Note: Rounding errors can mean that if you divide out the length of the two original vectors, the value you get for a sine can potentially be outside of the valid range of -1 to 1. Use `clamp()` if you need to pass the sine to `arcsin()`, so you can be sure it stays in range. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/proc/Dot.md b/ref/vector/proc/Dot.md index 1733aae4..cd40367d 100644 --- a/ref/vector/proc/Dot.md +++ b/ref/vector/proc/Dot.md @@ -1,36 +1,34 @@ -## Dot proc (vector) -###### BYOND Version 516 + +## Dot (proc) **Format:** + A.Dot(B) -**Args:** +**Arguments:** + B: The other vector. **Returns:** + The dot product of the two vectors. +*** +The dot product of two vectors is determined by multiplying each component in the first vector by its matching component in the second, and adding those multiples together. For instance in a 2D vector, the dot product of A and B is: -The dot product of two vectors is determined by multiplying -each component in the first vector by its matching component in the -second, and adding those multiples together. For instance in a 2D -vector, the dot product of A and B is: ```dm -dot = A.x * B.x + -A.y + B.y +dot = A.x * B.x + A.y * B.y ``` - -The dot product is equal to the product of -the magnitude of the two vectors and the cosine of the angle between -them. + +The dot product is equal to the product of the magnitude of the two vectors and the cosine of the angle between them. + + ```dm dot = A.size * B.size * cos(angle) ``` -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +Note: Rounding errors in the math can affect this result. For instance, if you take the dot product of two unit vectors pointing the same direction, you would expect a result of 1, since the angle between them is 0. But due to small rounding errors, you can get a value just over 1. Therefore an expression like `arccos(V1.Dot(V2))` can give a not-a-number value when you expected 0. To combat this, use `clamp()` to clamp the cosine between -1 and 1, as in `arccos(clamp(V1.Dot(V2), -1, 1))`. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/proc/Interpolate.md b/ref/vector/proc/Interpolate.md index f3af4671..3e158965 100644 --- a/ref/vector/proc/Interpolate.md +++ b/ref/vector/proc/Interpolate.md @@ -1,24 +1,20 @@ -## Interpolate proc (vector) -###### BYOND Version 516 + +## Interpolate (proc) **Format:** + A.Interpolate(B, t) -**Args:** +**Arguments:** + B: The other vector to interpolate with. -+ t: The interpolation factor: from 0 (A) to 1 (B). Usually this is a - value between 0 and 1. ++ t: The interpolation factor: from 0 (A) to 1 (B). Usually this is a value between 0 and 1. **Returns:** + A new vector interpolated between A and B. +*** +Returns the equivalent of `A + (B-A) * t`. - -Returns the equivalent of `A + (B-A) * t`. - -There is -special handling for a case of `t=1` to avoid rounding errors. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) \ No newline at end of file +There is special handling for a case of `t=1` to avoid rounding errors. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) diff --git a/ref/vector/proc/Normalize.md b/ref/vector/proc/Normalize.md index 7e8deaa3..cb0fc3b6 100644 --- a/ref/vector/proc/Normalize.md +++ b/ref/vector/proc/Normalize.md @@ -1,21 +1,17 @@ -## Normalize proc (vector) -###### BYOND Version 516 + +## Normalize (proc) **Format:** + V.Normalize() **Returns:** + The same vector, after normalizing it to a unit vector. +*** +Modifies the vector to make it a unit vector. This is the same as setting its `size` var to 1. - -Modifies the vector to make it a unit vector. This is the same -as setting its `size` var to 1. - -A degenerate vector such as -0,0,0 cannot be normalized; it will be unchanged by this call. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [size var (vector)](/ref/vector/var/size.md) \ No newline at end of file +A degenerate vector such as 0,0,0 cannot be normalized; it will be unchanged by this call. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [size](/ref/vector/var/size) diff --git a/ref/vector/proc/Turn.md b/ref/vector/proc/Turn.md index 94f85783..e886b84f 100644 --- a/ref/vector/proc/Turn.md +++ b/ref/vector/proc/Turn.md @@ -1,36 +1,27 @@ -## Turn proc (vector) -###### BYOND Version 516 + +## Turn (proc) **Format:** + A.Turn(angle) + A.Turn(B) -**Args:** +**Arguments:** + angle: An angle to turn a vector clockwise in 2D. + B: A vector to rotate around (right-hand rule). **Returns:** + The vector A, after rotating it. +*** +This proc modifies the source vector. For legacy reasons, it rotates in the opposite direction of the built-in `turn()` proc. +All angles are in degrees. -This proc modifies the source vector. For legacy reasons, it -rotates in the opposite direction of the built-in `turn()` proc. - - -All angles are in degrees. - -When the argument is an -angle, the source vector A is rotated in 2 dimensions clockwise. - - -When the argument is a vector, the source vector A is rotated -in 3 dimensions around vector B using the right-hand rule (thumb pointed -in the direction of B, rotation following curled fingers). The angle of -rotation is the length of B, in degrees. +When the argument is an angle, the source vector A is rotated in 2 dimensions clockwise. -> [!TIP] -> **See also:** -> + [turn proc (applied to a vector)](/ref/proc/turn/vector.md) -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +When the argument is a vector, the source vector A is rotated in 3 dimensions around vector B using the right-hand rule (thumb pointed in the direction of B, rotation following curled fingers). The angle of rotation is the length of B, in degrees. +*** +**Related Pages:** ++ [turn proc (applied to a vector)](/ref/proc/turn/vector) ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/proc/index.md b/ref/vector/proc/index.md new file mode 100644 index 00000000..486c7ea4 --- /dev/null +++ b/ref/vector/proc/index.md @@ -0,0 +1,9 @@ + +## proc (proc) +*** +Built-in vector procs: +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/var.md b/ref/vector/var.md deleted file mode 100644 index 54003b38..00000000 --- a/ref/vector/var.md +++ /dev/null @@ -1,18 +0,0 @@ -## vars (vector) -###### BYOND Version 516 - - - -Built-in vector vars: -vector/var -+ [len](/ref/vector/var/len.md) -+ [size](/ref/vector/var/size.md) -+ [x](/ref/vector/var/x.md) -+ [y](/ref/vector/var/y.md) -+ [z](/ref/vector/var/z.md) - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vector proc](/ref/proc/vector.md) -> + [procs (vector)](/ref/vector/proc.md) \ No newline at end of file diff --git a/ref/vector/var/index.md b/ref/vector/var/index.md new file mode 100644 index 00000000..00620d01 --- /dev/null +++ b/ref/vector/var/index.md @@ -0,0 +1,9 @@ + +## var (var) +*** +Built-in vector vars: +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vector proc](/ref/proc/vector) ++ [procs (vector)](/ref/vector/proc) diff --git a/ref/vector/var/len.md b/ref/vector/var/len.md index 9cad8508..31f2d511 100644 --- a/ref/vector/var/len.md +++ b/ref/vector/var/len.md @@ -1,16 +1,11 @@ -## len var (vector) -###### BYOND Version 516 +## len (var) +*** +The dimensionality (number of components) of this vector. Can be 2 or 3. This value can be changed. -The dimensionality (number of components) of this vector. Can -be 2 or 3. This value can be changed. - -Most math operations on a -vector will expand the result to the same dimension as the largest -operand. - -> [!TIP] -> **See also:** -> + [length proc](/ref/proc/length.md) -> + [vector](/ref/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +Most math operations on a vector will expand the result to the same dimension as the largest operand. +*** +**Related Pages:** ++ [length proc](/ref/proc/length) ++ [vector](/ref/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/var/size.md b/ref/vector/var/size.md index b37e97c5..95993c27 100644 --- a/ref/vector/var/size.md +++ b/ref/vector/var/size.md @@ -1,24 +1,16 @@ -## size var (vector) -###### BYOND Version 516 +## size (var) +*** +The magnitude of this vector. Magnitude is the square root of the summed-up squares of all its components. For instance in 3D: -The magnitude of this vector. Magnitude is the square root of -the summed-up squares of all its components. For instance in 3D: +size = x*x + y*y + z*z +`V.size` is the same as `sqrt(V.Dot(V))`. -size = x*x + y*y + z*z +This value can be set at runtime, so setting `size = 1` will normalize the vector. -`V.size` is the same as -`sqrt(V.Dot(V))`. - -This value can be set at runtime, so setting -`size = 1` will normalize the vector. - -If the size is already 0, -as in the case of a degenerate vector like 0,0, then changing this value -will have no effect. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +If the size is already 0, as in the case of a degenerate vector like 0,0, then changing this value will have no effect. +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/var/x.md b/ref/vector/var/x.md index 199713b2..760a6ab0 100644 --- a/ref/vector/var/x.md +++ b/ref/vector/var/x.md @@ -1,10 +1,8 @@ -## x var (vector) -###### BYOND Version 516 - +## x (var) +*** The x component of this vector. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/var/y.md b/ref/vector/var/y.md index e073cc62..018d81cb 100644 --- a/ref/vector/var/y.md +++ b/ref/vector/var/y.md @@ -1,10 +1,8 @@ -## y var (vector) -###### BYOND Version 516 - +## y (var) +*** The y component of this vector. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/var/z.md b/ref/vector/var/z.md index 4ac859ab..7a72efeb 100644 --- a/ref/vector/var/z.md +++ b/ref/vector/var/z.md @@ -1,10 +1,8 @@ -## z var (vector) -###### BYOND Version 516 - +## z (var) +*** The z component of this vector. - -> [!TIP] -> **See also:** -> + [vector](/ref/vector.md) -> + [vars (vector)](/ref/vector/var.md) \ No newline at end of file +*** +**Related Pages:** ++ [vector](/ref/vector) ++ [vars (vector)](/ref/vector/var) diff --git a/ref/vector/vector.md b/ref/vector/vector.md deleted file mode 100644 index 5b685b4c..00000000 --- a/ref/vector/vector.md +++ /dev/null @@ -1,45 +0,0 @@ -## vector -###### BYOND Version 516 - - - -A primitive value representing a numeric vector in 2 or 3 -dimensions. That is, a 2D vector has x and y components, and a 3D vector -has x, y, and z components. - -Vectors are primarily useful for -physics and distance calculations. - -Vectors can be treated as a -list for purposes of using the indexing `[]` operator, or a for loop. -The `len` var is the number of components in the list, just like a -regular list. - -Vectors support most math operations. -Multiplication and division can be done with either a single number or a -vector; the latter will act piecewise on each component, just like -addition and subtraction do. - -When doing math on two vectors of -different dimensions, the result will use the highest dimensionality. -E.g., adding a 2D and 3D vector produces a 3D vector. - -Other -supported procs for vectors include: -[min()](/ref/proc/min.md) -[max()](/ref/proc/max.md) -[clamp()](/ref/proc/clamp.md) -[round()](/ref/proc/round.md) -[floor()](/ref/proc/floor.md) -[ceil()](/ref/proc/ceil.md) -[trunc()](/ref/proc/trunc.md) -[fract()](/ref/proc/fract.md) - -> [!TIP] -> **See also:** -> + [vector proc](/ref/proc/vector.md) -> + [procs (vector)](/ref/vector/proc.md) -> + [vars (vector)](/ref/vector/var.md) -> + [pixloc](/ref/pixloc.md) -> + [operators](/ref/operator.md) -> + [matrix](/ref/matrix.md) \ No newline at end of file diff --git a/ref/verb/arguments.md b/ref/verb/arguments.md deleted file mode 100644 index 363020af..00000000 --- a/ref/verb/arguments.md +++ /dev/null @@ -1,85 +0,0 @@ -## arguments (verb) - - -The parameters to a verb are referred to as arguments. For -verbs, the input type and possible value list may also be specified. - - -The possible input types are: - text // a quoted text string - password // un-echoed text (for use with input() only) - message // multi-line text - command_text // raw command text from the rest of the input line - num // a number - icon // an icon file from the user's computer - sound // a sound file from the user's computer - file // any type of file from the user's computer - key // a key from the user's BYOND key file - color // a color (see rgb proc) - null // indicates that the argument is optional - mob - obj - turf - area - anything - - -These can be combined with the \'\|\' operator. The first group -are called *constant* input types because they turn on various types of -literal values that the user can type in (like a number or a text -string). The second group work in conjunction with a list of objects or -values. They are called input type *filters* because they may be used to -filter out certain types of values from the list. For example a mob or -an obj within sight would be specified as follows: -```dm - -myverb(M as mob\|obj in view()) {...} -``` - - -A default -value may be specified which takes effect in the case of null arguments. -For example: -```dm - myverb(M=usr as null\|mob\|obj in view()) -{...} -``` - - -In this example, the input type `null` did -not have to be used explicitly, because assigning a default value (in -this case `usr`) turns it on by default. - -The `anything` input -type can be used to combine values in a list with other constant input -types. Here, this is done with the `null` input type: -```dm - -set_aggression(a="on" as null\|anything in list("on","off")) - -``` - - -For input types containing mob, obj, turf, or area, -the possible value list defaults to view(). - -If no input type is -specified, the variable type will be used to determine whether it is a -mob, obj, turf, or area. -### Example: - -```dm - mob/verb/tell(mob/M,msg as text) M << "[usr] tells -you, /"[msg]/"" -``` - - -This example defines a verb -with two arguments: a target mob, and some text. - -> [!TIP] -> **See also:** -> + [argument expanding](/ref/verb/arguments/expanding.md) -> + [command_text (client)](/ref/client/var/command_text.md) -> + [arglist proc](/ref/proc/arglist.md) -> + [args var (verb)](/ref/verb/var/args.md) \ No newline at end of file diff --git a/ref/verb/arguments/expanding.md b/ref/verb/arguments/expanding.md index 26513877..862a2d08 100644 --- a/ref/verb/arguments/expanding.md +++ b/ref/verb/arguments/expanding.md @@ -1,29 +1,23 @@ -## argument expanding +## expanding (info) +*** +The expression used to to provide a list of possible values for a verb argument may reference the value of arguments prior to the one being expanded. It may even reference the value of the argument being expanded, but this will always be a text string equal to what the user has typed so far. -The expression used to to provide a list of possible values for -a verb argument may reference the value of arguments prior to the one -being expanded. It may even reference the value of the argument being -expanded, but this will always be a text string equal to what the user -has typed so far. +In addition, there is a special variable called "expanding" which is only accessible in this context. It is 1 if the user's input is being expanded and 0 if the user's final input is being validated. In certain rare cases, you may wish to tell the difference between these two cases. For example, you could use this to have possible values which do not show up in the expansion lists, but which are accepted when typed in full. -In addition, there is a special variable -called "expanding" which is only accessible in this context. It is 1 -if the user\'s input is being expanded and 0 if the user\'s final input -is being validated. In certain rare cases, you may wish to tell the -difference between these two cases. For example, you could use this to -have possible values which do not show up in the expansion lists, but -which are accepted when typed in full. -### Example: ```dm - mob/verb/test(A in MyProc(A,expanding)) usr << "You -typed: [A]" proc/MyProc(A,expanding) var/values[] = -list("one","two","three") if(!expanding) values += "secret" -return values -``` +mob/verb/test(A in MyProc(A,expanding)) + usr << "You typed: [A]" + +proc/MyProc(A,expanding) + var/values[] = list("one","two","three") + if(!expanding) values += "secret" + return values + +``` -> [!TIP] -> **See also:** -> + [arguments (verb)](/ref/verb/arguments.md) \ No newline at end of file +*** +**Related Pages:** ++ [arguments (verb)](/ref/verb/arguments) diff --git a/ref/verb/arguments/index.md b/ref/verb/arguments/index.md new file mode 100644 index 00000000..f11ae0cb --- /dev/null +++ b/ref/verb/arguments/index.md @@ -0,0 +1,59 @@ + +## arguments (info) +*** +The parameters to a verb are referred to as arguments. For verbs, the input type and possible value list may also be specified. + +The possible input types are: + +These can be combined with the '|' operator. The first group are called constant input types because they turn on various types of literal values that the user can type in (like a number or a text string). The second group work in conjunction with a list of objects or values. They are called input type filters because they may be used to filter out certain types of values from the list. For example a mob or an obj within sight would be specified as follows: + + +```dm + +myverb(M as mob|obj in view()) {...} + +``` + + +A default value may be specified which takes effect in the case of null arguments. For example: + + +```dm + +myverb(M=usr as null|mob|obj in view()) {...} + +``` + + +In this example, the input type null did not have to be used explicitly, because assigning a default value (in this case usr) turns it on by default. + +The anything input type can be used to combine values in a list with other constant input types. Here, this is done with the null input type: + + +```dm + +set_aggression(a="on" as null|anything in list("on","off")) + +``` + + +For input types containing mob, obj, turf, or area, the possible value list defaults to view(). + +If no input type is specified, the variable type will be used to determine whether it is a mob, obj, turf, or area. + + +```dm + +mob/verb/tell(mob/M,msg as text) + M << "[usr] tells you, /"[msg]/"" + +``` + + +This example defines a verb with two arguments: a target mob, and some text. +*** +**Related Pages:** ++ [argument expanding](/ref/verb/arguments/expanding) ++ [command_text (client)](/ref/client/var/command_text) ++ [arglist proc](/ref/proc/arglist) ++ [args var (verb)](/ref/verb/var/args) diff --git a/ref/verb/index.md b/ref/verb/index.md new file mode 100644 index 00000000..b40fd990 --- /dev/null +++ b/ref/verb/index.md @@ -0,0 +1,64 @@ + +## verb (info) +*** +Verbs may be attached to mobs, objs, turfs, and areas. Players can then use them as commands if they have access to the source. + +Verbs are fundamentally the same "type" as procs, so their vars are the same. + + +```dm + +mob/verb/poof() + world << "POOF!" + +``` + + +Whenever a player in the world types the command "poof", this verb will be invoked. + +In addition to the normal access control (see the verb src setting) verbs can be dynamically added and removed from objects. One way to do this is to use new() with the following syntax: + + +```dm + +new verb_path(Destination,Name,Desc) + +``` + + +The Destination specifies the object to receive the verb. Name and Desc optionally specify a new name and description for the verb. + + +```dm + +mob/DM/verb/kill(mob/M) + del(M) + +mob/DM/verb/give_kill_verb(mob/M) + new/mob/DM/verb/kill(M) + +``` + + +This example defines two verbs (accessible to mobs of type /mob/DM). One verb kills other mobs. The other adds the kill verb to another mob (giving the second mob the ability to kill). + +In some situations, the ability to dynamically change an object's verb list is quite useful, but most of the time it is far more convenient to do the same thing by manipulating objects rather than verbs directly. For example, the previous example can be handled by having an object with the kill verb attached it it. Then players have greater versatility in manipulating the verb by simply moving the object around. + + +```dm + +obj/scroll/kill/verb/kill(mob/M) + set src = usr.contents //implicit src + del(M) + +``` + + +The use of an implicit verb source in this example gives the user access to the kill verb without having to specify the source scroll as long as the scroll exists in the user's inventory. In other words, the player types "kill rat" rather than "kill kill rat". +*** +**Related Pages:** ++ [arguments (verb)](/ref/verb/arguments) ++ [settings (verb)](/ref/verb/set) ++ [vars (verbs)](/ref/verb/var) ++ [src var (proc)](/ref/proc/var/src) ++ [usr var (proc)](/ref/proc/var/usr) diff --git a/ref/verb/set.md b/ref/verb/set.md deleted file mode 100644 index ac7ce1c1..00000000 --- a/ref/verb/set.md +++ /dev/null @@ -1,19 +0,0 @@ -# settings (verb) - - -verb settings: - verb/set - name - desc - category - hidden - popup_menu - instant - invisibility - src - background - - -Procs and verbs are the same "type" so these attributes may -be set for procs as well; most of them do not have any meaning, however, -unless the proc is invoked as a verb (by adding it to a verb list). \ No newline at end of file diff --git a/ref/verb/set/category.md b/ref/verb/set/category.md index 9f9f577b..710824ee 100644 --- a/ref/verb/set/category.md +++ b/ref/verb/set/category.md @@ -1,25 +1,16 @@ -## category setting (verb) - (client)](/ref/client/var/default_verb_category.md) -+ [show_verb_panel var (client)](/ref/client/var/show_verb_panel.md) +## category (info) **Format:** + set category = "Category" -**Args:** +**Arguments:** + Category: A text string for the category. +*** +Verbs in the same category are visually grouped together in the verb panels. The default is "", which is displayed in the default panel titled "Commands". You can change that default by setting client/default_verb_category. - -Verbs in the same category are visually grouped together in the -verb panels. The default is "", which is displayed in the default -panel titled "Commands". You can change that default by setting -`client/default_verb_category`. - -To hide a verb from all panels, -set the category to null. The verb may still show up in right-click -popup menus, so you may want to use the [hidden](/ref/verb/set/hidden.md) or -[popup_menu](/ref/verb/set/popup_menu.md) verb properties instead. - -> [!TIP] -> **See also:** -> + [default_verb_category var \ No newline at end of file +To hide a verb from all panels, set the category to null. The verb may still show up in right-click popup menus, so you may want to use the hidden or popup_menu verb properties instead. +*** +**Related Pages:** ++ [default_verb_category var (client)](/ref/client/var/default_verb_category) ++ [show_verb_panel var (client)](/ref/client/var/show_verb_panel) diff --git a/ref/verb/set/desc.md b/ref/verb/set/desc.md index 448845fe..95d70b5e 100644 --- a/ref/verb/set/desc.md +++ b/ref/verb/set/desc.md @@ -1,37 +1,41 @@ -# desc setting (verb) + +## desc (info) + **Format:** + set desc = "Description" -**Args:** +**Arguments:** + Description: A text string containing the help text. +*** +The desc attribute sets the descriptive help string for the verb. The player may access this by hitting the 'F1' key after entering the command. This will normally produce a list of each argument by type followed by the desc text. If you wish to override the syntax description, put your modified version inside parentheses at the beginning of the desc text. -The desc attribute sets the descriptive help string for the -verb. The player may access this by hitting the \'F1\' key after -entering the command. This will normally produce a list of each argument -by type followed by the desc text. If you wish to override the syntax -description, put your modified version inside parentheses at the -beginning of the desc text. -### Example: - ```dm - mob/verb/tell(mob/M,T as text) set desc = -"(target,message) Talk privately to someone." M << "[usr] tells -you, \'[T]" + +mob/verb/tell(mob/M,T as text) + set desc = "(target,message) Talk privately to someone." + M << "[usr] tells you, '[T]" + ``` - + This will produce the help text: + ```dm - usage: tell target message (Talk privately to someone.) + +usage: tell target message (Talk privately to someone.) ``` - -If the syntax description had not been supplied, it -would have produced: + +If the syntax description had not been supplied, it would have produced: + + ```dm - usage: tell mob "text" (Talk -privately to someone.) + +usage: tell mob "text" (Talk privately to someone.) + ``` + +*** \ No newline at end of file diff --git a/ref/verb/set/hidden.md b/ref/verb/set/hidden.md index 72cfb7f9..9662930b 100644 --- a/ref/verb/set/hidden.md +++ b/ref/verb/set/hidden.md @@ -1,28 +1,18 @@ -## hidden setting (verb) +## hidden (info) **Format:** + set hidden = Setting -**Args:** +**Arguments:** + Setting: 1 for hidden verbs; 0 otherwise. +*** +A hidden verb is not visible to players (in menus or in expansion lists) but if typed in full can still be accessed. - -A hidden verb is not visible to players (in menus or in -expansion lists) but if typed in full can still be accessed. - -An -alternate way to hide a verb from the command-line and verb panels is to -make "." the first character in the name. The verb will not show up in -command-expansion (ie when hitting spacebar) until the "." has been -typed. This could be useful for hiding verbs that would otherwise -clutter up the verb list, while still making them relatively easy to -use. If you think this is a random quirky feature, you are right. To put -"." in front of the name, use the [name setting](/ref/verb/set/name.md) - -> [!TIP] -> **See also:** -> + [category setting (verb)](/ref/verb/set/category.md) -> + [invisibility setting (verb)](/ref/verb/set/invisibility.md) -> + [name setting (verb)](/ref/verb/set/name.md) -> + [popup_menu setting (verb)](/ref/verb/set/popup_menu.md) \ No newline at end of file +An alternate way to hide a verb from the command-line and verb panels is to make "." the first character in the name. The verb will not show up in command-expansion (ie when hitting spacebar) until the "." has been typed. This could be useful for hiding verbs that would otherwise clutter up the verb list, while still making them relatively easy to use. If you think this is a random quirky feature, you are right. To put "." in front of the name, use the name setting. +*** +**Related Pages:** ++ [category setting (verb)](/ref/verb/set/category) ++ [invisibility setting (verb)](/ref/verb/set/invisibility) ++ [name setting (verb)](/ref/verb/set/name) ++ [popup_menu setting (verb)](/ref/verb/set/popup_menu) diff --git a/ref/verb/set/index.md b/ref/verb/set/index.md new file mode 100644 index 00000000..2f0a9a5a --- /dev/null +++ b/ref/verb/set/index.md @@ -0,0 +1,7 @@ + +## set (info) +*** +verb settings:
 verb/set name desc category hidden popup_menu instant invisibility src background 
+ +Procs and verbs are the same "type" so these attributes may be set for procs as well; most of them do not have any meaning, however, unless the proc is invoked as a verb (by adding it to a verb list). +*** \ No newline at end of file diff --git a/ref/verb/set/instant.md b/ref/verb/set/instant.md index 159e7fe2..1091a64f 100644 --- a/ref/verb/set/instant.md +++ b/ref/verb/set/instant.md @@ -1,38 +1,30 @@ -## instant setting (verb) + +## instant (info) **Format:** + set instant = Setting -**Args:** +**Arguments:** + Setting: 1 for "instant" verbs; 0 otherwise. -**Default value:** +**Default Value:** + 0 +*** +Normally a player can only call one verb per tick, but they can call any number of "instant" verbs in the same tick. This setting is useful for commands called by the game's interface, or for more responsive controls like for instance the use of "combos" in fighting games. +Verbs with the instant setting can be used on the same tick as a regular verb, but only one regular verb can be used each tick. Instant commands will jump ahead of non-instant commands in the queue. -Normally a player can only call one verb per tick, but they can -call any number of "instant" verbs in the same tick. This setting is -useful for commands called by the game\'s interface, or for more -responsive controls like for instance the use of "combos" in fighting -games. +Any verbs that are already built-in, such as movement commands, cannot be modified to use this setting. (Some, such as mouse commands, already use it.) You can, however, create replacement verbs of your own for most of them. -Verbs with the instant setting can be used on the same -tick as a regular verb, but only one regular verb can be used each tick. -Instant commands will jump ahead of non-instant commands in the queue. +```dm -Any verbs that are already built-in, such as movement commands, -cannot be modified to use this setting. (Some, such as mouse commands, -already use it.) You can, however, create replacement verbs of your own -for most of them. -### Example: +mob/verb/FastNorth() + set instant = 1 + usr.Move(get_step(usr,NORTH), NORTH) -```dm - mob/verb/FastNorth() set instant = 1 -usr.Move(get_step(usr,NORTH), NORTH) ``` - -> [!TIP] -> **See also:** -> + [settings (verb)](/ref/verb/set.md) \ No newline at end of file +*** +**Related Pages:** ++ [settings (verb)](/ref/verb/set) diff --git a/ref/verb/set/invisibility.md b/ref/verb/set/invisibility.md index 86c3b3fd..5856ff29 100644 --- a/ref/verb/set/invisibility.md +++ b/ref/verb/set/invisibility.md @@ -1,22 +1,18 @@ -## invisibility setting (verb) + +## invisibility (info) **Format:** + set invisibility = Setting -**Args:** +**Arguments:** + Setting: 0 to 100 -**Default value:** +**Default Value:** + same as invisibility of the source object. - - -An invisible verb is only accessible to players who can see -invisible objects. This is different from a hidden verb which does not -clutter up the verb list but which is still accessible when typed in -full. - -> [!TIP] -> **See also:** -> + [hidden setting (verb)](/ref/verb/set/hidden.md) -> + [invisibility var (atom)](/ref/atom/var/invisibility.md) -> + [sight var (mob)](/ref/mob/var/sight.md) \ No newline at end of file +*** +An invisible verb is only accessible to players who can see invisible objects. This is different from a hidden verb which does not clutter up the verb list but which is still accessible when typed in full. +*** +**Related Pages:** ++ [hidden setting (verb)](/ref/verb/set/hidden) ++ [invisibility var (atom)](/ref/atom/var/invisibility) ++ [sight var (mob)](/ref/mob/var/sight) diff --git a/ref/verb/set/name.md b/ref/verb/set/name.md index f9a47672..07874dd8 100644 --- a/ref/verb/set/name.md +++ b/ref/verb/set/name.md @@ -1,11 +1,11 @@ -# name setting (verb) + +## name (info) + **Format:** + set name = "Name" -**Args:** +**Arguments:** + Name: A text string for the name. - - -The name attribute of a verb defaults to the node name. Setting -the name attribute explicitly may be necessary if the name includes -characters not allowed in node names. \ No newline at end of file +*** +The name attribute of a verb defaults to the node name. Setting the name attribute explicitly may be necessary if the name includes characters not allowed in node names. +*** \ No newline at end of file diff --git a/ref/verb/set/popup_menu.md b/ref/verb/set/popup_menu.md index 90e5f23e..2ba9706a 100644 --- a/ref/verb/set/popup_menu.md +++ b/ref/verb/set/popup_menu.md @@ -1,18 +1,15 @@ -## popup_menu setting (verb) + +## popup_menu (info) **Format:** + set popup_menu = Setting -**Args:** -+ Setting: 1 (default) for showing this verb in the popup menus; 0 - otherwise. - - -Use this to prevent a verb from showing up in the popup -"context" menu when users right-click on objects. - -> [!TIP] -> **See also:** -> + [category setting (verb)](/ref/verb/set/category.md) -> + [hidden setting (verb)](/ref/verb/set/hidden.md) -> + [invisibility setting (verb)](/ref/verb/set/invisibility.md) \ No newline at end of file +**Arguments:** ++ Setting: 1 (default) for showing this verb in the popup menus; 0 otherwise. +*** +Use this to prevent a verb from showing up in the popup "context" menu when users right-click on objects. +*** +**Related Pages:** ++ [category setting (verb)](/ref/verb/set/category) ++ [hidden setting (verb)](/ref/verb/set/hidden) ++ [invisibility setting (verb)](/ref/verb/set/invisibility) diff --git a/ref/verb/set/src.md b/ref/verb/set/src.md index f3013b5b..7250fbf5 100644 --- a/ref/verb/set/src.md +++ b/ref/verb/set/src.md @@ -1,43 +1,52 @@ -# src setting (verb) + +## src (info) + **Format:** + set src in List + set src = List -**Args:** -+ List: One of view(), oview(), world, world.contents, usr, - usr.contents, usr.loc, or usr.group +**Arguments:** ++ List: One of view(), oview(), world, world.contents, usr, usr.contents, + usr.loc, or usr.group +*** +With the first format, if src is in List for a particular player, then that player will have access to the proc. The player must explicitly specify the name of the source on the command line. +The second format behaves the same, except the source is not read from the command line. If more than one possible source exists, one will be chosen at random. -With the first format, if src is in List for a particular -player, then that player will have access to the proc. The player must -explicitly specify the name of the source on the command line. +When usr or world is specified for the first format, it will be expanded to usr.contents and world.contents respectively. +The default setting depends on the type of src: -The second format behaves the same, except the source is not -read from the command line. If more than one possible source exists, one -will be chosen at random. -When usr or world is specified for -the first format, it will be expanded to usr.contents and world.contents -respectively. +```dm -The default setting depends on the type of src: +mob: src = usr +obj: src in usr // short for usr.contents +turf: src = view(0) +area: src = view(0) -```dm - mob: src = usr obj: src in usr // short for usr.contents -turf: src = view(0) area: src = view(0) ``` -### Example: + ```dm - obj/verb/examine() set src in view() usr << "You -examine [src]." + +obj/verb/examine() + set src in view() + usr << "You examine [src]." + ``` -### Example: + ```dm - obj/MagicCloak/verb/disappear() set src = usr.contents -usr.invisibility = 1 view() << "[usr] disappears!" + +obj/MagicCloak/verb/disappear() + set src = usr.contents + + usr.invisibility = 1 + view() << "[usr] disappears!" + ``` + +*** \ No newline at end of file diff --git a/ref/verb/set/visibility.md b/ref/verb/set/visibility.md index 2029708c..24b90e2d 100644 --- a/ref/verb/set/visibility.md +++ b/ref/verb/set/visibility.md @@ -1,6 +1,5 @@ -## visibility setting (verb) -**See:** -+ [invisibility setting (verb)](/ref/verb/set/invisibility.md) -The function of this variable has been replaced by -`invisibility`, which provides a full range of settings. \ No newline at end of file +## visibility (info) +*** +The function of this variable has been replaced by invisibility, which provides a full range of settings. +*** \ No newline at end of file diff --git a/ref/verb/var.md b/ref/verb/var.md deleted file mode 100644 index 4fb0480b..00000000 --- a/ref/verb/var.md +++ /dev/null @@ -1,3 +0,0 @@ -## vars (verbs) -**See:** -+ [vars (procs)](/ref/proc/var.md) \ No newline at end of file diff --git a/ref/verb/var/..md b/ref/verb/var/..md index 52e033f4..86ad9d24 100644 --- a/ref/verb/var/..md +++ b/ref/verb/var/..md @@ -1,3 +1,3 @@ -## . var (verb) -**See:** -+ [. var (proc)](/ref/proc/var/%2e.md) \ No newline at end of file + +## %2e (var) +****** \ No newline at end of file diff --git a/ref/verb/var/args.md b/ref/verb/var/args.md index 7d8ff39c..e6024a45 100644 --- a/ref/verb/var/args.md +++ b/ref/verb/var/args.md @@ -1,3 +1,3 @@ -## args list var (verb) -**See:** -+ [args list var (proc)](/ref/proc/var/args.md) \ No newline at end of file + +## args (var) +****** \ No newline at end of file diff --git a/ref/verb/var/index.md b/ref/verb/var/index.md new file mode 100644 index 00000000..f6350edc --- /dev/null +++ b/ref/verb/var/index.md @@ -0,0 +1,3 @@ + +## var (var) +****** \ No newline at end of file diff --git a/ref/verb/var/src.md b/ref/verb/var/src.md index da4f42c9..71944b3e 100644 --- a/ref/verb/var/src.md +++ b/ref/verb/var/src.md @@ -1,3 +1,3 @@ -## src var (verb) -**See:** -+ [src var (proc)](/ref/proc/var/src.md) \ No newline at end of file + +## src (var) +****** \ No newline at end of file diff --git a/ref/verb/var/usr.md b/ref/verb/var/usr.md index 66de6455..c7ca46e6 100644 --- a/ref/verb/var/usr.md +++ b/ref/verb/var/usr.md @@ -1,3 +1,3 @@ -## usr var (verb) -**See:** -+ [usr var (proc)](/ref/proc/var/usr.md) \ No newline at end of file + +## usr (var) +****** \ No newline at end of file diff --git a/ref/verb/verb.md b/ref/verb/verb.md deleted file mode 100644 index eb2921ec..00000000 --- a/ref/verb/verb.md +++ /dev/null @@ -1,73 +0,0 @@ -## verbs - - -Verbs may be attached to mobs, objs, turfs, and areas. Players -can then use them as commands if they have access to the source. - - -Verbs are fundamentally the same "type" as procs, so their -vars are the same. -### Example: - -```dm - mob/verb/poof() world << "POOF!" -``` - - - -Whenever a player in the world types the command "poof", this -verb will be invoked. - -In addition to the normal access control -(see the verb src setting) verbs can be dynamically added and removed -from objects. One way to do this is to use new() with the following -syntax: -```dm - new verb_path(Destination,Name,Desc) -``` - - - -The Destination specifies the object to receive the verb. Name -and Desc optionally specify a new name and description for the verb. -### Example: - -```dm - mob/DM/verb/kill(mob/M) del(M) -mob/DM/verb/give_kill_verb(mob/M) new/mob/DM/verb/kill(M) -``` - - - -This example defines two verbs (accessible to mobs of type -/mob/DM). One verb kills other mobs. The other adds the kill verb to -another mob (giving the second mob the ability to kill). - -In -some situations, the ability to dynamically change an object\'s verb -list is quite useful, but most of the time it is far more convenient to -do the same thing by manipulating objects rather than verbs directly. -For example, the previous example can be handled by having an object -with the kill verb attached it it. Then players have greater versatility -in manipulating the verb by simply moving the object around. -### Example: - -```dm - obj/scroll/kill/verb/kill(mob/M) set src = usr.contents -//implicit src del(M) -``` - - -The use of an implicit verb -source in this example gives the user access to the kill verb without -having to specify the source scroll as long as the scroll exists in the -user\'s inventory. In other words, the player types "kill rat" rather -than "kill kill rat". - -> [!TIP] -> **See also:** -> + [arguments (verb)](/ref/verb/arguments.md) -> + [settings (verb)](/ref/verb/set.md) -> + [vars (verbs)](/ref/verb/var.md) -> + [src var (proc)](/ref/proc/var/src.md) -> + [usr var (proc)](/ref/proc/var/usr.md) \ No newline at end of file diff --git a/ref/world/index.md b/ref/world/index.md new file mode 100644 index 00000000..bf627000 --- /dev/null +++ b/ref/world/index.md @@ -0,0 +1,8 @@ + +## world (info) +*** +The world node is used to define some global properties for the world. Like the other types, the world has overridable vars and procs. New vars and procs cannot be defined under world though; to make global vars and procs, use /var and /proc instead. +*** +**Related Pages:** ++ [procs (world)](/ref/world/proc) ++ [vars (world)](/ref/world/var) diff --git a/ref/world/proc.md b/ref/world/proc.md deleted file mode 100644 index a4decd8a..00000000 --- a/ref/world/proc.md +++ /dev/null @@ -1,29 +0,0 @@ -## procs (world) - -New procs and vars cannot be defined under /world. Define them globally instead. - -Built-in world procs: -world/proc -+ [AddCredits](/ref/world/proc/AddCredits.md) -+ [ClearMedal](/ref/world/proc/ClearMedal.md) -+ [Del](/ref/world/proc/Del.md) -+ [Error](/ref/world/proc/Error.md) -+ [Export](/ref/world/proc/Export.md) -+ [GetConfig](/ref/world/proc/GetConfig.md) -+ [GetCredits](/ref/world/proc/GetCredits.md) -+ [GetMedal](/ref/world/proc/GetMedal.md) -+ [GetScores](/ref/world/proc/GetScores.md) -+ [Import](/ref/world/proc/Import.md) -+ [IsBanned](/ref/world/proc/IsBanned.md) -+ [IsSubscribed](/ref/world/proc/IsSubscribed.md) -+ [New](/ref/world/proc/New.md) -+ [OpenPort](/ref/world/proc/OpenPort.md) -+ [PayCredits](/ref/world/proc/PayCredits.md) -+ [Profile](/ref/world/proc/Profile.md) -+ [Reboot](/ref/world/proc/Reboot.md) -+ [Repop](/ref/world/proc/Repop.md) -+ [SetConfig](/ref/world/proc/SetConfig.md) -+ [SetMedal](/ref/world/proc/SetMedal.md) -+ [SetScores](/ref/world/proc/SetScores.md) -+ [Tick](/ref/world/proc/Tick.md) -+ [Topic](/ref/world/proc/Topic.md) diff --git a/ref/world/proc/AddCredits.md b/ref/world/proc/AddCredits.md index 2fea845a..50f02802 100644 --- a/ref/world/proc/AddCredits.md +++ b/ref/world/proc/AddCredits.md @@ -1,43 +1,35 @@ -## AddCredits proc (world) -###### BYOND Version 503 + +## AddCredits (proc) **Format:** + AddCredits(player, credits, note) -**Returns:** -+ 1 if the credits were added successfully, 0 or null otherwise. - -**Args:** +**Arguments:** + player: a mob, client, key, or ckey -+ credits: A number of credits to add to the player\'s account ++ credits: A number of credits to add to the player's account + note: An optional note (for author purposes) for the credit change +**Returns:** ++ 1 if the credits were added successfully, 0 or null otherwise. +*** +Adds credits to a player's account. The proc will return 1 if it is successful, or 0 if the attempt failed and should not be tried again. This feature is intended for games that make use of the credit system, and for security all such games must use a hub password. -Adds credits to a player\'s account. The proc will return 1 if -it is successful, or 0 if the attempt failed and should not be tried -again. This feature is intended for games that make use of the credit -system, and for security all such games must use a hub password. - +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -This proc will return null if there was no way to reach the -hub. Use isnull() to check for a null value. Contacting the hub may take -a few moments, so it is a good idea to use spawn() to avoid holding up -the rest of the game. -### Example: ```dm - mob/proc/QuestCompleted(name, credits) src << -"Congratulations! You completed the [name] quest and earned -[credits] credit\\s!" world.AddCredits(name, credits, "Quest: -[name]") + +mob/proc/QuestCompleted(name, credits) + src << "Congratulations! You completed the [name] quest and earned [credits] credit\s!" + world.AddCredits(name, credits, "Quest: [name]") + ``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. -> [!TIP] -> **See also:** -> + [GetCredits proc (world)](/ref/world/proc/GetCredits.md) -> + [PayCredits proc (world)](/ref/world/proc/PayCredits.md) \ No newline at end of file + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** +**Related Pages:** ++ [GetCredits proc (world)](/ref/world/proc/GetCredits) ++ [PayCredits proc (world)](/ref/world/proc/PayCredits) diff --git a/ref/world/proc/ClearMedal.md b/ref/world/proc/ClearMedal.md index 55c4ba13..85157855 100644 --- a/ref/world/proc/ClearMedal.md +++ b/ref/world/proc/ClearMedal.md @@ -1,41 +1,38 @@ -## ClearMedal proc (world) + +## ClearMedal (proc) **Format:** + ClearMedal(medal, player) -**Returns:** -+ 1 if the medal was rescinded successfully, 0 or null otherwise. - -**Args:** +**Arguments:** + medal: name of the medal being rescinded + player: a mob, client, key, or ckey +**Returns:** ++ 1 if the medal was rescinded successfully, 0 or null otherwise. +*** +Removes a medal from a player. The proc will return 1 if it is successful, or 0 if the medal was not already awarded. If the world already knows this medal was not earned, the hub will not be contacted. -Removes a medal from a player. The proc will return 1 if it is -successful, or 0 if the medal was not already awarded. If the world -already knows this medal was not earned, the hub will not be contacted. - +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -This proc will return null if there was no way to reach the -hub. Use isnull() to check for a null value. Contacting the hub may take -a few moments, so it is a good idea to use spawn() to avoid holding up -the rest of the game. -### Example: ```dm - mob/NPC Die(mob/killer) // assume Die() is a proc all mobs -have spawn() if(ismob(killer) && killer.key) -world.ClearMedal("Pacifist", killer) + +mob/NPC + Die(mob/killer) // assume Die() is a proc all mobs have + spawn() + if(ismob(killer) && killer.key) + world.ClearMedal("Pacifist", killer) + ``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. - -> [!TIP] -> **See also:** -> + [GetMedal proc (world)](/ref/world/proc/GetMedal.md) -> + [SetMedal proc (world)](/ref/world/proc/SetMedal.md) -> + [GetScores proc (world)](/ref/world/proc/GetScores.md) -> + [SetScores proc (world)](/ref/world/proc/SetScores.md) \ No newline at end of file + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** +**Related Pages:** ++ [GetMedal proc (world)](/ref/world/proc/GetMedal) ++ [SetMedal proc (world)](/ref/world/proc/SetMedal) ++ [GetScores proc (world)](/ref/world/proc/GetScores) ++ [SetScores proc (world)](/ref/world/proc/SetScores) diff --git a/ref/world/proc/Del.md b/ref/world/proc/Del.md index 6fe1f278..edfd23b3 100644 --- a/ref/world/proc/Del.md +++ b/ref/world/proc/Del.md @@ -1,29 +1,19 @@ -## Del proc (world) + +## Del (proc) **Format:** + Del() -**When:** +**Called When:** + Called when the world is shutdown. -**Default action:** +**Default Action:** + Shutdown the world. +*** +When the world is destroyed, only the Del() proc of the world object is called automatically. If you want to delete any other objects, you must do so from within world/Del(). Once this procedure returns, any other procedures which may still be executing are immediately aborted and all objects are silently destroyed. - -When the world is destroyed, only the Del() proc of the `world` -object is called automatically. If you want to delete any other objects, -you must do so from within `world/Del()`. Once this procedure returns, -any other procedures which may still be executing are immediately -aborted and all objects are silently destroyed. - -To prevent -accidental hangs during `world/Del()` from preventing shutdown, a -timeout is applied to any sleeping operations such as `sleep`, -`world.Export()`, and so on. If the total time slept exceeds the -timeout, `world/Del()` is aborted. Currently, this timeout is set at 30 -seconds. - -> [!TIP] -> **See also:** -> + [Del proc (datum)](/ref/datum/proc/Del.md) -> + [shutdown proc](/ref/proc/shutdown.md) \ No newline at end of file +To prevent accidental hangs during world/Del() from preventing shutdown, a timeout is applied to any sleeping operations such as sleep, world.Export(), and so on. If the total time slept exceeds the timeout, world/Del() is aborted. Currently, this timeout is set at 30 seconds. +*** +**Related Pages:** ++ [Del proc (datum)](/ref/datum/proc/Del) ++ [shutdown proc](/ref/proc/shutdown) diff --git a/ref/world/proc/Error.md b/ref/world/proc/Error.md index 225b394f..5de99b68 100644 --- a/ref/world/proc/Error.md +++ b/ref/world/proc/Error.md @@ -1,19 +1,15 @@ -## Error proc (world) -###### BYOND Version 508 + +## Error (proc) **Format:** + Error(exception) -**Args:** -+ exception: The error that was thrown. If this was a runtime error, - the value will be an /exception datum. - - -Called when a runtime error happens, or the throw keyword is -used, without a try/catch to handle it. The return value is ignored. - -> [!TIP] -> **See also:** -> + [try and catch statements](/ref/proc/try.md) -> + [throw statement](/ref/proc/throw.md) -> + [exception](/ref/exception.md) \ No newline at end of file +**Arguments:** ++ exception: The error that was thrown. If this was a runtime error, the value will be an /exception datum. +*** +Called when a runtime error happens, or the throw keyword is used, without a try/catch to handle it. The return value is ignored. +*** +**Related Pages:** ++ [try and catch statements](/ref/proc/try) ++ [throw statement](/ref/proc/throw) ++ [exception](/ref/exception) diff --git a/ref/world/proc/Export.md b/ref/world/proc/Export.md index f5043335..21a70442 100644 --- a/ref/world/proc/Export.md +++ b/ref/world/proc/Export.md @@ -1,76 +1,92 @@ -## Export proc (world) + +## Export (proc) **Format:** -+ Export(Addr,File,Persist,Clients) - -**When:** -+ Call this to send a message to another server. The message may be - composed of an optional topic text string (in the address) and an - optional file. This will call world.Topic() on the remote server, - which may in turn call world.Import() to access the file. - -**Args:** -+ Addr: The address of the recipient server. It should be in the form - byond://server?topic. The topic portion is optional. -+ File: The (optional) file to send. This could be a cache file (in - single quotes) an external file (in double quotes) or a savefile. -+ Persist: Set to 1 to indicate that the server should keep this - connection open, to expedite subsequent calls to the same address. - An open connection can be closed at a later time by passing 0 in the - Persist field. -+ Clients: An optional client, or list of clients, to tell the - receiver about. - -**Default action:** -+ Send the topic text string and file to the remote server and return - the result of calling world.Topic() there. Note that this will cause - the caller to sleep while waiting for the necessary data to be - transfered. -### Example: ++ Export(Addr,File,Persist,Clients,Method) + +**Arguments:** ++ Addr: The address of the recipient server. It should be in the form , unless it's a web request. The topic portion is optional. ++ File: The (optional) file to send. This could be a cache file (in single quotes) an external file (in double quotes) or a savefile, or an associative list if sending a web request. ++ Persist: Set to 1 to indicate that the server should keep this connection +open, to expedite subsequent calls to the same address. An open connection can be closed at a later time by passing 0 in the Persist field. ++ Clients: An optional client, or list of clients, to tell the receiver about. ++ Method: The request method for HTTP requests; defaults to . +about. + +**Called When:** ++ Call this to send a message to another server. The message may be + composed of an optional topic text string (in the address) and an + optional file. This will call world.Topic() on the remote server, + which may in turn call world.Import() to access the file. + +**Default Action:** ++ Send the topic text string and file to the remote server and return the result of calling world.Topic() there. Note that this will cause the caller to sleep while waiting for the necessary data to be transfered. ++ Send a web request via HTTP. This will also cause the caller to sleep while waiting for the request to finish. +*** +Sends a request to a remote BYOND server that will be handled by its world.Topic() proc, or a web request via HTTP. + + +```dm + +mob/verb/shout(Msg as text) + world << Msg + world.Export("[ShadowWorld]?shout:[Msg]") + +``` + + +This example defines a verb that will broadcast a message to everyone in this world as well as sending it in the form of topic text to another world whose address is stored in the variable ShadowWorld. This address could be manually set or could be the result of calling startup(). + +If the Clients argument is used, it accepts a client that is currently loggedin, a mob belonging to such a client, or a list of any of these. The remote server will receive a list of their keys in world.Topic(). + +It is also possible to access an HTTP server via `world.Export()`. Simply use an http address such as: `http://www.byond.com`. This returns a list of HTTP header parameters as well as the extra values `"STATUS"` and `"CONTENT"`. The value associated with the `"STATUS"` entry is the HTTP status code returned by the web server (as text). The value associated with the `"CONTENT"` entry is the requested resource, as a file. + ```dm - mob/verb/shout(Msg as text) world << Msg -world.Export("[ShadowWorld]?shout:[Msg]") + +mob/verb/test() + var/http[] = world.Export("http://www.byond.com") + + if(!http) + usr << "Failed to connect." + return + + usr << "HTTP Header:" + for(var/V in http) + usr << "[V] = [http[V]]" + usr << "\n" + + var/F = http["CONTENT"] + if(F) + usr << html_encode(file2text(F)) + ``` - - -This -example defines a verb that will broadcast a message to everyone in this -world as well as sending it in the form of topic text to another world -whose address is stored in the variable ShadowWorld. This address could -be manually set or could be the result of calling startup(). - -It -is also possible to access an HTTP server via world.Export(). Simply use -an http address such as: `http://www.byond.com`. This returns a list of -HTTP header parameters as well as the extra values "STATUS" and -"CONTENT". The value associated with the "STATUS" entry is the HTTP -status code returned by the web server (as text). The value associated -with the "CONTENT" entry is the requested resource. -### Example: + + +Note that the HTTP request is submitted using the GET method by default. + +As of BYOND 516.1664, HTTPS is supported as well, along with other methods such as POST and PUT. + +If sending a POST request, the File argument should be an associative list, representing form data. + ```dm - mob/verb/test() var/http[] = -world.Export("http://www.byond.com") if(!http) usr << "Failed to -connect." return usr << "HTTP Header:" for(var/V in http) usr << -"[V] = [http[V]]" usr << "\\n" var/F = http["CONTENT"] -if(F) usr << html_encode(file2text(F)) + +mob/verb/SendForm(name as text, favoritecolor as color) + var/list/formdata = list("name"=name, "color"=favoritecolor) + + var/http[] = world.Export("http://mysite.com/myform", formdata, 0, null, "POST") + + if(!http || findtextEx(http["STATUS"],"200") != 1) + usr << "Failed to send the form." + return + ``` - - -Note that -the HTTP request is submitted using the GET method as opposed to the -POST method. Support for POST may be added in the future. - -If -the Clients argument is used, it accepts a client that is currently -loggedin, a mob belonging to such a client, or a list of any of these. -The remote server will receive a list of their keys in world.Topic(). - -> [!TIP] -> **See also:** -> + [Export proc (client)](/ref/client/proc/Export.md) -> + [Import proc (world)](/ref/world/proc/Import.md) -> + [Topic proc (world)](/ref/world/proc/Topic.md) -> + [link proc](/ref/proc/link.md) -> + [shutdown proc](/ref/proc/shutdown.md) \ No newline at end of file + +*** +**Related Pages:** ++ [Export proc (client)](/ref/client/proc/Export) ++ [Import proc (world)](/ref/world/proc/Import) ++ [Topic proc (world)](/ref/world/proc/Topic) ++ [link proc](/ref/proc/link) ++ [shutdown proc](/ref/proc/shutdown) diff --git a/ref/world/proc/GetConfig.md b/ref/world/proc/GetConfig.md index 056380f1..f8fc79ec 100644 --- a/ref/world/proc/GetConfig.md +++ b/ref/world/proc/GetConfig.md @@ -1,114 +1,71 @@ -## GetConfig proc (world) + +## GetConfig (proc) **Format:** + GetConfig(config_set,param) -**Returns:** -+ Value of requested parameter. - -**Args:** +**Arguments:** + config_set: name of the configuration set (see below) + param: name of the configuration parameter +**Returns:** ++ Value of requested parameter. +*** +This command is for retrieving configuration information that is shared by applications installed on the same system. The configuration data is accessed by specifying the configuration "set" and the parameter within that set. The "sets" defined so far are: -This command is for retrieving configuration information that -is shared by applications installed on the same system. The -configuration data is accessed by specifying the configuration "set" -and the parameter within that set. The "sets" defined so far are: ```dm - env system environment variables (changes are not -persistent) admin list of site administrators ban list of banned users -or IP addresses keyban list of banned users (deprecated) ipban list of -banned addresses (deprecated) + +env system environment variables (changes are not persistent) +admin list of site administrators +ban list of banned users or IP addresses +keyban list of banned users (deprecated) +ipban list of banned addresses (deprecated) + ``` - -If no parameter is -specified, a list of the names of all available parameters is returned. +If no parameter is specified, a list of the names of all available parameters is returned. + +The format of the configuration data itself is currently being defined. It will generally be a sequence of parameters (such as produced by list2params()). For example, each ban entry would have the user's ckey or ckeyEx as the parameter, and might have data such as "reason=jerkish;message=You+jerk!". -The format of the configuration data itself is currently being -defined. It will generally be a sequence of parameters (such as produced -by list2params()). For example, each ban entry would have the user\'s -ckey or ckeyEx as the parameter, and might have data such as -"reason=jerkish;message=You+jerk!". -### Example: ```dm - mob/verb ban(key as text) -world.SetConfig("ban",ckey(key),"reason=fiendish;admin=[ckey]") -lookban(key as null\|text) if(key) usr << "[key]: -[world.GetConfig("ban",key)]" else var/lst[] = -world.GetConfig("ban") for(key in lst) usr << "[key]: -[world.GetConfig("ban",key)]" + +mob/verb + ban(key as text) + world.SetConfig("ban",ckey(key),"reason=fiendish;admin=[ckey]") + lookban(key as null|text) + if(key) + usr << "[key]: [world.GetConfig("ban",key)]" + else + var/lst[] = world.GetConfig("ban") + for(key in lst) + usr << "[key]: [world.GetConfig("ban",key)]" + ``` - - -Ban files store -information on a game-specific basis. You will only be able to read and -write values that are set for the game you are running (defined by the -value of world.hub). It is possible for a host to specify universal bans -as well, but these will not be accessible via GetConfig or SetConfig. If -you are using "ban" as the config_set, IP addresses are recognized -automatically. (See the ban format info below.) - -It is possible, -but rarely useful, to specify a configuration "space" of SYSTEM, USER, -HOME, or APP. Settings made in the SYSTEM space are shared by all BYOND -software on the computer. The USER space is shared by all software owned -by the same user. The HOME space is shared by all worlds running with -the same safe home directory. The APP space is shared by all software -running from the same filesystem directory. By default, the USER space -is used, and if that cannot be modified (in safe mode), then HOME is -used instead. These distinctions are sometimes important on a UNIX -machine, where there are many BYOND sites belonging to different users, -but even then, the default behavior is almost always what you want. - - -The configuration space is specified inside the configuration -set parameter like this: + + +Ban files store information on a game-specific basis. You will only be able to read and write values that are set for the game you are running (defined by the value of world.hub). It is possible for a host to specify universal bans as well, but these will not be accessible via GetConfig or SetConfig. If you are using "ban" as the config_set, IP addresses are recognized automatically. (See the ban format info below.) + +It is possible, but rarely useful, to specify a configuration "space" of SYSTEM, USER, HOME, or APP. Settings made in the SYSTEM space are shared by all BYOND software on the computer. The USER space is shared by all software owned by the same user. The HOME space is shared by all worlds running with the same safe home directory. The APP space is shared by all software running from the same filesystem directory. By default, the USER space is used, and if that cannot be modified (in safe mode), then HOME is used instead. These distinctions are sometimes important on a UNIX machine, where there are many BYOND sites belonging to different users, but even then, the default behavior is almost always what you want. + +The configuration space is specified inside the configuration set parameter like this: + + ```dm -world.SetConfig("APP/keyban",...) +world.SetConfig("APP/keyban",...) + ``` - - -When reading -configuration settings, the spaces are always lumped together. In cases -of settings with the same name but different values, APP overrides HOME, -which overrides USER, which overrides SYSTEM. -### Ban Format - - -If you want to create or read bans at runtime by using the -"ban" config set, these are the main parameters currently used: -type -+ The ban\'s type, if any. It can be "sticky", "session", or - "time", or a combination separated by commas. Session bans expire - when the current session is over (world.Reboot() does not affect - this). -reason -+ The reason the ban was implemented; this is for the host\'s or - admin\'s purposes only and is not displayed to the user. -message -+ A message to display to the user. -keys -+ Other keys caught in a sticky ban. -IP -+ Other IP addresses caught in a sticky ban. -computer_id -+ Other computer_id values caught in a sticky ban. -time -+ The number of seconds remaining in the ban. The type parameter must - include "time" for this to mean anything. If this parameter is not - present when a timed ban is read, it means the ban has expired. - - -The old "keyban" and "ipban" config files are now just -aliases for "ban". - -> [!TIP] -> **See also:** -> + [IsBanned proc (world)](/ref/world/proc/IsBanned.md) -> + [SetConfig proc (world)](/ref/world/proc/SetConfig.md) \ No newline at end of file + + +When reading configuration settings, the spaces are always lumped together. In cases of settings with the same name but different values, APP overrides HOME, which overrides USER, which overrides SYSTEM. + +If you want to create or read bans at runtime by using the "ban" config set, these are the main parameters currently used: + +The old "keyban" and "ipban" config files are now just aliases for "ban". +*** +**Related Pages:** ++ [IsBanned proc (world)](/ref/world/proc/IsBanned) ++ [SetConfig proc (world)](/ref/world/proc/SetConfig) diff --git a/ref/world/proc/GetCredits.md b/ref/world/proc/GetCredits.md index c0011c67..f35762ce 100644 --- a/ref/world/proc/GetCredits.md +++ b/ref/world/proc/GetCredits.md @@ -1,35 +1,25 @@ -## GetCredits proc (world) -###### BYOND Version 503 + +## GetCredits (proc) **Format:** + GetCredits(player) -**Returns:** -+ Number of credits if hub contact was successful, null otherwise. - -**Args:** +**Arguments:** + player: a mob, client, key, or ckey +**Returns:** ++ Number of credits if hub contact was successful, null otherwise. +*** +Retrieves the number of available credits in a player's account. This feature is intended for games that make use of the credit system, and for security all such games must use a hub password. -Retrieves the number of available credits in a player\'s -account. This feature is intended for games that make use of the credit -system, and for security all such games must use a hub password. - +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -This proc will return null if there was no way to reach the -hub. Use isnull() to check for a null value. Contacting the hub may take -a few moments, so it is a good idea to use spawn() to avoid holding up -the rest of the game. +The best time to call this proc is before a player does something that would allow them to spend credits, and/or just afterward, so they can see what is left in their account. -The best time to call this proc is before -a player does something that would allow them to spend credits, and/or -just afterward, so they can see what is left in their account. -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. -> [!TIP] -> **See also:** -> + [AddCredits proc (world)](/ref/world/proc/AddCredits.md) -> + [PayCredits proc (world)](/ref/world/proc/PayCredits.md) \ No newline at end of file +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** +**Related Pages:** ++ [AddCredits proc (world)](/ref/world/proc/AddCredits) ++ [PayCredits proc (world)](/ref/world/proc/PayCredits) diff --git a/ref/world/proc/GetMedal.md b/ref/world/proc/GetMedal.md index 7f0dbaed..9cc58082 100644 --- a/ref/world/proc/GetMedal.md +++ b/ref/world/proc/GetMedal.md @@ -1,58 +1,54 @@ -## GetMedal proc (world) + +## GetMedal (proc) **Format:** + GetMedal(medal, player) +**Arguments:** ++ medal: name of the medal being checked ++ player: a mob, client, key, or ckey + **Returns:** + 1 if the medal has been earned by the player + 0 if the medal has not been earned + A list of medals in list2params() format if checking all medals + null if the hub cannot be contacted +*** +Checks to see if a medal has been awarded to the player in question. If the medal has been awarded, the return value is 1. If not, 0. -**Args:** -+ medal: name of the medal being checked -+ player: a mob, client, key, or ckey - - -Checks to see if a medal has been awarded to the player in -question. If the medal has been awarded, the return value is 1. If not, -0. +You can also use GetMedal() to read a list of all medals a player has earned for the hub entry, by leaving the medal argument blank. If you also leave the player argument blank, you will get a list of all medals available to the hub entry. In both cases the result can be parsed with params2list(). -You can also use GetMedal() to read a list of all medals a -player has earned for the hub entry, by leaving the medal argument -blank. If you also leave the player argument blank, you will get a list -of all medals available to the hub entry. In both cases the result can -be parsed with params2list(). +This proc will return null if there was no way to reach the hub or otherwise verify the medal's status. Use isnull() to check for a null value. -This proc will return null if -there was no way to reach the hub or otherwise verify the medal\'s -status. Use isnull() to check for a null value. +Whenever possible, GetMedal() will avoid contacting the hub by using the information it was given when the user logged in. If contacting the hub is required, the proc may take a few moments to return a result. It is a good idea to use spawn() to avoid holding up the rest of the game. -Whenever -possible, GetMedal() will avoid contacting the hub by using the -information it was given when the user logged in. If contacting the hub -is required, the proc may take a few moments to return a result. It is a -good idea to use spawn() to avoid holding up the rest of the game. -### Example: ```dm - turf/medal_door density = 1 icon_state = "closed" -var/medal = "Dragon slayer" verb/Knock() usr << "**Guard:** Just -checking your credentials...." var/hasmedal = world.GetMedal(medal, -usr) if(hasmedal) usr << "**Guard:** Go right in." icon_state = -"open" density = 0 else if(!isnull(hasmedal)) usr << "**Guard:** -Sorry, no admittance without a **[medal]** badge." else usr << -"**Guard:** Sorry, I lost the paperwork. Try again later." -``` +turf/medal_door + density = 1 + icon_state = "closed" + var/medal = "Dragon slayer" + + verb/Knock() + usr << "Guard: Just checking your credentials...." + var/hasmedal = world.GetMedal(medal, usr) + if(hasmedal) + usr << "Guard: Go right in." + icon_state = "open" + density = 0 + else if(!isnull(hasmedal)) + usr << "Guard: Sorry, no admittance without a [medal] badge." + else + usr << "Guard: Sorry, I lost the paperwork. Try again later." +``` -You can add an optional hub path argument if you want to look -at a medal for a different hub entry. -> [!TIP] -> **See also:** -> + [SetMedal proc (world)](/ref/world/proc/SetMedal.md) -> + [ClearMedal proc (world)](/ref/world/proc/ClearMedal.md) -> + [GetScores proc (world)](/ref/world/proc/GetScores.md) -> + [SetScores proc (world)](/ref/world/proc/SetScores.md) \ No newline at end of file +You can add an optional hub path argument if you want to look at a medal for a different hub entry. +*** +**Related Pages:** ++ [SetMedal proc (world)](/ref/world/proc/SetMedal) ++ [ClearMedal proc (world)](/ref/world/proc/ClearMedal) ++ [GetScores proc (world)](/ref/world/proc/GetScores) ++ [SetScores proc (world)](/ref/world/proc/SetScores) diff --git a/ref/world/proc/GetScores.md b/ref/world/proc/GetScores.md index 6f9f6b28..f41ab534 100644 --- a/ref/world/proc/GetScores.md +++ b/ref/world/proc/GetScores.md @@ -1,103 +1,7370 @@ -## GetScores proc (world) -**Formats:** -+ GetScores(key, fields) -+ GetScores(count, field) -+ GetScores(count, skip, field) +## GetScores (proc) + +**Format:** ++ number + +**Arguments:** ++ x: Horiztonal direction and period of wave ++ y: Vertical direction and period of wave ++ size: Maximum distortion in pixels (defaults to 1) ++ offset: Phase of wave, in periods (e.g., 0 to 1) ++ flags: Defaults to 0; see below for other flags **Returns:** -+ A parameter list of scores for a given entry. Use params2list() to - interpret the results. - -**Args:** -+ key: the name of the player, character, etc. for which scores have - been set -+ fields: The data fields to retrieve -+ count: The number of top score records to look at -+ skip: The number of top score records to skip over - - -Retrieves information about scores that is kept on the BYOND -hub. - -This proc will return null if there was no way to reach -the hub. Use isnull() to check for a null value. Contacting the hub may -take a few moments, so it is a good idea to use spawn() to avoid holding -up the rest of the game. -### GetScores(key, fields) - - -In this form, you can get information about individual scores. -This is the most common way to use GetScores(). - -The key is an -arbitrary text value. Usually a player\'s key is a good choice, but you -can also use the name of their character, or anything else you like, as -long as it is unique. The key is case-insensitive. - -Scores and -stats use data fields, which might be things like "Score", "Level", -"Class", etc. To retrieve all the fields associated with a key, leave -the fields argument blank. To retrieve only certain fields, you can send -a separated list like "Score;Level" which is in the same format -returned by list2params(). - -If you leave the key argument blank, -you will get a complete list of keys that have scores and stats -associated with them. -### Example 1: - -```dm - mob/var/scores_found mob/var/score = 0 mob/Login() ..() -spawn() var/scores = world.GetScores(key) scores_found = !isnull(scores) -if(scores) var/list/params = params2list(scores) if(params["Score"]) -score = text2num(params["Score"]) src << "You have [score] -point\\s!" -``` - -### GetScores(count, field) *and* GetScores(count, skip, field) - - -In this form, the proc gets a list of the top scores for a -certain field, and gives you the keys and scores in order. To get the -top 10 players by level, for instance, you would use -GetScores(10,"level"). This returns a parameter list with the top keys -and scores, so it might be in a form like -"Bob=100;Anita=80;David=20;Charlie=5". - -The count and skip -arguments are always numbers, not text. The count is the number of -scores to retrieve, and skip is the number to skip over to get to them. -So count=10 and skip=0 is the top 10, while count=10 and skip=5 is #6 -through #15. If you leave out skip, it\'s a 0. - -The way you set -up your hub entry is how the top scores are determined. If you told the -hub that the "score" field is always sorted from highest number to -lowest, then that\'s what you\'ll get. If "birthplace" is set up to -use an alphabetical order, that\'s the order that GetScores() will use. -If a field cannot be sorted, this form of GetScores() will return an -empty text string. - -If you don\'t specify a field, your hub -entry may have a default field to use. For instance if your hub page -displays "Score", then "Level", then the "Score" field is the -default. -### Example 2: - -```dm - mob/var/scores_found mob/Login() ..() spawn() -var/top_scores = world.GetScores(10, "Booty") scores_found = -!isnull(scores) if(scores) var/list/params = params2list(scores) src -<< "**Top Buccaneers:**" for(var/i=1, iNote: You can specify a -different hub path and hub_password by adding these as extra arguments, -but this is not recommended for security reasons. If you use this -feature, it should only be on games that cannot be downloaded by the -public. - -> [!TIP] -> **See also:** -> + [SetScores proc (world)](/ref/world/proc/SetScores.md) -> + [GetMedal proc (world)](/ref/world/proc/GetMedal.md) -> + [SetMedal proc (world)](/ref/world/proc/SetMedal.md) -> + [ClearMedal proc (world)](/ref/world/proc/ClearMedal.md) \ No newline at end of file ++ The key, if the scores were successfully updated; null otherwise. + +**Called When:** ++ Called when a message is received from another server by using + world.Export(). If a file is expected, world.Import() may be called to + get it. The return value of Topic() will be passed back to the remote + server. + +**Default Action:** ++ The topic "ping" returns a true value (number of players plus one), + which may be useful for telling if a server is alive. The topics + "Reboot" and "Del" will call world.Reboot() and world.Del() + respectively if the message was sent by the master server. + +**Default Value:** ++ normal +*** +Retrieves information about scores that is kept on the BYOND hub. + +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. + +In this form, you can get information about individual scores. This is the most common way to use GetScores(). + +The key is an arbitrary text value. Usually a player's key is a good choice, but you can also use the name of their character, or anything else you like, as long as it is unique. The key is case-insensitive. + +Scores and stats use data fields, which might be things like "Score", "Level", "Class", etc. To retrieve all the fields associated with a key, leave the fields argument blank. To retrieve only certain fields, you can send a separated list like "Score;Level" which is in the same format returned by list2params(). + +If you leave the key argument blank, you will get a complete list of keys that have scores and stats associated with them. + + +```dm + +mob/var/scores_found +mob/var/score = 0 + +mob/Login() + ..() + spawn() + var/scores = world.GetScores(key) + scores_found = !isnull(scores) + if(scores) + var/list/params = params2list(scores) + if(params["Score"]) + score = text2num(params["Score"]) + src << "You have [score] point\s!" + +``` + + +In this form, the proc gets a list of the top scores for a certain field, and gives you the keys and scores in order. To get the top 10 players by level, for instance, you would use GetScores(10,"level"). This returns a parameter list with the top keys and scores, so it might be in a form like "Bob=100;Anita=80;David=20;Charlie=5". + +The count and skip arguments are always numbers, not text. The count is the number of scores to retrieve, and skip is the number to skip over to get to them. So count=10 and skip=0 is the top 10, while count=10 and skip=5 is #6 through #15. If you leave out skip, it's a 0. + +The way you set up your hub entry is how the top scores are determined. If you told the hub that the "score" field is always sorted from highest number to lowest, then that's what you'll get. If "birthplace" is set up to use an alphabetical order, that's the order that GetScores() will use. If a field cannot be sorted, this form of GetScores() will return an empty text string. + +If you don't specify a field, your hub entry may have a default field to use. For instance if your hub page displays "Score", then "Level", then the "Score" field is the default. + + +```dm + +mob/var/scores_found + +mob/Login() + ..() + spawn() + var/top_scores = world.GetScores(10, "Booty") + scores_found = !isnull(scores) + if(scores) + var/list/params = params2list(scores) + src << "Top Buccaneers:" + for(var/i=1, i +Note: You can specify a different hub path and hub_password +by adding these as extra arguments, but this is not recommended for security +reasons. If you use this feature, it should only be on games that cannot be +downloaded by the public. + + + +Import proc (world) + + + + +Example: + +//sending the file +mob/proc/Export(Addr) + var/savefile/F = new() + F.Write(src) + world.Export(Addr,F) + +//receiving the file +world/Topic() + var/savefile/F = new(world.Import()) + F.Read() //read the mob + +This example defines a mob proc called Export() which writes the mob to a +savefile and sends it to another server (specified by Addr). The remote +server opens it as a savefile and creates the mob (if the same mob type is +defined on both servers and mob.Read() is compatible with the sending +server's mob.Write()). + +Note that another method of transferring player mobs is to use the key +savefile (accessed by client.Export() and client.Import()). Direct server +to server communication on the other hand could transfer data (like +non-players) without the need for player involvement at all. + +Savefiles are the most common type of file to transfer, but world.Import() +simply returns a reference to an item in the world's .rsc file, which could be +any type of file. This particular example demonstrates how to open such a +file as a temporary savefile. (It gets dumped from the cache into a separate +temporary file, which is then opened as a savefile.) Other types of files +would be handled differently. For example, you could use fcopy() to dump the +cached item to its own separate file. + + + +IsBanned proc (world) + + + + +By default, this procedure checks the "ban" configuration file. If an +entry is found for the current world (based on the value of world.hub), the +parameter text is converted into a list (using params2list()), and the result +is returned. Otherwise, null is returned. + +A ban that applies to all worlds on the host's computer will not call +IsBanned(). The connection will simply be denied. + +This procedure is called internally whenever a new user connects (before +client/New() is called). If the result is true, access is denied. If you +want to ban a user but still allow them to log in (perhaps with reduced +functionality), you can put "Login=1" in the parameter text. If you want to +display an explanation to the user about why they are banned, you can also put +"message=X" in the parameter text, where X is the message to display to the user. +A reason for the ban can be added with a "reason=X" field. Of course, you can +also override IsBanned() and insert these values directly into the list that is +returned. + +Example + +world/IsBanned(key,address) + . = ..() //check the ban lists + if(istype(., /list)) + .["Login"] = 1 //allow banned user to login + +When you ban people from paging you, this also causes them to be added to +the keyban list. Even if they are already connected, IsBanned() will be +re-evaluated and acted upon at that time. When you remove pager ban, they are +removed from keyban as well. + +Additional data elements may be added to the ban list in the future. +The current definition includes just the following items: + + +Since the data in the "ban" file is in +application/x-www-form-urlencoded format, it is +probably not desirable to edit the file by hand. No built-in facilities for +editing the file have been provided (aside from automatic addition of pager +bans), but an interface could be created, using GetConfig +and SetConfig to read and write the data. +Extra features could also be added such as automatic inference of key +associations by IP address. + + + +IsSubscribed proc (world) + + + +Checks a player for their subscription status to this game. This is a +simpler alternative to client.CheckPassport(), which is deprecated, +and also allows you to check even when the player has gone offline. + +This proc will return null if contacting the hub was required, but there +was no way to reach the hub. Contacting the hub may take a few moments, so it +is a good idea to use spawn() to avoid +holding up the rest of the game. + +Example: + +mob/verb/JoinClub() + if(!world.IsSubscribed(src)) + src << "Sorry, the club is only for subscribers." + else + // go to the turf with the tag "clubhouse" + loc = locate("clubhouse") + src << "Welcome to the clubhouse!" + +Note: You can specify a different hub path and hub_password +by adding these as extra arguments, but this is not recommended for security +reasons. If you use this feature, it should only be on games that cannot be +downloaded by the public. + + + +New proc (world) + + + + + +OpenPort proc (world) + + + + +This causes the world to be hosted on the specified network port. A value +of 0 or "any" requests that any available port be used. The value "none" +causes the port to be closed so that no new connections are possible. + +This proc may be overridden. If it is, calling ..() is necessary to open +the port. If ..() is not called, it will not open. + +Example: + +world/OpenPort(port) + // only allow subscribers to host + if(host_is_subscribed) + return ..() + +The "ports" configuration option in cfg/byond.txt can be used to control +what ports worlds may open. The -ports command-line option may also be used. +See startup for the syntax. + + + +PayCredits proc (world) + + + + +Removes credits from a player's account, if they have enough. The proc +will return 1 if it is successful, or 0 if the attempt failed (usually +because the player doesn't have enough credits). This feature is intended +for games that make use of the credit system, and for security all such +games must use a hub password. + +This proc will return null if there was no way to reach the hub. Use +isnull() to check for a null value. Contacting the hub may take a few +moments, so it is often a good idea to use spawn() to avoid holding up the +rest of the game. + +Example: + +mob/proc/ItemShop() + var/items = list("Get credits!", "Magic sword"=10, "Skeleton key"=50) + var/choices[0] + var/item,price + for(item in items) + price = items[item] + choices["[item]: [price] credit\s"] = item + + var/credits = world.GetCredits(key) + if(isnull(credits)) + src << "Sorry, the item shop isn't available right now." + return + + var/choice = input(src,\ + "You have [credits] credit\s. What would you like to purchase?",\ + "Item Shop")\ + as null|anything in choices + if(!choice) return // cancel + + if(choice == "Get credits") + src << link("http://www.byond.com/games/Author/MyGame/credits") + return + + item = choices[choice] + price = items[item] + if(!price) return + + src << "Contacting item shop..." + var/result = world.PayCredits(name, price, "Item shop: [item]") + + if(isnull(result)) + src << "Sorry, the item shop isn't available right now." + else if(!result) + src << "You need [price-credits] more credit\s to buy [item]." + else + src << "You bought \a [item]!" + + // Now give the user the item and save their character + // These procs are for you to define + src.AddEquipment(item) + src.SaveCharacter() + +Note: You can specify a different hub path and hub_password +by adding these as extra arguments, but this is not recommended for security +reasons. If you use this feature, it should only be on games that cannot be +downloaded by the public. + + + +Profile proc (world) + + + +Interacts with the built-in server profiler without requiring the host to do +so via Dream Daemon, or an authorized player via Dream Seeker. + +The command value is built from bitflags, so it can combine any of +these three values via the | operator: + + +These additional values are also defined for convenience: + + +Profiling procs +By default, data will be returned as a list. The first six values are the +column names: "name", "self", "total", +"real", "over", and "calls", corresponding to the +columns in the profiler. These are followed by the profile data for each proc, +with the data being in the same column order. E.g. the next six items +represent the first proc in the profile. + +The optional format argument however can be used to return the +data in other formats. Currently the only accepted value is "json", +which will output the same data in JSON format. + +SendMaps profile +Using "sendmaps" in the type argument will profile the +routines used to send map informaiton to players. Unlike the proc profiling +this only has three data columns: "name", "value", and +"calls". The value column might be a time or number value, depending +on what's being measured. + +The JSON format will include a unit property data that is not a +raw number, such as a time value. + + + +Reboot proc (world) + + + +Reload the world from scratch. Any connected players will automatically +relogin. This would be useful if you needed to recompile the world after +changing some code. + +In a UNIX environment, you can cause a running server to reboot by +sending it the signal SIGUSR1. + +If you override this proc, you must call ..() if you want the reboot to +complete normally. + +For reboots initiated by Dream Seeker, usr will be the mob belonging to +the player who sent the command. + + + +Repop proc (world) + + + + +SetConfig proc (world) + + + +This command is for storing configuration information that is shared by +applications installed on the same system. The configuration data is +accessed by specifying the configuration "set" and the parameter within that +set. + +For more information, see GetConfig. + + + +SetMedal proc (world) + + + + +Awards a medal to a player. The proc will return 1 if it is successful, or +0 if the medal was already awarded. If the world already knows this medal was +earned before, the hub will not be contacted. + +This proc will return null if there was no way to reach the hub. Use +isnull() to check for a null value. Contacting the hub may take a few +moments, so it is a good idea to use spawn() to avoid holding up the rest of +the game. + + +Example: + +mob/monster/dragon + Die(mob/killer) // assume Die() is a proc all mobs have + spawn() + if(ismob(killer) && killer.key) + world.SetMedal("Dragon slayer", killer) + +Note: You can specify a different hub path and hub_password +by adding these as extra arguments, but this is not recommended for security +reasons. If you use this feature, it should only be on games that cannot be +downloaded by the public. + + + +SetScores proc (world) + + + + +Updates scores that are kept on the BYOND hub. + +The key is an arbitrary text value. Usually a player's key is a good +choice, but you can also use the name of their character, or anything else +you like, as long as it is unique. The key is case-insensitive. + +Scores and stats use data fields, which might be things like "Score", +"Level", "Class", etc. Use list2params() to set the fields that you want to +change. Fields that you do not include in the list will not be changed. A +field with a blank value will be deleted. + +Sending an empty text string for the fields will erase the scores for that +key. + +This proc will return null if there was no way to reach the hub. Use +isnull() to check for a null value. Contacting the hub may take a few +moments, so it is a good idea to use spawn() to avoid holding up the rest of +the game. + +Example: + +var/params + +// Change the Score and Pet fields +params = list("Score"=123, "Pet"="Dog") +world.SetScores("Tom", list2params(params)) + +// Delete the Pet field +params = list("Pet"="") +world.SetScores("Tom", list2params(params)) + +// Delete Tom's scores entirely +world.SetScores("Tom", "") + +Note: You can specify a different hub path and hub_password +by adding these as extra arguments, but this is not recommended for security +reasons. If you use this feature, it should only be on games that cannot be +downloaded by the public. + + + +Tick proc (world) + + + + +This proc allows you to do any updates just before map info is sent out. +One possible use for this is to run a movement loop, or sync up any user +interface input that might have arrived and deal with it all at once. + +Example: + +world/Tick() + for(var/client/C) + if(C.mob?.move_dir) + try + step(C.mob, move_dir) + catch + // empty catch, just so a failed step won't break the loop + +Note: The tick will not wait if this proc sleeps. It effectively has +set waitfor=0 already built in. +It's a good idea not to sleep in this proc or any of its callees at all, +since it will keep getting called every tick. + + + +Topic proc (world) + + + + + +Example: + +world/Topic(T) + if(findtext(T,"shout:") == 1) + world << copytext(T,7) + +This example allows other servers to send this server topic text of the +form "shout:msg" and will broadcast the message to all the players in this +world. + +The Keys argument is either null, or a list of user keys. Any keys in the +list are logged in to the remote server. + +Always validate the input in Topic() calls +to make sure it's correct and the query you're recieving is legitimate. + + + +vars (world) +Built-in world vars: + + + + +address var (world) + +This is the network address of the machine hosting the world. If it +cannot be determined, it will be null. + +The full network address of the world may be formed by concatenating the +world address and port: "byond://[address]:[port]". + +In CGI mode, this is the web address of the world. + +This is the local address only. If the world is hosted via a router, the +external IP address may be different. Use internet_address to find +the external address, if available. + + + +area var (world) + +This is the default area type to be placed on the map wherever no area is +specified. A value of 0 turns off the default area. + + + +byond_build var (world) + +This is the build number (minor version) of BYOND being run by this server. +Typically this is not useful information, but it can come in handy when +diagnosing issues reported by players when hosting with a beta build. + + + +byond_version var (world) + +This is the version of BYOND at run-time. A game designed to work around +known bugs in older versions could use this to adapt its behavior accordingly. + + + +cache_lifespan var (world) + + +Number of days items that are not in use will be saved in the resource +cache (.rsc file). Files uploaded by players are stored in the world's .rsc +file for future use. If the file is not used for the specified amount of +time, it will be removed to save space. + +Setting this value to 0 causes items to be saved for the current session +only. This is used by the CGI library, because web browsers cannot make use +of server-side caches when uploading files anyway. + +This value must be a whole number. + + + +contents list var (world) + + +This is a list of every object in the world. Objects in this list are in +no particular order. + +Example: + +proc/ListAreas(mob/M) + var/area/A + M << "Areas:" + for (A in world.contents) + M << A + +This example displays a list of every area in existence. As a convenient +short-hand, one may simply write for(A) or for(A in world) instead of the +full for(A in world.contents). + + + +cpu var (world) + +This is the percentage of a server tick that the server spends processing +running procs and the work of sending map information to players. A value of 0 +would indicate very little cpu usage. A value of 100 would indicate full cpu +usage, which could mean that the server cannot complete all the necessary +computations during a tick to finish in time for the next tick. In this case, +timed events (such as sleep) may take +longer than requested. + +When deciding on a value for tick_lag, one could use this value to +determine if the CPU is fast enough to tick at a higher rate. + +The map_cpu var is a subset of this, measuring only time used for +sending map information. + + + +executor var (world) + + +This option is for direct execution of .dmb files in UNIX. +The most common use is for writing CGI programs that are executed by the web +server. + +The first parameter in the executor text string is the path to +DreamDaemon. The one listed above is the standard UNIX location. + +Optional parameters may follow. The most common are -CGI and -logself. + +Example: + +world/executor = "/usr/local/byond/bin/DreamDaemon -CGI -logself" + +This example creates a CGI program to be executed by a web server. It +puts its error output in the file projname.log. + +All of this is configured for you when you include +html/CGI.dm from the html library. + + + +fps var (world) + + +The value of world.fps defines the speed of the world in frames +(server ticks) per second. By default this is 10 fps, which is a good speed if +all objects move in full tiles. Higher values yield smoother results, but at a +cost to performance. Timing of many events may be limited by the system clock, +so fps values beyond 40 or 50 may cause unwanted effects like jitter +even for projects that are not very demanding in terms of performance. + +For projects making use of pixel movement, higher fps is usually +desired. 40 seems to be a good value for general use, but in worlds that have +a large number of players, you may wish to lower the value and give players a +higher step_size per tick instead. + +This var exists for convenience; it is calculated by 10 / +world.tick_lag. The value of world.tick_lag is actually more +accurate, but it is easier to think of world speed in terms of frames per +second. The actual tick rate has a resolution of 1 ms. + +When reading world.fps, the result is always given as a whole +number to gloss over rounding error. + +If you set client.tick_lag or client.fps to a value other +than 0, you can make the client tick at a different (usually faster) rate. + + + +game_state var (world) + + +At runtime, this value may be changed to let the BYOND hub know about +certain changes in the game's status. An example for using this value is if +the number of players in the game gets too high and most new logins are +rejected, you can set game_state to 1 to let the hub know this server is +full. + +The following values are accepted: + + +Note that this value does not affect how your world actually reacts to new +players logging in. It is only used by the hub and website. + + + +host var (world) + + +If the information is made available by the pager, this will provide the +key of the world's host. If the host is not known, this value will be either +null or an empty string. + + + +hub var (world) + + +This is a registered BYOND hub path. +The default value of null is for unregistered games. Registered games (don't +worry, it's free!) have their own hub page showing a brief description of the +game, the author, an optional installation package, and links to online games. +The hub path is a string of the form "YourName.GameName" and can be found in your +hub console. + +Even unregistered games show up in the hub when they are live (that is +online with people connected). It just doesn't show any of the extra info +like a description, and there is no way for people to find out about it when +nobody is logged in. + +If you do not want your game to show up in the hub (like while you are in +the initial stages of development), just compile with +visibility=0. Either that, or turn off your pager or your BYOND +locator when you are connected to it. + +You (or the players) might also wish to turn off the notice of a live +game in the hub when there is no longer any room for new players or if it is +too late in the game for new people to join. At such times, you can simply +set the visibility to 0. + +Example: + +world + hub = "Dan.PipeStock" //registered hub path + +mob/verb/start_game() + world.visibility = 0 + //... + +If you configure your hub page to require a hub password, you must also +specify world.hub_password. + + + +hub_password var (world) + + +If world.hub is set, any live session of the game will be +attached to the specified BYOND Hub page. Under the default settings, +any game can set world.hub and attach itself to any BYOND +Hub page. +To beef up security, you can set a hub password in your hub's +configuration page via the BYOND website. This will ensure that +only authorized copies of your game can attach themselves to your +hub page when live. Then simply copy that password into your code as +world.hub_password so that your game's live broadcast will +be accepted by the hub. +Example: + +world + hub = "Dan.PipeStock" //registered hub path + hub_password = "UPAggnJaeXmSBoKK" //password for live game authentication + +Note that for security reasons, reading this variable at runtime will +return a hashed version of the value that was set. + + +icon_size var (world) + + +This is the tile size that will be used as a default for icons in the +world. It can be set to a single number that represents both the width and +height, or you can use a format like "[width]x[height]" (such as "16x48") to +specify width and height separately. + +This value affects several calculations, including icon operations and +gliding between turfs. + +Note: If you do not use a square icon size and you are using a topdown map +format, you may experience display issues if setting client.dir +to EAST or WEST. A non-square tile with a topdown map format +will also interfere with pixel movement. For this reason, square sizes are +recommended when using any topdown-view map format. + + + +internet_address var (world) + +This is the network address of the machine hosting the world, as it is +seen by the outside network (from the Internet) and the hub. If it cannot +be determined, it will be null. + +The full network address of the world may be formed by concatenating the +world address and port: "byond://[address]:[port]". + +This var exists because world.address may not be accurate if the +world is hosted on a machine behind a router using NAT. The value returned +by internet_address can be given to other players who wish to log +in. + + + +log var (world) + +Sending output to world.log may be useful for debugging purposes. The +output goes to the same place run-time proc errors are displayed. + +Example: + +if(1+1 != 2) + world.log << "Uh oh." + +You can assign world.log to a file name or file() object to redirect output +to that file. (There is also a command-line option to Dream Daemon that does +this.) + +Example: + +world.log = file("mylog.txt") + + + +loop_checks var (world) + +Setting this to 0 disables the very long loop protection. By default, +loops in the code which undergo a very large number of iterations or +recursions are aborted (by crashing the proc). This prevents the proc from +locking up the server for too long. + +You may need to disable this feature if your code has some very long loops +in it. Before doing that, make sure it's not infinitely long! Your +program will utterly crash if it runs out of system stack space, which can +happen in a very deep or infinite recursion. + +Note: The compiler will now generate a warning when you disable +loop_checks. It is not advisable to disable the check unless you're +trying to debug something, since you can cause the server to hang. Generally +if you have a loop so long it can cause the regular loop checks to freak out, +you need to make a change to the loop behavior anyway. + + + +map_format var (world) + + + +This value says how the world will display maps. In a normal overhead +tiled map the value is TOPDOWN_MAP for the top-down format. For older +games that predate this feature, the value is TILED_ICON_MAP. + +If you use a map format other than top-down, the HUD will still use a +tile format like it would in top-down display. HUD objects are not projected +into whatever map_format you use and they are not affected by changing +client.dir. The size of the HUD is rounded up to the nearest number of full +screen tiles; the size of each tile is defined by world.icon_size. + +Top-down format + +(See more at Topdown maps.) + +This is the default map format. Icons are drawn in a tile form and viewed +from overhead. In this layout, the layer assigned to each atom is very +important. The number of tiles shown is set by client.view or world.view. + +Because this format is familiar and easy to understand, it is the default +setting. Most of the vars related to maps and atoms are designed and +documented with this format in mind. + +Tiled icon format + +(See more at Tiled icons.) + +In BYOND 4.0 a new feature was introduced for using "big" icons, bigger than +the standard tile size, by splitting them up into states like "0,0", "1,0", +and so on. This functionality is no longer needed since BYOND now has the +ability to display icons in their natural size. Some games that were designed +before this, however, may still need to make use of this splitting feature +that breaks icons into smaller tile-sized pieces. + +When an icon is broken into chunks, each state in the icon is given a +thumbail version of the full image, and then new states are added to show +each chunk. For instance if world.icon_size is the default 32×32, and +the icon is 64×64, then the "door" state would become a thumbnail of +the full door image while "door 0,0" (the lower left corner), "door 1,0", +"door 0,1", and "door 1,1" were created to show each smaller section of the +image. If the default "" state is broken into chunks, those chunks are just +named "0,0" and so on without a space. + +This format is deprecated. It exists to support +older games and allow them to be compiled without causing them to break, +until they can be redesigned for one of the newer formats. + +Isometric format + +(See more at Isometric maps.) + +If map_format is set to ISOMETRIC_MAP, the map is displayed in +isometric form. Isometric tiles are displayed in a foreshortened diagonal +perspective, where the "north" direction actually displays as northeast on +the player's screen, and "east" shows up as southeast. The value of +client.view or world.view is used to calculate the +minimum number of tiles to display, and extra tiles to each side will +be shown to fill in the corners. + +In an isometric map, the tile width set in world.icon_size is the most +important factor. This should be a multiple of 4 for best results. The +minimum tile height is half that value, and any extra height is used to show +vertical structures that "stick up" off the map surface. When you draw an +isometric tile icon, start with a flattened diamond shape at the bottom that +is only half as high as it is wide. + +Isometric maps behave differently during drawing than top-down maps. In +isometric, tiles that are nearer to the viewer's perspective are drawn in +front of tiles farther back, regardless of layer. Layers only count within an +individual tile. This means that if you want to have a vertical structure +"stick up" to partially hide something behind it, the icon sticking up should +always be on a tile forward from the one being partly covered. E.g. if you +have a wall taking up part of your tile, it needs to be at the "back" end of +the tile to properly hide anything on the tiles behind it. + +The pixel_x and pixel_y values, step_x and +step_y values, and the gliding that happens when moving between +tiles, are based on the width set by world.icon_size. If you set +world.icon_size="64x128" to show tall buildings, only the 64 matters +for pixel offsets. Use pixel_w and pixel_z to adjust the +position of atoms (or the client) horizontally or vertically without respect +to client.dir or the map format. + +Note: Offsets for x and y also affect the layering order used to draw +the icons. Any object with a pixel offset onto another tile is considered +part of whichever tile is closer. + +If you use an icon wider than one tile, the "footprint" of the isometric +icon (the actual map tiles it takes up) will always be a square. That is, if +your normal tile size is 64 and you want to show a 128x128 icon, the icon is +two tiles wide and so it will take up a 2×2-tile area on the map. The +height of a big icon is irrelevant--any excess height beyond width/2 is used +to show vertical features. To draw this icon properly, other tiles on that +same ground will be moved behind it in the drawing order. + +One important warning about using big icons in isometric mode is that you +should only do this with dense atoms. If part of a big mob icon covers the +same tile as a tall building for instance, the tall building is moved back +and it could be partially covered by other turfs that are actually behind it. +A mob walking onto a very large non-dense turf icon would experience similar +irregularities. + +Side-view format + +(See more at Side-view maps.) + +The SIDE_MAP format is like a cross between TOPDOWN_MAP +and ISOMETRIC_MAP. It looks very similar to a top-down view but it is +intended for more of a 3/4 perspective, where tiles lower on the screen are +considered closer to the viewer. Because this impacts the way layers work, +most of the layering behavior is the same as with isometric. + +In a 3/4 perspective the tiles are often foreshortened, so pixel offsets +are adjusted to account for this. For example, you may set +world.icon_size to "32x24", but the tile is considered to be +a perfect square if you look at it from the top down. Because the width is 32 +pixels, the virtual height is also 32, so if you use pixel_y=32 the atom will +appear one tile further back than it normally is. (This adjustment doesn't +affect screen objects or pixel_w/pixel_z.) + +Changing client.dir preserves the same tile size regardless of +orientation. + + + +map_cpu var (world) + +This is the percentage of a server tick that the server spends processing +information about the map to send to players. A value of 0 would indicate very +little cpu usage. A value of 100 would indicate full cpu usage, which means +that the server cannot complete all the necessary computations during a tick to +finish in time for the next tick. In this case, timed events (such as sleep) +may take longer than requested. + + + +maxx var (world) + + +The world map is a three-dimensional block of turfs with coordinates +ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it +provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions +are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with +the default turf and area (world.turf, and world.area). + + + +maxy var (world) + + +The world map is a three-dimensional block of turfs with coordinates +ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it +provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions +are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with +the default turf and area (world.turf, and world.area). + + + +maxz var (world) + + +The world map is a three-dimensional block of turfs with coordinates +ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it +provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions +are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with +the default turf and area (world.turf, and world.area). + + + +mob var (world) + + +When a player connects to the world, the world is searched for a mob with +the player's key. If one is found, the player is connected to that mob. If +none is found, a new mob of type world.mob is created and the player is +connected to this new mob. + +The default value is /mob. Setting world.mob to 0 prevents the creation +of default mobs. + +Example: + +world + mob = /mob/newbie + +mob/newbie + Login() + src << "Welcome, [name]." + ..() + +This example will connect new players to mobs of type /mob/newbie. They +are welcomed when they connect. + + + +movement_mode var (world) + + + +Controls how movement works on the map. + +TILE_MOVEMENT_MODE allows you to easily discard any and all pixel +movement, so if step_x or step_y coordinates or unexpected atom bounds were +loaded from a savefile, for instance, they would be eliminated. If you use any +other movement mode, you can give an atom the +TILE_MOVER flag and it will +behave as if it were in this mode, while other atoms are free to do their own +thing. + +LEGACY_MOVEMENT_MODE exists to distinguish between old and new +movement behavior. In older versions of BYOND before pixel movement, turfs +took their contents into consideration by default in Enter() and Exit(). This +doesn't really make sense for newer games, so in any other movement mode the +turf behavior will ignore its contents. mob.Cross() is also affected, since +it would return 0 by default in legacy mode when both mobs were dense; now +by default it checks mob.group. + + + +name var (world) + +This is the name of the world. + +Example: + +world + name = "The Void" + + + +params var (world) + + +This is a list of parameters passed to the world from the command-line +-params option when the server was started. The parameter text is passed +through params2list() to generate the world.params list. + +Example: + +world/New() + var/p + if(params.len) world.log << "Command-line parameters:" + for(p in params) + world.log << "[p] = [params[p]]" + +This example displays the value of each parameter. + + + +port var (world) + +This is the network port of the world. If the world does not have an +open network port, this is 0. + + + +process var (world) + +This read-only variable indicates the ID of the server's process on the +system running it. The result is a number, unless for some unexpected +reason the number won't fit in a num type, in which case it will +be text. (In practice it should always be a number.) + + + +realtime var (world) + +This is the time (in 1/10 seconds) since 00:00:00 GMT, January 1, 2000 +(also known as the BYOND era). + +Because this is a large number, BYOND's number system isn't capable of +enough precision to deliver the exact number of 1/10 second ticks. It usually +rounds off to the nearest several seconds. For more accurate readings use +world.timeofday. + + + +reachable var (world) + +Returns 1 if the world is currently hosted and the port can be reached by +players (as determined by the BYOND hub), 0 if not. + +If the port is not reachable, there may be a brief period during which the +hub is still attempting to make contact; during that time the port is assumed +to be reachable. Currently, the reachability test times out and fails after +30 seconds. + + + +sleep_offline var (world) + +Setting this to 1 causes the world to be suspended when there are no +players, even if you have sleeping procs waiting to happen. The default +value is 0, which means the server will only sleep if there are no players +and no procs waiting to happen. The main purpose of the variable is to save +the cpu from doing work when there is nobody around to appreciate it. On the +other hand, that doesn't give the poor NPC's a break from the nasty humans. + + + +status var (world) + +This is a short text string used in BYOND hub to describe the state of a +game in progress. For example, you might want to indicate if new players +will be able to actively play, or whether they would have to join as +spectators. + +Example: + +world + status = "accepting players" +mob/verb/start_game() + world.status = "accepting spectators" + //... + + + +system_type var (world) + +This variable indicates the operating system type at run-time. It will be +one of the following constants: + + +MS_WINDOWS +UNIX + + + +tick_lag var (world) + + +This is the smallest unit of time (one server tick) measured in 1/10 +seconds. The duration of events that take some finite amount of time (like +sleep) will be rounded to a whole number of ticks. + +Players are limited to one command (including movements) per server tick, +so this value can be used to adjust the responsiveness of the game. If the +network is too slow to keep up with players, their commands will get queued +up, which can be annoying when trying to move. In this case, tick_lag +should be increased so that the stored up movement commands are discarded. +On the other hand, if you have a very fast network, you may wish to decrease +tick_lag to speed up the response time to player commands. + +Often it is more convenient to set world.fps instead of world.tick_lag, +since fps (frames per second) is an easier way to think of server ticks. +world.tick_lag is 10 / world.fps and vice-versa, so a tick_lag of 0.25 is +equal to 40 fps. + +If you set client.tick_lag or client.fps to a value other than 0, you can +make the client tick at a different (usually faster) rate. + + + +tick_usage var (world) + +This is the approximate percentage of the server tick that has been used +already. A value under 100 means there's time to do more calculations, which +can include any pending procs that are still waiting to run on this tick. +When the value is over 100, the tick is running long and your world will +experience lag. + +Keep in mind that sending maps to clients is the last thing that happens +during a tick, except for handling any events such as player commands that +might arrive before the next tick begins. Therefore in a verb, +tick_usage might have a higher value than you would expect to see in +a proc that loops and sleeps. + + + +time var (world) + +This gives the amount of time (in 1/10 seconds) that the world has been +running. In actual fact, it is the number of server ticks that have passed +multiplied by world.tick_lag. Therefore if the server sleeps (when no +players are connected) this time is not counted. Also, if the server runs +overtime during a tick (because procs take longer than tick_lag to finish) +this still only counts as one tick. This value is therefore a measure of +"game time" rather than real time. + + + +timeofday var (world) + +This is the time (in 1/10 seconds) since 00:00:00 GMT today. It is +basically identical to world.realtime but doesn't include any +information about the date. This is a much smaller number; hence it is more +accurate. + + + +timezone var (world) + +This is the time offset from UTC, in hours, for the world's time zone. It +can be used in the time2text() proc, although it is the default time +zone for that proc. + + + +turf var (world) + +This is the default turf type to be placed on the map wherever no turf is +specified. A value of 0 turns off the default turf. + + + +url var (world) + +This is the full network address of the world. (For example, +byond://dan.byond.com:6005.) + + + +version var (world) + + +If you are distributing your game to players, you can use this variable +to automatically notify them of new releases. To do so, you will first need +to set world.hub to the hub +path of your game. You can then advertise the current version by +configuring that value in your +hub console. + +When players boot up an outdated version of your game (as indicated by +comparing world.version with the version advertised by BYOND +hub), they will be notified of the new release. + + + +view var (world) + + + +This is the default map viewport range. The default value of 5 produces an +11x11 viewport. A value of -1 turns off the map display altogether. The client may automatically +scale down icons in order to conveniently fit the map on the player's screen. + +For non-square views, you can assign this to a text string of the form +"WIDTHxHEIGHT". For example, "11x11" is equivalent to a view depth of 5, but +you could make it wider like this: "13x11". + +This setting also affects the default range of the view(), +oview(), range(), and orange() +procedures. + +If the entire map is small enough to fit on one screen +(arbitrarily defined to be 21x21 or less), +the default view is automatically adjusted to fit the map. In +this case, client.lazy_eye is also automatically turned on by +default, since you probably don't want the map to scroll around. + + + +visibility var (world) + + +This controls whether the world advertises itself in the +BYOND Hub when it has an open network +port for accepting players. The visibility of the world still depends on +whether any of the connected players has their location reporter turned on, +and that in turn relies on the pager being turned on. + + + +Special notes +This section of the reference should help explain some concepts that +may be harder to understand or that can use more clarification. + + + + +BACKGROUND_LAYER + +This is mostly no longer needed. A negative value for plane is the +preferred way to do show objects in the background. It can still be used +however when you want to rearrange objects in the same plane when using +PLANE_MASTER for visual +effects. + +BACKGROUND_LAYER is a special high value that can be added to the +regular layer of any atom. + +The purpose of this value is to make an atom appear below any regular +atoms, even if they share the same plane. In an isometric map for instance, +HUD objects will always appear above the map, but makeing a HUD object appear +behind the map was basically impossible without this feature until +plane was implemented. + +When using this special layer, it should be added to the layer an atom +normally uses. For instance an obj should have a layer of BACKGROUND_LAYER ++ OBJ_LAYER. + +This can be mixed with TOPDOWN_LAYER and EFFECTS_LAYER, +but it will take precedence over both. Anything with BACKGROUND_LAYER +will always appear below anything without it on the same plane. + +Images or overlays with FLOAT_LAYER can be left alone. They will +automatically have the same layer as whatever atom they are attached to. + + + +Big icons + +BYOND allows you to use icons that are not the same size as the tile size +defined in world.icon_size. These icons can be manipulated with the /icon datum +using their raw, native size, and shown on the map in full size. To use the old +behavior where an atom can display only an icon of the normal tile size, use +the TILED_ICON_MAP value for map_format instead. + +When you use an icon of non-standard size on an atom, the icon is "anchored" +to the southwest corner of the atom. If you are using a top-down view +(world.map_format=TOPDOWN_MAP), the icon will appear to spread out further to +the east and north. In an isometric map (world.map_format=ISOMETRIC_MAP), the +icon will cover additional tiles north and east as well. The "footprint" of an +isometric icon--the actual map tiles it covers--is always square, so if your +tile size is 64x64 and you use a 128x64 icon, the 128-pixel width means the +icon will cover a 2x2 section of map tiles. + +It is important to remember that using a big icon is a visual effect +only. It will not affect how the atom bumps into other atoms or +vice-versa. + +Big icons will affect layering--the order in which icons are drawn. In +general, because a big icon is covering more than one tile of the map, it will +try to draw above any other tiles in that space that are on the same layer. +This way, you can set a turf to use a big icon without having to change the +turfs to the north and east. If an atom has a big icon, any overlays and +underlays attached to it will be pulled forward as well, so they will draw in +front of anything on their same layer. In isometric mode this is about the same, +except that the layer isn't that important--anything in the way will just be +moved back behind the big icon. + +Note: Big overlays will not "pull forward" on their own. If the main atom +uses a single-tile icon, a big overlay attached to it will not try to draw in +front of other icons on the same layer. This is so that name labels, health +bar overlays, etc. will not cause any odd behavior. To be safe, you should +always specify a layer when adding an overlay. + +In isometric mode, layering is affected by the "distance" between the atom +and the viewer, so putting a regular-sized icon and part of a big icon on the +same tile could cause layering oddities. Tiles that are covered by a big icon +will tend to be drawn behind the big icon as mentioned above. For this reason, +any atoms whose icons cover more than one tile (the extra height of an +isometric icon doesn't count) should always be dense, and you should block +movement onto any tile covered by them. + +When manipulating icons with the /icon datum, you can still use Blend() to +combine icons of different sizes. By default, the icons will be lined up at +their southwest corners. You can change the position at which the second icon +is blended. + + + +Color gradient + +A color gradient is a special list that defines a range of colors that you +can smoothly interpolate between. A simple example is a gradient from red to +white: + +Example: + +list("red", "white") +// OR +list(0, "red", 1, "white") + +Applying a number like 0.2 to this gradient would give you a color that's +20% of the way from red to white. More complex gradients however are also +possible. + +The format of a gradient is a list that contains a number (the position +along the gradient, from 0 to 1 unless you use values outside that range) +followed by a color. You can have as complex a gradient as you like. If you +reuse the same number twice in a row, the gradient will have a sudden color +change at that point. + +It is also possible to skip numbers or colors, and they will be filled in +automatically with the previous number or color. The exceptions are at the +beginning and ends of the list; at the end of the gradient, the last color is +assigned a number 1 by default, and the first is assigned 0. If you skip +colors at the beginning, they will be filled in with the first color you use. + +Include "loop" anywhere in the list to make this a looped gradient. If you +don't, any numbers outside the gradient's range will be clamped to that range. +E.g., in a normal gradient ranging from 0 to 1, a number of 1.2 is +interpreted as 1 without a loop and 0.2 with a loop. + +Here are some more examples: + +Example: + +// color wheel; ranges 0 to 6 and loops +list(0, "#f00", 1, "#ff0", 2, "#0f0", 3, "#0ff", 4, "#00f", 5, "#f0f", 6, "#f00", "loop") + +// 10% each red, yellow, green, blue, with a 20% transition zone between each +// notice no color follows 0.4 or 0.7, so the previous color is used +list(0.1, "#f00", 0.3, "#ff0", 0.4, 0.6, "#008000", 0.7, 0.9, "#00f") + +// green and black stripes +list(0.5, "#008000", 0.5, "#000000", "loop") + +You can also include "space" in the list, and give it an associated value +that describes the color space this gradient uses to interpolate between +colors. For instance, "space"=COLORSPACE_HSL will use HSL +interpolation instead of the default RGB. See +Color space for more information. + +Example: + +// color wheel with a different color space +list(0, "#f00", 3, "#0ff", 6, "#f00", "loop", "space"=COLORSPACE_HSLA) + +Currently, color gradients are only used by particle effects and the +gradient proc. With particles, if you use +a gradient the particle's color is given as a number, and that number is used +to look up its real color from the gradient. The number can change over time, +thus changing the particle's color. + + + +Color matrix + +A color matrix is used to transform colors, in the same way that a matrix +represented by the /matrix datum is used to transform 2D coordinates. +A transformation matrix is 3x3, of which only 6 values are needed because the +last column is always the same. A color matrix, because it transforms four +different numbers instead of two, is 5x5. + + + |rr rg rb ra 0| + |gr gg gb ga 0| +[r g b a 255] x |br bg bb ba 0| = [r' g' b' a' 255] + |ar ag ab aa 0| + |cr cg cb ca 1| + +In that formula, values like rg mean "red to green", meaning +that's the ratio of red in of green out. (The "c" is for "constant".) In +an identity matrix, which just produces the original color, the values +rr, gg, bb, and aa are all 1 and +everything else is 0. + +In easier-to-understand terms, this is how the result is calculated: + + +new_red = red * rr + green * gr + blue * br + alpha * ar + 255 * cr +new_green = red * rg + green * gg + blue * bg + alpha * ag + 255 * cg +new_blue = red * rb + green * gb + blue * bb + alpha * ab + 255 * cb +new_alpha = red * ra + green * ga + blue * ba + alpha * aa + 255 * ca + +It is helpful to think of each row in the matrix as what each component of +the original color will become. The first row of the matrix is the rgba value +you'll get for each unit of red; the second is what each green becomes, and so +on. + +Because the fifth column of the matrix is always the same, only 20 of the +values need to be provided. You can use a color matrix with atom.color or +client.color in any of the following ways: + + +Reading a color var that has been set to a matrix will return the full +20-item list, where every 4 items represent a row in the matrix (without the +fifth column). + +In the MapColors() icon proc, the values are sent as arguments, +not as a list. + +Other color spaces +The color filter allows the use of +other color spaces for a matrix. In those other color spaces, the matrix +calculations work the same but instead of red, green, and blue, they'll be +whatever values that color space uses. For instance an HSL color matrix uses +hue in place of red, saturation in place of green, and luminance in place of +blue. (Alpha is always alpha.) + +The way that works internally is that the shader will convert a color from +RGB to the color space used by the matrix, then apply the matrix, then convert +back to RGB. + + + +EFFECTS_LAYER + +This is mostly no longer needed. A negative value for plane is the +preferred way to do show objects in the background. It can still be used +however when you want to rearrange objects in the same plane when using +PLANE_MASTER for visual +effects. + +EFFECTS_LAYER is a special high value that can be added to the +regular layer of any atom. + +The purpose of this value is to make an atom appear above any regular +atoms. For instance, in an isometric map if you want to display a character's +name below them, it does not make much sense to have nearer objects cover up +that name, so you can tell the name overlay to use EFFECTS_LAYER + +MOB_LAYER and it will show up on top of all the normal icons on the map. +This has been somewhat obviated by plane but may still be useful in +some cases. + +When using this special layer, it should be added to the layer an atom +normally uses. For instance an obj should have a layer of EFFECTS_LAYER + +OBJ_LAYER. + +This can be mixed with TOPDOWN_LAYER, in non-topdown map formats. +Anything in TOPDOWN_LAYER will display on top of +EFFECTS_LAYER, and TOPDOWN_LAYER + EFFECTS_LAYER will be +above both. + +This can also be mixed with BACKGROUND_LAYER, which takes priority +over everything else. + +Images or overlays with FLOAT_LAYER can be left alone. They will +automatically have the same layer as whatever atom they are attached to. + + + +Filter effects + +Filters are a way of adding special effects to an icon, or a group of icons +(see KEEP_TOGETHER in +appearance_flags), by +post-processing the image. A filter object describes a specific form of image +processing, like for instance a blur or a drop shadow. Filters can be added or +removed at will, and can even be animated. + +A filter is created by using the filter proc like +so: + + +// halo effect +mob.filters += filter(type="drop_shadow", x=0, y=0,\ + size=5, offset=2, color=rgb(255,255,170)) + +These are the filters currently supported: + + +Alpha mask +Angular blur +Bloom +Color matrix +Displacement map +Drop shadow +Gaussian blur +Layering (composite) +Motion blur +Outline +Radial blur +Rays +Ripple +Wave + + + +Alpha mask filter + + + +Uses an icon or render target as a mask over this image. Every pixel that +is transparent in either the image or the mask, is transparent in the result. + +The x and y values can move the mask from its normal +position. By default, the mask is centered over the center of the image. + +The MASK_INVERSE flag will invert the alpha mask so that opaque +areas in the mask become transparent, and vice-versa. There is also a +MASK_SWAP flag which treats the source image as the mask and +vice-versa, which might be useful for some effects. + +Note: Unlike many other filters, this filter is taken into account +for mouse-hit purposes. + + + +Angular blur filter + + + +Blurs the image by a certain amount in a circular formation, as if the +image is spinning. The size of the blur can roughly be thought of in "degrees" +worth of blur. As the distance from the center increases, the blur becomes +more noticeable since the same amount of angular motion has to travel farther +along a circle. + +Typically this blur is used with an entire plane, but it could be used to +give a sense of motion blur to a spinning object. + +Note: Large blurs will look worse toward the edges due to limited sampling. +Loss of accuracy will appear where size × distance is greater +than about 300. You can increase accuracy by breaking up large sizes into +multiple filter passes with differing sizes. The blur used is Gaussian, so +combining blur sizes A and B will give a total size of +sqrt(A2+B2). + +The offset parameter, if used, is effectively subtracted from the +pixel distance to the center. Pixels within that radius won't blur. Anything +outside that radius will act as if it's offset pixels closer to the +center. + + + +Bloom filter + + + +Post-processing effect that makes bright colors look like they're a strong +light source, spreading their light additively to other nearby pixels. This is +a complex effect that involves multiple shader passes. For both performance and +visual reasons, it is usually best applied to an entire plane rather than to +individual objects. + +The color threshold determines which pixels this effect applies to. +If any of the red, green, or blue components of the pixel are greater than the +same component for the threshold, that pixel will bloom. The blooming pixels +then have their colors spread outward to create a glow that gets added to the +original image. + +The offset and size parameters are used to control the +glow effect. They work the same as they do in the drop shadow filter: +offset causes the light to grow outwards, and a blur of size +is then applied to soften it. Often just using a blur alone will produce a +pleasing effect. By playing with these two values you can make the bloom effect +appear differently. + +The alpha value is applied to any light contributions from bloomed +pixels that get added to the original image, so values lower than 255 can make +the effect less pronounced. This can be very useful if you choose to animate +the filter. + + + +Gaussian blur filter + + + +Blurs the image by a certain amount. The size of the blur can roughly be +thought of in "pixels" worth of blur. + +Note: Large blurs will result in reduced performance. The +highest size that can be handled easily in this filter is 6. Higher sizes +require multiple passes, although the filter will "cheat" and use low-quality +passes for much higher sizes. + + + +Color matrix filter + + + +Applies a color matrix to this image. Unlike with the atom.color var, you +can apply color conversions other than the regular RGBA color space, depending +on the value of space. See Color +space for more information. + + + +Displacement map filter + + + +Uses an icon or render target as a template for various warping effects on +the main image. Think of displacement as "pulling" a pixel from an offset +location. + +In the displacement map, pixels that have a higher red component will make +the image appear to warp to the left, lower reds warp it to the right, and +gray (r=128) will cause no horizontal warping. The green component affects the +vertical: higher to warp upward, lower to warp downward. Transparent pixels in +the displacement map will have no effect. + +This can be used for very complex distortion, unlike other distortion +filters such as wave and ripple that are confined to specific equations. + +The optional FILTER_OVERLAY flag is supported for the +flags argument, which will overlay the displaced image onto the +original. + + + +Drop shadow filter + + + +Applies a drop shadow to this image. This is a combination of multiple +filters, since it will apply an outline if offset is included, a +Gaussian blur to the shadow, and will underlay the shadow beneath the image. + +You can also think of this filter as an outer glow. + +If you use a size less than 0, the shadow will appear inside the +image instead. This would be an inset shadow, or inner glow. + + + +Layering (composite) filter + + + +Composites another image over or under this image. Using the +FILTER_OVERLAY flag, which is the default, puts the second image +on top of what's already here. FILTER_UNDERLAY puts it underneath. + +The x and y values can move the mask from its normal +position. By default, the second image is centered over the center of the +first. + +The color, transform, and blend_mode vars are +available for convenience. Because the bottom image is drawn over a blank +background, blend_mode is always applied to the top image. All of +the other vars apply to the second image being drawn. + +Note: Transforms use default bilinear scaling, since +PIXEL_SCALE is not +available here. +Note: Like most other filters, this filter is not taken into account +for mouse-hit purposes. Any layered icons will be strictly visual. + + + +Motion blur filter + + + +Applies Gaussian blur in one direction only. The amount and direction are +both specified by x and y. The size of the blur is equal to +sqrt(x*x + y*y). + +See Gaussian blur for more information. + + + +Outline filter + + + +Applies an outline to this image. + +At larger sizes, the outline is less accurate and will take more passes to +produce. Performance and appearance are best at sizes close to 1 or less. + +flags can be a combination of the following values: + + + +Radial blur filter + + + +Blurs the image by a certain amount outward from the center, as if the +image is zooming in or out. As the distance from the center increases, the +amount of blurring increases, and near the center the blur is hardly visible +at all. The size value is smaller by default for this filter than it +is for other filters, since it's typically used with an entire plane where the +distance from the center can easily be several hundred pixels. + +Typically this blur is used with an entire plane. + +Note: Large blurs will look worse toward the edges due to limited sampling. +Loss of accuracy will begin when size × distance is greather +than 6. You can increase accuracy by breaking up large sizes into multiple +filter passes. The blur used is Gaussian, so combining blur sizes A and B will +give a total size of sqrt(A2+B2). + +The offset parameter, if used, is effectively subtracted from the +pixel distance to the center. Pixels within that radius won't blur. Anything +outside that radius will act as if it's offset pixels closer to the +center. + + + +Rays filter + + +Draws random rays that radiate outward from a center point. (That point may +be outside of the image.) As they move outward, their alpha value diminishes +linearly. These are meant to be animated. The offset value determines +the "time", where every jump of +1 can be a very different set of rays, and +every 1000 units this filter will repeat. + +The threshold value can be thought of as a way of culling +lower-strength rays. Ray strength is anywhere from 0 to 1 at any given angle, +but values below threshold may as well be 0. Values above that are +re-scaled into a range of 0 to 1. + +The factor parameter allows you to tie the ray's length to its +strength. At 0, the length of every ray is the same. At 1, the length ranges +from 0 to size. Generally speaking, the higher factor is, +the more the rays will appear to move outward as they strengthen and inward +as they weaken. + +Ray color can be provided as a matrix. Only the diagonal values of the +color matrix will be used, but using a matrix will allow you to set values +outside of the normal color range. + +flags can have the following values: + + + +Ripple filter + + + +Applies a ripple distortion effect to this image. + +This filter is meant to be animated. A good animation will typically start +at a radius of 0 and animate to a larger value, with size +decreasing to 0. + +The falloff parameter can be tweaked to your liking. A value of 1 +should look reasonably like ripples in water, with the inner ripples losing +strength. A value of 0 will cause no reduction in strength. + +The equation governing the ripple distortion is size × sin(2πr') ÷ (2.5 × falloff × r'2 + 1), +where r' = (radius - distance) ÷ repeat. + +Up to 10 ripples can be stacked together in a single pass of the filter, as +long as they have the same repeat, falloff, and +flags values. (See the wave filter for the WAVE_BOUNDED flag.) + + + +Wave filter + + + +Applies a wave distortion effect to this image. + +The x and y parameters specify both the direction and +period of the wave; the period is sqrt(x*x + y*y). + +This filter is meant to be animated, from whatever offset you want +to offset+1, and then repeating. With multiple waves, you can produce +a very convincing water effect. + +Example + +#define WAVE_COUNT 7 +atom/proc/WaterEffect() + var/start = filters.len + var/X,Y,rsq,i,f + for(i=1, i<=WAVE_COUNT, ++i) + // choose a wave with a random direction and a period between 10 and 30 pixels + do + X = 60*rand() - 30 + Y = 60*rand() - 30 + rsq = X*X + Y*Y + while(rsq<100 || rsq>900) // keep trying if we don't like the numbers + // keep distortion (size) small, from 0.5 to 3 pixels + // choose a random phase (offset) + filters += filter(type="wave", x=X, y=Y, size=rand()*2.5+0.5, offset=rand()) + for(i=1, i<=WAVE_COUNT, ++i) + // animate phase of each wave from its original phase to phase-1 and then reset; + // this moves the wave forward in the X,Y direction + f = filters[start+i] + animate(f, offset=f:offset, time=0, loop=-1, flags=ANIMATION_PARALLEL) + animate(offset=f:offset-1, time=rand()*20+10) + +The equation governing the wave distortion is size × sin(2π(d - offset)), +where d is the number of wave periods' distance from the center along the x, y +direction. + +The WAVE_SIDEWAYS flag will cause the distortion to be transverse +(perpendicular) to the wave instead of in the same direction as the wave. The +WAVE_BOUNDED flag limits the distortion to the confines of this image, +instead of lettings its pixels spill out a little further from the distortion +(and likewise, transparent pixels spill inward). + +Up to 10 waves can be stacked together in a single pass of the filter, as long as they +have the same WAVE_BOUNDED flags. + + + +Generators + +A generator is an object that can produce a random number, vector (list of 3 numbers), color (as a text string), or color matrix (list of 20 numbers) in a specified range according to rules you set down. It is used primarily for particle effects, since it can run on the client. + +There are several types of generators: + + +Numbers: Generate a random real number. +Vectors: Generate a random vector. +Shapes: Generate a random vector within a specific shaped region. +Colors: Generate a random color or color matrix. + +Generators can also be chained together with math operators and some procs. The second value can be a regular value instead of a generator, so for instance you can multiply a vector by 2, or by a matrix to transform it. + + +OperatorsAction ++ - * /Arithmetic operators. You can multiply a 3D vector by a color matrix (where red,green,blue in the matrix correspond to x,y,z) to do a 3D transform, or by a 2D matrix for a 2D transform. +- (unary)Negate the value, same as multiplying by -1. +turn(), generator.Turn()Rotate a vector clockwise in the XY plane. + + + +Gliding + +Gliding is a "glitz" effect applied by BYOND to cover up the visual sins +of tile-based movement, by making objects and the map appear to move smoothly +from one tile to another instead of immediately jumping. It is also available to +smooth over small jumps in pixel movement that might occur, for instance if the +client FPS is set higher than the server's. + +To control the gliding speed of an atom, set glide_size to the +value of your choice. If this is not set, the client will attempt to adjust +the speed manually. glide_size is measured in server ticks, so +if client.fps is set to a value greater than world.fps, +it will be scaled appropriately. + +Whether an object glides or jumps is based on how far it moves relative to +its step_size value, which by default is a full tile width. If the +movement goes too far past step_size in the X or Y directions, it's +no longer a glide. + +The animate_movement var can be used to control the way in which +an object glides, or suppress gliding altogether. + +By using the LONG_GLIDE flag in appearance_flags, a +diagonal glide will take just as long as a cardinal-direction glide by moving +a fullt glide_size pixels in the dominant X or Y direction. +Otherwise, gliding tries to move by that many pixels in strict Euclidean +distance (a straight line) and diagonal glides take longer. + +In LEGACY_MOVEMENT_MODE, +gliding is turned off if you set any of the bound or step vars for an atom to +a non-default value. The only gliding that occurs in this case is when +client.fps is higher than world.fps. All other movement modes base gliding on +an atom's glide_size value. + + + +HUD / screen objects + +HUD stands for Heads-Up Display, and refers to any atoms that appear on +the screen but don't move when the player moves. These are also called screen +objects. Any movable atom can be added to the HUD by setting its +screen_loc var, and adding it to client.screen for each user +who is supposed to see it. This can be used to display a character's vital +stats, scores, etc. + +If you want to have something like a health meter or name attached to a +moving atom, use overlays or /image objects instead. An +/image object is similar to a screen object in that it can be shown +to only certain players instead of being shown to everyone. + +The size of the screen depends on client.view (or +world.view), world.map_format, and world.icon_size. +In a normal topdown map format, client.view is the same as the screen +size; in other map formats the screen might be a different size. + +The screen_loc var can be set to a value like "1,1" (the +southwest tile of the screen), "4,NORTH" (fourth tile from the west, +along the north side of the screen), "SOUTHEAST", and so on. You can +also include pixel offsets, percentages, and specify two corners to tile an +icon repeatedly from one end to the other. See +screen_loc for more +details. + +screen_loc can also be used to stretch the bounds of the HUD. A +value of "0,0" will cause the atom to appear to the southwest of the +southwest-most tile on the visible map, outside of the regular map bounds. +Using HUDs in this way, you can provide a nice decorative "frame" for your map. + +More complex + +You can use HUDs in other map controls as well, by preceding screen_loc with +the name of the map you will use followed by a colon. For instance, +screen_loc="map2:1,1" will show an icon in the southwest corner of the +map2 control. The actual size of a secondary HUD is based on how far +out the icons in it extend in any direction. If you have one icon at +"map2:1,1" and another at "map2:4,3", then that HUD will be +four tiles wide and three high. + + + +Isometric maps + + + + +Isometric projection is a form of pseudo-3D in which the 2D icons used by +BYOND can be arranged in a way to give the appearance of three dimensions. If +you look at a map top-down, each tile on the map is a square. The map is +rotated 45° clockwise and then tilted at an angle (30°) so that each +square now looks like a foreshortened diamond from the viewer's perspective. +What was once north now points to the northeast end of the viewer's screen; +what was once east now points southeast to the viewer. Tiles that are more to +the south or east are "nearer" to the viewer, and tiles that are north or west +are "farther". The actual direction the map faces can be changed by using +client.dir. + +It is important to remember that this is an illusion of 3D, not real 3D. + +To use isometric mapping, set world.map_format to +ISOMETRIC_MAP. You should set world.icon_size so the tile +width is a multiple of 4 pixels. The width of the tile is highly important. +The height of your tiles should be at least half that value. BYOND uses a 2:1 +isometric format, meaning that the diamond base of each tile is half as high +as its width. For example if you have a 64x64 tile size, every diamond in the +map will be 64 pixels wide by 32 high, and you have an extra 32 pixels at the +top of your icon for vertical projections like buildings. If you set the tile +size to 64x80, the base is still a 64x32 diamond and you have 48 pixels left +over for vertical structures. + +In this mode pixel_x and pixel_y will offset icons along the +"ground". To adjust horizontal and vertical positions, use the pixel_w +and pixel_z vars. + +Layers +The layer var behaves differently in isometric mode. Because some +tiles are nearer to the viewer than others, the tiles that are farther back +need to be drawn first so they are behind any tiles that should go in front of +them. So in isometric mode, the back row of tiles (a diagonal line of them) is +drawn first, followed by the next row forward, and so on. The layer +var only matters when icons overlap each other in the "physical" space, like +an obj sitting on a turf. + +When pixel or step offsets, or gliding, place an object on multiple turfs, +it is drawn on top of the nearer turf (assuming its layer is higher). + +Using icons wider than the regular tile size can have an impact on layering +as well. See Big icons for more information. + +Because of the order in which icons are drawn, you may want to limit the +ability of an atom to cut diagonally around corners. While moving northeast +behind a dense wall, for instance, a mob might temporarily appear in front of +the wall because its pixel offsets (from gliding) temporarily put it on the +same tile as the wall. If you do not want to limit corner-cutting, a simple +workaround for this case is to give the wall a higher layer than the mob. + +Screen objects (in client.screen) are always drawn on top of all +isometric tiles, as is the case in other map modes as well. + +Since it may be desirable in some games to use a topdown map for some +situations (like a special battle map), you can add TOPDOWN_LAYER to +any atom's layer—e.g., TOPDOWN_LAYER+TURF_LAYER—to make +it appear in topdown mode. Topdown and isometric tiles really aren't meant to +be mixed, but if they do mix you'll see topdown tiles always display above +isometric tiles, just like screen objects do. The best way to use this is to +apply TOPDOWN_LAYER to every tile in a certain part of the map that +the players can't walk to. + +If you want to use an overlay that should not be covered by other "nearer" +icons on the map, such as a name or health meter, you can add +EFFECTS_LAYER to the overlay's layer. Icons with +EFFECTS_LAYER will draw above regular icons. Then objects with +TOPDOWN_LAYER will draw on top of everything else. However, be aware +that EFFECTS_LAYER has largely been superseded by the plane +var. + +Screen size +In this mode, world.view or client.view is used to define +the minimum number of map tiles you will see, not the screen/HUD size +which is calculated from client.view. Extra map tiles are shown to fill out +the screen size. HUD objects use screen coordinates, so 1,1 is still the lower +left. + +The actual HUD size is always a full number of tiles, whose size is defined +by world.icon_size. If you have a tile size of 64x64, and +world.view=6 (a 13x13 map), a full 13x13 diamond of map tiles will be +shown. The width of this diamond is 13 tiles. The height is only half that, +plus whatever vertical space is needed to show the icons in that area. Then +everything is rounded up to a full tile size, so the result is a 13x7-tile +screen. This is the formula you need if you want to calculate the screen size: + + +pixel_width = round(icon_width * (view_width + view_height) / 2) +pixel_height = round(icon_width * (view_width + view_height - 2) / 4) + icon_height + +screen_width = round((pixel_width + icon_width - 1) / icon_width) +screen_height = round((pixel_height + icon_height - 1) / icon_height) + +If you use TOPDOWN_LAYER, any topdown sections of the map will be +limited to this same view. + + + +Numbers +In DM, all numbers are stored in floating point format. Specifically, +single-precision (32-bit) floating point. This is important to know if you +think you will be working with large numbers or decimal values a lot, because +the accuracy of the numbers is limited. + +32-bit floating point numbers can represent integers from -16777216 +to 16777216 (224). Non-integer values can get about as small as +2-126 and as large as 2127. + +Floating point numbers do not handle most decimal values precisely. For +instance, 0.1 is not exactly 0.1, because floating point numbers are stored +in a binary format and in binary, 1/10 is a fraction that repeats +forever—the same way 1/3 repeats as 0.33333... in decimal numbers. It +ends up being rounded off, either a little higher or a littler lower than +its true value. This means that the following loop won't work like you might +expect: + +Example: + +for(i = 0, i < 100, i += 0.1) + world << i + +You might expect that code to loop exactly 1000 times, with i +going from 0 up to 99.9 before stopping. The truth is more complicated, +because 0.1 stored in floating point is actually greater than the exact value +of 0.1. Other values might be more or less than their exact numbers, and as +you add these numbers together repeatedly you'll introduce more and more +rounding error. + +Even more insidious, if you add 0.1 a bunch of times starting from 0, and +then subtract it out again the same number of times, the result you get may +not be 0. This is counterintuitive, because you might expect rounding errors +to reverse themselves in the same order they crept in. Unfortunately it +doesn't work that way. + +You can correct for rounding error somewhat by using the +round proc to adjust the loop var each time, +although for performance reasons it might be preferable to find another +alternative. + + +for(i = 0, i < 100, i = round(i + 0.1, 0.1)) + world << i + +Only fractions whose denominators are powers of 2 are immune to this +rounding error, so 0.5 is in fact stored as an exact value. + +Another place floating point may lose accuracy is when you try to add +numbers of very different sizes. For instance as stated above, the upper +limit for accurate integers is 16777216. If you try to use a number such +as 100 million it will only be approximate, so adding 1 to that number +won't actually change it because the 1 is so much smaller, it will be +gobbled up by rounding error. + +Also for the same reasons stated above, division will cost you +accuracy. Again you can divide by powers of 2 easily enough, and you can +divide an integer by any of its factors (like dividing 9 by 3) without a +problem, but a fraction like 1/3 will repeat forever so it gets rounded +to as much precision as floating point can manage. + +In decimal, floating point numbers have at least six decimal digits of +precision. Since they're actually stored in binary, their true precision +is exactly 24 bits. + + + +Particle effects + +A particle set is a special effect, whose computations are handled entirely +on the client, that spawns and tracks multiple pixels or icons with a +temporary lifespan. Examples of this might be confetti, sparks, rocket +exhaust, or rain or snow. Particles are rendered on a special surface and that +gets attached to an obj or a mob like an overlay. + +Particles can exist in 3 dimensions instead of the usual 2, so a particle's +position, velocity, and other values may have a z coordinate. To make use of +this z coordinate, you can use a projection +matrix. (The value of the z coordinate must be between -100 and +100 after projection. Otherwise it's not guaranteed the particle will be +displayed.) + +To create a particle set, use new to create a new +/particles datum, and then you can set the datum's vars. The vars can +be set to constant values, or generator functions that will allow the client +to choose from a range of values when spawning those particles. (The easiest +way to handle this is to create your own type that inherits from +/particles, and set up the parameters you'll want at compile-time.) + +After the datum is created, it can be assigned to an obj or mob using their +particles var. The particles will appear on the map wherever that obj +or mob appears. + +Example: + +particles/snow + width = 500 // 500 x 500 image to cover a moderately sized map + height = 500 + count = 2500 // 2500 particles + spawning = 12 // 12 new particles per 0.1s + bound1 = vector(-1000, -300, -1000) // end particles at Y=-300 + lifespan = 600 // live for 60s max + fade = 50 // fade out over the last 5s if still on screen + // spawn within a certain x,y,z space + position = generator("box", vector(-300,250,0), vector(300,300,50)) + // control how the snow falls + gravity = vector(0, -1) + friction = 0.3 // shed 30% of velocity and drift every 0.1s + drift = generator("sphere", 0, 2) +obj/snow + screen_loc = "CENTER" + particles = new/particles/snow + +mob + proc/CreateSnow() + client?.screen += new/obj/snow + +These are the vars that can be used in a particle set. "Tick" refers to a +BYOND standard tick of 0.1s. + + +Particle vars that affect the entire set (generators are not allowed for these) +VarTypeDescription +widthnumSize of particle image in pixels +height +countnumMaximum particle count +spawningnumNumber of particles to spawn per tick (can be fractional) +bound1vectorMinimum particle position in x,y,z space; defaults to list(-1000,-1000,-1000) +bound2vectorMaximum particle position in x,y,z space; defaults to list(1000,1000,1000) +gravityvectorConstant acceleration applied to all particles in this set (pixels per squared tick) +gradientcolor gradientColor gradient used, if any +transformmatrixTransform done to all particles, if any (can be higher than 2D) +Vars that apply when a particle spawns +lifespannumMaximum life of the particle, in ticks +fadenumFade-out time at end of lifespan, in ticks +fadeinnumFade-in time, in ticks +iconiconIcon to use, if any; no icon means this particle will be a dotCan be assigned a weighted list of icon files, to choose an icon at random +icon_statetextIcon state to use, if anyCan be assigned a weighted list of strings, to choose an icon at random +colornum or colorParticle color (not a color matrix); can be a number if a gradient is used +color_changenumColor change per tick; only applies if gradient is used +positionnumx,y,z position, from center in pixels +velocitynumx,y,z velocity, in pixels +scalevector (2D)Scale applied to icon, if used; defaults to list(1,1) +grownumChange in scale per tick; defaults to list(0,0) +rotationnumAngle of rotation (clockwise); applies only if using an icon +spinnumChange in rotation per tick +frictionnumAmount of velocity to shed (0 to 1) per tick, also applied to acceleration from drift +Vars that are evalulated every tick +driftvectorAdded acceleration every tick; e.g. a circle or sphere generator can be applied to produce snow or ember effects + +The icon and icon_state values are special in that they can't be assigned a generator, but they can be assigned a constant icon or string, respectively, or a list of possible values to choose from like so: + +icon = list('confetti.dmi'=5, 'coin.dmi'=1) +The list used can either be a simple list, or it can contain weights as shown above. + +Changing a var on a particle datum will make changes to future particles. +For instance, you can set the datum's spawning var to 0 to make it +stop creating new particles. (Note: If you are changing a vector or color +matrix, such as gravity, you need to assign a new value. You can't +for instance set particles.gravity[2] = 0 because it won't do +anything to update the particle stream.) + +The same particle datum can be assigned to more than one movable atom. +However the particles displayed by each atom will be different. + +The .add-particles command +If you want to spawn particles at specific times, you can use the client +.add-particles command. +From the server, you can run this command via +winset(). + +Example: + +// spawn 100 particles for src's particle set right now +winset(player, null, list(command=".add-particles \ref[src] 100")) + + + +Pixel movement + +Pixel movement is a concept that allows atoms to escape the constraints of +BYOND's historically tile-based movement, and move in smaller steps. In the +past this had to be done with soft code, but that was sometimes inconvenient +and it did not perform as well in projects with many objects moving. + +The key to understanding pixel movement is to use the bound and step vars. +You use the bound family of vars to define a bounding box for a movable atom, +instead of just making it one full tile in size. The step vars can give it a +movement speed and offset it from the corner of the tile it's standing on. + +bound_x: The left edge of the bounding box +bound_y: The bottom edge of the bounding box +bound_width: Width of the bounding box +bound_height: Height of the bounding box +step_size: default movement speed +step_x: x offset from the corner of loc +step_y: y offset from the corner of loc +Those are for movable atoms only; they do not apply to turfs. + +If world.movement_mode +is set to TILED_MOVEMENT_MODE, all movable atoms must be aligned +to the tile grid: their step_x/y/size values must be multiples of the icon +size, and their bounds must also land on tile boundaries although the atom +can be bigger than one tile. In other movement modes you can specify that +only specific atoms use this behavior, by giving them the +TILE_MOVER appearance +flag. + +Bounding boxes + + +Left: The bounding box (blue) is the only part of the mob that actually collides with anything. By default, it would cover the whole turf (brown). Any turfs covered by the bounding box are in the mob's locs var. Right: The atom's true position (shaded) is offset from the turf by step_x and step_y. + +As an example, if your players' mobs have icons that only cover the center +24×24 pixels of a regular 32×32 icon, then you would set the +mobs' bound_x and bound_y to 4--because there are 4 pixels unused to the left +and bottom--and bound_width and bound_height to 24. + +The mob's physical location on the map depends on four things: Its loc, +its step_x/y values, its bound_x/y values, and its bound_width/height. The +lower left corner of the bounding box, relative to the turf the mob is +actually standing on, begins at step_x+bound_x on the left and step_y+bound_y +on the bottom. + +The physical position of the bounding box is not affected by the +pixel_x/y/z vars. Those are still strictly visual offsets. + +The turfs the mob is covering can be read from the read-only locs var. The +mob will also appear in the contents of those turfs. + +Note: This means if an atom is in a turf's contents, its loc is not +necessarily that turf. The contents list is made to include "overhangers" +from another tile for ease of use. + +Movement +All of the step and walk procs have been upgraded to take an additional +argument, which is the speed at which the atom should move. If that argument +is left out, the atom's own step_size is used by default. The step_size +determines how fast the step_x and step_y values will change when moving. + +Move() has two new arguments that handle the position change gracefully. +These are the step_x and step_y values for the target location. + +Pixel movement changes the behavior of the Move() proc, because a lot of +things are possible that were not possible when BYOND only supported moving +one tile at a time. For starters, a Move() is either a "slide" or a "jump" +depending on the distance. A slide is when the move can be stopped partway; +a jump is strictly pass/fail. Anything greater than one tile and the +mover's regular step_size is considered a jump. Changing z levels is also a +jump, as is moving to/from a non-turf. + +If step_x and step_y aren't within a good range, the new loc and the +step_x/y values may be changed so that the southwest corner of the mover's +bounding box is standing on its actual loc, or as close to it as possible. + +Enter() and Exit() can be called for several turfs and/or areas, not +just one at a time. It is also possible for them not to be called at all, +if the moving atom moves within a turf but doesn't cross a new turf +boundary. Enter() and Exit() are only called when first attempting to enter +or fully exit. The behavior of these procs depends on +world.movement_mode; in +legacy mode, they look at some of the contents of the turfs as well as the +turfs themselves, to preserve behavior found in older BYOND versions. + +Cross() and Uncross() are the equivalent of Enter() and Exit() but apply +to objects the mover will either overlap or stop overlapping. (For turfs, +Enter() and Exit() call these procs by default, since the mover is both +stepping into and onto a turf.) Likewise Crossed() and +Uncrossed() are the equivalents of Entered() and Exited(). + +If an atom is sliding, its movement can be halted if it encounters an +obstacle partway along its route. Bump() will still be called for any +obstacles the atom runs into, but Move() will return the number of pixels +moved (the most in any direction). When sliding at a speed so fast that the +distance is bigger than the atom itself, the move will be split up into +several smaller slides to avoid skipping over any obstacles. + +Gliding, which is used to show smooth movement between atoms in tile +movement, is mostly not used in pixel movement. It only applies when the +client uses a higher fps than the +server. + +Pixel procs +The bounds() and obounds() procs have been added to grab a list of atoms +within a given bounding box. That box can be relative to an atom, or in +absolute coordinates. + +bounds_dist() tells the distance between two atoms, in pixels. If it is +positive, that is the minimum distance the atoms would have to traverse to be +touching. At 0, they are touching but not in collision. A negative value +means the two atoms are in collision. + + + +Projection matrix + +Note: Currently this feature applies only to particle effects, using the +transform var. + +Normally icons in BYOND can only be transformed in 2D, using a simple 3x3 +matrix. This is represented by the /matrix object, which cuts off the +last column because it isn't used. However particles can have coordinates in x, +y, and z, and the whole particle set can be given a transformation matrix that +handles all three dimensions. + +Simple 2D transforms +The easiest transformation for particles is a simple 2D one, which you can +do by setting the particle datum's transform var to a /matrix +object. + + a d 0 +x y 1 * b e 0 = x' y' 1 + c f 1 +When an x,y point is multiplied by the matrix, it becomes the new point +x',y'. This is equivalent to: + +x' = a*x + b*y + c +y' = d*x + e*y + f +This is called an affine transform because all the operations are +"linear" in math terms. (That is, every term in the formula above has a single +variable, not raised to a higher power than 1.) + +3x4 matrix (x,y,z with translation) +3D affine transforms of this type are also affine transformations. There is +no special object for this so a list is used (see below). + + xx xy xz 0 +x y z 1 * yx yy yz 0 = x' y' z' 1 + zx zy zz 0 + cx cy cz 1 +The way to read the vars above is that the first letter says what input +component is being transformed (x,y,z, or c for "constant"), and the second +letter is the output component. + +x' = xx*x + yx*y + zx*z + cx +y' = xy*x + yy*y + zy*z + cy +z' = xz*x + yz*y + zz*z + cz +To use this kind of matrix, you can cut off the 4th column and provide the +values in a list form, in row-major order: + +list(xx,xy,xz, yx,yy,yz, zx,zy,zz, cx,cy,cz) +Note the 4th row is also optional. +4x4 matrix (x,y,z,w with projection) +This is the most interesting matrix, since if you use all 4 columns you're +actually altering an "axis" called w. This isn't a real axis, but is just a +number that the resulting vector will be divided by. + + xx xy xz xw +x y z 1 * yx yy yz yw = x'w' y'w' z'w' w' + zx zy zz zw + wx wy wz ww + +w' = xw*x + yw*y + zw*z + ww +x' = (xx*x + yx*y + zx*z + wx) / w' +y' = (xy*x + yy*y + zy*z + wy) / w' +z' = (xz*x + yz*y + zz*z + wz) / w' +In a regular affine transform, w always stays at 1. In projection you can +think of w as a distance from the "camera". 1 is where objects are their +"normal" size. If you make the z value affect w' by setting zw, you basically +make an object look smaller at higher z values. + +This is a simple projection matrix where x,y,z are left untouched, but +there's a projection effect. The "D" value is how far away the "camera" is +from z=0, so a point at z=D looks like it's twice as far away. + + +1 0 0 0 +0 1 0 0 +0 0 1 1/D +0 0 0 1 + +This 4x4 matrix is handled as a list just like the 3x4 affine matrix: + +list(xx,xy,xz,xw, yx,yy,yz,yw, zx,zy,zz,zw, wx,wy,wz,ww) + + +Regular expressions + +Regular expressions are patterns that can be searched for within a text +string, instead of searching for an exact match to a known piece of text. +They are much more versatile for find and replace operations, and therefore +useful for parsing, filtering, etc. + +Some example regular expressions are: + + +PatternCodeMeaning +B.*Dregex("B.*D")Find B, followed by any number of characters (including none), followed by a D. +[0-3]regex(@"[0-3]")Find any digit from 0 to 3 +foo|barregex("foo|bar","i")Find foo or bar, case-insensitive +\d+regex(@"\d+","g")Find all sequences of digits + +These are some of the patterns you can use. If you want to use any of the +operators as an actual character, it must be escaped with a backslash. + +It is highly recommended that you use raw strings +like @"..." for your regular expression patterns, because with a +regular DM string you have to escape all backslash \ and open +bracket [ characters, which will make your regular expression +much harder for you to read. It's easier to write @"[\d]\n" than +"\[\\d]\\n". + + +PatternMatches +a|ba or b +.Any character (except a line break) +^Beginning of text; or line if m flag is used +$End of text; or line if m flag is used +\ABeginning of text +\ZEnd of text +[chars]Any character between the brackets. Ranges can be specified with a hyphen, like 0-9. Character classes like \d and \s can also be used (see below). +[^chars]Any character NOT matching the ones between the brackets. +\bWord break +\BWord non-break +(pattern)Capturing group: the pattern must match, and its contents will be captured in the group list. +(?:pattern)Non-capturing group: Match the pattern, but do not capture its contents. +\1 through \9Backreference; \N is whatever was captured in the Nth capturing group. +Modifiers +Modifiers are "greedy" by default, looking for the longest match possible. When following a word, they only apply to the last character. +a*Match a zero or more times +a+Match a one or more times +a?Match a zero or one time +a{n}Match a, exactly n times +a{n,}Match a, n or more times +a{n,m}Match a, n to m times +modifier?Make the previous modifier non-greedy (match as little as possible) +Escape codes and character classes +\xNNEscape code for a single character, where NN is its hexadecimal ASCII value +\uNNNNEscape code for a single 16-bit Unicode character, where NNNN is its hexadecimal value +\UNNNNNNEscape code for a single 21-bit Unicode character, where NNNNNN is its hexadecimal value +\dAny digit 0 through 9 +\DAny character except a digit or line break +\lAny letter A through Z, case-insensitive +\LAny character except a letter or line break +\wAny identifier character: digits, letters, or underscore +\WAny character except an identifier character or line break +\sAny space character +\SAny character except a space or line break +Assertions +(?=pattern)Look-ahead: Require this pattern to come next, but don't include it in the match +(?!pattern)Look-ahead: Require this pattern NOT to come next +(?<=pattern)Look-behind: Require this pattern to come before, but don't include it in the match (must be a fixed byte length) +(? tag; otherwise only locally stored images can be shown. + + + +flash parameter (skin) + + + +Set to a positive number to make the window flash that many times, -1 to flash forever, and 0 to stop flashing. + + + +focus parameter (skin) + + + + +This parameter is true if this control currently has focus. + +This is also a special read-only global parameter. Calling winget() with no id and focus as the parameter will return the id of the currently focused control, if any. + + + +font-family parameter (skin) + + + +Leave blank to use the default font. This can be used for CSS-style fallback fonts, e.g. "Arial,Helvetica". + +You can include fonts in your resource file, making them available to the client, like so: + + +var/list/extra_resources = list(\ + 'myfont.ttf', + 'myfont_bold.ttf') + + + +font-size parameter (skin) + + + + +Point size of the font, or leave at 0 for the default size. + +The Output control behaves differently for legacy reasons, unless legacy-size is false. + + + +font-style parameter (skin) + + + + +Sets the font style. Any combination of the above values may be used, or none of them. Multiple values may be separated by spaces or commas. + + + +group parameter (skin) + + + +Used for "radio" buttons and menu items, where only one of them in the same group may be checked at a time. This value is a text string, or may be left empty. + +Buttons in different windows/panes, or menu items in another menu/submenu, are always treated as a different group. + + + +has-stats parameter (skin) + + + + +True if this info control contains the statpanels created via stat() and statpanel(). + +Only one info control can have statpanels. + + + +has-verbs parameter (skin) + + + + +True if this info control contains the verbs used in the game. + +Currently only one info control can have verbs. + + + +highlight-color parameter (skin) + + + + +The color used to highlight moused-over statpanel items or verbs. In grids, this color is used when hovering over objects or links. + + + +icon parameter (skin) + + + + +Custom icon used for the window. If no icon is specified, the Dream Seeker icon is used by windows by default. + +If this control is a pane, its icon will appear on the tab if the pane is inside a tab control. Lack of an icon will mean no icon appears in the tab. + +Note: The Windows .ico format is not used. Only image formats BYOND can already use are supported. + + + +icon-size parameter (skin) + + + + +Size, in pixels, of icons on the map. A size of 0 stretches to fit available space. + +This parameter has been deprecated. Use zoom instead. + + + +id parameter (skin) + + + +The name of this control. Read-only. + +If this is a Main control, the name should always be unique. For others, it is usually still a good idea to use a unique name, but they can be referenced by window.id at runtime. + +You can use a colon in front of the type to refer to the default control of a certain type, if one exists, e.g. :map is the default map. + + + +image parameter (skin) + + + +A background image to show in this control. + +In the Output control this image is always tiled. + +Note: Icons displayed in the output control will not show the background image underneath their transparent parts, but will instead show the background color. +For Label and Main, use image-mode to control how the image is displayed. + + + +image-mode parameter (skin) + + + + +Determines how the background image is displayed. + + + +index parameter (skin) + + + +Moves the menu item to the Nth position among its siblings. 0 or less is no change. Write-only. + + + +inner-mouse-pos / mouse-pos parameter (skin) + + + +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, not including the control's borders. + +mouse-pos is an alias for inner-mouse-pos. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending * as the parameter in winget(). + + + +inner-pos parameter (skin) + + + +Read-only. + +Reads the position where the window's interior contents begin (i.e., not counting titlebar, statusbar, borders, etc.), relative to its outer-pos. + + + +inner-size parameter (skin) + + + +Read-only. + +If the control is a window, this refers to its current interior size: i.e., not counting titlebar, statusbar, borders, etc. If it's maximized, this will be the true size of the window interior, as opposed to size which is the interior size once this window is no longer maximized. + +If this control is a pane and can-scroll is true, this is the size of the display area not including the scrollbars. + + + +is-checked parameter (skin) + + + + +True if the button or menu item is checked. Menu items can set this even if can-check is false. + + + +is-default parameter (skin) + + + + +Specifies that this is a default control. This should be true for your main window, and for your primary map, info, output, input, and browser controls. + +The default control of a given type can be referenced in winset() and other skin-related procs by the name ":type", e.g. ":map". + +Changing this value at runtime should be avoided, especially for windows. Results may be unpredictable. + + + +is-disabled parameter (skin) + + + + +Disables the control, menu item, or macro. + + + +is-flat parameter (skin) + + + + +Gives this button a flat appearance instead of pseudo-3D highlights. + + + +is-fullscreen parameter (skin) + + + + +True if the window should be in fullscreen mode. This suppresses +can-resize, titlebar, is-maximized, and +is-minimized. They will continue to return the values that would apply +if fullscreen mode were turned off. + + + +is-list parameter (skin) + + + + +True if the grid is used for a flexible list of items; the number of columns and rows may change to fit them. + + + +is-maximized parameter (skin) + + + + +True if the window is maximized. + +If is-fullscreen is true, this value represents the state of the window when is-fullscreen is turned off again. + + + +is-minimized parameter (skin) + + + + +True if the window is minimized. + +If is-fullscreen is true, this value represents the state of the window when is-fullscreen is turned off again. + + + +is-pane parameter (skin) + + + + +True if this is a pane that will be used in other container controls, instead of an independent window. Read-only. + + + +is-password parameter (skin) + + + + +Hide text with asterisks. Copy to clipboard is not available in this mode, but the text parameter can still read the control's contents. + +Note: For obvious reasons, you should never use the same password in a game that you would use anywhere else. + + + +is-slider parameter (skin) + + + + +Make this an adjustable slider capable of being changed by the user, instead of a progress bar. + + + +is-transparent parameter (skin) + + + +Make this control transparent. + +Transparency support is extremely limited. Only some controls can actually use it, and only when on top of certain other controls. + +Bars and labels handle transparency reasonably well, when not on top of other controls (or only on top of other conrols of these types). + + + +is-vert parameter (skin) + + + + +The splitter between the two panes in this control is vertical. + + + +is-visible parameter (skin) + + + + +True if this control can be seen. The main window should usually be made visible. + + + +keep-aspect parameter (skin) + + + + +If stretching a background image, preserve its aspect ratio. + + + +left, top parameters (skin) + + + + +The id of the left/top pane in this control. The parameter names left and top can be used interchangeably. + + + +legacy-size parameter (skin) + + + + +When true, font sizes are scaled slightly larger for readability, which is legacy (and default) BYOND behavior. Set to false for exact font sizing. + + + +letterbox parameter (skin) + + + + +If map auto-scales its icons (zoom is 0), make sure the entire map fits, and fill excess space with the background color. + +If letterbox is not enabled, auto-zoom will fill all available space, and any excess will be cut off. + + + +line-color parameter (skin) + + + + +The color of grid lines. + + + +link-color parameter (skin) + + + + +The color used for links. In some controls visited links may have a different color. + + + +lock parameter (skin) + + + + +Allows one pane to "lock" the splitter so if this Child control is resized, the splitter will stay put on that side. + + + +macro parameter (skin) + + + +The id of the macro set this window will use, if any, when it's active. + + + +map-to parameter (skin) + + + +The macro name (e.g., "SOUTH") of a key combo, Dpad, mouse button, etc. that this macro maps to. + + + +max-lines parameter (skin) + + + +Maximum number of lines before the control drops old text to make room for more. 0 is no limit. + +An overflow of 5% is allowed, to reduce flicker. + + + +menu parameter (skin) + + + +The id of the menu this window will use, if any, when it's active. + + + +multi-line parameter (skin) + + + +Input control: Create a multi-line input control. Read-only for this control. + +Info and Tab controls: Show tabs in multiple rows if there are too many to fit in a single row. + + + +name parameter (skin) + + + +Macro control: The key/gamepad combination such as R+REP, CTRL+Northwest, GamepadLeft. + +Menu control: This is the menu item label. A tab character can be used between the name and a keyboard shortcut, like "Help\tF1". (Keyboard shortcuts must be implemented as macros in order to work. This is just a label.) A blank name shows just a separator. + + + +no-command parameter (skin) + + + + +True if this input control is for typing only; hitting Enter will not run a command. + + + +on-blur parameter (skin) + + + +Command executed when the control loses focus. + + + +on-close parameter (skin) + + + +Command executed when the window is closed. + + + +on-change parameter (skin) + + + +Command executed when the value of the bar/slider is changed. If you drag the slider around, the command will not run until you let go. + +If you include [[*]] in the command, it will be replaced by the control's new value. (See embedded winget for more details on the [[...]] format.) + + + +on-focus parameter (skin) + + + +Command executed when the control gains focus. + + + +on-hide parameter (skin) + + + +Commandexecuted when this control is hidden by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. + + + +on-show parameter (skin) + + + +Command executed when this control is shown by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. + + + +on-size parameter (skin) + + + +Command executed when this control is resized. If you are dragging a window edge or splitter, the command won't run until you finish. + +No command will be sent in response to size or splitter changes made by winset(). + +If you include [[*]] in the command, it will be replaced by the control's new size. Likewise, [[width]] will be replaced with the width and [[height]] with the height. (See embedded winget for more details on the [[...]] format.) + + + +on-status parameter (skin) + + + +Command executed when the text that would go in the statusbar is changed. This applies even if this control is a pane and not a window, or is a window without a statusbar. It applies to all panes and windows that directly or indirectly contain whatever control generated the statusbar text (e.g., a map). + +If you include [[*]] in the command, it will be replaced by the new text. (See embedded winget for more details on the [[...]] format.) + +[[from]] can be used to reference the control (if any) that generated the next text. You can also use expressions like [[from.type]], [[from.parent.pos.x]], etc. + + + +on-tab parameter (skin) + + + +Command executed when the current tab is changed. + +If you include [[*]] in the command, it will be replaced by the new tab's id. (See embedded winget for more details on the [[...]] format.) + + + +outer-mouse-pos parameter (skin) + + + +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, including the control's borders. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending * as the parameter in winget(). + + + +outer-pos parameter (skin) + + + +Read-only. + +Reads the control's current exterior position including titlebar, statusbar, borders, etc. If the window is not minimized or maximized, this is identical to pos. + + + +outer-size parameter (skin) + + + +Read-only. + +If the control is a window, this refers to its current exterior size including titlebar, statusbar, borders, etc. If the window is maximized, this is the maximized size. + +If this control is a pane and can-scroll is true, this is the size of the display area including the scrollbars. + + + +parent parameter (skin) + + + +The id of this control's parent. Write-only, used when creating a new control at runtime or deleting a control that was created this way. + + + +pass-through parameter (skin) + + + + +Sends default action for this input after the user macro. Currently this applies only to mouse macros. + +An example of this is if you want to override MouseDown with new functionality in your own verb, but still handle default mouse processing. + + + +pos parameter (skin) + + + + +Position of this control's upper left corner, relative to its container. (Not applicable to panes.) + + + +prefix-color parameter (skin) + + + + +The color used for the prefix/header column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was red. + + + +right, bottom parameters (skin) + + + + +The id of the right/bottom pane in this control. The parameter names top and bottom can be used interchangeably. + + + +right-click parameter (skin) + + + + +True if this control should allow right-clicks to behave like any other click instead of opening up popup menus or similar special behavior. + + + +saved-params parameter (skin) + + + +A semicolon-separated list of parameters that get saved with this control. This is often used for things a user might set, like zoom level for a map. + +Currently not editable in Dream Maker. + + + +screen-pos parameter (skin) + + + +Read-only. + +For windows, this is the upper left corner of the nearest monitor's area. + +This is also a special read-only global parameter, which returns the position for the main monitor. + + + +screen-size parameter (skin) + + + +Read-only. + +For windows, this is the size of the nearest monitor's area (minus taskbar). + +This is also a special read-only global parameter, which returns the size (minus taskbar) for the main monitor. + + + +size parameter (skin) + + + +The size of this control. + +Setting 0 for width or height uses up any available space right/downward. + +If the control is a window, this refers to its interior size when not maximized or minimized. That is, it does not count borders, titlebar, menu, or statusbar, and if the window is minimized/maximized, this refers to the window's normal size when it is restored. See the inner-size and outer-size params for comparison. + +If this control is a pane and can-scroll is true, size refers to the total scrollable size of the pane, NOT the smaller size displayed. In this case, outer-size and inner-size refer to the display area with and without scrollbars, respectively. + + + +show-history parameter (skin) + + + + +Show forward/back navigation buttons. + + + +show-lines parameter (skin) + + + + +Determines which grid lines to display. + + + +show-names parameter (skin) + + + + +When atoms are output to the grid, show the atom's name next to its icon. + +If the atom has no icon and show-names is false, the grid cell will be blank. + + + +show-splitter parameter (skin) + + + + +Show a splitter if both the left and right (or top and bottom) panes are in use. The splitter can be dragged to resize the panes. + + + +show-url parameter (skin) + + + + +Shows an address bar for this browser control. + + + +small-icons parameter (skin) + + + + +When output(object,grid) is sent, show smaller icons in this control instead of larger ones. + + + +splitter parameter (skin) + + + + +Position of the splitter when two panes are in use, whether show-splitter is true or not. This value is a percentage. Specifically, it is the percentage of the available width/height that is given to the left/top pane. + + + +suffix-color parameter (skin) + + + + +The color used for the suffix column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was blue. + + + +statusbar parameter (skin) + + + + +Shows a status bar at the bottom of the window. This will show the name of an atom when you hover over it with the mouse. + + + +stretch parameter (skin) + + + + +Stretch the background image. + +Deprecated; use image-mode instead. + + + +style parameter (skin) + + +Custom stylesheet used for the control. Changes made at runtime will usually not impact any existing text. + +For Map controls, this affects any maptext drawn, and changes to the style should appear on the next refresh. + + + +tab-background-color parameter (skin) + + + + +Affects the background color for tabs. The regular background-color is used for the content area. + + + +tab-font-family, tab-font-size, tab-font-style parameters (skin) + + +Affects the font for tabs. The regular versions of these without the tab- prefix are used for the content area. + + + +tab-text-color parameter (skin) + + + + +Affects the text color for tabs. The regular text-color is used for the content area. + + + +tabs parameter (skin) + + + +A comma-separated list of id values for the panes included as tabs in this control. + +When setting this value, you can put + in front of the list to add tabs to the existing control, without affecting current tabs. You can likewise use - in front of the list to remove tabs. + +Note: When using this with winset(), remember you will need to escape + as %2B via url_encode() or list2params(). + + + +text parameter (skin) + + + +Text shown in this control. For Input controls this setting is only available at runtime. + + + +text-color parameter (skin) + + + +The control's foreground text color. + + + +text-mode parameter (skin) + + + + +Show text mode even if icons are available. Text mode will be used if no icons are present, regardless of this setting. + + + +text-wrap parameter (skin) + + + + +Wrap text that is too long for the width of the label. + + + +title parameter (skin) + + + +The title of this window or pane. For a window, the title will appear in the titlebar if present. For a pane, this will be displayed on the tab if this pane is in a Tab control. + +If this is the default window, world.name takes precedence over the window title. + + + +titlebar parameter (skin) + + + + +Show a titlebar for this window. This is also required for the close, minimize, and maximize buttons to appear. + +If is-fullscreen is true, titlebar is ignored, so this value represents the state of the window when is-fullscreen is turned off again. + + + +transparent-color parameter (skin) + + + + +A color that will be turned into transparency wherever it appears in this window. Overall, this method of transparency comes with many limitations, so it is considered deprecated. + + + +type parameter (skin) + + + +The type of this control. Read-only. + + + +use-title parameter (skin) + + + + +Use the browser's document title to override the title of the window or pane it appears in. + + + +value parameter (skin) + + + + +The "fullness" of this bar/slider, as a percentage. + + + +view-size parameter (skin) + + + +The size, in pixels, of the map after zoom has been applied. + +For instance, if the client view has 10×10 tiles (this includes any extended tiles caused by HUD objects) and world.icon_size is 32x32, the map has a native size of 320×320 pixels. If the map has a zoom level of 2, then view-size will be 640x640. + +With a zoom value of 0, which is the default for most projects, the actual zoom level is automatically determined by the size of the map control, the map's native pixel size as explained above, and the value of the letterbox parameter. + + + +visited-color parameter (skin) + + + + +The color used for visited links. + + + +width parameter (skin) + + + + +Width, in pixels, of the bar or slider. A value of 0 uses all available width. + + + +zoom parameter (skin) + + + + +Zoom factor for icons on the map. 1 means to show the icons at their original size, 2 is 200%, 0.5 is 50%, and so on. A value of 0 stretches to fit available space. + + + +zoom-mode parameter (skin) + + + + +Controls the way the map is upscaled. + +Preserves a pixelated look, but does some blending between adjacent pixels when the zoom factor is not an integer. This is equivalent to upscaling by the next highest integer, then downscaling. +distortUses nearest-neighbor sampling to upscale. This may look odd if the zoom factor is not an integer, since for instance some pixels might scale up to be 2 pixels wide, others 3 pixels wide. Some users prefer it anyway. +blurUses bilinear sampling to upscale. This will cause a blurry appearance if the zoom factor is high, but it may be desired in some cases. + + +Appendix +This section contains miscellaneous information that may apply to multiple +vars or procs. + + + + +Byondapi + +Byondapi is a set of exported functions from BYOND's core library that can +be used by external libraries that you call via the +call_ext() proc. The purpose is to make +interfacing with native code easier, and to allow external access to BYOND's +functionality. Before this existed, all external calls had to use text strings +to pass data back and forth, which was inefficient for many uses and very +limited. + +To build your external library with Byondapi, you have to include the +byondapi.h header file that's included in BYOND's distribution. When +compiling in Windows, you'll also need to link with byondapi.lib; in +Linux, your makefile should link with byondcore.so from BYOND's own +bin directory. + +Simple BYOND types +For simplicity, BYOND defines some basic types and macros in +byondapi.h. The one most relevant to you is u4c, which is an +unsigned 4-byte integer. There's also s4c which is a signed integer, +as well as simple 1-byte and 2-byte ints that use 1c and 2c +(respectively) insteaed of the 4c suffix. + +CByondValue struct +The main structure used to pass data back and forth is +CByondValue. This mimics an internal structure in BYOND that holds +values of all sorts: numbers, null, references to strings, references to +objects and lists, and so on. + +The exact functions used for interfacing with this structure are documented +in byondapi.h. + +The main tricky aspect of working with BYOND data is strings. If you need +to get the contents of a string, you'll need to allocate memory for the +character data and call Byond_ToString() to get a copy of the string. +For converting character data to an internal string stored in CByondValue, +you'll need to call ByondValue_SetStr(). + +Other function calls +There are many function calls available in Byondapi for interacting with +the server. These include the ability to read and write vars, call procs, +create lists, read and write from lists, and so on. + +Most of these procs return boolean values: true if they succeed, false if +not. In the event of a failure, you can call Byond_LastError() to +get the error message. + +In any functions that read data from lists or read string data—including +Byond_LastError()—you need to allocate the required memory for +a copy of the string or list items. These functions take a pointer to the +buffer that will be filled, and a u4c pointer for the buffer size (in +items for lists, in bytes for strings). If the return value is false and the +length is set to zero, an error occurred. If the return value is false and the +length is non-zero, the new length value is the required length of the array; +the memory should be allocated and the function called again. + +Example: + +char *errmsg = NULL; +u4c buflen = 0; +while(!Byond_LastError(errmsg, &buflen)) { + free(errmsg); + errmsg = (char*)malloc(buflen); + if(!errmsg) break; +} +... // do someting with the error message +free(errmsg); + +The C++ wrappers have a better way of calling Byond_LastError() +and other functions like it, where you don't need to worry about allocations. + +Reference counting +Objects in BYOND are reference-counted; when an object's count reaches 0 +it gets garbage-collected. In Byondapi you can call ByondValue_IncRef() +and ByondValue_DecRef() to increment or decrement the reference +count, respectively. + +Byondapi maintains its own internal reference count for any object, so +you can't decref past the number of references Byondapi holds. + +The results you get from calls to Byondapi functions, such as reading a +var or getting a return value from a proc call, have already had their +reference count increased. That means when you're done using the value, you +need to clean it up with ByondValue_DecRef() or else you'll have a +memory leak. + +The value you return from a function called by call_ext() should +have a reference. + +The C++ wrappers take care of most of the reference counting issues for you +(see below). + +Threads +BYOND servers handle proc execution and the management of data in a single +thread. If your library tries to call any BYOND server functions in a +different thread of its own, the call will block until the server thread can +handle it. + +The special function Byond_ThreadSync() will run a callback +function on the main thread, avoiding the need to keep syncing over multiple +Byondapi calls. + +C++ wrappers +If you want to use the handy C++ wrappers and classes, you can include +byondapi_cpp_wrappers.cpp and byondapi_cpp_wrappers.h in +your library. + +The ByondValue class is a wrapper around CByondValue +that handles a number of operations for you. You can redefine the argv +argument of any call_ext() functions as an array of +ByondValue instead of CByondValue, but the return value +should stay a CByondValue. + +Example: + +#include +#include +#include +#include + +extern "C" BYOND_EXPORT CByondValue merge(int n, ByondValue v[]) +{ + ByondValue result; + std::string merged, str; + for(int i=0; i [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. + + +```dm + +//sending the file +mob/proc/Export(Addr) + var/savefile/F = new() + F.Write(src) + world.Export(Addr,F) + +//receiving the file +world/Topic() + var/savefile/F = new(world.Import()) + F.Read() //read the mob + +``` + + +This example defines a mob proc called Export() which writes the mob to a savefile and sends it to another server (specified by Addr). The remote server opens it as a savefile and creates the mob (if the same mob type is defined on both servers and mob.Read() is compatible with the sending server's mob.Write()). + +Note that another method of transferring player mobs is to use the key savefile (accessed by client.Export() and client.Import()). Direct server to server communication on the other hand could transfer data (like non-players) without the need for player involvement at all. + +Savefiles are the most common type of file to transfer, but world.Import() simply returns a reference to an item in the world's .rsc file, which could be any type of file. This particular example demonstrates how to open such a file as a temporary savefile. (It gets dumped from the cache into a separate temporary file, which is then opened as a savefile.) Other types of files would be handled differently. For example, you could use fcopy() to dump the cached item to its own separate file. + +By default, this procedure checks the "ban" configuration file. If an entry is found for the current world (based on the value of world.hub), the parameter text is converted into a list (using params2list()), and the result is returned. Otherwise, null is returned. + +A ban that applies to all worlds on the host's computer will not call IsBanned(). The connection will simply be denied. + +This procedure is called internally whenever a new user connects (before client/New() is called). If the result is true, access is denied. If you want to ban a user but still allow them to log in (perhaps with reduced functionality), you can put "Login=1" in the parameter text. If you want to display an explanation to the user about why they are banned, you can also put "message=X" in the parameter text, where X is the message to display to the user. A reason for the ban can be added with a "reason=X" field. Of course, you can also override IsBanned() and insert these values directly into the list that is returned. + + +```dm + +world/IsBanned(key,address) + . = ..() //check the ban lists + if(istype(., /list)) + .["Login"] = 1 //allow banned user to login + +``` + + +When you ban people from paging you, this also causes them to be added to the keyban list. Even if they are already connected, IsBanned() will be re-evaluated and acted upon at that time. When you remove pager ban, they are removed from keyban as well. + +Additional data elements may be added to the ban list in the future. The current definition includes just the following items: + +Since the data in the "ban" file is in application/x-www-form-urlencoded format, it is probably not desirable to edit the file by hand. No built-in facilities for editing the file have been provided (aside from automatic addition of pager bans), but an interface could be created, using GetConfig and SetConfig to read and write the data. Extra features could also be added such as automatic inference of key associations by IP address. + +Checks a player for their subscription status to this game. This is a simpler alternative to `client.CheckPassport()`, which is deprecated, and also allows you to check even when the player has gone offline. + +This proc will return null if contacting the hub was required, but there was no way to reach the hub. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. + + +```dm + +mob/verb/JoinClub() + if(!world.IsSubscribed(src)) + src << "Sorry, the club is only for subscribers." + else + // go to the turf with the tag "clubhouse" + loc = locate("clubhouse") + src << "Welcome to the clubhouse!" + +``` + + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. + +This causes the world to be hosted on the specified network port. A value of 0 or "any" requests that any available port be used. The value "none" causes the port to be closed so that no new connections are possible. + +This proc may be overridden. If it is, calling ..() is necessary to open the port. If ..() is not called, it will not open. + + +```dm + +world/OpenPort(port) + // only allow subscribers to host + if(host_is_subscribed) + return ..() + +``` + + +The "ports" configuration option in cfg/byond.txt can be used to control what ports worlds may open. The -ports command-line option may also be used. See startup for the syntax. + +Removes credits from a player's account, if they have enough. The proc will return 1 if it is successful, or 0 if the attempt failed (usually because the player doesn't have enough credits). This feature is intended for games that make use of the credit system, and for security all such games must use a hub password. + +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is often a good idea to use spawn() to avoid holding up the rest of the game. + + +```dm + +mob/proc/ItemShop() + var/items = list("Get credits!", "Magic sword"=10, "Skeleton key"=50) + var/choices[0] + var/item,price + for(item in items) + price = items[item] + choices["[item]: [price] credit\s"] = item + + var/credits = world.GetCredits(key) + if(isnull(credits)) + src << "Sorry, the item shop isn't available right now." + return + + var/choice = input(src,\ + "You have [credits] credit\s. What would you like to purchase?",\ + "Item Shop")\ + as null|anything in choices + if(!choice) return // cancel + + if(choice == "Get credits") + src << link("http://www.byond.com/games/Author/MyGame/credits") + return + + item = choices[choice] + price = items[item] + if(!price) return + + src << "Contacting item shop..." + var/result = world.PayCredits(name, price, "Item shop: [item]") + + if(isnull(result)) + src << "Sorry, the item shop isn't available right now." + else if(!result) + src << "You need [price-credits] more credit\s to buy [item]." + else + src << "You bought \a [item]!" + + // Now give the user the item and save their character + // These procs are for you to define + src.AddEquipment(item) + src.SaveCharacter() + +``` + + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. + +Interacts with the built-in server profiler without requiring the host to do so via Dream Daemon, or an authorized player via Dream Seeker. + +The `command` value is built from bitflags, so it can combine any of these three values via the `|` operator: + +These additional values are also defined for convenience: + +By default, data will be returned as a list. The first six values are the column names: `"name"`, `"self"`, `"total"`, `"real"`, `"over"`, and `"calls"`, corresponding to the columns in the profiler. These are followed by the profile data for each proc, with the data being in the same column order. E.g. the next six items represent the first proc in the profile. + +The optional `format` argument however can be used to return the data in other formats. Currently the only accepted value is `"json"`, which will output the same data in JSON format. + +Using `"sendmaps"` in the `type` argument will profile the routines used to send map informaiton to players. Unlike the proc profiling this only has three data columns: `"name"`, `"value"`, and `"calls"`. The value column might be a time or number value, depending on what's being measured. + +The JSON format will include a `unit` property data that is not a raw number, such as a time value. + +Reload the world from scratch. Any connected players will automatically relogin. This would be useful if you needed to recompile the world after changing some code. + +In a UNIX environment, you can cause a running server to reboot by sending it the signal SIGUSR1. + +If you override this proc, you must call ..() if you want the reboot to complete normally. + +For reboots initiated by Dream Seeker, usr will be the mob belonging to the player who sent the command. + +This command is for storing configuration information that is shared by applications installed on the same system. The configuration data is accessed by specifying the configuration "set" and the parameter within that set. + +For more information, see GetConfig. + +Awards a medal to a player. The proc will return 1 if it is successful, or 0 if the medal was already awarded. If the world already knows this medal was earned before, the hub will not be contacted. + +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. + + +```dm + +mob/monster/dragon + Die(mob/killer) // assume Die() is a proc all mobs have + spawn() + if(ismob(killer) && killer.key) + world.SetMedal("Dragon slayer", killer) + +``` + + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. + +Updates scores that are kept on the BYOND hub. + +The key is an arbitrary text value. Usually a player's key is a good choice, but you can also use the name of their character, or anything else you like, as long as it is unique. The key is case-insensitive. + +Scores and stats use data fields, which might be things like "Score", "Level", "Class", etc. Use list2params() to set the fields that you want to change. Fields that you do not include in the list will not be changed. A field with a blank value will be deleted. + +Sending an empty text string for the fields will erase the scores for that key. + +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. + + +```dm + +var/params + +// Change the Score and Pet fields +params = list("Score"=123, "Pet"="Dog") +world.SetScores("Tom", list2params(params)) + +// Delete the Pet field +params = list("Pet"="") +world.SetScores("Tom", list2params(params)) + +// Delete Tom's scores entirely +world.SetScores("Tom", "") + +``` + + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. + +This proc allows you to do any updates just before map info is sent out. One possible use for this is to run a movement loop, or sync up any user interface input that might have arrived and deal with it all at once. + + +```dm + +world/Tick() + for(var/client/C) + if(C.mob?.move_dir) + try + step(C.mob, move_dir) + catch + // empty catch, just so a failed step won't break the loop + +``` + + +Note: The tick will not wait if this proc sleeps. It effectively has set waitfor=0 already built in. It's a good idea not to sleep in this proc or any of its callees at all, since it will keep getting called every tick. + + +```dm + +world/Topic(T) + if(findtext(T,"shout:") == 1) + world << copytext(T,7) + +``` + + +This example allows other servers to send this server topic text of the form "shout:msg" and will broadcast the message to all the players in this world. + +The Keys argument is either null, or a list of user keys. Any keys in the list are logged in to the remote server. + + +> [!CAUTION] +> +> > [!NOTE] +> > Always validate the input in `Topic()` calls to make sure it's correct and the query you're recieving is legitimate. + +Built-in world vars: + +This is the network address of the machine hosting the world. If it cannot be determined, it will be null. + +The full network address of the world may be formed by concatenating the world address and port: "byond://[address]:[port]". + +In CGI mode, this is the web address of the world. + +This is the local address only. If the world is hosted via a router, the external IP address may be different. Use `internet_address` to find the external address, if available. + +This is the default area type to be placed on the map wherever no area is specified. A value of 0 turns off the default area. + +This is the build number (minor version) of BYOND being run by this server. Typically this is not useful information, but it can come in handy when diagnosing issues reported by players when hosting with a beta build. + +This is the version of BYOND at run-time. A game designed to work around known bugs in older versions could use this to adapt its behavior accordingly. + +Number of days items that are not in use will be saved in the resource cache (.rsc file). Files uploaded by players are stored in the world's .rsc file for future use. If the file is not used for the specified amount of time, it will be removed to save space. + +Setting this value to 0 causes items to be saved for the current session only. This is used by the CGI library, because web browsers cannot make use of server-side caches when uploading files anyway. + +This value must be a whole number. + +This is a list of every object in the world. Objects in this list are in no particular order. + + +```dm + +proc/ListAreas(mob/M) + var/area/A + M << "Areas:" + for (A in world.contents) + M << A + +``` + + +This example displays a list of every area in existence. As a convenient short-hand, one may simply write for(A) or for(A in world) instead of the full for(A in world.contents). + +This is the percentage of a server tick that the server spends processing running procs and the work of sending map information to players. A value of 0 would indicate very little cpu usage. A value of 100 would indicate full cpu usage, which could mean that the server cannot complete all the necessary computations during a tick to finish in time for the next tick. In this case, timed events (such as sleep) may take longer than requested. + +When deciding on a value for tick_lag, one could use this value to determine if the CPU is fast enough to tick at a higher rate. + +The `map_cpu` var is a subset of this, measuring only time used for sending map information. + +This option is for direct execution of .dmb files in UNIX. The most common use is for writing CGI programs that are executed by the web server. + +The first parameter in the `executor` text string is the path to DreamDaemon. The one listed above is the standard UNIX location. + +Optional parameters may follow. The most common are -CGI and -logself. + + +```dm + +world/executor = "/usr/local/byond/bin/DreamDaemon -CGI -logself" + +``` + + +This example creates a CGI program to be executed by a web server. It puts its error output in the file `projname`.log. + +All of this is configured for you when you include html/CGI.dm from the html library. + +The value of `world.fps` defines the speed of the world in frames (server ticks) per second. By default this is 10 fps, which is a good speed if all objects move in full tiles. Higher values yield smoother results, but at a cost to performance. Timing of many events may be limited by the system clock, so `fps` values beyond 40 or 50 may cause unwanted effects like jitter even for projects that are not very demanding in terms of performance. + +For projects making use of pixel movement, higher `fps` is usually desired. 40 seems to be a good value for general use, but in worlds that have a large number of players, you may wish to lower the value and give players a higher `step_size` per tick instead. + +This var exists for convenience; it is calculated by `10 / world.tick_lag`. The value of `world.tick_lag` is actually more accurate, but it is easier to think of world speed in terms of frames per second. The actual tick rate has a resolution of 1 ms. + +When reading `world.fps`, the result is always given as a whole number to gloss over rounding error. + +If you set `client.tick_lag` or `client.fps` to a value other than 0, you can make the client tick at a different (usually faster) rate. + +At runtime, this value may be changed to let the BYOND hub know about certain changes in the game's status. An example for using this value is if the number of players in the game gets too high and most new logins are rejected, you can set game_state to 1 to let the hub know this server is full. + +The following values are accepted: + +Note that this value does not affect how your world actually reacts to new players logging in. It is only used by the hub and website. + +If the information is made available by the pager, this will provide the key of the world's host. If the host is not known, this value will be either null or an empty string. + +This is a registered BYOND hub path. The default value of null is for unregistered games. Registered games (don't worry, it's free!) have their own hub page showing a brief description of the game, the author, an optional installation package, and links to online games. The hub path is a string of the form "YourName.GameName" and can be found in your hub console. + +Even unregistered games show up in the hub when they are live (that is online with people connected). It just doesn't show any of the extra info like a description, and there is no way for people to find out about it when nobody is logged in. + +If you do not want your game to show up in the hub (like while you are in the initial stages of development), just compile with visibility=0. Either that, or turn off your pager or your BYOND locator when you are connected to it. + +You (or the players) might also wish to turn off the notice of a live game in the hub when there is no longer any room for new players or if it is too late in the game for new people to join. At such times, you can simply set the visibility to 0. + + +```dm + +world + hub = "Dan.PipeStock" //registered hub path + +mob/verb/start_game() + world.visibility = 0 + //... + +``` + + +If you configure your hub page to require a hub password, you must also specify world.hub_password. + +If world.hub is set, any live session of the game will be attached to the specified BYOND Hub page. Under the default settings, any game can set world.hub and attach itself to any BYOND Hub page. + +To beef up security, you can set a hub password in your hub's configuration page via the BYOND website. This will ensure that only authorized copies of your game can attach themselves to your hub page when live. Then simply copy that password into your code as world.hub_password so that your game's live broadcast will be accepted by the hub. + + +```dm + +world + hub = "Dan.PipeStock" //registered hub path + hub_password = "UPAggnJaeXmSBoKK" //password for live game authentication + +``` + + +Note that for security reasons, reading this variable at runtime will return a hashed version of the value that was set. + +This is the tile size that will be used as a default for icons in the world. It can be set to a single number that represents both the width and height, or you can use a format like "[width]x[height]" (such as "16x48") to specify width and height separately. + +This value affects several calculations, including icon operations and gliding between turfs. + +Note: If you do not use a square icon size and you are using a topdown map format, you may experience display issues if setting `client.dir` to `EAST` or `WEST`. A non-square tile with a topdown map format will also interfere with pixel movement. For this reason, square sizes are recommended when using any topdown-view map format. + +This is the network address of the machine hosting the world, as it is seen by the outside network (from the Internet) and the hub. If it cannot be determined, it will be null. + +The full network address of the world may be formed by concatenating the world address and port: "byond://[address]:[port]". + +This var exists because `world.address` may not be accurate if the world is hosted on a machine behind a router using NAT. The value returned by `internet_address` can be given to other players who wish to log in. + +Sending output to world.log may be useful for debugging purposes. The output goes to the same place run-time proc errors are displayed. + + +```dm + +if(1+1 != 2) + world.log << "Uh oh." + +``` + + +You can assign world.log to a file name or file() object to redirect output to that file. (There is also a command-line option to Dream Daemon that does this.) + + +```dm + +world.log = file("mylog.txt") + +``` + + +Setting this to 0 disables the very long loop protection. By default, loops in the code which undergo a very large number of iterations or recursions are aborted (by crashing the proc). This prevents the proc from locking up the server for too long. + +You may need to disable this feature if your code has some very long loops in it. Before doing that, make sure it's not infinitely long! Your program will utterly crash if it runs out of system stack space, which can happen in a very deep or infinite recursion. + +Note: The compiler will now generate a warning when you disable `loop_checks`. It is not advisable to disable the check unless you're trying to debug something, since you can cause the server to hang. Generally if you have a loop so long it can cause the regular loop checks to freak out, you need to make a change to the loop behavior anyway. + +This value says how the world will display maps. In a normal overhead tiled map the value is `TOPDOWN_MAP` for the top-down format. For older games that predate this feature, the value is `TILED_ICON_MAP`. + +If you use a map format other than top-down, the HUD will still use a tile format like it would in top-down display. HUD objects are not projected into whatever map_format you use and they are not affected by changing client.dir. The size of the HUD is rounded up to the nearest number of full screen tiles; the size of each tile is defined by world.icon_size. + +This is the default map format. Icons are drawn in a tile form and viewed from overhead. In this layout, the layer assigned to each atom is very important. The number of tiles shown is set by client.view or world.view. + +Because this format is familiar and easy to understand, it is the default setting. Most of the vars related to maps and atoms are designed and documented with this format in mind. + + +> [!WARNING] +> +> > [!NOTE] +> > This format is deprecated. It exists to support older games and allow them to be compiled without causing them to break, until they can be redesigned for one of the newer formats. + +If map_format is set to `ISOMETRIC_MAP`, the map is displayed in isometric form. Isometric tiles are displayed in a foreshortened diagonal perspective, where the "north" direction actually displays as northeast on the player's screen, and "east" shows up as southeast. The value of `client.view` or `world.view` is used to calculate the *minimum* number of tiles to display, and extra tiles to each side will be shown to fill in the corners. + +In an isometric map, the tile width set in world.icon_size is the most important factor. This should be a multiple of 4 for best results. The minimum tile height is half that value, and any extra height is used to show vertical structures that "stick up" off the map surface. When you draw an isometric tile icon, start with a flattened diamond shape at the bottom that is only half as high as it is wide. + +Isometric maps behave differently during drawing than top-down maps. In isometric, tiles that are nearer to the viewer's perspective are drawn in front of tiles farther back, regardless of layer. Layers only count within an individual tile. This means that if you want to have a vertical structure "stick up" to partially hide something behind it, the icon sticking up should always be on a tile forward from the one being partly covered. E.g. if you have a wall taking up part of your tile, it needs to be at the "back" end of the tile to properly hide anything on the tiles behind it. + +The `pixel_x` and `pixel_y` values, `step_x` and `step_y` values, and the gliding that happens when moving between tiles, are based on the width set by `world.icon_size`. If you set `world.icon_size="64x128"` to show tall buildings, only the 64 matters for pixel offsets. Use `pixel_w` and `pixel_z` to adjust the position of atoms (or the client) horizontally or vertically without respect to `client.dir` or the map format. + +Note: Offsets for x and y also affect the layering order used to draw the icons. Any object with a pixel offset onto another tile is considered part of whichever tile is closer. + +If you use an icon wider than one tile, the "footprint" of the isometric icon (the actual map tiles it takes up) will always be a square. That is, if your normal tile size is 64 and you want to show a 128x128 icon, the icon is two tiles wide and so it will take up a 2×2-tile area on the map. The height of a big icon is irrelevant--any excess height beyond width/2 is used to show vertical features. To draw this icon properly, other tiles on that same ground will be moved behind it in the drawing order. + +One important warning about using big icons in isometric mode is that you should only do this with dense atoms. If part of a big mob icon covers the same tile as a tall building for instance, the tall building is moved back and it could be partially covered by other turfs that are actually behind it. A mob walking onto a very large non-dense turf icon would experience similar irregularities. + +The `SIDE_MAP` format is like a cross between `TOPDOWN_MAP` and `ISOMETRIC_MAP`. It looks very similar to a top-down view but it is intended for more of a 3/4 perspective, where tiles lower on the screen are considered closer to the viewer. Because this impacts the way layers work, most of the layering behavior is the same as with isometric. + +In a 3/4 perspective the tiles are often foreshortened, so pixel offsets are adjusted to account for this. For example, you may set `world.icon_size` to `"32x24"`, but the tile is considered to be a perfect square if you look at it from the top down. Because the width is 32 pixels, the virtual height is also 32, so if you use pixel_y=32 the atom will appear one tile further back than it normally is. (This adjustment doesn't affect screen objects or `pixel_w`/`pixel_z`.) + +Changing `client.dir` preserves the same tile size regardless of orientation. + +This is the percentage of a server tick that the server spends processing information about the map to send to players. A value of 0 would indicate very little cpu usage. A value of 100 would indicate full cpu usage, which means that the server cannot complete all the necessary computations during a tick to finish in time for the next tick. In this case, timed events (such as sleep) may take longer than requested. + +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). + +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). + +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. + +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. + +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). + +When a player connects to the world, the world is searched for a mob with the player's key. If one is found, the player is connected to that mob. If none is found, a new mob of type world.mob is created and the player is connected to this new mob. + +The default value is /mob. Setting world.mob to 0 prevents the creation of default mobs. + + +```dm + +world + mob = /mob/newbie + +mob/newbie + Login() + src << "Welcome, [name]." + ..() + +``` + + +This example will connect new players to mobs of type /mob/newbie. They are welcomed when they connect. + +Controls how movement works on the map. + +`TILE_MOVEMENT_MODE` allows you to easily discard any and all pixel movement, so if step_x or step_y coordinates or unexpected atom bounds were loaded from a savefile, for instance, they would be eliminated. If you use any other movement mode, you can give an atom the TILE_MOVER flag and it will behave as if it were in this mode, while other atoms are free to do their own thing. + +`LEGACY_MOVEMENT_MODE` exists to distinguish between old and new movement behavior. In older versions of BYOND before pixel movement, turfs took their contents into consideration by default in Enter() and Exit(). This doesn't really make sense for newer games, so in any other movement mode the turf behavior will ignore its contents. mob.Cross() is also affected, since it would return 0 by default in legacy mode when both mobs were dense; now by default it checks `mob.group`. + +This is the name of the world. + + +```dm + +world + name = "The Void" + +``` + + +This is a list of parameters passed to the world from the command-line -params option when the server was started. The parameter text is passed through params2list() to generate the world.params list. + + +```dm + +world/New() + var/p + if(params.len) world.log << "Command-line parameters:" + for(p in params) + world.log << "[p] = [params[p]]" + +``` + + +This example displays the value of each parameter. + +This is the network port of the world. If the world does not have an open network port, this is 0. + +This read-only variable indicates the ID of the server's process on the system running it. The result is a number, unless for some unexpected reason the number won't fit in a `num` type, in which case it will be text. (In practice it should always be a number.) + +This is the time (in 1/10 seconds) since 00:00:00 GMT, January 1, 2000 (also known as the BYOND era). + +Because this is a large number, BYOND's number system isn't capable of enough precision to deliver the exact number of 1/10 second ticks. It usually rounds off to the nearest several seconds. For more accurate readings use world.timeofday. + +Returns 1 if the world is currently hosted and the port can be reached by players (as determined by the BYOND hub), 0 if not. + +If the port is not reachable, there may be a brief period during which the hub is still attempting to make contact; during that time the port is assumed to be reachable. Currently, the reachability test times out and fails after 30 seconds. + +Setting this to 1 causes the world to be suspended when there are no players, even if you have sleeping procs waiting to happen. The default value is 0, which means the server will only sleep if there are no players and no procs waiting to happen. The main purpose of the variable is to save the cpu from doing work when there is nobody around to appreciate it. On the other hand, that doesn't give the poor NPC's a break from the nasty humans. + +This is a short text string used in BYOND hub to describe the state of a game in progress. For example, you might want to indicate if new players will be able to actively play, or whether they would have to join as spectators. + + +```dm + +world + status = "accepting players" +mob/verb/start_game() + world.status = "accepting spectators" + //... + +``` + + +This variable indicates the operating system type at run-time. It will be one of the following constants: + +This is the smallest unit of time (one server tick) measured in 1/10 seconds. The duration of events that take some finite amount of time (like sleep) will be rounded to a whole number of ticks. + +Players are limited to one command (including movements) per server tick, so this value can be used to adjust the responsiveness of the game. If the network is too slow to keep up with players, their commands will get queued up, which can be annoying when trying to move. In this case, tick_lag should be increased so that the stored up movement commands are discarded. On the other hand, if you have a very fast network, you may wish to decrease tick_lag to speed up the response time to player commands. + +Often it is more convenient to set world.fps instead of world.tick_lag, since fps (frames per second) is an easier way to think of server ticks. world.tick_lag is 10 / world.fps and vice-versa, so a tick_lag of 0.25 is equal to 40 fps. + +If you set client.tick_lag or client.fps to a value other than 0, you can make the client tick at a different (usually faster) rate. + +This is the approximate percentage of the server tick that has been used already. A value under 100 means there's time to do more calculations, which can include any pending procs that are still waiting to run on this tick. When the value is over 100, the tick is running long and your world will experience lag. + +Keep in mind that sending maps to clients is the last thing that happens during a tick, except for handling any events such as player commands that might arrive before the next tick begins. Therefore in a verb, `tick_usage` might have a higher value than you would expect to see in a proc that loops and sleeps. + +This gives the amount of time (in 1/10 seconds) that the world has been running. In actual fact, it is the number of server ticks that have passed multiplied by world.tick_lag. Therefore if the server sleeps (when no players are connected) this time is not counted. Also, if the server runs overtime during a tick (because procs take longer than tick_lag to finish) this still only counts as one tick. This value is therefore a measure of "game time" rather than real time. + +This is the time (in 1/10 seconds) since 00:00:00 GMT today. It is basically identical to world.realtime but doesn't include any information about the date. This is a much smaller number; hence it is more accurate. + +This is the time offset from UTC, in hours, for the world's time zone. It can be used in the `time2text()` proc, although it is the default time zone for that proc. + +This is the default turf type to be placed on the map wherever no turf is specified. A value of 0 turns off the default turf. + +This is the full network address of the world. (For example, byond://dan.byond.com:6005.) + +If you are distributing your game to players, you can use this variable to automatically notify them of new releases. To do so, you will first need to set world.hub to the hub path of your game. You can then advertise the current version by configuring that value in your hub console. + +When players boot up an outdated version of your game (as indicated by comparing world.version with the version advertised by BYOND hub), they will be notified of the new release. + +This is the default map viewport range. The default value of 5 produces an 11x11 viewport. A value of -1 turns off the map display altogether. The client may automatically scale down icons in order to conveniently fit the map on the player's screen. + +For non-square views, you can assign this to a text string of the form "WIDTHxHEIGHT". For example, "11x11" is equivalent to a view depth of 5, but you could make it wider like this: "13x11". + +This setting also affects the default range of the view(), oview(), range(), and orange() procedures. + +If the entire map is small enough to fit on one screen (arbitrarily defined to be 21x21 or less), the default view is automatically adjusted to fit the map. In this case, client.lazy_eye is also automatically turned on by default, since you probably don't want the map to scroll around. + +This controls whether the world advertises itself in the BYOND Hub when it has an open network port for accepting players. The visibility of the world still depends on whether any of the connected players has their location reporter turned on, and that in turn relies on the pager being turned on. + +This section of the reference should help explain some concepts that may be harder to understand or that can use more clarification. + +This is mostly no longer needed. A negative value for plane is the preferred way to do show objects in the background. It can still be used however when you want to rearrange objects in the same plane when using PLANE_MASTER for visual effects. + +`BACKGROUND_LAYER` is a special high value that can be added to the regular layer of any atom. + +The purpose of this value is to make an atom appear below any regular atoms, even if they share the same plane. In an isometric map for instance, HUD objects will always appear above the map, but makeing a HUD object appear behind the map was basically impossible without this feature until `plane` was implemented. + +When using this special layer, it should be added to the layer an atom normally uses. For instance an obj should have a layer of `BACKGROUND_LAYER + OBJ_LAYER`. + +This can be mixed with `TOPDOWN_LAYER` and `EFFECTS_LAYER`, but it will take precedence over both. Anything with `BACKGROUND_LAYER` will always appear below anything without it on the same plane. + +Images or overlays with `FLOAT_LAYER` can be left alone. They will automatically have the same layer as whatever atom they are attached to. + +BYOND allows you to use icons that are not the same size as the tile size defined in world.icon_size. These icons can be manipulated with the /icon datum using their raw, native size, and shown on the map in full size. To use the old behavior where an atom can display only an icon of the normal tile size, use the TILED_ICON_MAP value for map_format instead. + +When you use an icon of non-standard size on an atom, the icon is "anchored" to the southwest corner of the atom. If you are using a top-down view (world.map_format=TOPDOWN_MAP), the icon will appear to spread out further to the east and north. In an isometric map (world.map_format=ISOMETRIC_MAP), the icon will cover additional tiles north and east as well. The "footprint" of an isometric icon--the actual map tiles it covers--is always square, so if your tile size is 64x64 and you use a 128x64 icon, the 128-pixel width means the icon will cover a 2x2 section of map tiles. + +It is important to remember that using a big icon is a visual effect *only*. It will not affect how the atom bumps into other atoms or vice-versa. + +Big icons will affect layering--the order in which icons are drawn. In general, because a big icon is covering more than one tile of the map, it will try to draw above any other tiles in that space that are on the same layer. This way, you can set a turf to use a big icon without having to change the turfs to the north and east. If an atom has a big icon, any overlays and underlays attached to it will be pulled forward as well, so they will draw in front of anything on their same layer. In isometric mode this is about the same, except that the layer isn't that important--anything in the way will just be moved back behind the big icon. + +Note: Big overlays will not "pull forward" on their own. If the main atom uses a single-tile icon, a big overlay attached to it will not try to draw in front of other icons on the same layer. This is so that name labels, health bar overlays, etc. will not cause any odd behavior. To be safe, you should always specify a layer when adding an overlay. + +In isometric mode, layering is affected by the "distance" between the atom and the viewer, so putting a regular-sized icon and part of a big icon on the same tile could cause layering oddities. Tiles that are covered by a big icon will tend to be drawn behind the big icon as mentioned above. For this reason, any atoms whose icons cover more than one tile (the extra height of an isometric icon doesn't count) should always be dense, and you should block movement onto any tile covered by them. + +When manipulating icons with the /icon datum, you can still use Blend() to combine icons of different sizes. By default, the icons will be lined up at their southwest corners. You can change the position at which the second icon is blended. + +A color gradient is a special list that defines a range of colors that you can smoothly interpolate between. A simple example is a gradient from red to white: + + +```dm + +list("red", "white") +// OR +list(0, "red", 1, "white") + +``` + + +Applying a number like 0.2 to this gradient would give you a color that's 20% of the way from red to white. More complex gradients however are also possible. + +The format of a gradient is a list that contains a number (the position along the gradient, from 0 to 1 unless you use values outside that range) followed by a color. You can have as complex a gradient as you like. If you reuse the same number twice in a row, the gradient will have a sudden color change at that point. + +It is also possible to skip numbers or colors, and they will be filled in automatically with the previous number or color. The exceptions are at the beginning and ends of the list; at the end of the gradient, the last color is assigned a number 1 by default, and the first is assigned 0. If you skip colors at the beginning, they will be filled in with the first color you use. + +Include "loop" anywhere in the list to make this a looped gradient. If you don't, any numbers outside the gradient's range will be clamped to that range. E.g., in a normal gradient ranging from 0 to 1, a number of 1.2 is interpreted as 1 without a loop and 0.2 with a loop. + +Here are some more examples: + + +```dm + +// color wheel; ranges 0 to 6 and loops +list(0, "#f00", 1, "#ff0", 2, "#0f0", 3, "#0ff", 4, "#00f", 5, "#f0f", 6, "#f00", "loop") + +// 10% each red, yellow, green, blue, with a 20% transition zone between each +// notice no color follows 0.4 or 0.7, so the previous color is used +list(0.1, "#f00", 0.3, "#ff0", 0.4, 0.6, "#008000", 0.7, 0.9, "#00f") + +// green and black stripes +list(0.5, "#008000", 0.5, "#000000", "loop") + +``` + + +You can also include "space" in the list, and give it an associated value that describes the color space this gradient uses to interpolate between colors. For instance, `"space"=COLORSPACE_HSL` will use HSL interpolation instead of the default RGB. See Color space for more information. + + +```dm + +// color wheel with a different color space +list(0, "#f00", 3, "#0ff", 6, "#f00", "loop", "space"=COLORSPACE_HSLA) + +``` + + +Currently, color gradients are only used by particle effects and the `gradient` proc. With particles, if you use a gradient the particle's color is given as a number, and that number is used to look up its real color from the gradient. The number can change over time, thus changing the particle's color. + +A color matrix is used to transform colors, in the same way that a matrix represented by the `/matrix` datum is used to transform 2D coordinates. A transformation matrix is 3x3, of which only 6 values are needed because the last column is always the same. A color matrix, because it transforms four different numbers instead of two, is 5x5. + +In that formula, values like `rg` mean "red to green", meaning that's the ratio of red in of green out. (The "c" is for "constant".) In an identity matrix, which just produces the original color, the values `rr`, `gg`, `bb`, and `aa` are all 1 and everything else is 0. + +In easier-to-understand terms, this is how the result is calculated: + + +```dm + +new_red = red * rr + green * gr + blue * br + alpha * ar + 255 * cr +new_green = red * rg + green * gg + blue * bg + alpha * ag + 255 * cg +new_blue = red * rb + green * gb + blue * bb + alpha * ab + 255 * cb +new_alpha = red * ra + green * ga + blue * ba + alpha * aa + 255 * ca + +``` + + +It is helpful to think of each row in the matrix as what each component of the original color will become. The first row of the matrix is the rgba value you'll get for each unit of red; the second is what each green becomes, and so on. + +Because the fifth column of the matrix is always the same, only 20 of the values need to be provided. You can use a color matrix with atom.color or client.color in any of the following ways: + +Reading a color var that has been set to a matrix will return the full 20-item list, where every 4 items represent a row in the matrix (without the fifth column). + +In the `MapColors()` icon proc, the values are sent as arguments, not as a list. + +The color filter allows the use of other color spaces for a matrix. In those other color spaces, the matrix calculations work the same but instead of red, green, and blue, they'll be whatever values that color space uses. For instance an HSL color matrix uses hue in place of red, saturation in place of green, and luminance in place of blue. (Alpha is always alpha.) + +The way that works internally is that the shader will convert a color from RGB to the color space used by the matrix, then apply the matrix, then convert back to RGB. + +This is mostly no longer needed. A negative value for plane is the preferred way to do show objects in the background. It can still be used however when you want to rearrange objects in the same plane when using PLANE_MASTER for visual effects. + +`EFFECTS_LAYER` is a special high value that can be added to the regular layer of any atom. + +The purpose of this value is to make an atom appear above any regular atoms. For instance, in an isometric map if you want to display a character's name below them, it does not make much sense to have nearer objects cover up that name, so you can tell the name overlay to use `EFFECTS_LAYER + MOB_LAYER` and it will show up on top of all the normal icons on the map. This has been somewhat obviated by `plane` but may still be useful in some cases. + +When using this special layer, it should be added to the layer an atom normally uses. For instance an obj should have a layer of `EFFECTS_LAYER + OBJ_LAYER`. + +This can be mixed with `TOPDOWN_LAYER`, in non-topdown map formats. Anything in `TOPDOWN_LAYER` will display on top of `EFFECTS_LAYER`, and `TOPDOWN_LAYER + EFFECTS_LAYER` will be above both. + +This can also be mixed with `BACKGROUND_LAYER`, which takes priority over everything else. + +Images or overlays with `FLOAT_LAYER` can be left alone. They will automatically have the same layer as whatever atom they are attached to. + +Filters are a way of adding special effects to an icon, or a group of icons (see `KEEP_TOGETHER` in appearance_flags), by post-processing the image. A filter object describes a specific form of image processing, like for instance a blur or a drop shadow. Filters can be added or removed at will, and can even be animated. + +A filter is created by using the filter proc like so: + + +```dm + +// halo effect +mob.filters += filter(type="drop_shadow", x=0, y=0,\ + size=5, offset=2, color=rgb(255,255,170)) + +``` + + +These are the filters currently supported: + +Uses an icon or render target as a mask over this image. Every pixel that is transparent in either the image or the mask, is transparent in the result. + +The `x` and `y` values can move the mask from its normal position. By default, the mask is centered over the center of the image. + +The `MASK_INVERSE` flag will invert the alpha mask so that opaque areas in the mask become transparent, and vice-versa. There is also a `MASK_SWAP` flag which treats the source image as the mask and vice-versa, which might be useful for some effects. + +Note: Unlike many other filters, this filter **is** taken into account for mouse-hit purposes. + +Blurs the image by a certain amount in a circular formation, as if the image is spinning. The size of the blur can roughly be thought of in "degrees" worth of blur. As the distance from the center increases, the blur becomes more noticeable since the same amount of angular motion has to travel farther along a circle. + +Typically this blur is used with an entire plane, but it could be used to give a sense of motion blur to a spinning object. + +Note: Large blurs will look worse toward the edges due to limited sampling. Loss of accuracy will appear where `size` × distance is greater than about 300. You can increase accuracy by breaking up large sizes into multiple filter passes with differing sizes. The blur used is Gaussian, so combining blur sizes A and B will give a total size of sqrt(A2+B2). + +The `offset` parameter, if used, is effectively subtracted from the pixel distance to the center. Pixels within that radius won't blur. Anything outside that radius will act as if it's `offset` pixels closer to the center. + +Post-processing effect that makes bright colors look like they're a strong light source, spreading their light additively to other nearby pixels. This is a complex effect that involves multiple shader passes. For both performance and visual reasons, it is usually best applied to an entire plane rather than to individual objects. + +The color `threshold` determines which pixels this effect applies to. If any of the red, green, or blue components of the pixel are greater than the same component for the threshold, that pixel will bloom. The blooming pixels then have their colors spread outward to create a glow that gets added to the original image. + +The `offset` and `size` parameters are used to control the glow effect. They work the same as they do in the drop shadow filter: `offset` causes the light to grow outwards, and a blur of `size` is then applied to soften it. Often just using a blur alone will produce a pleasing effect. By playing with these two values you can make the bloom effect appear differently. + +The `alpha` value is applied to any light contributions from bloomed pixels that get added to the original image, so values lower than 255 can make the effect less pronounced. This can be very useful if you choose to animate the filter. + +Blurs the image by a certain amount. The size of the blur can roughly be thought of in "pixels" worth of blur. + + +> [!TIP] +> Note: Large blurs will result in reduced performance. The highest size that can be handled easily in this filter is 6. Higher sizes require multiple passes, although the filter will "cheat" and use low-quality passes for much higher sizes. + +Applies a color matrix to this image. Unlike with the atom.color var, you can apply color conversions other than the regular RGBA color space, depending on the value of `space`. See Color space for more information. + +Uses an icon or render target as a template for various warping effects on the main image. Think of displacement as "pulling" a pixel from an offset location. + +In the displacement map, pixels that have a higher red component will make the image appear to warp to the left, lower reds warp it to the right, and gray (r=128) will cause no horizontal warping. The green component affects the vertical: higher to warp upward, lower to warp downward. Transparent pixels in the displacement map will have no effect. + +This can be used for very complex distortion, unlike other distortion filters such as wave and ripple that are confined to specific equations. + +The optional `FILTER_OVERLAY` flag is supported for the `flags` argument, which will overlay the displaced image onto the original. + +Applies a drop shadow to this image. This is a combination of multiple filters, since it will apply an outline if `offset` is included, a Gaussian blur to the shadow, and will underlay the shadow beneath the image. + +You can also think of this filter as an outer glow. + +If you use a `size` less than 0, the shadow will appear inside the image instead. This would be an inset shadow, or inner glow. + +Composites another image over or under this image. Using the `FILTER_OVERLAY` flag, which is the default, puts the second image on top of what's already here. `FILTER_UNDERLAY` puts it underneath. + +The `x` and `y` values can move the mask from its normal position. By default, the second image is centered over the center of the first. + +The `color`, `transform`, and `blend_mode` vars are available for convenience. Because the bottom image is drawn over a blank background, `blend_mode` is always applied to the top image. All of the other vars apply to the second image being drawn. + +Note: Transforms use default bilinear scaling, since PIXEL_SCALE is not available here. + +Note: Like most other filters, this filter is **not** taken into account for mouse-hit purposes. Any layered icons will be strictly visual. + +Applies Gaussian blur in one direction only. The amount and direction are both specified by `x` and `y`. The size of the blur is equal to `sqrt(x*x + y*y)`. + +See Gaussian blur for more information. + +Applies an outline to this image. + +At larger sizes, the outline is less accurate and will take more passes to produce. Performance and appearance are best at sizes close to 1 or less. + +`flags` can be a combination of the following values: + +Blurs the image by a certain amount outward from the center, as if the image is zooming in or out. As the distance from the center increases, the amount of blurring increases, and near the center the blur is hardly visible at all. The `size` value is smaller by default for this filter than it is for other filters, since it's typically used with an entire plane where the distance from the center can easily be several hundred pixels. + +Typically this blur is used with an entire plane. + +Note: Large blurs will look worse toward the edges due to limited sampling. Loss of accuracy will begin when `size` × distance is greather than 6. You can increase accuracy by breaking up large sizes into multiple filter passes. The blur used is Gaussian, so combining blur sizes A and B will give a total size of sqrt(A2+B2). + +The `offset` parameter, if used, is effectively subtracted from the pixel distance to the center. Pixels within that radius won't blur. Anything outside that radius will act as if it's `offset` pixels closer to the center. + +Draws random rays that radiate outward from a center point. (That point may be outside of the image.) As they move outward, their alpha value diminishes linearly. These are meant to be animated. The `offset` value determines the "time", where every jump of +1 can be a very different set of rays, and every 1000 units this filter will repeat. + +The `threshold` value can be thought of as a way of culling lower-strength rays. Ray strength is anywhere from 0 to 1 at any given angle, but values below `threshold` may as well be 0. Values above that are re-scaled into a range of 0 to 1. + +The `factor` parameter allows you to tie the ray's length to its strength. At 0, the length of every ray is the same. At 1, the length ranges from 0 to `size`. Generally speaking, the higher `factor` is, the more the rays will appear to move outward as they strengthen and inward as they weaken. + +Ray `color` can be provided as a matrix. Only the diagonal values of the color matrix will be used, but using a matrix will allow you to set values outside of the normal color range. + +`flags` can have the following values: + +Applies a ripple distortion effect to this image. + +This filter is meant to be animated. A good animation will typically start at a `radius` of 0 and animate to a larger value, with `size` decreasing to 0. + +The `falloff` parameter can be tweaked to your liking. A value of 1 should look reasonably like ripples in water, with the inner ripples losing strength. A value of 0 will cause no reduction in strength. + +The equation governing the ripple distortion is size × sin(2πr') ÷ (2.5 × falloff × r'2 + 1), where r' = (radius - distance) ÷ repeat. + +Up to 10 ripples can be stacked together in a single pass of the filter, as long as they have the same `repeat`, `falloff`, and `flags` values. (See the wave filter for the `WAVE_BOUNDED` flag.) + +Applies a wave distortion effect to this image. + +The `x` and `y` parameters specify both the direction and period of the wave; the period is `sqrt(x*x + y*y)`. + +This filter is meant to be animated, from whatever `offset` you want to `offset+1`, and then repeating. With multiple waves, you can produce a very convincing water effect. + + +```dm + +#define WAVE_COUNT 7 +atom/proc/WaterEffect() + var/start = filters.len + var/X,Y,rsq,i,f + for(i=1, i<=WAVE_COUNT, ++i) + // choose a wave with a random direction and a period between 10 and 30 pixels + do + X = 60*rand() - 30 + Y = 60*rand() - 30 + rsq = X*X + Y*Y + while(rsq<100 || rsq>900) // keep trying if we don't like the numbers + // keep distortion (size) small, from 0.5 to 3 pixels + // choose a random phase (offset) + filters += filter(type="wave", x=X, y=Y, size=rand()*2.5+0.5, offset=rand()) + for(i=1, i<=WAVE_COUNT, ++i) + // animate phase of each wave from its original phase to phase-1 and then reset; + // this moves the wave forward in the X,Y direction + f = filters[start+i] + animate(f, offset=f:offset, time=0, loop=-1, flags=ANIMATION_PARALLEL) + animate(offset=f:offset-1, time=rand()*20+10) + +``` + + +The equation governing the wave distortion is size × sin(2π(d - offset)), where d is the number of wave periods' distance from the center along the x, y direction. + +The `WAVE_SIDEWAYS` flag will cause the distortion to be transverse (perpendicular) to the wave instead of in the same direction as the wave. The `WAVE_BOUNDED` flag limits the distortion to the confines of this image, instead of lettings its pixels spill out a little further from the distortion (and likewise, transparent pixels spill inward). + +Up to 10 waves can be stacked together in a single pass of the filter, as long as they have the same `WAVE_BOUNDED` flags. + +A generator is an object that can produce a random number, vector (list of 3 numbers), color (as a text string), or color matrix (list of 20 numbers) in a specified range according to rules you set down. It is used primarily for particle effects, since it can run on the client. + +There are several types of generators: + +Generators can also be chained together with math operators and some procs. The second value can be a regular value instead of a generator, so for instance you can multiply a vector by 2, or by a matrix to transform it. + +Gliding is a "glitz" effect applied by BYOND to cover up the visual sins of tile-based movement, by making objects and the map appear to move smoothly from one tile to another instead of immediately jumping. It is also available to smooth over small jumps in pixel movement that might occur, for instance if the client FPS is set higher than the server's. + +To control the gliding speed of an atom, set glide_size to the value of your choice. If this is not set, the client will attempt to adjust the speed manually. glide_size is measured in server ticks, so if client.fps is set to a value greater than world.fps, it will be scaled appropriately. + +Whether an object glides or jumps is based on how far it moves relative to its `step_size` value, which by default is a full tile width. If the movement goes too far past `step_size` in the X or Y directions, it's no longer a glide. + +The `animate_movement` var can be used to control the way in which an object glides, or suppress gliding altogether. + +By using the `LONG_GLIDE` flag in `appearance_flags`, a diagonal glide will take just as long as a cardinal-direction glide by moving a fullt `glide_size` pixels in the dominant X or Y direction. Otherwise, gliding tries to move by that many pixels in strict Euclidean distance (a straight line) and diagonal glides take longer. + + +> [!NOTE] +> In LEGACY_MOVEMENT_MODE, gliding is turned off if you set any of the bound or step vars for an atom to a non-default value. The only gliding that occurs in this case is when client.fps is higher than world.fps. All other movement modes base gliding on an atom's `glide_size` value. + +HUD stands for Heads-Up Display, and refers to any atoms that appear on the screen but don't move when the player moves. These are also called screen objects. Any movable atom can be added to the HUD by setting its `screen_loc` var, and adding it to `client.screen` for each user who is supposed to see it. This can be used to display a character's vital stats, scores, etc. + +If you want to have something like a health meter or name attached to a moving atom, use overlays or `/image` objects instead. An `/image` object is similar to a screen object in that it can be shown to only certain players instead of being shown to everyone. + +The size of the screen depends on `client.view` (or `world.view`), `world.map_format`, and `world.icon_size`. In a normal topdown map format, `client.view` is the same as the screen size; in other map formats the screen might be a different size. + +The `screen_loc` var can be set to a value like `"1,1"` (the southwest tile of the screen), `"4,NORTH"` (fourth tile from the west, along the north side of the screen), `"SOUTHEAST"`, and so on. You can also include pixel offsets, percentages, and specify two corners to tile an icon repeatedly from one end to the other. See screen_loc for more details. + +`screen_loc` can also be used to stretch the bounds of the HUD. A value of `"0,0"` will cause the atom to appear to the southwest of the southwest-most tile on the visible map, outside of the regular map bounds. Using HUDs in this way, you can provide a nice decorative "frame" for your map. + +More complex + +You can use HUDs in other map controls as well, by preceding screen_loc with the name of the map you will use followed by a colon. For instance, `screen_loc="map2:1,1"` will show an icon in the southwest corner of the `map2` control. The actual size of a secondary HUD is based on how far out the icons in it extend in any direction. If you have one icon at `"map2:1,1"` and another at `"map2:4,3"`, then that HUD will be four tiles wide and three high. + +Isometric projection is a form of pseudo-3D in which the 2D icons used by BYOND can be arranged in a way to give the appearance of three dimensions. If you look at a map top-down, each tile on the map is a square. The map is rotated 45° clockwise and then tilted at an angle (30°) so that each square now looks like a foreshortened diamond from the viewer's perspective. What was once north now points to the northeast end of the viewer's screen; what was once east now points southeast to the viewer. Tiles that are more to the south or east are "nearer" to the viewer, and tiles that are north or west are "farther". The actual direction the map faces can be changed by using `client.dir`. + +It is important to remember that this is an illusion of 3D, not real 3D. + +To use isometric mapping, set `world.map_format` to `ISOMETRIC_MAP`. You should set `world.icon_size` so the tile width is a multiple of 4 pixels. The width of the tile is highly important. The height of your tiles should be at least half that value. BYOND uses a 2:1 isometric format, meaning that the diamond base of each tile is half as high as its width. For example if you have a 64x64 tile size, every diamond in the map will be 64 pixels wide by 32 high, and you have an extra 32 pixels at the top of your icon for vertical projections like buildings. If you set the tile size to 64x80, the base is still a 64x32 diamond and you have 48 pixels left over for vertical structures. + +In this mode `pixel_x` and `pixel_y` will offset icons along the "ground". To adjust horizontal and vertical positions, use the `pixel_w` and `pixel_z` vars. + +The `layer` var behaves differently in isometric mode. Because some tiles are nearer to the viewer than others, the tiles that are farther back need to be drawn first so they are behind any tiles that should go in front of them. So in isometric mode, the back row of tiles (a diagonal line of them) is drawn first, followed by the next row forward, and so on. The `layer` var only matters when icons overlap each other in the "physical" space, like an obj sitting on a turf. + +When pixel or step offsets, or gliding, place an object on multiple turfs, it is drawn on top of the nearer turf (assuming its layer is higher). + +Using icons wider than the regular tile size can have an impact on layering as well. See Big icons for more information. + +Because of the order in which icons are drawn, you may want to limit the ability of an atom to cut diagonally around corners. While moving northeast behind a dense wall, for instance, a mob might temporarily appear in front of the wall because its pixel offsets (from gliding) temporarily put it on the same tile as the wall. If you do not want to limit corner-cutting, a simple workaround for this case is to give the wall a higher layer than the mob. + +Screen objects (in `client.screen`) are always drawn on top of all isometric tiles, as is the case in other map modes as well. + +Since it may be desirable in some games to use a topdown map for some situations (like a special battle map), you can add `TOPDOWN_LAYER` to any atom's layer—e.g., `TOPDOWN_LAYER+TURF_LAYER`—to make it appear in topdown mode. Topdown and isometric tiles really aren't meant to be mixed, but if they do mix you'll see topdown tiles always display above isometric tiles, just like screen objects do. The best way to use this is to apply `TOPDOWN_LAYER` to every tile in a certain part of the map that the players can't walk to. + +If you want to use an overlay that should not be covered by other "nearer" icons on the map, such as a name or health meter, you can add `EFFECTS_LAYER` to the overlay's layer. Icons with `EFFECTS_LAYER` will draw above regular icons. Then objects with `TOPDOWN_LAYER` will draw on top of everything else. However, be aware that `EFFECTS_LAYER` has largely been superseded by the `plane` var. + +In this mode, `world.view` or `client.view` is used to define the minimum number of map tiles you will see, *not* the screen/HUD size which is calculated from client.view. Extra map tiles are shown to fill out the screen size. HUD objects use screen coordinates, so 1,1 is still the lower left. + +The actual HUD size is always a full number of tiles, whose size is defined by `world.icon_size`. If you have a tile size of `64x64`, and `world.view=6` (a 13x13 map), a full 13x13 diamond of map tiles will be shown. The width of this diamond is 13 tiles. The height is only half that, plus whatever vertical space is needed to show the icons in that area. Then everything is rounded up to a full tile size, so the result is a 13x7-tile screen. This is the formula you need if you want to calculate the screen size: + + +```dm + +pixel_width = round(icon_width * (view_width + view_height) / 2) +pixel_height = round(icon_width * (view_width + view_height - 2) / 4) + icon_height + +screen_width = round((pixel_width + icon_width - 1) / icon_width) +screen_height = round((pixel_height + icon_height - 1) / icon_height) + +``` + + +If you use `TOPDOWN_LAYER`, any topdown sections of the map will be limited to this same view. + +In DM, all numbers are stored in floating point format. Specifically, single-precision (32-bit) floating point. This is important to know if you think you will be working with large numbers or decimal values a lot, because the accuracy of the numbers is limited. + +32-bit floating point numbers can represent integers from -16777216 to 16777216 (224). Non-integer values can get about as small as 2-126 and as large as 2127. + +Floating point numbers do not handle most decimal values precisely. For instance, 0.1 is not exactly 0.1, because floating point numbers are stored in a binary format and in binary, 1/10 is a fraction that repeats forever—the same way 1/3 repeats as 0.33333... in decimal numbers. It ends up being rounded off, either a little higher or a littler lower than its true value. This means that the following loop won't work like you might expect: + + +```dm + +for(i = 0, i < 100, i += 0.1) + world << i + +``` + + +You might expect that code to loop exactly 1000 times, with `i` going from 0 up to 99.9 before stopping. The truth is more complicated, because 0.1 stored in floating point is actually greater than the exact value of 0.1. Other values might be more or less than their exact numbers, and as you add these numbers together repeatedly you'll introduce more and more rounding error. + +Even more insidious, if you add 0.1 a bunch of times starting from 0, and then subtract it out again the same number of times, the result you get may not be 0. This is counterintuitive, because you might expect rounding errors to reverse themselves in the same order they crept in. Unfortunately it doesn't work that way. + +You can correct for rounding error somewhat by using the `round` proc to adjust the loop var each time, although for performance reasons it might be preferable to find another alternative. + + +```dm + +for(i = 0, i < 100, i = round(i + 0.1, 0.1)) + world << i + +``` + + +Only fractions whose denominators are powers of 2 are immune to this rounding error, so 0.5 is in fact stored as an exact value. + +Another place floating point may lose accuracy is when you try to add numbers of very different sizes. For instance as stated above, the upper limit for accurate integers is 16777216. If you try to use a number such as 100 million it will only be approximate, so adding 1 to that number won't actually change it because the 1 is so much smaller, it will be gobbled up by rounding error. + +Also for the same reasons stated above, division will cost you accuracy. Again you can divide by powers of 2 easily enough, and you can divide an integer by any of its factors (like dividing 9 by 3) without a problem, but a fraction like 1/3 will repeat forever so it gets rounded to as much precision as floating point can manage. + +In decimal, floating point numbers have at least six decimal digits of precision. Since they're actually stored in binary, their true precision is exactly 24 bits. + +A particle set is a special effect, whose computations are handled entirely on the client, that spawns and tracks multiple pixels or icons with a temporary lifespan. Examples of this might be confetti, sparks, rocket exhaust, or rain or snow. Particles are rendered on a special surface and that gets attached to an obj or a mob like an overlay. + +Particles can exist in 3 dimensions instead of the usual 2, so a particle's position, velocity, and other values may have a z coordinate. To make use of this z coordinate, you can use a projection matrix. (The value of the z coordinate must be between -100 and 100 after projection. Otherwise it's not guaranteed the particle will be displayed.) + +To create a particle set, use `new` to create a new `/particles` datum, and then you can set the datum's vars. The vars can be set to constant values, or generator functions that will allow the client to choose from a range of values when spawning those particles. (The easiest way to handle this is to create your own type that inherits from `/particles`, and set up the parameters you'll want at compile-time.) + +After the datum is created, it can be assigned to an obj or mob using their `particles` var. The particles will appear on the map wherever that obj or mob appears. + + +```dm + +particles/snow + width = 500 // 500 x 500 image to cover a moderately sized map + height = 500 + count = 2500 // 2500 particles + spawning = 12 // 12 new particles per 0.1s + bound1 = vector(-1000, -300, -1000) // end particles at Y=-300 + lifespan = 600 // live for 60s max + fade = 50 // fade out over the last 5s if still on screen + // spawn within a certain x,y,z space + position = generator("box", vector(-300,250,0), vector(300,300,50)) + // control how the snow falls + gravity = vector(0, -1) + friction = 0.3 // shed 30% of velocity and drift every 0.1s + drift = generator("sphere", 0, 2) +obj/snow + screen_loc = "CENTER" + particles = new/particles/snow + +mob + proc/CreateSnow() + client?.screen += new/obj/snow + +``` + + +These are the vars that can be used in a particle set. "Tick" refers to a BYOND standard tick of 0.1s. + +The `icon` and `icon_state` values are special in that they can't be assigned a generator, but they can be assigned a constant icon or string, respectively, or a list of possible values to choose from like so: + + +```dm +icon = list('confetti.dmi'=5, 'coin.dmi'=1) +``` + + +The list used can either be a simple list, or it can contain weights as shown above. + +Changing a var on a particle datum will make changes to future particles. For instance, you can set the datum's `spawning` var to 0 to make it stop creating new particles. (Note: If you are changing a vector or color matrix, such as `gravity`, you need to assign a new value. You can't for instance set `particles.gravity[2] = 0` because it won't do anything to update the particle stream.) + +The same particle datum can be assigned to more than one movable atom. However the particles displayed by each atom will be different. + +If you want to spawn particles at specific times, you can use the client `.add-particles` command. From the server, you can run this command via winset(). + + +```dm + +// spawn 100 particles for src's particle set right now +winset(player, null, list(command=".add-particles \ref[src] 100")) + +``` + + +Pixel movement is a concept that allows atoms to escape the constraints of BYOND's historically tile-based movement, and move in smaller steps. In the past this had to be done with soft code, but that was sometimes inconvenient and it did not perform as well in projects with many objects moving. + +The key to understanding pixel movement is to use the bound and step vars. You use the bound family of vars to define a bounding box for a movable atom, instead of just making it one full tile in size. The step vars can give it a movement speed and offset it from the corner of the tile it's standing on. + +Those are for movable atoms only; they do not apply to turfs. + +If world.movement_mode is set to `TILED_MOVEMENT_MODE`, all movable atoms must be aligned to the tile grid: their step_x/y/size values must be multiples of the icon size, and their bounds must also land on tile boundaries although the atom can be bigger than one tile. In other movement modes you can specify that only specific atoms use this behavior, by giving them the TILE_MOVER appearance flag. + +**Left:** The bounding box (blue) is the only part of the mob that actually collides with anything. By default, it would cover the whole turf (brown). Any turfs covered by the bounding box are in the mob's locs var. **Right:** The atom's true position (shaded) is offset from the turf by step_x and step_y. + +As an example, if your players' mobs have icons that only cover the center 24×24 pixels of a regular 32×32 icon, then you would set the mobs' bound_x and bound_y to 4--because there are 4 pixels unused to the left and bottom--and bound_width and bound_height to 24. + +The mob's physical location on the map depends on four things: Its loc, its step_x/y values, its bound_x/y values, and its bound_width/height. The lower left corner of the bounding box, relative to the turf the mob is actually standing on, begins at step_x+bound_x on the left and step_y+bound_y on the bottom. + +The physical position of the bounding box is **not affected** by the pixel_x/y/z vars. Those are still strictly visual offsets. + +The turfs the mob is covering can be read from the read-only locs var. The mob will also appear in the contents of those turfs. + +Note: This means if an atom is in a turf's contents, its loc is *not necessarily* that turf. The contents list is made to include "overhangers" from another tile for ease of use. + +All of the step and walk procs have been upgraded to take an additional argument, which is the speed at which the atom should move. If that argument is left out, the atom's own step_size is used by default. The step_size determines how fast the step_x and step_y values will change when moving. + +Move() has two new arguments that handle the position change gracefully. These are the step_x and step_y values for the target location. + +Pixel movement changes the behavior of the Move() proc, because a lot of things are possible that were not possible when BYOND only supported moving one tile at a time. For starters, a Move() is either a "slide" or a "jump" depending on the distance. A slide is when the move can be stopped partway; a jump is strictly pass/fail. Anything greater than one tile *and* the mover's regular step_size is considered a jump. Changing z levels is also a jump, as is moving to/from a non-turf. + +If step_x and step_y aren't within a good range, the new loc and the step_x/y values may be changed so that the southwest corner of the mover's bounding box is standing on its actual loc, or as close to it as possible. + +Enter() and Exit() can be called for several turfs and/or areas, not just one at a time. It is also possible for them not to be called at all, if the moving atom moves within a turf but doesn't cross a new turf boundary. Enter() and Exit() are only called when first attempting to enter or fully exit. The behavior of these procs depends on world.movement_mode; in legacy mode, they look at some of the contents of the turfs as well as the turfs themselves, to preserve behavior found in older BYOND versions. + +Cross() and Uncross() are the equivalent of Enter() and Exit() but apply to objects the mover will either overlap or stop overlapping. (For turfs, Enter() and Exit() call these procs by default, since the mover is both stepping *into* and *onto* a turf.) Likewise Crossed() and Uncrossed() are the equivalents of Entered() and Exited(). + +If an atom is sliding, its movement can be halted if it encounters an obstacle partway along its route. Bump() will still be called for any obstacles the atom runs into, but Move() will return the number of pixels moved (the most in any direction). When sliding at a speed so fast that the distance is bigger than the atom itself, the move will be split up into several smaller slides to avoid skipping over any obstacles. + +Gliding, which is used to show smooth movement between atoms in tile movement, is mostly not used in pixel movement. It only applies when the client uses a higher fps than the server. + +The bounds() and obounds() procs have been added to grab a list of atoms within a given bounding box. That box can be relative to an atom, or in absolute coordinates. + +bounds_dist() tells the distance between two atoms, in pixels. If it is positive, that is the minimum distance the atoms would have to traverse to be touching. At 0, they are touching but not in collision. A negative value means the two atoms are in collision. + +Note: Currently this feature applies only to particle effects, using the `transform` var. + +Normally icons in BYOND can only be transformed in 2D, using a simple 3x3 matrix. This is represented by the `/matrix` object, which cuts off the last column because it isn't used. However particles can have coordinates in x, y, and z, and the whole particle set can be given a transformation matrix that handles all three dimensions. + +The easiest transformation for particles is a simple 2D one, which you can do by setting the particle datum's `transform` var to a `/matrix` object. + +When an x,y point is multiplied by the matrix, it becomes the new point x',y'. This is equivalent to: + +This is called an **affine transform** because all the operations are "linear" in math terms. (That is, every term in the formula above has a single variable, not raised to a higher power than 1.) + +3D affine transforms of this type are also affine transformations. There is no special object for this so a list is used (see below). + +The way to read the vars above is that the first letter says what input component is being transformed (x,y,z, or c for "constant"), and the second letter is the output component. + +To use this kind of matrix, you can cut off the 4th column and provide the values in a list form, in row-major order: + + +```dm +list(xx,xy,xz, yx,yy,yz, zx,zy,zz, cx,cy,cz) +``` + + +Note the 4th row is also optional. + +This is the most interesting matrix, since if you use all 4 columns you're actually altering an "axis" called w. This isn't a real axis, but is just a number that the resulting vector will be divided by. + +In a regular affine transform, w always stays at 1. In projection you can think of w as a distance from the "camera". 1 is where objects are their "normal" size. If you make the z value affect w' by setting zw, you basically make an object look smaller at higher z values. + +This is a simple projection matrix where x,y,z are left untouched, but there's a projection effect. The "D" value is how far away the "camera" is from z=0, so a point at z=D looks like it's twice as far away. + +This 4x4 matrix is handled as a list just like the 3x4 affine matrix: + + +```dm +list(xx,xy,xz,xw, yx,yy,yz,yw, zx,zy,zz,zw, wx,wy,wz,ww) +``` + + +Regular expressions are patterns that can be searched for within a text string, instead of searching for an exact match to a known piece of text. They are much more versatile for find and replace operations, and therefore useful for parsing, filtering, etc. + +Some example regular expressions are: + +These are some of the patterns you can use. If you want to use any of the operators as an actual character, it must be escaped with a backslash. + +It is highly recommended that you use raw strings like @"..." for your regular expression patterns, because with a regular DM string you have to escape all backslash \ and open bracket [ characters, which will make your regular expression much harder for you to read. It's easier to write @"[\d]\n" than "\[\\d]\\n". + +The optional flags can be any combination of these: + +After calling `Find()` on a `/regex` datum, the datum's `group` var will contain a list—if applicable—of any sub-patterns found with the `()` parentheses operator. For instance, searching the string `"123"` for `1(\d)(\d)` will match `"123"`, and the `group` var will be `list("2","3")`. Groups can also be used in replacement expressions; see the Replace() proc for more details. + +To get the most out of BYOND's visual effects, it helps to understand how the map is displayed. + +Every atom has an appearance that holds all of its visual info (and sometimes a little non-visual info). This appearance has to be turned into sprites in order to be rendered. + +Although many atoms need little more than a simple icon and icon_state and produce only a single sprite, some are more complex with overlays, underlays, maptext, etc. Also there may be image objects and visual contents involved, although they're not part of the atom's appearance. + +For a simple `icon` and `icon_state`, just one sprite is generated. The client looks up the icon it's given. Then it looks up an icon state, which may be influenced by whether the atom is moving or not since you can have moving and non-moving icon states. Then it determines which direction to draw and which frame of the icon's animation (if any) to use. + +So with several simple icons, and not worrying about layers for now, a list of sprites lays out like this: + +Now let's consider what happens when an appearance has overlays. + +The underlays list is processed first, then overlays. These lists contain appearances themselves, rather than actual atoms. This means that overlays are recursive: an overlay can have overlays itself. To picture how that works, just replace one of the overlays above with another list. + +Any atom can have an image object attached, which can be shown to only specific players. Most atoms, and image objects, can have visual contents that display other atoms as if they're overlays. + +As you see this is very similar to overlays. Just like overlays, image objects and visual contents have appearances of their own (and may also have their own images or visual contents), so this may be recursive as they add new overlays, etc. + +A couple of things to keep in mind: + +Any appearance may have maptext attached. That maptext draws above the icon but is grouped with it. That grouping will be discussed further below. + +Particle effects also get grouped with the main icon in a similar way to maptext. + +For simplicity, from this point forward the diagram will just treat underlays, overlays, image objects, and visual contents as overlays. + +An appearance's color and alpha vars (from here forwarded they'll just be referred to by `color`) and transform are inherited by any overlays, which also includes images and visual contents. You can avoid that inheritance by giving those overlays special appearance_flags: `RESET_COLOR`, `RESET_ALPHA`, and `RESET_TRANSFORM`. + +The appearance's filters are only applied to the main icon. + +When `color` and `transform` are inherited, they "stack". The inherited color and transform values are applied after those of the overlays. + +There are times it's desirable for an appearance and all its overlays to be treated as a single unit so any colors or filters can be applied all at once. One simple example is if the appearance has an `alpha` of 128 to make it translucent, you probably want to draw the whole atom faded instead of drawing each sprite faded, one on top of the other. + +By using the `KEEP_TOGETHER` value in appearance_flags (called KT for short), an appearance will group all of its underlays and overlays together. If this is an atom with image objects and visual contents, those will be grouped with it as well. + +With `KEEP_TOGETHER` all of these sprites are rendered to a temporary drawing surface, and then the main appearance's `color`, `transform`, and `filters` are all applied to the combined drawing. This comes with a trade-off, since you can no longer use flags such as `RESET_COLOR` to opt out of inheritance. + +If an overlay doesn't want to be part of a KT group, it can use the `KEEP_APART` flag (KA for short). If there are multiple nested KT groups, KA will only escape the innermost group. + +If an overlay inside a KT group has a different plane than the group's owner, it will be separated as if it defined `KEEP_APART`, except it can escape multiple nested groups. + +Any appearance can have a layer or plane, and these influence how it gets sorted. (There's also a concept called a "sub-plane" that's influenced by whether an atom is a HUD/screen object or special layers like BACKGROUND_LAYER.) + +If a sprite is created with `FLOAT_LAYER` (any negative value counts as a floating layer) its layer has to be resolved, or "unfloated". The main sprite for an atom can never float; it has to have a real layer. Its overlays and underlays with floating layers will reorder themselves in numerical order, then look for the next closest sprites in the rendering list that has a non-negative layer. + +A similar process happens with `FLOAT_PLANE`. Planes can have negative values but `FLOAT_PLANE` and the values close to it are special. Sprites with floating planes have to resolve those as well. + +Once all atoms that will appear on the map are assembled into a rendering list of sprites, the order in which they're rendered on the map is determined in this order: + +In a typical topdown map, `layer` is basically all that matters after the plane and subplane are taken into account. There is a legacy concept called micro-layers that helps break ties between sprites with the same layer; for instance if an atom is moving it's usually desirable to draw it above other atoms with the same layer; this applies only to topdown maps. + +Sometimes it's helpful to group multiple sprites on one plane as if the plane itself were a KT group. For this, appearance_flags has a value called `PLANE_MASTER`. An object with this flag will act as a "parent" for everything else on the plane. All other sprites on the plane will be grouped together and rendered on a temporary drawing surface, and then the plane master's `color`, `transform`, and `filters` will be applied. + +A plane master does not, however, get an icon or maptext of its own; they're simply ignored. It can have overlays added to the group. + +There are other topics not covered in this article, such as render targets and special map formats. Any details on how those features impact rendering are discussed in their own articles. + +The side-view map format is used for 3/4 perspective, where the map is basically similar to a top-down view but is usually foreshortened. Just like with isometric projection, tiles that are closer to the bottom of the screen are considered to be closer to the viewer. This is a form of pseudo-3D in which the 2D icons used by BYOND can be arranged in a way to give the appearance of three dimensions. + +It is important to remember that this is an illusion of 3D, not real 3D. + +The `layer` var behaves much the same way it does in `ISOMETRIC_MAP` mode.See isometric maps for more information. + +When using this mode you may want to use a foreshortened `world.icon_size`, like a 32x24 format instead of 32x32 for example, and use taller icons for any vertical structures like walls or buildings. If you set `world.icon_size` to use foreshortening, then `pixel_y` (or `pixel_x`, depending on the orientation of client.dir) will be adjusted for you; the same applies to `step_x` and `step_y`. For example, with `world.icon_size` set to `"64x32"`, the *physical* tile—what you would see if you were to look at it straight down from above— is considered to be 64x64, so you would need `pixel_y=64` or `step_y=64` to offset by a whole tile. This adjustment does not apply to screen objects, `pixel_w`, or `pixel_z`. + +In BYOND 3.0, any file like a large .bmp would be treated like a regular icon that had been broken up into several tile-sized icon states. All tiles then were 32x32 pixels. An image that was 100x100 would therefore take at least 4x4 tiles to display. The icon was padded to the right and the top with blank space to become an even multiple of 32x32, and then broken up into sections. The lower left section was given an icon_state of `"0,0"`, the next to the right was `"1,0"`, and so on, up to the upper right which was `"3,3"`. Another icon state, a 32x32 thumbnail of the big image, was also included. + +BYOND 4.0 expanded on this concept by allowing icons to be defined that had individual graphics bigger than 32x32, and it would break each one up into tiles just like 3.0 did. If an icon had a state called `"open"` then it might break down into `"open 0,0"`, `"open 1,0"`, and so on, while the actual `"open"` state would be a thumbnail image. To show the whole image, you would have to have a separate atom or overlay for each individual tile. + +In newer versions, breaking big icons into tiles is no longer done by default. Instead, icons are shown and manipulated in their native size. To use the old method of breaking icons into tiles, set `world.map_format` to `TILED_ICON_MAP`. This is the default for all projects compiled before version 455. + +When using tiled icons, there are some important things to note: + +This example shows a big icon being applied to an atom in tiled mode, as overlays: + + +```dm + +// icon is 3 tiles wide by 2 high +icon_state = "0,0" + +// A temporary object used for the overlays +var/obj/O = new +O.icon = icon +O.layer = FLOAT_LAYER + +for(var/tile_y=0, tile_y<2, ++tile_y) + for(var/tile_x=0, tile_x<3, ++tile_x) + if(tile_x && tile_y) + O.pixel_x = tile_x * 32 + O.pixel_y = tile_y * 32 + O.icon_state = "[tile_x],[tile_y]" + overlays += O + +``` + + +By default, BYOND displays all maps in top-down format, so `world.map_format` is set to `TOPDOWN_MAP` unless you say otherwise. This view means players are looking down on the map, and "north" corresponds to the top of their screen. (This can be changed by setting `client.dir`.) + +A related map_format, used by older games, is `TILED_ICON_MAP`. This is also topdown but it handles icons differently. + +In this form, the `layer` var behaves exactly as you would expect: Icons with a lower layer are drawn beneath icons with a higher layer. The only exception is when you use big icons, which will be drawn above any other icons on the same layer. Also an atom's underlays will be drawn behind it unless their layer is changed, and its overlays will draw in front of it unless otherwise stated. + +Topdown mode also guarantees that `world.view` or `client.view` will set the exact screen size used by the HUD, except for HUD objects that appear outside of the normal bounds. + +Screen objects (also called the HUD) cannot be intermixed with topdown icons. They will appear on top of other icons, unless using a lower plane or a special layer like `BACKGROUND_LAYER`. + +TOPDOWN_LAYER is a special high value that can be added to the regular layer of any atom. This is only available when using a non-topdown world.map_format, such as isometric mapping. + +The purpose of this value is to make an atom appear as if it belongs in a top-down map, when using a map_format other than TOPDOWN_MAP or TILED_ICON_MAP. This can be handy for title screens, or for special battle maps or the inside of a building in an RPG. + +When using this special layer, it should be added to the layer an atom normally uses. For instance a turf should have a layer of TOPDOWN_LAYER + TURF_LAYER. Usually you will want one part of the map to have TOPDOWN_LAYER, and for players to be unable to walk to there from the regular map. Mixing topdown icons and icons in the normal map_format in view of each other could look very strange. For safety's sake, the easiest thing to do is to keep them on separate z layers. + +This can be mixed with EFFECTS_LAYER. Anything in TOPDOWN_LAYER will display on top of EFFECTS_LAYER, and TOPDOWN_LAYER + EFFECTS_LAYER will be above both. + +This can also be mixed with BACKGROUND_LAYER, which takes priority over everything else. + +Images or overlays with FLOAT_LAYER can be left alone. They will automatically have the same layer as whatever atom they are attached to. + +BYOND was originally written to handle 8-bit ("ANSI") characters only. However as time has marched on, Unicode has become ubiquitous for supporting multiple languages, special characters, and emojis. To adapt to this, BYOND now supports Unicode. + +When ANSI was king, every character was exactly one byte in width, because the only valid characters were between 1 and 255. (And technically, BYOND reserved 255 for its own use.) Now, BYOND uses an encoding called UTF-8 to store characters that can't fit in one byte. + +UTF-8 breaks up characters with codes of 128 or higher into multiple bytes, like so: + +Importantly, BYOND's text procs are based on the byte position, not the character position which may be lower. In other words, `length("abcdéfg")` is greater than 7; it's 8, because `é` takes up 2 bytes in UTF-8. That also means `f` is at position 7, not position 6. + +Why do the text procs work with byte position instead of character position? Because ultimately, it's faster. Going by character position would require counting every byte in a string (at least when it uses UTF-8) until the right character position was found. This would be detrimental to performance in most cases. + +For the most part, this distinction should be fairly invisible to you. Most code isn't going to encounter problems, but if you do a lot of text processing you should be aware of it. + +In particular, text2ascii() returns the Unicode value at a specific position, which may cover several bytes. If you loop through a string calling this proc for each character, you'll have to make adjustments for cases when multiple bytes have been read. + +The read-only `[]` index operator also uses byte positions. + +If you read a byte or cut text at an inappropriate point, any broken characters resulting from the cut will be turned into the Unicode replacement character � which is 0xFFFD. + +Most of the text handling procs have slower `_char` versions (e.g., `copytext_char`) that use character positions instead of byte positions. + +These should be used sparingly if at all; whenever it's possible to use byte positions, you should. When you do use a `_char` version of a proc, prefer using `-offset` instead of `length_char(text)-offset` for positions near the end of the string. Most text procs allow negative position values that count backwards from the end, and counting a small number of characters backward is faster than counting a lot of characters going forward. + +Code written in ANSI will be up-converted to UTF-8 by Dream Maker, based on your current locale when the code is loaded. + +BYOND games used to have very limited interface options, all effectively sharing the same layout. In BYOND 4.0, skins were introduced, allowing developers more control over the layout. + +A skin consists of macro sets for keyboard/gamepad input, menus, and windows and/or panes. All of these are considered controls that a game can interact with via winset(), winget(), output(), and a few other procs. + +About the simplest possible skin is a single window with a single map control, and a single macro set. + +Several commands can be executed on the client that are not verbs, but instructions for Dream Seeker. Some of these commands have detailed syntax described in their own reference entries. + +Client commands have a special syntax that allows you to query information from the skin and include it directly in the command, as if you had called winget(). Embedded expressions look like `[[*expression*]]` in your command text. Some commands have built-in data that gets filled in via `[[*]]`. See embedded winget for more information. + +Immediately spawns a batch of particles for a known particle set. + +The object parameter is a reference string for the object that holds the particles. + +A negative count is allowed, which will absorb some ordinary particle spawns. + +If the object isn't known to the client, nothing will happen. + +Sends output to a control. The text does not need quotes, but any backslashes, newlines, and tabs should be escaped with a backslash. This works similarly to the `output()` proc. If text is omitted, the control is cleared. + +Here is an example of using a map control's on-status event to set a label rather than using the window's own statusbar. + +Plays, stops, or modifies a sound. This command can be used for instance to play a click sound when using mouse macros, for instance, without waiting for the server to initiate the sound which would introduce a small delay. + +The file can be `none` or `-` when updating or stopping a sound. Any options should be separated by spaces; most are in a `name=value` format, as seen below. + +Supported options are: + +**T* represents a true/false value. True values include `true`, `on`, or 1. False would be `false`, `off`, or 0. + +Sets skin parameters like the `winset()` proc. You can set more than one parameter by separating them with semicolons. + +This command also allows you to use conditional expressions, like so: + +The condition is the same as any other parameter you might use in `.winset`, but instead of setting the parameter, it checks to see if it's true. If so, then the parameters in `choice1` will be set. Otherwise, the parameters in `choice2` are set. This example makes the window background red if bigbutton is checked. + +If you want to look for values that don't match instead of values that do, use `!=` instead of `=` in the condition. + +The `choice2` item is optional. + +Because it's often useful to do more than one thing at a time, `choice1` and `choice2` don't have to be just one parameter. You can use multiple parameters, but they are separated with a space instead of a semicolon. (A semicolon indicates the conditional expression is over.) + +Commands that are initiated by the skin (like button.command, map.on-show, etc.) have a special syntax that allows you to include information that would normally require a winget call. By including `[[*something*]]` in the command, the double-bracketed text will be replaced by the result of running a winget on that parameter. + +A value of `[[id.parameter]]` will run a winget on the control with the given ID. Just using `[[parameter]]` will run a winget for the control that initiated this command. You can also use `parent` in place of the ID to do something with the parent of the control, or `parent.id` for access to a sibling control. Position and size parameters can be further broken down by appending `.x` or `.y` to get at the numbers directly. + +Several commands already support some special cases like `[[*]]` or `[[width]]` or such, where the special-case values are relevant to the command. An example is that in `on-size` the value of `[[*]]` is a size value. The Any macro, gamepad macros, and mouse macros, also support this syntax; see macros for more info. + +You can choose how embedded wingets get formatted by following the value with `as` and a type, such as `[[window.size as string]]`. There are several types you can use, and different types of parameters get formatted differently: + +The `arg` type is the default, unless the `[[`*...*`]]` expression has double quotes on both sides, in which case `escaped` is the default. + +Controls can be created or deleted at runtime. (Only controls you created during runtime may be deleted.) To create a control, call winset() using the id of the new control, and the parameter list should include type, parent, and probably also pos, size, and any anchors. + +To delete the control again, set its `parent` to a blank value. + +Menu items and macros work similarly, except they have no positional info. For those, the name parameter is important when you create them, and you will either need command or (for macros) map-to to do anything with them. + +A progress bar or interactive slider. This can be made to use several different orientations. Its `value` can be read or set as a percentage from 0 to 100. + +A browser panel integrated into the skin. + +Browsers are capable of displaying HTML documents, and can also interact with the skin. + +A longstanding behavior of BYOND is the ability to create a new browser window by sending an extra argument to the browse() proc. Since the advent of skins in BYOND 4.0, this behavior was kept. When you create a new browser popup, the window name you specify for the popup is used for the name of a new window control, and within that window there will be a new browser control simply called `browser`. + +If you want to interact with the new browser, its full "decorated" id is `*windowname*.browser`. + +Sending output() to a browser will send a document to display there, but if you follow the browser's control name with a colon and a function name, you can call a JavaScript function in the document displayed within that browser. + + +```dm + +var/list/info = list("name"="fridge", "power"=12) +// send {"name":"fridge","power":12} to a JavaScript function +usr << output(url_encode(json_encode(info)), "mybrowser:myJSfunction") + +``` + + +The text that you send as output will be parsed like URL parameters, where mutliple arguments to the function are separated by `&` or `;`, which is why url_encode() is wrapped around the json_encode() call in this example. + +These topics cover more advanced uses of the browser control. + +The BYOND object is a built-in shortcut for interacting with the client via JavaScript in a browser control. It contains the following methods: + +Performs a winset, where `id` is the ID of the control to change (or null for global settings), and `params` is an object with parameter,value pairs such as `{"text-color": "red"}`. Parameters can use camelCase, where a capital letter indicates where a hyphen would normally go, e.g. `"textColor"` and `"text-color"` are the same. + + +```dm + +// uncheck a button from JavaScript +BYOND.winset("inventory_button", {isChecked: false}); + +``` + + +Sends a winget, where `id` is the ID of the control to retrieve (or null for global settings), and `props` is a single property or an array of properties to retrieve. As with `winset`, camelCase is allowed, but the result will not use camelCase. + +Returns a Promise object, so this call can be used with the `await` keyword or followed by `then()`. The result inside the promise is an object with parameter,value pairs, such as `{"background-color": {value: "#ff0000", red: 255, green: 0, blue: 0, isDefault: false}}`. + + +```dm + +// get a button's status JavaScript +let buttonData = await BYOND.winget("inventory_button", "isChecked"); +if(buttonData["is-checked"]) { + alert("The button is checked!"); +} + +``` + + +Initiates a client command. This is basically just a shortcut for using `winset` to run a command. + + +```dm + +// play a sound +BYOND.command(".sound 'ding.ogg'"); + +``` + + +A replacement for `localStorage` that can be used to hold information for reuse in later sessions of the same game. (This must be enabled via `browser-options` with the `winset()` proc.) + +There are three actual storage objects you can use: + +Interacting with these storage objects is done in JavaScript, the same way you would use `localStorage` or `sessionStorage`. + +Note: Technically `localStorage` does work, but because of the way BYOND handles browser controls it acts more like `sessionStorage` in practice. + +Browser controls can interact with the skin via JavaScript, by setting `window.location` to a special URL. + +This works like an ordinary winset() call from the server. If `id` is omitted, it's the same as a winset with a null ID. You can also leave the `id` blank if you use "fully decorated" property names such as `mybutton.is-checked` instead of just `is-checked`. + +Any text you use other than letters, numbers, hyphens, commas, and periods should be encoded via the `encodeURIComponent()` function in JavaScript. + +In this winget, the IDs and properties you want can be separated by commas if you want to retrieve more than one. The winget operation works via a callback function you must define in JavaScript. The callback is given just one argument, a JavaScript object with all of the properties you requested. For example, this URL: + +...might send this to the callback function `wgcb`: + +The property names will be in the same format you would expect from winget(), so when you're looking at multiple elements' properties, you'll get the full names in `id.property` format. The values are always sent back in a convenient form for JavaScript to work with; in the case of size, position, and color these will always be objects. + +An optional `control` parameter for the winget call can be used if you want to send data to a callback in a different browser control. + +A button that can be pressed to run a command, or possibly toggled. + +A container that can hold one or two panes. If it holds two panes, a splitter may appear between them. This control can therefore be used to subdivide a window or pane into smaller units. + +A grid that contains multiple cells that can show various kinds of output data. + +Sending output to a grid looks like this: + + +```dm + +// output to column 3, row 2 +winset(usr, "thegrid", "current-cell=3,2") +usr << output("Text", "thegrid") + +// or even easier: +usr << output("Text", "thegrid:3,2") + +// when is-list is true: +usr << output("5th item", "thegrid:5") + +``` + + +You can output an atom to the grid, which can be clicked, dragged, etc. However, you should make sure that atom is *not* temporary and will persist until you no longer need it, or else the server may recycle it and the object in the cell will either disappear or be impossible to interact with anymore. + +There are some limitations to output in grid controls: + +The classic BYOND statpanel, which contains both stat and verb tabs. This is technically a 3-column grid with a variable number of rows. + +Output to a statpanel is done via the stat() and statpanel() procs, during mob/Stat(). + +The same limitations that apply to grid output apply here. + +Info controls can now be split so that one displays stats and another handles verbs. + +A text box into which the user can type. By default this is used for sending client commands, but it can be used for other purposes as well. + +Note that when in "standard" mode of accepting user commands, built-in verbs like `.click`, or local commands like `.winset`, are not accepted when typed in. This kind of command can still be entered manually through the Client menu of the Options & Messages window. + +A text label that appears on the skin. + +A keyboard/gamepad/mouse macro, usually designed to run a command. The control is a means of interacting with the macro as an object, allowing some of its properties to be changed at runtime. + +A container for other controls. The Main control takes two forms: a window or a pane. + +A window exists independently and can be moved around on the screen. A pane has to be used within another container control such as a Child or Tab control. + +The font parameters have no impact on a window's statusbar or titlebar; those are drawn by the operating system. + +A map that will display icons from the game. + +A menu item, that when activate will run a command. + +Displays text output. + +A tab control, where each tab holds a different pane. + +Macros are used to convert keyboard and gamepad events into actions. There are two ways this works: A macro can run a command, or in some cases (such as gamepad controls) it can be used to remap one control to another. + +A collection of macros is called a macro set, and the window currently in use defines which macro set will be used via its macro parameter. + +Macros can be changed at runtime. If a macro does not have an id, you can refer to it by its key combination (name). If you have a macro set named `macro1` and have a `Ctrl+E` macro for instance, you could use winset() with `"macro1.Ctrl+E"`. See the Macro control for information on which parameters you can change with `winset()`. + +The `name` of the macro is actually the full key combination as it would appear in the macro editor, like `CTRL+E`, `Space+REP`, or `Alt+Shift+F1`. This is not case-specific and it doesn't matter where you put modifiers like `CTRL+`, `SHIFT+`, etc. + +Oftentimes it's desirable to keep track of key presses yourself rather than have a hundred different macros defined. BYOND makes this possible via the `Any` and `Any+UP` macros, which respond to any key or gamepad button. `UP` is the only allowed modifier for this macro, since other modifier keys are handled by this same macro. + +Typically, you will want to use set instant=1 on the verbs that will be tied to the Any macro, so that keyboard input doesn't queue up and lag behind. + +In the command that goes with this macro, `[[*]]` will be replaced with the name of the key or gamepad button that was pressed/released. (See embedded winget for more details on the `[[...]]` format.) + +The map-to parameter is used by **mappings**, which are like macros but are used to convert gamepad inputs easily and quickly to keyboard inputs. E.g., `GamepadLeft` can map to `West` which is the left arrow key. A set of default mappings will be added automatically at runtime if you don't include any gamepad mapping in your project. + +BYOND will support up to four gamepads, and breaks up their input into the following categories: + +See the list of available macros below for information on how to harness these inputs. + +To let a user configure their gamepad, you need to call the client-side `.gamepad-mapping` command. Or, if they have access to the Options & Messages window and Dream Seeker's default menus, they can reach it from there. However it's a good idea to make this easy for them to find. Several common gamepads are already known by BYOND. + +There is also the `GamepadRaw` macro, which is similar to `Any` in some ways and will avoid doing any processing (e.g. checking for dead zones on the analog sticks) so you can handle all input yourself. `GamepadRaw` does not rely on BYOND's controller configuration, so it will not, for instance, know that button 0 should be `GamepadFace1`. See below for more information on how to use this macro. + +You can add macros (not local player-defined ones) for any of the mouse input commands, thereby bypassing the normal mouse verbs. This can be helpful for designing custom setups where you don't want to have to parse the normal parameter string that provides most of the info, and instead want to provide data directly to the verb. You will want `set instant=1` on any such verb. + +Mouse macro commands use the `[[...]]` syntax to embed values, just like embedded wingets. These are the values you can include in a mouse macro: + +An example mouse macro command might look like this: + +And the verb to go with it looks like this: + + +```dm + +client + // "in src" is the same as "in usr.client" here + verb/my_mousedown_verb(object as anything in src, button as text, params as text) + +``` + + +In the example, the `src` value is a reference such as you would get with the `ref()` proc. It can be used as a verb argument directly and won't be enclosed by quotes by default. The `button` value is a string and the default formatting will put quotes around it. The `keys` and `drag` values were given the `as params` format specifier so they would behave as part of a parameter list. + +In drag/drop actions, you can precede any value with `src` or `over` if there may be different information for the dragged object and the mouseover object/location. This also applies to things like `keys`, which by default will be the currently held keys but you can use `src.keys` to refer to the values from when the drag began. + +This is a list of all keys and gamepad events that can be used in macros. + +* If no gamepad mappings are included in a game's interface, the default mappings are used instead, which will map the Dpad buttons to the arrow keys. This will cause the Any macro to register both a gamepad directional button and the mapped key on the same press. If you plan on using macros to capture gamepad input, you may wish instead to map any one of the directional buttons to "None", which will override the default gamepad mappings completely. + + All of the gamepad macros defined above apply to the first gamepad. BYOND can now support up to four gamepads, and you can replace Gamepad in the names above with Gamepad2, Gamepad3, or Gamepad4 to access them. Each gamepad also has its own raw macro (i.e., Gamepad2Raw). + + If you use a Dpad macro like GamepadDir as a `map-to` target, you don't have to specify gamepad 2-4 in map-to; the mapping will automatically know that when Gamepad2LeftAnalog is mapped to GamepadDir, it means Gamepad2Dir. + +Controls can be interacted with via winset() and winget() to change or read various parameters. + +Parameters come in a few different formats: + +The list of all controls which shows which parameters are universal, and each individual control type lists additional parameters that apply to that type specifically. + +Note: In any parameter's "Applies to" section, "all" refers to positionable controls only, not Macro or Menu controls. Macro and Menu will be listed separately if supported. + +Default alignment of text/image, both horizontal and vertical. + +A BYOND direction flag like `WEST` may be assigned to this parameter, or 0 for center alignment. + +Info control: Allow HTML tags to be used in stat() info. The same limitations apply as to the Grid control. + +Label control: Currently, the label control will not actually use the HTML; it will simply strip it out. Full support may appear in a later version. + +Opacity of the window, from 0 (invisible) to 255 (opaque). + +Anchors the control within the window or pane. If the anchor is not `none`, it is expressed as pecentages of the container's width and height. For example, an anchor of 100,100 means that the X and Y position are tied to the lower right of the container, and 50,0 is tied to the top center. + +Setting only `anchor1` will control the position of the control but won't affect its size. + +Setting `anchor2` as well will allow you to stretch the control as the container's size changes. You can think of this `anchor1` controlling the top left corner, and `anchor2` the bottom right corner. + +The angle of the bar control's arc when its dir is `clockwise` or `counterclockwise`. Angles are measured clockwise from due north, so 0 is north, 90 is east, and so on. `angle1` is the beginning of the arc, and `angle2` is the end. + + +> [!WARNING] +> +> > [!NOTE] +> > This parameter only existed to inject compatibility scripts into very old versions of the embedded browser. It is no longer used. + +The control's background color. The exact way this applies depends on the control. + +The color of the bar or slider. + +Border type around the control or window. May not work the same in all controls. + +Changes the type of button. + +If true, this menu item is toggled like a checkbox or radio button when clicked. + +Allow the window to be closed, and also shows a system menu for the window. + +Allow the window to be minimized. + +Allow the window to be resized or maximized. + +If `is-fullscreen` is true, `can-resize` is ignored, so this value represents the state of the window when `is-fullscreen` is turned off again. + +Allow this pane to retain its horizontal and/or vertical size and show scrollbars if necessary, instead of shrinking to fit the container. + +Command executed when this control is activated. + +For the Input control, whatever the user types in follows this command. If your command starts with an exclamation point `!`, everything after the `!` is shown as a default prompt that may be cleared by the user. + +The span of the current grid cell; it can be merged with cells to the right and down. If `is-list` is true, this setting is ignored. This setting is only available at runtime. + +The number of columns and rows in the grid. Using -1 for either columns or rows will leave that value unchanged. + +If is-list is true, this value can be set to a single number. + +The active cell. Any output sent to the grid, that is not sent to a specific cell, will go into this cell. + +If is-list is true, this value can be set to a single number. + +The name of the pane in the active/default tab. If set to a pane that is not currently in this tab control, the pane by that name will be added as another tab. + +The direction/orientation of the bar. As the value increases the bar will move further in this direction. + +Shorthand values like `cw` and `ccw` can be used, or also numerical BYOND directions. + +Read-only and unlisted parameter that returns the DPI scaling factor. A value of 1 indicates 100%. This is currently system-wide for the whole application and won't vary by window, but is implemented for windows in case future scaling changes allow them to differ. + +This is also a special global parameter. Calling winget() with no `id` and `dpi` as the parameter will return the system DPI scaling. + +Note: The DPI scale is currently set at the time Dream Seeker starts, and does not change after that. + +True if dragged objects may be dropped here. Default is true for Map, Info, and Grid controls, false for others. When in use, this will be the value of the `over_control` argument in MouseDrop() if you drop an atom here. + +Grids can also add `drag-cell` and `drop-cell` to mouse proc parameters. The mouse procs' `src_location` and `over_location` arguments are in the form `"[column],[row]"` (or `"[item"]` if is-list is true) when dragging to/from a grid cell. + +In Info controls, `src_location` and `over_location` in mouse procs will be the name of the statpanel tab. + +Allows images to be pulled from the Web when using the `<img>` tag; otherwise only locally stored images can be shown. + +Set to a positive number to make the window flash that many times, -1 to flash forever, and 0 to stop flashing. + +This parameter is true if this control currently has focus. + +This is also a special read-only global parameter. Calling winget() with no `id` and `focus` as the parameter will return the id of the currently focused control, if any. + +Leave blank to use the default font. This can be used for CSS-style fallback fonts, e.g. "Arial,Helvetica". + +You can include fonts in your resource file, making them available to the client, like so: + + +```dm + +var/list/extra_resources = list(\ + 'myfont.ttf', + 'myfont_bold.ttf') + +``` + + +Point size of the font, or leave at 0 for the default size. + +The Output control behaves differently for legacy reasons, unless legacy-size is false. + +Sets the font style. Any combination of the above values may be used, or none of them. Multiple values may be separated by spaces or commas. + +Used for "radio" buttons and menu items, where only one of them in the same group may be checked at a time. This value is a text string, or may be left empty. + +Buttons in different windows/panes, or menu items in another menu/submenu, are always treated as a different group. + +True if this info control contains the statpanels created via stat() and statpanel(). + +Only one info control can have statpanels. + +True if this info control contains the verbs used in the game. + +Currently only one info control can have verbs. + +The color used to highlight moused-over statpanel items or verbs. In grids, this color is used when hovering over objects or links. + +Custom icon used for the window. If no icon is specified, the Dream Seeker icon is used by windows by default. + +If this control is a pane, its icon will appear on the tab if the pane is inside a tab control. Lack of an icon will mean no icon appears in the tab. + +Note: The Windows `.ico` format is not used. Only image formats BYOND can already use are supported. + +Size, in pixels, of icons on the map. A size of 0 stretches to fit available space. + + +> [!WARNING] +> +> > [!NOTE] +> > This parameter has been deprecated. Use zoom instead. + +The name of this control. Read-only. + +If this is a Main control, the name should always be unique. For others, it is usually still a good idea to use a unique name, but they can be referenced by *window*.*id* at runtime. + +You can use a colon in front of the type to refer to the default control of a certain type, if one exists, e.g. `:map` is the default map. + +A background image to show in this control. + +In the Output control this image is always tiled. + +Note: Icons displayed in the output control will not show the background image underneath their transparent parts, but will instead show the background color. + +For Label and Main, use image-mode to control how the image is displayed. + +Determines how the background image is displayed. + +Moves the menu item to the *N*th position among its siblings. 0 or less is no change. Write-only. + +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, not including the control's borders. + +`mouse-pos` is an alias for `inner-mouse-pos`. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending `*` as the parameter in winget(). + +Read-only. + +Reads the position where the window's interior contents begin (i.e., not counting titlebar, statusbar, borders, etc.), relative to its `outer-pos`. + +Read-only. + +If the control is a window, this refers to its current interior size: i.e., not counting titlebar, statusbar, borders, etc. If it's maximized, this will be the true size of the window interior, as opposed to `size` which is the interior size once this window is no longer maximized. + +If this control is a pane and can-scroll is true, this is the size of the display area not including the scrollbars. + +True if the button or menu item is checked. Menu items can set this even if can-check is false. + +Specifies that this is a default control. This should be true for your main window, and for your primary map, info, output, input, and browser controls. + +The default control of a given type can be referenced in winset() and other skin-related procs by the name `":*type*"`, e.g. `":map"`. + +Changing this value at runtime should be avoided, especially for windows. Results may be unpredictable. + +Disables the control, menu item, or macro. + +Gives this button a flat appearance instead of pseudo-3D highlights. + +True if the window should be in fullscreen mode. This suppresses `can-resize`, `titlebar`, `is-maximized`, and `is-minimized`. They will continue to return the values that would apply if fullscreen mode were turned off. + +True if the grid is used for a flexible list of items; the number of columns and rows may change to fit them. + +True if the window is maximized. + +If `is-fullscreen` is true, this value represents the state of the window when `is-fullscreen` is turned off again. + +True if the window is minimized. + +If `is-fullscreen` is true, this value represents the state of the window when `is-fullscreen` is turned off again. + +True if this is a pane that will be used in other container controls, instead of an independent window. Read-only. + +Hide text with asterisks. Copy to clipboard is not available in this mode, but the text parameter can still read the control's contents. + + +> [!CAUTION] +> Note: For obvious reasons, you should never use the same password in a game that you would use anywhere else. + +Make this an adjustable slider capable of being changed by the user, instead of a progress bar. + +Make this control transparent. + +Transparency support is extremely limited. Only some controls can actually use it, and only when on top of certain other controls. + +Bars and labels handle transparency reasonably well, when not on top of other controls (or only on top of other conrols of these types). + +The splitter between the two panes in this control is vertical. + +True if this control can be seen. The main window should usually be made visible. + +If stretching a background image, preserve its aspect ratio. + +The id of the left/top pane in this control. The parameter names `left` and `top` can be used interchangeably. + +When true, font sizes are scaled slightly larger for readability, which is legacy (and default) BYOND behavior. Set to false for exact font sizing. + +If map auto-scales its icons (zoom is 0), make sure the entire map fits, and fill excess space with the background color. + +If `letterbox` is not enabled, auto-zoom will fill all available space, and any excess will be cut off. + +The color of grid lines. + +The color used for links. In some controls visited links may have a different color. + +Allows one pane to "lock" the splitter so if this Child control is resized, the splitter will stay put on that side. + +The id of the macro set this window will use, if any, when it's active. + +The macro name (e.g., "SOUTH") of a key combo, Dpad, mouse button, etc. that this macro maps to. + +Maximum number of lines before the control drops old text to make room for more. 0 is no limit. + +An overflow of 5% is allowed, to reduce flicker. + +The id of the menu this window will use, if any, when it's active. + +Input control: Create a multi-line input control. Read-only for this control. + +Info and Tab controls: Show tabs in multiple rows if there are too many to fit in a single row. + +Macro control: The key/gamepad combination such as `R+REP`, `CTRL+Northwest`, `GamepadLeft`. + +Menu control: This is the menu item label. A tab character can be used between the name and a keyboard shortcut, like "Help\tF1". (Keyboard shortcuts must be implemented as macros in order to work. This is just a label.) A blank name shows just a separator. + +True if this input control is for typing only; hitting Enter will not run a command. + +Command executed when the control loses focus. + +Command executed when the window is closed. + +Command executed when the value of the bar/slider is changed. If you drag the slider around, the command will not run until you let go. + +If you include `[[*]]` in the command, it will be replaced by the control's new `value`. (See embedded winget for more details on the `[[...]]` format.) + +Command executed when the control gains focus. + +Commandexecuted when this control is hidden by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. + +Command executed when this control is shown by the game. Must be the default control for the game to show/hide it. + +Currently not editable in Dream Maker. + +Command executed when this control is resized. If you are dragging a window edge or splitter, the command won't run until you finish. + +No command will be sent in response to size or splitter changes made by winset(). + +If you include `[[*]]` in the command, it will be replaced by the control's new size. Likewise, `[[width]]` will be replaced with the width and `[[height]]` with the height. (See embedded winget for more details on the `[[...]]` format.) + +Command executed when the text that would go in the statusbar is changed. This applies even if this control is a pane and not a window, or is a window without a statusbar. It applies to all panes and windows that directly or indirectly contain whatever control generated the statusbar text (e.g., a map). + +If you include `[[*]]` in the command, it will be replaced by the new text. (See embedded winget for more details on the `[[...]]` format.) + +`[[from]]` can be used to reference the control (if any) that generated the next text. You can also use expressions like `[[from.type]]`, `[[from.parent.pos.x]]`, etc. + +Command executed when the current tab is changed. + +If you include `[[*]]` in the command, it will be replaced by the new tab's id. (See embedded winget for more details on the `[[...]]` format.) + +Read-only. + +Reads the position of the mouse cursor relative to the upper left corner of this control, including the control's borders. + +This parameter is "unlisted" and must be explicitly queried. It won't appear when sending `*` as the parameter in winget(). + +Read-only. + +Reads the control's current exterior position *including* titlebar, statusbar, borders, etc. If the window is not minimized or maximized, this is identical to `pos`. + +Read-only. + +If the control is a window, this refers to its current exterior size *including* titlebar, statusbar, borders, etc. If the window is maximized, this is the maximized size. + +If this control is a pane and can-scroll is true, this is the size of the display area including the scrollbars. + +The id of this control's parent. Write-only, used when creating a new control at runtime or deleting a control that was created this way. + +Sends default action for this input after the user macro. Currently this applies only to mouse macros. + +An example of this is if you want to override MouseDown with new functionality in your own verb, but still handle default mouse processing. + +Position of this control's upper left corner, relative to its container. (Not applicable to panes.) + +The color used for the prefix/header column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was red. + +The id of the right/bottom pane in this control. The parameter names `top` and `bottom` can be used interchangeably. + +True if this control should allow right-clicks to behave like any other click instead of opening up popup menus or similar special behavior. + +A semicolon-separated list of parameters that get saved with this control. This is often used for things a user might set, like zoom level for a map. + +Currently not editable in Dream Maker. + +Read-only. + +For windows, this is the upper left corner of the nearest monitor's area. + +This is also a special read-only global parameter, which returns the position for the main monitor. + +Read-only. + +For windows, this is the size of the nearest monitor's area (minus taskbar). + +This is also a special read-only global parameter, which returns the size (minus taskbar) for the main monitor. + +The size of this control. + +Setting 0 for width or height uses up any available space right/downward. + +If the control is a window, this refers to its *interior size when not maximized or minimized*. That is, it does not count borders, titlebar, menu, or statusbar, and if the window is minimized/maximized, this refers to the window's normal size when it is restored. See the inner-size and outer-size params for comparison. + +If this control is a pane and can-scroll is true, `size` refers to the total scrollable size of the pane, NOT the smaller size displayed. In this case, `outer-size` and `inner-size` refer to the display area with and without scrollbars, respectively. + +Show forward/back navigation buttons. + +Determines which grid lines to display. + +When atoms are output to the grid, show the atom's name next to its icon. + +If the atom has no icon and `show-names` is false, the grid cell will be blank. + +Show a splitter if both the left and right (or top and bottom) panes are in use. The splitter can be dragged to resize the panes. + +Shows an address bar for this browser control. + +When output(object,grid) is sent, show smaller icons in this control instead of larger ones. + +Position of the splitter when two panes are in use, whether show-splitter is true or not. This value is a percentage. Specifically, it is the percentage of the available width/height that is given to the left/top pane. + +The color used for the suffix column of statpanel displays. No color means the default text-color will be used. + +In BYOND 3.0, this color was blue. + +Shows a status bar at the bottom of the window. This will show the name of an atom when you hover over it with the mouse. + +Stretch the background image. + + +> [!WARNING] +> +> > [!NOTE] +> > Deprecated; use image-mode instead. + +Custom stylesheet used for the control. Changes made at runtime will usually not impact any existing text. + +For Map controls, this affects any maptext drawn, and changes to the style should appear on the next refresh. + +Affects the background color for tabs. The regular background-color is used for the content area. + +Affects the font for tabs. The regular versions of these without the `tab-` prefix are used for the content area. + +Affects the text color for tabs. The regular text-color is used for the content area. + +A comma-separated list of id values for the panes included as tabs in this control. + +When setting this value, you can put `+` in front of the list to add tabs to the existing control, without affecting current tabs. You can likewise use `-` in front of the list to remove tabs. + +Note: When using this with winset(), remember you will need to escape `+` as `%2B` via url_encode() or list2params(). + +Text shown in this control. For Input controls this setting is only available at runtime. + +The control's foreground text color. + +Show text mode even if icons are available. Text mode will be used if no icons are present, regardless of this setting. + +Wrap text that is too long for the width of the label. + +The title of this window or pane. For a window, the title will appear in the titlebar if present. For a pane, this will be displayed on the tab if this pane is in a Tab control. + +If this is the default window, world.name takes precedence over the window title. + +Show a titlebar for this window. This is also required for the close, minimize, and maximize buttons to appear. + +If `is-fullscreen` is true, `titlebar` is ignored, so this value represents the state of the window when `is-fullscreen` is turned off again. + +A color that will be turned into transparency wherever it appears in this window. Overall, this method of transparency comes with many limitations, so it is considered deprecated. + +The type of this control. Read-only. + +Use the browser's document title to override the title of the window or pane it appears in. + +The "fullness" of this bar/slider, as a percentage. + +The size, in pixels, of the map after `zoom` has been applied. + +For instance, if the client view has 10×10 tiles (this includes any extended tiles caused by HUD objects) and `world.icon_size` is 32x32, the map has a native size of 320×320 pixels. If the map has a zoom level of 2, then `view-size` will be 640x640. + +With a `zoom` value of 0, which is the default for most projects, the actual zoom level is automatically determined by the size of the map control, the map's native pixel size as explained above, and the value of the letterbox parameter. + +The color used for visited links. + +Width, in pixels, of the bar or slider. A value of 0 uses all available width. + +Zoom factor for icons on the map. 1 means to show the icons at their original size, 2 is 200%, 0.5 is 50%, and so on. A value of 0 stretches to fit available space. + +Controls the way the map is upscaled. + +This section contains miscellaneous information that may apply to multiple vars or procs. + +Byondapi is a set of exported functions from BYOND's core library that can be used by external libraries that you call via the `call_ext()` proc. The purpose is to make interfacing with native code easier, and to allow external access to BYOND's functionality. Before this existed, all external calls had to use text strings to pass data back and forth, which was inefficient for many uses and very limited. + +To build your external library with Byondapi, you have to include the `byondapi.h` header file that's included in BYOND's distribution. When compiling in Windows, you'll also need to link with `byondapi.lib`; in Linux, your makefile should link with `byondcore.so` from BYOND's own `bin` directory. + +For simplicity, BYOND defines some basic types and macros in `byondapi.h`. The one most relevant to you is `u4c`, which is an unsigned 4-byte integer. There's also `s4c` which is a signed integer, as well as simple 1-byte and 2-byte ints that use `1c` and `2c` (respectively) insteaed of the `4c` suffix. + +The main structure used to pass data back and forth is `CByondValue`. This mimics an internal structure in BYOND that holds values of all sorts: numbers, null, references to strings, references to objects and lists, and so on. + +The exact functions used for interfacing with this structure are documented in `byondapi.h`. + +The main tricky aspect of working with BYOND data is strings. If you need to get the contents of a string, you'll need to allocate memory for the character data and call `Byond_ToString()` to get a copy of the string. For converting character data to an internal string stored in CByondValue, you'll need to call `ByondValue_SetStr()`. + +There are many function calls available in Byondapi for interacting with the server. These include the ability to read and write vars, call procs, create lists, read and write from lists, and so on. + +Most of these procs return boolean values: true if they succeed, false if not. In the event of a failure, you can call `Byond_LastError()` to get the error message. + +In any functions that read data from lists or read string data—including `Byond_LastError()`—you need to allocate the required memory for a copy of the string or list items. These functions take a pointer to the buffer that will be filled, and a `u4c` pointer for the buffer size (in items for lists, in bytes for strings). If the return value is false and the length is set to zero, an error occurred. If the return value is false and the length is non-zero, the new length value is the required length of the array; the memory should be allocated and the function called again. + +The C++ wrappers have a better way of calling `Byond_LastError()` and other functions like it, where you don't need to worry about allocations. + +Objects in BYOND are reference-counted; when an object's count reaches 0 it gets garbage-collected. In Byondapi you can call `ByondValue_IncRef()` and `ByondValue_DecRef()` to increment or decrement the reference count, respectively. + +Byondapi maintains its own internal reference count for any object, so you can't decref past the number of references Byondapi holds. + +The results you get from calls to Byondapi functions, such as reading a var or getting a return value from a proc call, have already had their reference count increased. That means when you're done using the value, you need to clean it up with `ByondValue_DecRef()` or else you'll have a memory leak. + +The value you return from a function called by `call_ext()` should have a reference. + +The C++ wrappers take care of most of the reference counting issues for you (see below). + +BYOND servers handle proc execution and the management of data in a single thread. If your library tries to call any BYOND server functions in a different thread of its own, the call will block until the server thread can handle it. + +The special function `Byond_ThreadSync()` will run a callback function on the main thread, avoiding the need to keep syncing over multiple Byondapi calls. + +If you want to use the handy C++ wrappers and classes, you can include `byondapi_cpp_wrappers.cpp` and `byondapi_cpp_wrappers.h` in your library. + +The `ByondValue` class is a wrapper around `CByondValue` that handles a number of operations for you. You can redefine the `argv` argument of any `call_ext()` functions as an array of `ByondValue` instead of `CByondValue`, but the return value should stay a `CByondValue`. + +The external function calls like `ByondValue_CallProc()` have C++ wrappers that use the C calls internally, but if an error happens they'll call an error handler. The default error handler does nothing, but you can change it to a a different handler that accepts an error string. + +If you define a `CatchingByondExceptions` variable inside of a `try` block, it will automatically change the error handler to one that throws a `ByondExtException`. This replaces the more cumbersome approach of checking if the return value is false and then calling `Byond_LastError()`. + +DM-CSS is a subset of CSS, and only supports some kinds of selectors and attributes. + +The following table lists all supported attributes, and whether they are supported in text output, maptext, and in other controls (labels/etc.) Other controls will often allow only one style for an entire unit of text. A checkbox in "Other" only indicates that *some* support exists in other controls, but it may vary by the type of control. + +These pseudo-classes are allowed in some contexts, but they can only change the text color. + +Text colors may be specified by name or RGB value. The RGB color format uses hexadecimal numbers, with 2 hex digits each for red, green, and blue. These range from 0 (00 in hex) to 255 (FF in hex). In certain situations BYOND will also honor a fourth pair of digits for alpha. + +It is also possible to use 4 bit values by using only one hex digit per color. The full 8 bit color is produced by repeating each digit. For example, #F00 (red) is the same as #FF0000. + +The named colors supported by BYOND, and their corresponding RGB values, are listed in the following table: + +There are different ways of interpreting color besides RGB. Several parts of BYOND are capable of using other color spaces. + +The default color space is RGB, where each color is split into red, green, and blue components, as well as an optional alpha. All of these components range from 0 to 255. + +The color yellow for instance is `rgb(255,255,0)` which is red and green mixed together at their maximum brightness, but no blue component. + +HSV stands for hue, saturation, and value. + +All pure hues such as red (hue=0) have a saturation of 100 and a value of 100. As saturation decreases, the colors turns whiter. Lower values mean darker colors and darker shades of gray. + +In HSV, saturation is less meaningful as value gets closer to 0. Black of course always has a value of 0. With 10 as the value, saturation=100 gives you a very dark color whereas saturation=0 is a 10% shade of gray. + +HSL is a little more intuitive than HSV. Here, value is replaced by luminance, which again ranges from 0 to 100. Luminance is the average of the minimum and maximum values of the red, green, and blue components. + +Black has a luminance of 0; white has a luminance of 100. Pure hues all have a saturation of 100 and luminance of 50. As saturation decreases, the color will approach a grayscale shade of L%. + +Saturation is less meaningful the closer luminance is to 0 or 100. At a luminance of 100, the saturation is totally irrelevant. At 90, high saturation will get you a very light shade of the hue but that isn't very far off from a 90% shade of gray. + +HCY stands for **hue**, **chroma**, and the Y is for grayscale luminance. (Again chroma and Y range from 0 to 100.) This color space is based around the apparent brightness of each color according to a rough approximation of human vision. + +Chroma is similar to saturation in that it determines how far from grayscale the color is. As chroma decreases toward 0, the color approaches a grayscale shade of Y%. What's different about HCY color from HSV or HSL is that at chroma=0 and chroma=100 the colors should appear equally bright. Pure red, therefore, has a hue of 0, a chroma of 100, and a Y luminance of only 29.9—roughly what red would look like in black & white with all of the color leached out. + +This is a special file that's included in all projects when you compile. It contains various constants, definitions of some built-in datums, and so on. + +You can see the contents of this file by creating a new file in Dream Maker called `stddef.dm`. It will automatically be filled with the standard definitions. + +The contents of `stddef.dm` may change with new BYOND versions. However an eye is always kept on backwards-compatibility. +*** +**Related Pages:** ++ [rgb proc](/ref/proc/rgb) ++ [rgb2num proc](/ref/proc/rgb2num) ++ [gradient proc](/ref/proc/gradient) ++ [animate proc](/ref/proc/animate) ++ [Color gradient](/ref/{notes}/color-gradient) ++ [Color matrix filter](/ref/{notes}/filters/color) diff --git a/ref/world/proc/Import.md b/ref/world/proc/Import.md index 98184303..59a18a67 100644 --- a/ref/world/proc/Import.md +++ b/ref/world/proc/Import.md @@ -1,52 +1,26 @@ -## Import proc (world) -**Format:** -+ Import() +## Import (proc) +*** -**Returns:** -+ The file sent by the remote server. The file will be downloaded to - the local server\'s resource cache. Note that this will cause the - caller to sleep while waiting for the necessary data to be - transfered. +```dm -**When:** -+ Call this inside world.Topic() if you are expecting a file from the - remote server. -### Example: +//sending the file +mob/proc/Export(Addr) + var/savefile/F = new() + F.Write(src) + world.Export(Addr,F) + +//receiving the file +world/Topic() + var/savefile/F = new(world.Import()) + F.Read() //read the mob -```dm - //sending the file mob/proc/Export(Addr) var/savefile/F = -new() F.Write(src) world.Export(Addr,F) //receiving the file -world/Topic() var/savefile/F = new(world.Import()) F.Read() //read the -mob ``` - - -This example defines a mob proc called Export() -which writes the mob to a savefile and sends it to another server -(specified by Addr). The remote server opens it as a savefile and -creates the mob (if the same mob type is defined on both servers and -mob.Read() is compatible with the sending server\'s mob.Write()). - - -Note that another method of transferring player mobs is to use -the key savefile (accessed by client.Export() and client.Import()). -Direct server to server communication on the other hand could transfer -data (like non-players) without the need for player involvement at all. - - -Savefiles are the most common type of file to transfer, but -world.Import() simply returns a reference to an item in the world\'s -.rsc file, which could be any type of file. This particular example -demonstrates how to open such a file as a temporary savefile. (It gets -dumped from the cache into a separate temporary file, which is then -opened as a savefile.) Other types of files would be handled -differently. For example, you could use fcopy() to dump the cached item -to its own separate file. - -> [!TIP] -> **See also:** -> + [Export proc (world)](/ref/world/proc/Export.md) -> + [Import proc (client)](/ref/client/proc/Import.md) -> + [Topic proc (world)](/ref/world/proc/Topic.md) -> + [fcopy proc](/ref/proc/fcopy.md) \ No newline at end of file + + +This example defines a mob proc called Export() which writes the mob to a savefile and sends it to another server (specified by Addr). The remote server opens it as a savefile and creates the mob (if the same mob type is defined on both servers and mob.Read() is compatible with the sending server's mob.Write()). + +Note that another method of transferring player mobs is to use the key savefile (accessed by client.Export() and client.Import()). Direct server to server communication on the other hand could transfer data (like non-players) without the need for player involvement at all. + +Savefiles are the most common type of file to transfer, but world.Import() simply returns a reference to an item in the world's .rsc file, which could be any type of file. This particular example demonstrates how to open such a file as a temporary savefile. (It gets dumped from the cache into a separate temporary file, which is then opened as a savefile.) Other types of files would be handled differently. For example, you could use fcopy() to dump the cached item to its own separate file. +*** \ No newline at end of file diff --git a/ref/world/proc/IsBanned.md b/ref/world/proc/IsBanned.md index c862371d..1e47746b 100644 --- a/ref/world/proc/IsBanned.md +++ b/ref/world/proc/IsBanned.md @@ -1,85 +1,26 @@ -## IsBanned proc (world) +## IsBanned (proc) +*** +By default, this procedure checks the "ban" configuration file. If an entry is found for the current world (based on the value of world.hub), the parameter text is converted into a list (using params2list()), and the result is returned. Otherwise, null is returned. -**Format:** -+ IsBanned(key,address,computer_id,type) +A ban that applies to all worlds on the host's computer will not call IsBanned(). The connection will simply be denied. -**Returns:** -+ True value if user is banned from this world. This may be a list, in - which case special meaning is attributed to certain list elements as - described below. +This procedure is called internally whenever a new user connects (before client/New() is called). If the result is true, access is denied. If you want to ban a user but still allow them to log in (perhaps with reduced functionality), you can put "Login=1" in the parameter text. If you want to display an explanation to the user about why they are banned, you can also put "message=X" in the parameter text, where X is the message to display to the user. A reason for the ban can be added with a "reason=X" field. Of course, you can also override IsBanned() and insert these values directly into the list that is returned. -**Args:** -+ key: BYOND key of the user. -+ address: current IP address of the user. -+ computer_id: current computer_id of the user if known. -+ type: type of connection if known (see - [client.connection](/ref/client/var/connection.md) ) - - -By default, this procedure checks the "ban" configuration -file. If an entry is found for the current world (based on the value of -world.hub), the parameter text is converted into a list (using -params2list()), and the result is returned. Otherwise, null is returned. - - -A ban that applies to all worlds on the host\'s computer will -not call IsBanned(). The connection will simply be denied. - -This -procedure is called internally whenever a new user connects (before -client/New() is called). If the result is true, access is denied. If you -want to ban a user but still allow them to log in (perhaps with reduced -functionality), you can put "Login=1" in the parameter text. If you -want to display an explanation to the user about why they are banned, -you can also put "message=X" in the parameter text, where X is the -message to display to the user. A reason for the ban can be added with a -"reason=X" field. Of course, you can also override IsBanned() and -insert these values directly into the list that is returned. -## Example ```dm - world/IsBanned(key,address) . = ..() //check the ban lists -if(istype(., /list)) .["Login"] = 1 //allow banned user to login - -``` - -When you ban people from paging you, this also -causes them to be added to the keyban list. Even if they are already -connected, IsBanned() will be re-evaluated and acted upon at that time. -When you remove pager ban, they are removed from keyban as well. +world/IsBanned(key,address) + . = ..() //check the ban lists + if(istype(., /list)) + .["Login"] = 1 //allow banned user to login +``` -Additional data elements may be added to the ban list in the -future. The current definition includes just the following items: -Login -+ true if banned user should be allowed to log in -reason -+ text string describing the reason or origin of the ban. For example, - when people are banned from the pager, they are added to the - "keyban" list with reason = "pager ban". This text is internal - information only and is not displayed to the banned user. -message -+ text string explaining to the user why they were banned and possibly - what they should do to be forgiven. +When you ban people from paging you, this also causes them to be added to the keyban list. Even if they are already connected, IsBanned() will be re-evaluated and acted upon at that time. When you remove pager ban, they are removed from keyban as well. -Since the data in the "ban" file is in -[application/x-www-form-urlencoded](/ref/proc/list2params.md) format, it is -probably not desirable to edit the file by hand. No built-in facilities -for editing the file have been provided (aside from automatic addition -of pager bans), but an interface could be created, using -[GetConfig](/ref/world/proc/GetConfig.md) and -[SetConfig](/ref/world/proc/SetConfig.md) to read and write the data. Extra -features could also be added such as automatic inference of key -associations by IP address. +Additional data elements may be added to the ban list in the future. The current definition includes just the following items: -> [!TIP] -> **See also:** -> + [GetConfig proc (world)](/ref/world/proc/GetConfig.md) -> + [params2list proc](/ref/proc/params2list.md) -> + [address var (client)](/ref/client/var/address.md) -> + [computer_id var (client)](/ref/client/var/computer_id.md) -> + [connection var (client)](/ref/client/var/connection.md) -> + [hub var (world)](/ref/world/var/hub.md) \ No newline at end of file +Since the data in the "ban" file is in application/x-www-form-urlencoded format, it is probably not desirable to edit the file by hand. No built-in facilities for editing the file have been provided (aside from automatic addition of pager bans), but an interface could be created, using GetConfig and SetConfig to read and write the data. Extra features could also be added such as automatic inference of key associations by IP address. +*** \ No newline at end of file diff --git a/ref/world/proc/IsSubscribed.md b/ref/world/proc/IsSubscribed.md index 8cf33351..b04fa631 100644 --- a/ref/world/proc/IsSubscribed.md +++ b/ref/world/proc/IsSubscribed.md @@ -1,36 +1,25 @@ -## IsSubscribed proc (world) -###### BYOND Version 503 -**Format:** -+ IsSubscribed(player) -+ IsSubscribed(player, "BYOND") (to check BYOND Membership) -**Returns:** -+ Number of days left in subscription, -1 for a lifetime subscriber, - *or* null if hub contact failed +## IsSubscribed (proc) +*** +Checks a player for their subscription status to this game. This is a simpler alternative to `client.CheckPassport()`, which is deprecated, and also allows you to check even when the player has gone offline. -**Args:** -+ player: a mob, client, key, or ckey +This proc will return null if contacting the hub was required, but there was no way to reach the hub. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -Checks a player for their subscription status to this game. -This is a simpler alternative to `client.CheckPassport()`, which is -deprecated, and also allows you to check even when the player has gone -offline. +```dm -This proc will return null if contacting the hub was -required, but there was no way to reach the hub. Contacting the hub may -take a few moments, so it is a good idea to use -[spawn()](/ref/proc/spawn.md) to avoid holding up the rest of the game. -### Example: +mob/verb/JoinClub() + if(!world.IsSubscribed(src)) + src << "Sorry, the club is only for subscribers." + else + // go to the turf with the tag "clubhouse" + loc = locate("clubhouse") + src << "Welcome to the clubhouse!" -```dm - mob/verb/JoinClub() if(!world.IsSubscribed(src)) src << -"Sorry, the club is only for subscribers." else // go to the turf with -the tag "clubhouse" loc = locate("clubhouse") src << "Welcome to -the clubhouse!" ``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. \ No newline at end of file + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** \ No newline at end of file diff --git a/ref/world/proc/New.md b/ref/world/proc/New.md index 9ce1e4c8..a2652926 100644 --- a/ref/world/proc/New.md +++ b/ref/world/proc/New.md @@ -1,11 +1,3 @@ -# New proc (world) -**Format:** -+ New() -**When:** -+ Called after the world is initially loaded. The only procs preceding - this one would be in the initialization of global variables and - objects on the map. - -**Default action:** -+ None. \ No newline at end of file +## New (proc) +****** \ No newline at end of file diff --git a/ref/world/proc/OpenPort.md b/ref/world/proc/OpenPort.md index b7ed869c..d7d80dd6 100644 --- a/ref/world/proc/OpenPort.md +++ b/ref/world/proc/OpenPort.md @@ -1,38 +1,20 @@ -## OpenPort proc (world) +## OpenPort (proc) +*** +This causes the world to be hosted on the specified network port. A value of 0 or "any" requests that any available port be used. The value "none" causes the port to be closed so that no new connections are possible. -**See also:** -+ OpenPort(port=0) +This proc may be overridden. If it is, calling ..() is necessary to open the port. If ..() is not called, it will not open. -**Args:** -+ port: the network port to open -**Returns:** -+ 1 on success; 0 on failure - - -This causes the world to be hosted on the specified network -port. A value of 0 or "any" requests that any available port be used. -The value "none" causes the port to be closed so that no new -connections are possible. +```dm -This proc may be overridden. If it -is, calling ..() is necessary to open the port. If ..() is not called, -it will not open. -### Example: +world/OpenPort(port) + // only allow subscribers to host + if(host_is_subscribed) + return ..() -```dm - world/OpenPort(port) // only allow subscribers to host -if(host_is_subscribed) return ..() ``` - -The "ports" -configuration option in cfg/byond.txt can be used to control what ports -worlds may open. The -ports command-line option may also be used. See -[startup](/ref/proc/startup.md) for the syntax. -> [!TIP] -> **See also:** -> + [port var (world)](/ref/world/var/port.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file +The "ports" configuration option in cfg/byond.txt can be used to control what ports worlds may open. The -ports command-line option may also be used. See startup for the syntax. +*** \ No newline at end of file diff --git a/ref/world/proc/PayCredits.md b/ref/world/proc/PayCredits.md index 41d95d7b..97bc152f 100644 --- a/ref/world/proc/PayCredits.md +++ b/ref/world/proc/PayCredits.md @@ -1,58 +1,59 @@ -## PayCredits proc (world) -###### BYOND Version 503 -**Format:** -+ PayCredits(player, credits, note) +## PayCredits (proc) +*** +Removes credits from a player's account, if they have enough. The proc will return 1 if it is successful, or 0 if the attempt failed (usually because the player doesn't have enough credits). This feature is intended for games that make use of the credit system, and for security all such games must use a hub password. -**Returns:** -+ 1 if the credits were spent successfully, 0 or null otherwise. +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is often a good idea to use spawn() to avoid holding up the rest of the game. -**Args:** -+ player: a mob, client, key, or ckey -+ credits: A number of credits to deduct from the player\'s account -+ note: An optional note (for author purposes) for the credit change +```dm -Removes credits from a player\'s account, if they have enough. -The proc will return 1 if it is successful, or 0 if the attempt failed -(usually because the player doesn\'t have enough credits). This feature -is intended for games that make use of the credit system, and for -security all such games must use a hub password. - -This proc will -return null if there was no way to reach the hub. Use isnull() to check -for a null value. Contacting the hub may take a few moments, so it is -often a good idea to use spawn() to avoid holding up the rest of the -game. -### Example: +mob/proc/ItemShop() + var/items = list("Get credits!", "Magic sword"=10, "Skeleton key"=50) + var/choices[0] + var/item,price + for(item in items) + price = items[item] + choices["[item]: [price] credit\s"] = item + + var/credits = world.GetCredits(key) + if(isnull(credits)) + src << "Sorry, the item shop isn't available right now." + return + + var/choice = input(src,\ + "You have [credits] credit\s. What would you like to purchase?",\ + "Item Shop")\ + as null|anything in choices + if(!choice) return // cancel + + if(choice == "Get credits") + src << link("http://www.byond.com/games/Author/MyGame/credits") + return + + item = choices[choice] + price = items[item] + if(!price) return + + src << "Contacting item shop..." + var/result = world.PayCredits(name, price, "Item shop: [item]") + + if(isnull(result)) + src << "Sorry, the item shop isn't available right now." + else if(!result) + src << "You need [price-credits] more credit\s to buy [item]." + else + src << "You bought \a [item]!" + + // Now give the user the item and save their character + // These procs are for you to define + src.AddEquipment(item) + src.SaveCharacter() -```dm - mob/proc/ItemShop() var/items = list("Get credits!", -"Magic sword"=10, "Skeleton key"=50) var/choices[0] var/item,price -for(item in items) price = items[item] choices["[item]: [price] -credit\\s"] = item var/credits = world.GetCredits(key) -if(isnull(credits)) src << "Sorry, the item shop isn\'t available -right now." return var/choice = input(src,\\ "You have [credits] -credit\\s. What would you like to purchase?",\\ "Item Shop")\\ as -null\|anything in choices if(!choice) return // cancel if(choice == -"Get credits") src << -link("http://www.byond.com/games/Author/MyGame/credits") return item = -choices[choice] price = items[item] if(!price) return src << -"Contacting item shop..." var/result = world.PayCredits(name, price, -"Item shop: [item]") if(isnull(result)) src << "Sorry, the item -shop isn\'t available right now." else if(!result) src << "You need -[price-credits] more credit\\s to buy [item]." else src << "You -bought \\a [item]!" // Now give the user the item and save their -character // These procs are for you to define src.AddEquipment(item) -src.SaveCharacter() ``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. -> [!TIP] -> **See also:** -> + [AddCredits proc (world)](/ref/world/proc/AddCredits.md) -> + [GetCredits proc (world)](/ref/world/proc/GetCredits.md) \ No newline at end of file + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** \ No newline at end of file diff --git a/ref/world/proc/Profile.md b/ref/world/proc/Profile.md index b534aaf7..a5607ae0 100644 --- a/ref/world/proc/Profile.md +++ b/ref/world/proc/Profile.md @@ -1,74 +1,17 @@ -# Profile proc (world) -###### BYOND Version 513 -**Format:** -+ Profile(command, format) -+ Profile(command, type, format) -**Returns:** -+ Profilng data or null - -**Args:** -+ command: A numerical value that says whether to start, stop, - refresh, etc. -+ type: A type of profile to use, other than proc profiling. -+ format: Optional format for output data - -### Cheat Sheet: -The Profile gives information for the following data: -```cs -"name": proc path -"self": how long the proc takes to run, not including subordinate calls -"total": total time the proc takes to run, including subordinate calls -"real": real time the proc takes (start time - end time) -"over": how far over a tick the total usage runs -"calls": how many times the proc was called during profile -``` -The numbers given in the profile are in deciseconds. - -Interacts with the built-in server profiler without requiring -the host to do so via Dream Daemon, or an authorized player via Dream -Seeker. - -The `command` value is built from bitflags, so it can -combine any of these three values via the `|` operator: -PROFILE_STOP -+ Stop profiling. Not using this flag will start/continue profiling. -PROFILE_CLEAR -+ Clear all profile data. This will also cause the proc to return - null. -PROFILE_AVERAGE -+ Any output data should use average times instead of total times. +## Profile (proc) +*** +Interacts with the built-in server profiler without requiring the host to do so via Dream Daemon, or an authorized player via Dream Seeker. +The `command` value is built from bitflags, so it can combine any of these three values via the `|` operator: These additional values are also defined for convenience: -PROFILE_START -+ Start/continue profiling but don\'t clear any existing data. -PROFILE_REFRESH -+ Currently this is the same as `PROFILE_START`. -PROFILE_RESTART -+ Start profiling and clear existing data. -### Profiling procs - - -By default, data will be returned as a list. The first six -values are the column names: `"name"`, `"self"`, `"total"`, `"real"`, -`"over"`, and `"calls"`, corresponding to the columns in the profiler. -These are followed by the profile data for each proc, with the data -being in the same column order. E.g. the next six items represent the -first proc in the profile. -The optional `format` argument -however can be used to return the data in other formats. Currently the -only accepted value is `"json"`, which will output the same data in JSON -format. -### SendMaps profile +By default, data will be returned as a list. The first six values are the column names: `"name"`, `"self"`, `"total"`, `"real"`, `"over"`, and `"calls"`, corresponding to the columns in the profiler. These are followed by the profile data for each proc, with the data being in the same column order. E.g. the next six items represent the first proc in the profile. +The optional `format` argument however can be used to return the data in other formats. Currently the only accepted value is `"json"`, which will output the same data in JSON format. -Using `"sendmaps"` in the `type` argument will profile the -routines used to send map informaiton to players. Unlike the proc -profiling this only has three data columns: `"name"`, `"value"`, and -`"calls"`. The value column might be a time or number value, depending -on what\'s being measured. +Using `"sendmaps"` in the `type` argument will profile the routines used to send map informaiton to players. Unlike the proc profiling this only has three data columns: `"name"`, `"value"`, and `"calls"`. The value column might be a time or number value, depending on what's being measured. -The JSON format will include a -`unit` property data that is not a raw number, such as a time value. +The JSON format will include a `unit` property data that is not a raw number, such as a time value. +*** \ No newline at end of file diff --git a/ref/world/proc/Reboot.md b/ref/world/proc/Reboot.md index 4744a9b1..86eb0213 100644 --- a/ref/world/proc/Reboot.md +++ b/ref/world/proc/Reboot.md @@ -1,28 +1,11 @@ -## Reboot proc (world) -**Format:** -+ Reboot(reason) -**Args:** -+ reason: the reason `Reboot()` was called: - - 0 or null: Called by game code - - 1: By host (Ctrl+R in Dream Seeker) - - 2: By [world.Topic()](/ref/world/proc/Topic.md) - 3: By SIGUSR1 in UNIX +## Reboot (proc) +*** +Reload the world from scratch. Any connected players will automatically relogin. This would be useful if you needed to recompile the world after changing some code. -**Default action:** -+ +In a UNIX environment, you can cause a running server to reboot by sending it the signal SIGUSR1. +If you override this proc, you must call ..() if you want the reboot to complete normally. -Reload the world from scratch. Any connected players will -automatically relogin. This would be useful if you needed to recompile -the world after changing some code. - -In a UNIX environment, you -can cause a running server to reboot by sending it the signal SIGUSR1. - - -If you override this proc, you must call ..() if you want the -reboot to complete normally. - -For reboots initiated by Dream -Seeker, usr will be the mob belonging to the player who sent the -command. \ No newline at end of file +For reboots initiated by Dream Seeker, usr will be the mob belonging to the player who sent the command. +*** \ No newline at end of file diff --git a/ref/world/proc/Repop.md b/ref/world/proc/Repop.md index c1f7e384..fc817e4e 100644 --- a/ref/world/proc/Repop.md +++ b/ref/world/proc/Repop.md @@ -1,8 +1,3 @@ -# Repop proc (world) -**Format:** -+ Repop() -**Default action:** -+ Reload the obj and mob instances defined in the world map. This - "repopulates" a world to its initial state. Only objects that were - destroyed will be recreated. \ No newline at end of file +## Repop (proc) +****** \ No newline at end of file diff --git a/ref/world/proc/SetConfig.md b/ref/world/proc/SetConfig.md index bf063fbb..85462a4d 100644 --- a/ref/world/proc/SetConfig.md +++ b/ref/world/proc/SetConfig.md @@ -1,23 +1,7 @@ -## SetConfig proc (world) +## SetConfig (proc) +*** +This command is for storing configuration information that is shared by applications installed on the same system. The configuration data is accessed by specifying the configuration "set" and the parameter within that set. -**Format:** -+ SetConfig(config_set,param,value) - -**Args:** -+ config_set: name of the configuration set (see below) -+ param: name of the configuration parameter -+ value: data to store (or null to delete this entry) - - -This command is for storing configuration information that is -shared by applications installed on the same system. The configuration -data is accessed by specifying the configuration "set" and the -parameter within that set. - -For more information, see -[GetConfig](/ref/world/proc/GetConfig.md) - -> [!TIP] -> **See also:** -> + [GetConfig proc (world)](/ref/world/proc/GetConfig.md) \ No newline at end of file +For more information, see GetConfig. +*** \ No newline at end of file diff --git a/ref/world/proc/SetMedal.md b/ref/world/proc/SetMedal.md index e95509f8..3f6bfdf7 100644 --- a/ref/world/proc/SetMedal.md +++ b/ref/world/proc/SetMedal.md @@ -1,41 +1,23 @@ -## SetMedal proc (world) -**Format:** -+ SetMedal(medal, player) +## SetMedal (proc) +*** +Awards a medal to a player. The proc will return 1 if it is successful, or 0 if the medal was already awarded. If the world already knows this medal was earned before, the hub will not be contacted. -**Returns:** -+ 1 if the medal was awarded successfully, 0 or null otherwise. +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -**Args:** -+ medal: name of the medal being awarded -+ player: a mob, client, key, or ckey +```dm -Awards a medal to a player. The proc will return 1 if it is -successful, or 0 if the medal was already awarded. If the world already -knows this medal was earned before, the hub will not be contacted. +mob/monster/dragon + Die(mob/killer) // assume Die() is a proc all mobs have + spawn() + if(ismob(killer) && killer.key) + world.SetMedal("Dragon slayer", killer) +``` -This proc will return null if there was no way to reach the -hub. Use isnull() to check for a null value. Contacting the hub may take -a few moments, so it is a good idea to use spawn() to avoid holding up -the rest of the game. -### Example: -```dm - mob/monster/dragon Die(mob/killer) // assume Die() is a -proc all mobs have spawn() if(ismob(killer) && killer.key) -world.SetMedal("Dragon slayer", killer) -``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. - -> [!TIP] -> **See also:** -> + [GetMedal proc (world)](/ref/world/proc/GetMedal.md) -> + [ClearMedal proc (world)](/ref/world/proc/ClearMedal.md) -> + [GetScores proc (world)](/ref/world/proc/GetScores.md) -> + [SetScores proc (world)](/ref/world/proc/SetScores.md) \ No newline at end of file +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** \ No newline at end of file diff --git a/ref/world/proc/SetScores.md b/ref/world/proc/SetScores.md index f6d431e7..f2d23564 100644 --- a/ref/world/proc/SetScores.md +++ b/ref/world/proc/SetScores.md @@ -1,56 +1,36 @@ -## SetScores proc (world) -**Format:** -+ SetScores(key, fields) +## SetScores (proc) +*** +Updates scores that are kept on the BYOND hub. -**Returns:** -+ The key, if the scores were successfully updated; null otherwise. +The key is an arbitrary text value. Usually a player's key is a good choice, but you can also use the name of their character, or anything else you like, as long as it is unique. The key is case-insensitive. -**Args:** -+ key: the name of the player, character, etc. for which scores should - be set -+ fields: The data fields to set +Scores and stats use data fields, which might be things like "Score", "Level", "Class", etc. Use list2params() to set the fields that you want to change. Fields that you do not include in the list will not be changed. A field with a blank value will be deleted. +Sending an empty text string for the fields will erase the scores for that key. -Updates scores that are kept on the BYOND hub. +This proc will return null if there was no way to reach the hub. Use isnull() to check for a null value. Contacting the hub may take a few moments, so it is a good idea to use spawn() to avoid holding up the rest of the game. -The key -is an arbitrary text value. Usually a player\'s key is a good choice, -but you can also use the name of their character, or anything else you -like, as long as it is unique. The key is case-insensitive. +```dm -Scores and stats use data fields, which might be things like -"Score", "Level", "Class", etc. Use list2params() to set the -fields that you want to change. Fields that you do not include in the -list will not be changed. A field with a blank value will be deleted. +var/params +// Change the Score and Pet fields +params = list("Score"=123, "Pet"="Dog") +world.SetScores("Tom", list2params(params)) -Sending an empty text string for the fields will erase the -scores for that key. +// Delete the Pet field +params = list("Pet"="") +world.SetScores("Tom", list2params(params)) -This proc will return null if there was no -way to reach the hub. Use isnull() to check for a null value. Contacting -the hub may take a few moments, so it is a good idea to use spawn() to -avoid holding up the rest of the game. -### Example: +// Delete Tom's scores entirely +world.SetScores("Tom", "") -```dm - var/params // Change the Score and Pet fields params = -list("Score"=123, "Pet"="Dog") world.SetScores("Tom", -list2params(params)) // Delete the Pet field params = list("Pet"="") -world.SetScores("Tom", list2params(params)) // Delete Tom\'s scores -entirely world.SetScores("Tom", "") ``` -Note: You can specify a different hub path and hub_password by adding -these as extra arguments, but this is not recommended for security -reasons. If you use this feature, it should only be on games that cannot -be downloaded by the public. - -> [!TIP] -> **See also:** -> + [GetScores proc (world)](/ref/world/proc/GetScores.md) -> + [GetMedal proc (world)](/ref/world/proc/GetMedal.md) -> + [SetMedal proc (world)](/ref/world/proc/SetMedal.md) -> + [ClearMedal proc (world)](/ref/world/proc/ClearMedal.md) \ No newline at end of file + + +> [!CAUTION] +> Note: You can specify a different hub path and hub_password by adding these as extra arguments, but this is not recommended for security reasons. If you use this feature, it should only be on games that cannot be downloaded by the public. +*** \ No newline at end of file diff --git a/ref/world/proc/Tick.md b/ref/world/proc/Tick.md index 5375d26a..519d6187 100644 --- a/ref/world/proc/Tick.md +++ b/ref/world/proc/Tick.md @@ -1,39 +1,21 @@ -## Tick proc (world) -###### BYOND Version 515 +## Tick (proc) +*** +This proc allows you to do any updates just before map info is sent out. One possible use for this is to run a movement loop, or sync up any user interface input that might have arrived and deal with it all at once. -**Format:** -+ Tick() - -**When:** -+ Called during the server tick, after sleeping procs and queued - commands, just before map information is sent to the clients. - -**Default action:** -+ None. +```dm -This proc allows you to do any updates just before map info is -sent out. One possible use for this is to run a movement loop, or sync -up any user interface input that might have arrived and deal with it all -at once. -### Example: +world/Tick() + for(var/client/C) + if(C.mob?.move_dir) + try + step(C.mob, move_dir) + catch + // empty catch, just so a failed step won't break the loop -```dm - world/Tick() for(var/client/C) if(C.mob?.move_dir) try -step(C.mob, move_dir) catch // empty catch, just so a failed step won\'t -break the loop ``` - -Note: The tick will not wait if this -proc sleeps. It effectively has [set -waitfor=0](/ref/proc/set/waitfor.md) already built in. It\'s a good -idea not to sleep in this proc or any of its callees at all, since it -will keep getting called every tick. -> [!TIP] -> **See also:** -> + [cpu var (world)](/ref/world/var/cpu.md) -> + [map_cpu var (world)](/ref/world/var/map_cpu.md) -> + [tick_usage var (world)](/ref/world/var/tick_usage.md) \ No newline at end of file +Note: The tick will not wait if this proc sleeps. It effectively has set waitfor=0 already built in. It's a good idea not to sleep in this proc or any of its callees at all, since it will keep getting called every tick. +*** \ No newline at end of file diff --git a/ref/world/proc/Topic.md b/ref/world/proc/Topic.md index c37eddb8..c8b95879 100644 --- a/ref/world/proc/Topic.md +++ b/ref/world/proc/Topic.md @@ -1,50 +1,23 @@ -## Topic proc (world) - -**Format:** -+ Topic(T,Addr,Master,Keys) - -**When:** -+ Called when a message is received from another server by using - world.Export(). If a file is expected, world.Import() may be called - to get it. The return value of Topic() will be passed back to the - remote server. - -**Args:** -+ T: The topic text string specified by the remote server (everything - following ? in the URL). -+ Addr: The address of the remote server. -+ Master: 1 if remote server is the server which started this one. -+ Keys: List of keys belonging to users who are logged in on the - remote server - -**Default action:** -+ The topic "ping" returns a true value (number of players plus - one), which may be useful for telling if a server is alive. The - topics "Reboot" and "Del" will call world.Reboot() and - world.Del() respectively if the message was sent by the master - server. -### Example: + +## Topic (proc) +*** ```dm - world/Topic(T) if(findtext(T,"shout:") == 1) world << -copytext(T,7) + +world/Topic(T) + if(findtext(T,"shout:") == 1) + world << copytext(T,7) + ``` - - -This example allows other servers to -send this server topic text of the form "shout:msg" and will broadcast -the message to all the players in this world. - -The Keys argument -is either null, or a list of user keys. Any keys in the list are logged -in to the remote server. -Always validate the input in `Topic()` calls to make sure it\'s correct -and the query you\'re recieving is legitimate. - -> [!TIP] -> **See also:** -> + [Del proc (world)](/ref/world/proc/Del.md) -> + [Export proc (world)](/ref/world/proc/Export.md) -> + [Import proc (client)](/ref/client/proc/Import.md) -> + [Import proc (world)](/ref/world/proc/Import.md) -> + [Reboot proc (world)](/ref/world/proc/Reboot.md) \ No newline at end of file + + +This example allows other servers to send this server topic text of the form "shout:msg" and will broadcast the message to all the players in this world. + +The Keys argument is either null, or a list of user keys. Any keys in the list are logged in to the remote server. + + +> [!CAUTION] +> +> > [!NOTE] +> > Always validate the input in `Topic()` calls to make sure it's correct and the query you're recieving is legitimate. +*** \ No newline at end of file diff --git a/ref/world/proc/index.md b/ref/world/proc/index.md new file mode 100644 index 00000000..a689d1a9 --- /dev/null +++ b/ref/world/proc/index.md @@ -0,0 +1,5 @@ + +## proc (proc) +*** +Built-in world procs: +*** \ No newline at end of file diff --git a/ref/world/var.md b/ref/world/var.md deleted file mode 100644 index 0b09478c..00000000 --- a/ref/world/var.md +++ /dev/null @@ -1,50 +0,0 @@ -## vars (world) - -New procs and vars cannot be defined under /world. Define them globally instead. - -Built-in world vars: -world/var -+ [address](/ref/world/var/address.md) -+ [area](/ref/world/var/area.md) -+ [byond_build](/ref/world/var/byond_build.md) -+ [byond_version](/ref/world/var/byond_version.md) -+ [cache_lifespan](/ref/world/var/cache_lifespan.md) -+ [contents](/ref/world/var/contents.md) -+ [cpu](/ref/world/var/cpu.md) -+ [executor](/ref/world/var/executor.md) -+ [fps](/ref/world/var/fps.md) -+ [game_state](/ref/world/var/game_state.md) -+ [host](/ref/world/var/host.md) -+ [hub](/ref/world/var/hub.md) -+ [hub_password](/ref/world/var/hub_password.md) -+ [icon_size](/ref/world/var/icon_size.md) -+ [internet_address](/ref/world/var/internet_address.md) -+ [log](/ref/world/var/log.md) -+ [loop_checks](/ref/world/var/loop_checks.md) -+ [map_format](/ref/world/var/map_format.md) -+ [map_cpu](/ref/world/var/map_cpu.md) -+ [maxx](/ref/world/var/maxx.md) -+ [maxy](/ref/world/var/maxy.md) -+ [maxz](/ref/world/var/maxz.md) -+ [mob](/ref/world/var/mob.md) -+ [movement_mode](/ref/world/var/movement_mode.md) -+ [name](/ref/world/var/name.md) -+ [params](/ref/world/var/params.md) -+ [port](/ref/world/var/port.md) -+ [process](/ref/world/var/process.md) -+ [realtime](/ref/world/var/realtime.md) -+ [reachable](/ref/world/var/reachable.md) -+ [sleep_offline](/ref/world/var/sleep_offline.md) -+ [status](/ref/world/var/status.md) -+ [system_type](/ref/world/var/system_type.md) -+ [tick_lag](/ref/world/var/tick_lag.md) -+ [tick_usage](/ref/world/var/tick_usage.md) -+ [time](/ref/world/var/time.md) -+ [timeofday](/ref/world/var/timeofday.md) -+ [timezone](/ref/world/var/timezone.md) -+ [turf](/ref/world/var/turf.md) -+ [url](/ref/world/var/url.md) -+ [vars](/ref/datum/var/vars.md) -+ [version](/ref/world/var/version.md) -+ [view](/ref/world/var/view.md) -+ [visibility](/ref/world/var/visibility.md) diff --git a/ref/world/var/address.md b/ref/world/var/address.md index bca3ce5c..3933c923 100644 --- a/ref/world/var/address.md +++ b/ref/world/var/address.md @@ -1,23 +1,11 @@ -## address var (world) +## address (var) +*** +This is the network address of the machine hosting the world. If it cannot be determined, it will be null. -This is the network address of the machine hosting the world. -If it cannot be determined, it will be null. +The full network address of the world may be formed by concatenating the world address and port: "byond://[address]:[port]". -The full network -address of the world may be formed by concatenating the world address -and port: "byond://[address]:[port]". +In CGI mode, this is the web address of the world. -In CGI mode, this -is the web address of the world. - -This is the local address -only. If the world is hosted via a router, the external IP address may -be different. Use `internet_address` to find the external address, if -available. - -> [!TIP] -> **See also:** -> + [port var (world)](/ref/world/var/port.md) -> + [url var (world)](/ref/world/var/url.md) -> + [internet_address var (world)](/ref/world/var/internet_address.md) \ No newline at end of file +This is the local address only. If the world is hosted via a router, the external IP address may be different. Use `internet_address` to find the external address, if available. +*** \ No newline at end of file diff --git a/ref/world/var/area.md b/ref/world/var/area.md index 318b28dd..e02513af 100644 --- a/ref/world/var/area.md +++ b/ref/world/var/area.md @@ -1,7 +1,5 @@ -# area var (world) -**Default value:** -+ /area. - -This is the default area type to be placed on the map wherever -no area is specified. A value of 0 turns off the default area. \ No newline at end of file +## area (var) +*** +This is the default area type to be placed on the map wherever no area is specified. A value of 0 turns off the default area. +*** \ No newline at end of file diff --git a/ref/world/var/byond_build.md b/ref/world/var/byond_build.md index ea25e774..babefd6e 100644 --- a/ref/world/var/byond_build.md +++ b/ref/world/var/byond_build.md @@ -1,16 +1,5 @@ -## byond_build var (world) -###### BYOND Version 512 - -This is the build number (minor version) of BYOND being run by -this server. Typically this is not useful information, but it can come -in handy when diagnosing issues reported by players when hosting with a -beta build. - -> [!TIP] -> **See also:** -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [byond_version var (client)](/ref/client/var/byond_version.md) -> + [byond_build var (savefile)](/ref/savefile/var/byond_build.md) -> + [byond_version var (savefile)](/ref/savefile/var/byond_version.md) \ No newline at end of file +## byond_build (var) +*** +This is the build number (minor version) of BYOND being run by this server. Typically this is not useful information, but it can come in handy when diagnosing issues reported by players when hosting with a beta build. +*** \ No newline at end of file diff --git a/ref/world/var/byond_version.md b/ref/world/var/byond_version.md index d110e968..c9cfea71 100644 --- a/ref/world/var/byond_version.md +++ b/ref/world/var/byond_version.md @@ -1,15 +1,5 @@ -## byond_version var (world) - -This is the version of BYOND at run-time. A game designed to -work around known bugs in older versions could use this to adapt its -behavior accordingly. - -> [!TIP] -> **See also:** -> + [DM_VERSION macro](/ref/DM/preprocessor/DM_VERSION.md) -> + [byond_build var (world)](/ref/world/var/byond_build.md) -> + [system_type var (world)](/ref/world/var/system_type.md) -> + [byond_version var (client)](/ref/client/var/byond_version.md) -> + [byond_build var (savefile)](/ref/savefile/var/byond_build.md) -> + [byond_version var (savefile)](/ref/savefile/var/byond_version.md) \ No newline at end of file +## byond_version (var) +*** +This is the version of BYOND at run-time. A game designed to work around known bugs in older versions could use this to adapt its behavior accordingly. +*** \ No newline at end of file diff --git a/ref/world/var/cache_lifespan.md b/ref/world/var/cache_lifespan.md index a384834a..58717a0a 100644 --- a/ref/world/var/cache_lifespan.md +++ b/ref/world/var/cache_lifespan.md @@ -1,22 +1,9 @@ -## cache_lifespan var (world) -**Default value:** -+ 30 (days) +## cache_lifespan (var) +*** +Number of days items that are not in use will be saved in the resource cache (.rsc file). Files uploaded by players are stored in the world's .rsc file for future use. If the file is not used for the specified amount of time, it will be removed to save space. - -Number of days items that are not in use will be saved in the -resource cache (.rsc file). Files uploaded by players are stored in the -world\'s .rsc file for future use. If the file is not used for the -specified amount of time, it will be removed to save space. - - -Setting this value to 0 causes items to be saved for the -current session only. This is used by the CGI library, because web -browsers cannot make use of server-side caches when uploading files -anyway. +Setting this value to 0 causes items to be saved for the current session only. This is used by the CGI library, because web browsers cannot make use of server-side caches when uploading files anyway. This value must be a whole number. - -> [!TIP] -> **See also:** -> + [cache](/ref/DM/cache.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/world/var/contents.md b/ref/world/var/contents.md index d868eacb..14d99cb8 100644 --- a/ref/world/var/contents.md +++ b/ref/world/var/contents.md @@ -1,24 +1,19 @@ -## contents list var (world) -**Default value:** -+ List of all areas, turfs, mobs, and objs initially in the world. +## contents (var) +*** +This is a list of every object in the world. Objects in this list are in no particular order. -This is a list of every object in the world. Objects in this -list are in no particular order. -### Example: - ```dm - proc/ListAreas(mob/M) var/area/A M << "Areas:" for (A -in world.contents) M << A + +proc/ListAreas(mob/M) + var/area/A + M << "Areas:" + for (A in world.contents) + M << A + ``` - -This example displays a -list of every area in existence. As a convenient short-hand, one may -simply write for(A) or for(A in world) instead of the full for(A in -world.contents). -> [!TIP] -> **See also:** -> + [list](/ref/list.md) \ No newline at end of file +This example displays a list of every area in existence. As a convenient short-hand, one may simply write for(A) or for(A in world) instead of the full for(A in world.contents). +*** \ No newline at end of file diff --git a/ref/world/var/cpu.md b/ref/world/var/cpu.md index 53ed2737..cb6b4eca 100644 --- a/ref/world/var/cpu.md +++ b/ref/world/var/cpu.md @@ -1,24 +1,9 @@ -## cpu var (world) +## cpu (var) +*** +This is the percentage of a server tick that the server spends processing running procs and the work of sending map information to players. A value of 0 would indicate very little cpu usage. A value of 100 would indicate full cpu usage, which could mean that the server cannot complete all the necessary computations during a tick to finish in time for the next tick. In this case, timed events (such as sleep) may take longer than requested. -This is the percentage of a server tick that the server spends -processing running procs and the work of sending map information to -players. A value of 0 would indicate very little cpu usage. A value of -100 would indicate full cpu usage, which could mean that the server -cannot complete all the necessary computations during a tick to finish -in time for the next tick. In this case, timed events (such as sleep) -may take longer than requested. +When deciding on a value for tick_lag, one could use this value to determine if the CPU is fast enough to tick at a higher rate. -When deciding on a value for -tick_lag, one could use this value to determine if the CPU is fast -enough to tick at a higher rate. - -The `map_cpu` var is a subset -of this, measuring only time used for sending map information. - -> [!TIP] -> **See also:** -> + [map_cpu var (world)](/ref/world/var/map_cpu.md) -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) -> + [tick_usage var (world)](/ref/world/var/tick_usage.md) -> + [Tick proc (world)](/ref/world/proc/Tick.md) \ No newline at end of file +The `map_cpu` var is a subset of this, measuring only time used for sending map information. +*** \ No newline at end of file diff --git a/ref/world/var/executor.md b/ref/world/var/executor.md index 2c1ccff6..564a8056 100644 --- a/ref/world/var/executor.md +++ b/ref/world/var/executor.md @@ -1,34 +1,21 @@ -## executor var (world) -**Format:** -+ executor = "/usr/local/byond/bin/DreamDaemon [params]" +## executor (var) +*** +This option is for direct execution of .dmb files in UNIX. The most common use is for writing CGI programs that are executed by the web server. +The first parameter in the `executor` text string is the path to DreamDaemon. The one listed above is the standard UNIX location. -This option is for direct execution of `.dmb` files in UNIX. -The most common use is for writing CGI programs that are executed by the -web server. +Optional parameters may follow. The most common are -CGI and -logself. -The first parameter in the `executor` -text string is the path to DreamDaemon. The one listed above is the -standard UNIX location. - -Optional parameters may follow. The -most common are -CGI and -logself. -### Example: ```dm - world/executor = "/usr/local/byond/bin/DreamDaemon -CGI --logself" + +world/executor = "/usr/local/byond/bin/DreamDaemon -CGI -logself" + ``` - -This example creates a CGI program to be -executed by a web server. It puts its error output in the file -`projname``.log`. -All of this is configured for you -when you include `html/CGI.dm` from the html library. +This example creates a CGI program to be executed by a web server. It puts its error output in the file `projname`.log. -> [!TIP] -> **See also:** -> + [startup proc](/ref/proc/startup.md) \ No newline at end of file +All of this is configured for you when you include html/CGI.dm from the html library. +*** \ No newline at end of file diff --git a/ref/world/var/fps.md b/ref/world/var/fps.md index 7e0cf5b9..1214a05c 100644 --- a/ref/world/var/fps.md +++ b/ref/world/var/fps.md @@ -1,39 +1,13 @@ -## fps var (world) -###### BYOND Version 490 -**Default value:** -+ 10 +## fps (var) +*** +The value of `world.fps` defines the speed of the world in frames (server ticks) per second. By default this is 10 fps, which is a good speed if all objects move in full tiles. Higher values yield smoother results, but at a cost to performance. Timing of many events may be limited by the system clock, so `fps` values beyond 40 or 50 may cause unwanted effects like jitter even for projects that are not very demanding in terms of performance. +For projects making use of pixel movement, higher `fps` is usually desired. 40 seems to be a good value for general use, but in worlds that have a large number of players, you may wish to lower the value and give players a higher `step_size` per tick instead. -The value of `world.fps` defines the speed of the world in -frames (server ticks) per second. By default this is 10 fps, which is a -good speed if all objects move in full tiles. Higher values yield -smoother results, but at a cost to performance. Timing of many events -may be limited by the system clock, so `fps` values beyond 40 or 50 may -cause unwanted effects like jitter even for projects that are not very -demanding in terms of performance. +This var exists for convenience; it is calculated by `10 / world.tick_lag`. The value of `world.tick_lag` is actually more accurate, but it is easier to think of world speed in terms of frames per second. The actual tick rate has a resolution of 1 ms. -For projects making use of -pixel movement, higher `fps` is usually desired. 40 seems to be a good -value for general use, but in worlds that have a large number of -players, you may wish to lower the value and give players a higher -`step_size` per tick instead. +When reading `world.fps`, the result is always given as a whole number to gloss over rounding error. -This var exists for convenience; -it is calculated by `10 / world.tick_lag`. The value of `world.tick_lag` -is actually more accurate, but it is easier to think of world speed in -terms of frames per second. The actual tick rate has a resolution of 1 -ms. - -When reading `world.fps`, the result is always given as a -whole number to gloss over rounding error. - -If you set -`client.tick_lag` or `client.fps` to a value other than 0, you can make -the client tick at a different (usually faster) rate. - -> [!TIP] -> **See also:** -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) -> + [fps var (client)](/ref/client/var/fps.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +If you set `client.tick_lag` or `client.fps` to a value other than 0, you can make the client tick at a different (usually faster) rate. +*** \ No newline at end of file diff --git a/ref/world/var/game_state.md b/ref/world/var/game_state.md index 79e6c6f6..11f550f6 100644 --- a/ref/world/var/game_state.md +++ b/ref/world/var/game_state.md @@ -1,24 +1,9 @@ -## game_state var (world) -**Default value:** -+ 0 - -At runtime, this value may be changed to let the BYOND hub know -about certain changes in the game\'s status. An example for using this -value is if the number of players in the game gets too high and most new -logins are rejected, you can set game_state to 1 to let the hub know -this server is full. +## game_state (var) +*** +At runtime, this value may be changed to let the BYOND hub know about certain changes in the game's status. An example for using this value is if the number of players in the game gets too high and most new logins are rejected, you can set game_state to 1 to let the hub know this server is full. The following values are accepted: -+ 0 - Normal status -+ 1 - Server is full - -Note that this value does not affect how your world actually -reacts to new players logging in. It is only used by the hub and -website. -> [!TIP] -> **See also:** -> + [name var (world)](/ref/world/var/name.md) -> + [status var (world)](/ref/world/var/status.md) -> + [visibility var (world)](/ref/world/var/visibility.md) +Note that this value does not affect how your world actually reacts to new players logging in. It is only used by the hub and website. +*** \ No newline at end of file diff --git a/ref/world/var/host.md b/ref/world/var/host.md index 1282b077..01b256dd 100644 --- a/ref/world/var/host.md +++ b/ref/world/var/host.md @@ -1,16 +1,5 @@ -## host var (world) -**Default value:** -+ null - - -If the information is made available by the pager, this will -provide the key of the world\'s host. If the host is not known, this -value will be either null or an empty string. - -> [!TIP] -> **See also:** -> + [game_state var (world)](/ref/world/var/game_state.md) -> + [name var (world)](/ref/world/var/name.md) -> + [status var (world)](/ref/world/var/status.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file +## host (var) +*** +If the information is made available by the pager, this will provide the key of the world's host. If the host is not known, this value will be either null or an empty string. +*** \ No newline at end of file diff --git a/ref/world/var/hub.md b/ref/world/var/hub.md index 9fcc21ea..5a805d7d 100644 --- a/ref/world/var/hub.md +++ b/ref/world/var/hub.md @@ -1,50 +1,26 @@ -## hub var (world) -**Default value:** -+ null +## hub (var) +*** +This is a registered BYOND hub path. The default value of null is for unregistered games. Registered games (don't worry, it's free!) have their own hub page showing a brief description of the game, the author, an optional installation package, and links to online games. The hub path is a string of the form "YourName.GameName" and can be found in your hub console. +Even unregistered games show up in the hub when they are live (that is online with people connected). It just doesn't show any of the extra info like a description, and there is no way for people to find out about it when nobody is logged in. -This is a registered [BYOND hub](http://www.byond.com/hub/) -path. The default value of null is for unregistered games. Registered -games (don\'t worry, it\'s free!) have their own hub page showing a -brief description of the game, the author, an optional installation -package, and links to online games. The hub path is a string of the form -"YourName.GameName" and can be found in your [hub -console](https://secure.byond.com/members/?command=edit_hub). +If you do not want your game to show up in the hub (like while you are in the initial stages of development), just compile with visibility=0. Either that, or turn off your pager or your BYOND locator when you are connected to it. +You (or the players) might also wish to turn off the notice of a live game in the hub when there is no longer any room for new players or if it is too late in the game for new people to join. At such times, you can simply set the visibility to 0. -Even unregistered games show up in the hub when they are live -(that is online with people connected). It just doesn\'t show any of the -extra info like a description, and there is no way for people to find -out about it when nobody is logged in. -If you do not want your -game to show up in the hub (like while you are in the initial stages of -development), just compile with `visibility=0`. Either that, or turn off -your pager or your BYOND locator when you are connected to it. +```dm +world + hub = "Dan.PipeStock" //registered hub path -You (or the players) might also wish to turn off the notice of -a live game in the hub when there is no longer any room for new players -or if it is too late in the game for new people to join. At such times, -you can simply set the visibility to 0. -### Example: +mob/verb/start_game() + world.visibility = 0 + //... -```dm - world hub = "Dan.PipeStock" //registered hub path -mob/verb/start_game() world.visibility = 0 //... ``` - - -If -you configure your hub page to require a hub password, you must also -specify `world.hub_password`. - -> [!TIP] -> **See also:** -> + [hub_password var (world)](/ref/world/var/hub_password.md) -> + [name var (world)](/ref/world/var/name.md) -> + [status var (world)](/ref/world/var/status.md) -> + [game_state var (world)](/ref/world/var/game_state.md) -> + [version var (world)](/ref/world/var/version.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file + + +If you configure your hub page to require a hub password, you must also specify world.hub_password. +*** \ No newline at end of file diff --git a/ref/world/var/hub_password.md b/ref/world/var/hub_password.md index ed060f28..ebccd8bc 100644 --- a/ref/world/var/hub_password.md +++ b/ref/world/var/hub_password.md @@ -1,34 +1,19 @@ -## hub_password var (world) -**Default value:** -+ null +## hub_password (var) +*** +If world.hub is set, any live session of the game will be attached to the specified BYOND Hub page. Under the default settings, any game can set world.hub and attach itself to any BYOND Hub page. +To beef up security, you can set a hub password in your hub's configuration page via the BYOND website. This will ensure that only authorized copies of your game can attach themselves to your hub page when live. Then simply copy that password into your code as world.hub_password so that your game's live broadcast will be accepted by the hub. -If `world.hub` is set, any live session of the game will be -attached to the specified BYOND Hub page. Under the default settings, -any game can set `world.hub` and attach itself to any BYOND Hub page. +```dm -To beef up security, you can set a hub password in your hub\'s -configuration page via the BYOND website. This will ensure that only -authorized copies of your game can attach themselves to your hub page -when live. Then simply copy that password into your code as -`world.hub_password` so that your game\'s live broadcast will be -accepted by the hub. -### Example: +world + hub = "Dan.PipeStock" //registered hub path + hub_password = "UPAggnJaeXmSBoKK" //password for live game authentication -```dm - world hub = "Dan.PipeStock" //registered hub path -hub_password = "UPAggnJaeXmSBoKK" //password for live game -authentication ``` - -Note that for security reasons, -reading this variable at runtime will return a hashed version of the -value that was set. -> [!TIP] -> **See also:** -> + [hub var (world)](/ref/world/var/hub.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file +Note that for security reasons, reading this variable at runtime will return a hashed version of the value that was set. +*** \ No newline at end of file diff --git a/ref/world/var/icon_size.md b/ref/world/var/icon_size.md index 18546eee..c707afa0 100644 --- a/ref/world/var/icon_size.md +++ b/ref/world/var/icon_size.md @@ -1,28 +1,9 @@ -## icon_size var (world) -**Default value:** -+ 32 +## icon_size (var) +*** +This is the tile size that will be used as a default for icons in the world. It can be set to a single number that represents both the width and height, or you can use a format like "[width]x[height]" (such as "16x48") to specify width and height separately. +This value affects several calculations, including icon operations and gliding between turfs. -This is the tile size that will be used as a default for icons -in the world. It can be set to a single number that represents both the -width and height, or you can use a format like "[width]x[height]" -(such as "16x48") to specify width and height separately. - - -This value affects several calculations, including icon -operations and gliding between turfs. - -Note: If you do not use a -square icon size and you are using a topdown map format, you may -experience display issues if setting `client.dir` to `EAST` or `WEST`. A -non-square tile with a topdown map format will also interfere with pixel -movement. For this reason, square sizes are recommended when using any -topdown-view map format. - -> [!TIP] -> **See also:** -> + [map_format var (world)](/ref/world/var/map_format.md) -> + [step_size var (movable atoms)](/ref/atom/movable/var/step_size.md) -> + [Gliding](/ref/notes/gliding.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) \ No newline at end of file +Note: If you do not use a square icon size and you are using a topdown map format, you may experience display issues if setting `client.dir` to `EAST` or `WEST`. A non-square tile with a topdown map format will also interfere with pixel movement. For this reason, square sizes are recommended when using any topdown-view map format. +*** \ No newline at end of file diff --git a/ref/world/var/index.md b/ref/world/var/index.md new file mode 100644 index 00000000..bfb0dbdb --- /dev/null +++ b/ref/world/var/index.md @@ -0,0 +1,5 @@ + +## var (var) +*** +Built-in world vars: +*** \ No newline at end of file diff --git a/ref/world/var/internet_address.md b/ref/world/var/internet_address.md index 92367a69..4b152b80 100644 --- a/ref/world/var/internet_address.md +++ b/ref/world/var/internet_address.md @@ -1,21 +1,9 @@ -## internet_address var (world) +## internet_address (var) +*** +This is the network address of the machine hosting the world, as it is seen by the outside network (from the Internet) and the hub. If it cannot be determined, it will be null. -This is the network address of the machine hosting the world, -as it is seen by the outside network (from the Internet) and the hub. If -it cannot be determined, it will be null. +The full network address of the world may be formed by concatenating the world address and port: "byond://[address]:[port]". -The full network -address of the world may be formed by concatenating the world address -and port: "byond://[address]:[port]". - -This var exists -because `world.address` may not be accurate if the world is hosted on a -machine behind a router using NAT. The value returned by -`internet_address` can be given to other players who wish to log in. - -> [!TIP] -> **See also:** -> + [port var (world)](/ref/world/var/port.md) -> + [url var (world)](/ref/world/var/url.md) -> + [address var (world)](/ref/world/var/address.md) \ No newline at end of file +This var exists because `world.address` may not be accurate if the world is hosted on a machine behind a router using NAT. The value returned by `internet_address` can be given to other players who wish to log in. +*** \ No newline at end of file diff --git a/ref/world/var/log.md b/ref/world/var/log.md index 732995d8..a076487c 100644 --- a/ref/world/var/log.md +++ b/ref/world/var/log.md @@ -1,28 +1,24 @@ -## log var (world) +## log (var) +*** +Sending output to world.log may be useful for debugging purposes. The output goes to the same place run-time proc errors are displayed. -Sending output to world.log may be useful for debugging -purposes. The output goes to the same place run-time proc errors are -displayed. -### Example: ```dm - if(1+1 != 2) world.log << "Uh oh." + +if(1+1 != 2) + world.log << "Uh oh." + ``` +You can assign world.log to a file name or file() object to redirect output to that file. (There is also a command-line option to Dream Daemon that does this.) -You can assign world.log to a file name or file() object to -redirect output to that file. (There is also a command-line option to -Dream Daemon that does this.) -### Example: ```dm - world.log = file("mylog.txt") -``` +world.log = file("mylog.txt") + +``` -> [!TIP] -> **See also:** -> + [file proc](/ref/proc/file.md) -> + [startup proc](/ref/proc/startup.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/world/var/loop_checks.md b/ref/world/var/loop_checks.md index 1c486a6a..7f570feb 100644 --- a/ref/world/var/loop_checks.md +++ b/ref/world/var/loop_checks.md @@ -1,22 +1,9 @@ -# loop_checks var (world) -**Default value:** -+ 1 +## loop_checks (var) +*** +Setting this to 0 disables the very long loop protection. By default, loops in the code which undergo a very large number of iterations or recursions are aborted (by crashing the proc). This prevents the proc from locking up the server for too long. -Setting this to 0 disables the very long loop protection. By -default, loops in the code which undergo a very large number of -iterations or recursions are aborted (by crashing the proc). This -prevents the proc from locking up the server for too long. +You may need to disable this feature if your code has some very long loops in it. Before doing that, make sure it's not infinitely long! Your program will utterly crash if it runs out of system stack space, which can happen in a very deep or infinite recursion. -You -may need to disable this feature if your code has some very long loops -in it. Before doing that, make sure it\'s not *infinitely* long! Your -program will utterly crash if it runs out of system stack space, which -can happen in a very deep or infinite recursion. - -Note: The -compiler will now generate a warning when you disable `loop_checks`. It -is not advisable to disable the check unless you\'re trying to debug -something, since you can cause the server to hang. Generally if you have -a loop so long it can cause the regular loop checks to freak out, you -need to make a change to the loop behavior anyway. \ No newline at end of file +Note: The compiler will now generate a warning when you disable `loop_checks`. It is not advisable to disable the check unless you're trying to debug something, since you can cause the server to hang. Generally if you have a loop so long it can cause the regular loop checks to freak out, you need to make a change to the loop behavior anyway. +*** \ No newline at end of file diff --git a/ref/world/var/map_cpu.md b/ref/world/var/map_cpu.md index b800bcdf..41c0e375 100644 --- a/ref/world/var/map_cpu.md +++ b/ref/world/var/map_cpu.md @@ -1,17 +1,5 @@ -## map_cpu var (world) -###### BYOND Version 514 - -This is the percentage of a server tick that the server spends -processing information about the map to send to players. A value of 0 -would indicate very little cpu usage. A value of 100 would indicate full -cpu usage, which means that the server cannot complete all the necessary -computations during a tick to finish in time for the next tick. In this -case, timed events (such as sleep) may take longer than requested. - -> [!TIP] -> **See also:** -> + [cpu var (world)](/ref/world/var/cpu.md) -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) -> + [tick_usage var (world)](/ref/world/var/tick_usage.md) -> + [Tick proc (world)](/ref/world/proc/Tick.md) \ No newline at end of file +## map_cpu (var) +*** +This is the percentage of a server tick that the server spends processing information about the map to send to players. A value of 0 would indicate very little cpu usage. A value of 100 would indicate full cpu usage, which means that the server cannot complete all the necessary computations during a tick to finish in time for the next tick. In this case, timed events (such as sleep) may take longer than requested. +*** \ No newline at end of file diff --git a/ref/world/var/map_format.md b/ref/world/var/map_format.md index 29d370e8..d248860c 100644 --- a/ref/world/var/map_format.md +++ b/ref/world/var/map_format.md @@ -1,151 +1,7 @@ -# map_format var (world) -**Default value:** -+ TOPDOWN_MAP +## map_format (var) +*** +This value says how the world will display maps. In a normal overhead tiled map the value is `TOPDOWN_MAP` for the top-down format. For older games that predate this feature, the value is `TILED_ICON_MAP`. -**Possible values:** -- TOPDOWN_MAP -- ISOMETRIC_MAP -- SIDE_MAP -- TILED_ICON_MAP - -This value says how the world will display maps. In a normal -overhead tiled map the value is `TOPDOWN_MAP` for the top-down format. -For older games that predate this feature, the value is -`TILED_ICON_MAP`. -If you use a map format other than top-down, -the HUD will still use a tile format like it would in top-down display. -HUD objects are not projected into whatever map_format you use and they -are not affected by changing client.dir. The size of the HUD is rounded -up to the nearest number of full screen tiles; the size of each tile is -defined by world.icon_size. - -> [!TIP] -> Some people find it easier to differentiate SIDE_MAP and TOPDOWN_MAP by -> thinking of them as STANDING_MAP and FLAT_MAP respectively. - -### Top-down format -(See more at [Topdown maps](/ref/notes/topdown.md) .) -This is the default map format. Icons are drawn in a tile form and viewed from -overhead. In this layout, the layer assigned to each atom is very -important. The number of tiles shown is set by client.view or -world.view. -Because this format is familiar and easy to -understand, it is the default setting. Most of the vars related to maps -and atoms are designed and documented with this format in mind. - -### Tiled icon format (deprecated) -(See more at [Tiled icons](/ref/notes/tiled-icons.md) .) In BYOND 4.0 a -new feature was introduced for using \"big\" icons, bigger than the -standard tile size, by splitting them up into states like \"0,0\", -\"1,0\", and so on. This functionality is no longer needed since BYOND -now has the ability to display icons in their natural size. Some games -that were designed before this, however, may still need to make use of -this splitting feature that breaks icons into smaller tile-sized pieces. -When an icon is broken into chunks, each state in the icon is given a -thumbail version of the full image, and then new states are added to -show each chunk. For instance if world.icon_size is the default 32×32, -and the icon is 64×64, then the \"door\" state would become a thumbnail -of the full door image while \"door 0,0\" (the lower left corner), -\"door 1,0\", \"door 0,1\", and \"door 1,1\" were created to show each -smaller section of the image. If the default \"\" state is broken into -chunks, those chunks are just named \"0,0\" and so on without a space. -This format is deprecated. It exists to support older games and allow -them to be compiled without causing them to break, until they can be -redesigned for one of the newer formats. - -### Isometric format -(See more at [Isometric maps](/ref/notes/isometric.md) .) -If map_format is set to `ISOMETRIC_MAP`, the map is displayed in isometric -form. Isometric tiles are displayed in a foreshortened diagonal -perspective, where the \"north\" direction actually displays as -northeast on the player\'s screen, and \"east\" shows up as southeast. -The value of `client.view` or `world.view` is used to calculate the -*minimum* number of tiles to display, and extra tiles to each side will -be shown to fill in the corners. -In an isometric map, the tile -width set in world.icon_size is the most important factor. This should -be a multiple of 4 for best results. The minimum tile height is half -that value, and any extra height is used to show vertical structures -that \"stick up\" off the map surface. When you draw an isometric tile -icon, start with a flattened diamond shape at the bottom that is only -half as high as it is wide. -Isometric maps behave differently -during drawing than top-down maps. In isometric, tiles that are nearer -to the viewer\'s perspective are drawn in front of tiles farther back, -regardless of layer. Layers only count within an individual tile. This -means that if you want to have a vertical structure \"stick up\" to -partially hide something behind it, the icon sticking up should always -be on a tile forward from the one being partly covered. E.g. if you have -a wall taking up part of your tile, it needs to be at the \"back\" end -of the tile to properly hide anything on the tiles behind it. -The `pixel_x` and `pixel_y` values, `step_x` and `step_y` -values, and the gliding that happens when moving between tiles, are -based on the width set by `world.icon_size`. If you set -`world.icon_size="64x128"` to show tall buildings, only the 64 matters -for pixel offsets. Use `pixel_w` and `pixel_z` to adjust the position of -atoms (or the client) horizontally or vertically without respect to -`client.dir` or the map format. -Note: Offsets for x and y also -affect the layering order used to draw the icons. Any object with a -pixel offset onto another tile is considered part of whichever tile is -closer. -If you use an icon wider than one tile, the -\"footprint\" of the isometric icon (the actual map tiles it takes up) -will always be a square. That is, if your normal tile size is 64 and you -want to show a 128x128 icon, the icon is two tiles wide and so it will -take up a 2×2-tile area on the map. The height of a big icon is -irrelevant\--any excess height beyond width/2 is used to show vertical -features. To draw this icon properly, other tiles on that same ground -will be moved behind it in the drawing order. -One important -warning about using big icons in isometric mode is that you should only -do this with dense atoms. If part of a big mob icon covers the same tile -as a tall building for instance, the tall building is moved back and it -could be partially covered by other turfs that are actually behind it. A -mob walking onto a very large non-dense turf icon would experience -similar irregularities. - -### Side-view format 482 -(See more at [Side-view maps](/ref/notes/side.md) ) -The `SIDE_MAP` format is like a cross between `TOPDOWN_MAP` and -`ISOMETRIC_MAP`. It looks very similar to a top-down view but it is -intended for more of a 3/4 perspective, where tiles lower on the screen -are considered closer to the viewer. Because this impacts the way layers -work, most of the layering behavior is the same as with isometric. -> [!NOTE] -> When using SIDE_MAP, it's almost always desirable to change your -> default layer variables to the following: -> ```dm -> #define AREA_LAYER 1 + BACKGROUND_LAYER -> #define TURF_LAYER 2 + BACKGROUND_LAYER -> #define OBJ_LAYER 3 -> #define MOB_LAYER 3 -> -> area/layer = AREA_LAYER -> turf/layer = TURF_LAYER -> obj/layer = OBJ_LAYER -> mob/layer = MOB_LAYER -> ``` -In a 3/4 perspective the tiles are often foreshortened, so -pixel offsets are adjusted to account for this. For example, you may set -`world.icon_size` to `"32x24"`, but the tile is considered to be a -perfect square if you look at it from the top down. Because the width is -32 pixels, the virtual height is also 32, so if you use pixel_y=32 the -atom will appear one tile further back than it normally is. (This -adjustment doesn\'t affect screen objects or `pixel_w`/`pixel_z`.) -Changing `client.dir` preserves the same tile size regardless -of orientation. - -> [!TIP] -> **See also:** -> + [icon_size var (world)](/ref/world/var/icon_size.md) -> + [view var (world)](/ref/world/var/view.md) -> + [view var (client)](/ref/client/var/view.md) -> + [screen_loc var (movable atoms)](/ref/atom/movable/var/screen_loc.md) -> + [Topdown maps](/ref/notes/topdown.md) -> + [Isometric maps](/ref/notes/isometric.md) -> + [Side-view maps](/ref/notes/side.md) -> + [Big icons](/ref/notes/big-icons.md) -> + [Tiled icons](/ref/notes/tiled-icons.md) -> + [Understanding the renderer](/ref/notes/renderer.md) +If you use a map format other than top-down, the HUD will still use a tile format like it would in top-down display. HUD objects are not projected into whatever map_format you use and they are not affected by changing client.dir. The size of the HUD is rounded up to the nearest number of full screen tiles; the size of each tile is defined by world.icon_size. +*** \ No newline at end of file diff --git a/ref/world/var/maxx.md b/ref/world/var/maxx.md index 1c3fe0a6..c98da78d 100644 --- a/ref/world/var/maxx.md +++ b/ref/world/var/maxx.md @@ -1,26 +1,9 @@ -## maxx var (world) -**Default value:** -+ 0 +## maxx (var) +*** +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. -The world map is a three-dimensional block of turfs with -coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile -time, it provides a lower bound and will be increased as needed by the -map files. - -The default value is 0, indicating no map. If any of -the map dimensions are set to non-zero values at compile time, the -others will default to 1. - -New territory created by increasing -the map boundaries is filled in with the default turf and area -(world.turf, and world.area). - -> [!TIP] -> **See also:** -> + [area var (world)](/ref/world/var/area.md) -> + [maxy var (world)](/ref/world/var/maxy.md) -> + [maxz var (world)](/ref/world/var/maxz.md) -> + [turf var (world)](/ref/world/var/turf.md) -> + [Map](/ref/map.md) \ No newline at end of file +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). +*** \ No newline at end of file diff --git a/ref/world/var/maxy.md b/ref/world/var/maxy.md index f21d1481..cb5c0f44 100644 --- a/ref/world/var/maxy.md +++ b/ref/world/var/maxy.md @@ -1,25 +1,9 @@ -## maxy var (world) -**Default value:** -+ 0 +## maxy (var) +*** +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. -The world map is a three-dimensional block of turfs with -coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile -time, it provides a lower bound and will be increased as needed by the -map files. - -The default value is 0, indicating no map. If any of -the map dimensions are set to non-zero values at compile time, the -others will default to 1. - -New territory created by increasing -the map boundaries is filled in with the default turf and area -(world.turf, and world.area). - -> [!TIP] -> **See also:** -> + [area var (world)](/ref/world/var/area.md) -> + [maxx var (world)](/ref/world/var/maxx.md) -> + [maxz var (world)](/ref/world/var/maxz.md) -> + [turf var (world)](/ref/world/var/turf.md) \ No newline at end of file +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). +*** \ No newline at end of file diff --git a/ref/world/var/maxz.md b/ref/world/var/maxz.md index 3e6c817b..fb9a47d8 100644 --- a/ref/world/var/maxz.md +++ b/ref/world/var/maxz.md @@ -1,25 +1,9 @@ -## maxz var (world) -**Default value:** -+ 0 +## maxz (var) +*** +The world map is a three-dimensional block of turfs with coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile time, it provides a lower bound and will be increased as needed by the map files. +The default value is 0, indicating no map. If any of the map dimensions are set to non-zero values at compile time, the others will default to 1. -The world map is a three-dimensional block of turfs with -coordinates ranging from (1,1,1) to (maxx,maxy,maxz). If set at compile -time, it provides a lower bound and will be increased as needed by the -map files. - -The default value is 0, indicating no map. If any of -the map dimensions are set to non-zero values at compile time, the -others will default to 1. - -New territory created by increasing -the map boundaries is filled in with the default turf and area -(world.turf, and world.area). - -> [!TIP] -> **See also:** -> + [area var (world)](/ref/world/var/area.md) -> + [maxx var (world)](/ref/world/var/maxx.md) -> + [maxy var (world)](/ref/world/var/maxy.md) -> + [turf var (world)](/ref/world/var/turf.md) \ No newline at end of file +New territory created by increasing the map boundaries is filled in with the default turf and area (world.turf, and world.area). +*** \ No newline at end of file diff --git a/ref/world/var/mob.md b/ref/world/var/mob.md index eeec8de7..5b52e2b9 100644 --- a/ref/world/var/mob.md +++ b/ref/world/var/mob.md @@ -1,28 +1,23 @@ -## mob var (world) -**Default value:** -+ /mob. +## mob (var) +*** +When a player connects to the world, the world is searched for a mob with the player's key. If one is found, the player is connected to that mob. If none is found, a new mob of type world.mob is created and the player is connected to this new mob. +The default value is /mob. Setting world.mob to 0 prevents the creation of default mobs. -When a player connects to the world, the world is searched for -a mob with the player\'s key. If one is found, the player is connected -to that mob. If none is found, a new mob of type world.mob is created -and the player is connected to this new mob. - -The default value -is /mob. Setting world.mob to 0 prevents the creation of default mobs. -### Example: ```dm - world mob = /mob/newbie mob/newbie Login() src << -"Welcome, [name]." ..() + +world + mob = /mob/newbie + +mob/newbie + Login() + src << "Welcome, [name]." + ..() + ``` - -This example will -connect new players to mobs of type /mob/newbie. They are welcomed when -they connect. -> [!TIP] -> **See also:** -> + [New proc (client)](/ref/client/proc/New.md) \ No newline at end of file +This example will connect new players to mobs of type /mob/newbie. They are welcomed when they connect. +*** \ No newline at end of file diff --git a/ref/world/var/movement_mode.md b/ref/world/var/movement_mode.md index 479dcbf3..ea83862e 100644 --- a/ref/world/var/movement_mode.md +++ b/ref/world/var/movement_mode.md @@ -1,44 +1,9 @@ -## movement_mode var (world) -###### BYOND Version 514 - -**Possible values:** -+ `LEGACY_MOVEMENT_MODE`: Old BYOND behavior regarding pixel movement - and turf contents (see below) -+ `TILE_MOVEMENT_MODE`: All atoms are locked to the tile grid -+ `PIXEL_MOVEMENT_MODE`: All movable atoms can use pixel movement - unless otherwise specified (see below), but legacy behavior for turf - contents is ignored - -**Default value:** -+ LEGACY_MOVEMENT_MODE - +## movement_mode (var) +*** Controls how movement works on the map. +`TILE_MOVEMENT_MODE` allows you to easily discard any and all pixel movement, so if step_x or step_y coordinates or unexpected atom bounds were loaded from a savefile, for instance, they would be eliminated. If you use any other movement mode, you can give an atom the TILE_MOVER flag and it will behave as if it were in this mode, while other atoms are free to do their own thing. -`TILE_MOVEMENT_MODE` allows you to easily discard any and all -pixel movement, so if step_x or step_y coordinates or unexpected atom -bounds were loaded from a savefile, for instance, they would be -eliminated. If you use any other movement mode, you can give an atom the -[TILE_MOVER](/ref/atom/var/appearance_flags.md) flag and it will behave -as if it were in this mode, while other atoms are free to do their own -thing. - -`LEGACY_MOVEMENT_MODE` exists to distinguish between old -and new movement behavior. In older versions of BYOND before pixel -movement, turfs took their contents into consideration by default in -Enter() and Exit(). This doesn\'t really make sense for newer games, so -in any other movement mode the turf behavior will ignore its contents. -mob.Cross() is also affected, since it would return 0 by default in -legacy mode when both mobs were dense; now by default it checks -`mob.group`. - -> [!TIP] -> **See also:** -> + [appearance_flags var (atom)](/ref/atom/var/appearance_flags.md) -> + [Enter proc (atom)](/ref/atom/proc/Enter.md) -> + [Exit proc (atom)](/ref/atom/proc/Exit.md) -> + [Cross proc (atom)](/ref/atom/proc/Cross.md) -> + [Uncross proc (atom)](/ref/atom/proc/Uncross.md) -> + [Pixel movement](/ref/notes/pixel-movement.md) -> + [Gliding](/ref/notes/gliding.md) \ No newline at end of file +`LEGACY_MOVEMENT_MODE` exists to distinguish between old and new movement behavior. In older versions of BYOND before pixel movement, turfs took their contents into consideration by default in Enter() and Exit(). This doesn't really make sense for newer games, so in any other movement mode the turf behavior will ignore its contents. mob.Cross() is also affected, since it would return 0 by default in legacy mode when both mobs were dense; now by default it checks `mob.group`. +*** \ No newline at end of file diff --git a/ref/world/var/name.md b/ref/world/var/name.md index b09a2de5..0f55844e 100644 --- a/ref/world/var/name.md +++ b/ref/world/var/name.md @@ -1,11 +1,14 @@ -# name var (world) -**Default value:** -+ The part of the .dmb file. - +## name (var) +*** This is the name of the world. -### Example: + ```dm - world name = "The Void" + +world + name = "The Void" + ``` + +*** \ No newline at end of file diff --git a/ref/world/var/params.md b/ref/world/var/params.md index befc2335..bf56d294 100644 --- a/ref/world/var/params.md +++ b/ref/world/var/params.md @@ -1,26 +1,19 @@ -## params var (world) -**Default value:** -+ null +## params (var) +*** +This is a list of parameters passed to the world from the command-line -params option when the server was started. The parameter text is passed through params2list() to generate the world.params list. -This is a list of parameters passed to the world from the -command-line -params option when the server was started. The parameter -text is passed through params2list() to generate the world.params list. -### Example: - ```dm - world/New() var/p if(params.len) world.log << -"Command-line parameters:" for(p in params) world.log << "[p] = -[params[p]]" + +world/New() + var/p + if(params.len) world.log << "Command-line parameters:" + for(p in params) + world.log << "[p] = [params[p]]" + ``` - -This example displays the value of -each parameter. -> [!TIP] -> **See also:** -> + [list associations](/ref/list/associations.md) -> + [params2list proc](/ref/proc/params2list.md) -> + [startup proc](/ref/proc/startup.md) \ No newline at end of file +This example displays the value of each parameter. +*** \ No newline at end of file diff --git a/ref/world/var/port.md b/ref/world/var/port.md index f6fea199..91282471 100644 --- a/ref/world/var/port.md +++ b/ref/world/var/port.md @@ -1,12 +1,5 @@ -## port var (world) - -This is the network port of the world. If the world does not -have an open network port, this is 0. - -> [!TIP] -> **See also:** -> + [OpenPort proc (world)](/ref/world/proc/OpenPort.md) -> + [address var (world)](/ref/world/var/address.md) -> + [reachable var (world)](/ref/world/var/reachable.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file +## port (var) +*** +This is the network port of the world. If the world does not have an open network port, this is 0. +*** \ No newline at end of file diff --git a/ref/world/var/process.md b/ref/world/var/process.md index 93d54a53..8a8c925e 100644 --- a/ref/world/var/process.md +++ b/ref/world/var/process.md @@ -1,13 +1,5 @@ -## process var (world) - -This read-only variable indicates the ID of the server\'s -process on the system running it. The result is a number, unless for -some unexpected reason the number won\'t fit in a `num` type, in which -case it will be text. (In practice it should always be a number.) - -> [!TIP] -> **See also:** -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [system_type var (world)](/ref/world/var/system_type.md) -> + [shell proc](/ref/proc/shell.md) \ No newline at end of file +## process (var) +*** +This read-only variable indicates the ID of the server's process on the system running it. The result is a number, unless for some unexpected reason the number won't fit in a `num` type, in which case it will be text. (In practice it should always be a number.) +*** \ No newline at end of file diff --git a/ref/world/var/reachable.md b/ref/world/var/reachable.md index 3532e800..40938e31 100644 --- a/ref/world/var/reachable.md +++ b/ref/world/var/reachable.md @@ -1,17 +1,7 @@ -## reachable var (world) -###### BYOND Version 502 +## reachable (var) +*** +Returns 1 if the world is currently hosted and the port can be reached by players (as determined by the BYOND hub), 0 if not. -Returns 1 if the world is currently hosted and the port can be -reached by players (as determined by the BYOND hub), 0 if not. - - -If the port is not reachable, there may be a brief period -during which the hub is still attempting to make contact; during that -time the port is assumed to be reachable. Currently, the reachability -test times out and fails after 30 seconds. - -> [!TIP] -> **See also:** -> + [port var (world)](/ref/world/var/port.md) -> + [OpenPort proc (world)](/ref/world/proc/OpenPort.md) \ No newline at end of file +If the port is not reachable, there may be a brief period during which the hub is still attempting to make contact; during that time the port is assumed to be reachable. Currently, the reachability test times out and fails after 30 seconds. +*** \ No newline at end of file diff --git a/ref/world/var/realtime.md b/ref/world/var/realtime.md index 15d03216..006d7e1d 100644 --- a/ref/world/var/realtime.md +++ b/ref/world/var/realtime.md @@ -1,17 +1,7 @@ -## realtime var (world) +## realtime (var) +*** +This is the time (in 1/10 seconds) since 00:00:00 GMT, January 1, 2000 (also known as the BYOND era). -This is the time (in 1/10 seconds) since 00:00:00 GMT, January -1, 2000 (also known as the BYOND era). - -Because this is a large -number, BYOND\'s number system isn\'t capable of enough precision to -deliver the exact number of 1/10 second ticks. It usually rounds off to -the nearest several seconds. For more accurate readings use -`world.timeofday`. - -> [!TIP] -> **See also:** -> + [time var (world)](/ref/world/var/time.md) -> + [timeofday var (world)](/ref/world/var/timeofday.md) -> + [time2text proc](/ref/proc/time2text.md) \ No newline at end of file +Because this is a large number, BYOND's number system isn't capable of enough precision to deliver the exact number of 1/10 second ticks. It usually rounds off to the nearest several seconds. For more accurate readings use world.timeofday. +*** \ No newline at end of file diff --git a/ref/world/var/sleep_offline.md b/ref/world/var/sleep_offline.md index 7b6ccdac..fad47378 100644 --- a/ref/world/var/sleep_offline.md +++ b/ref/world/var/sleep_offline.md @@ -1,12 +1,5 @@ -# sleep_offline var (world) -**Default value:** -+ 0 - -Setting this to 1 causes the world to be suspended when there -are no players, even if you have sleeping procs waiting to happen. The -default value is 0, which means the server will only sleep if there are -no players and no procs waiting to happen. The main purpose of the -variable is to save the cpu from doing work when there is nobody around -to appreciate it. On the other hand, that doesn\'t give the poor NPC\'s -a break from the nasty humans. \ No newline at end of file +## sleep_offline (var) +*** +Setting this to 1 causes the world to be suspended when there are no players, even if you have sleeping procs waiting to happen. The default value is 0, which means the server will only sleep if there are no players and no procs waiting to happen. The main purpose of the variable is to save the cpu from doing work when there is nobody around to appreciate it. On the other hand, that doesn't give the poor NPC's a break from the nasty humans. +*** \ No newline at end of file diff --git a/ref/world/var/status.md b/ref/world/var/status.md index 3ffb94f5..c83fc4fe 100644 --- a/ref/world/var/status.md +++ b/ref/world/var/status.md @@ -1,20 +1,17 @@ -## status var (world) +## status (var) +*** +This is a short text string used in BYOND hub to describe the state of a game in progress. For example, you might want to indicate if new players will be able to actively play, or whether they would have to join as spectators. -This is a short text string used in BYOND hub to describe the -state of a game in progress. For example, you might want to indicate if -new players will be able to actively play, or whether they would have to -join as spectators. -### Example: ```dm - world status = "accepting players" mob/verb/start_game() -world.status = "accepting spectators" //... -``` +world + status = "accepting players" +mob/verb/start_game() + world.status = "accepting spectators" + //... + +``` -> [!TIP] -> **See also:** -> + [hub var (world)](/ref/world/var/hub.md) -> + [game_state var (world)](/ref/world/var/game_state.md) -> + [visibility var (world)](/ref/world/var/visibility.md) \ No newline at end of file +*** \ No newline at end of file diff --git a/ref/world/var/system_type.md b/ref/world/var/system_type.md index ca7aff9d..a91300b1 100644 --- a/ref/world/var/system_type.md +++ b/ref/world/var/system_type.md @@ -1,13 +1,5 @@ -## system_type var (world) - -This variable indicates the operating system type at run-time. -It will be one of the following constants: -- MS_WINDOWS -- UNIX - -> [!TIP] -> **See also:** -> + [byond_version var (world)](/ref/world/var/byond_version.md) -> + [process var (world)](/ref/world/var/process.md) -> + [shell proc](/ref/proc/shell.md) \ No newline at end of file +## system_type (var) +*** +This variable indicates the operating system type at run-time. It will be one of the following constants: +*** \ No newline at end of file diff --git a/ref/world/var/tick_lag.md b/ref/world/var/tick_lag.md index 6b94b2ca..6ae6ce58 100644 --- a/ref/world/var/tick_lag.md +++ b/ref/world/var/tick_lag.md @@ -1,35 +1,11 @@ -## tick_lag var (world) -**Default value:** -+ 1 +## tick_lag (var) +*** +This is the smallest unit of time (one server tick) measured in 1/10 seconds. The duration of events that take some finite amount of time (like sleep) will be rounded to a whole number of ticks. +Players are limited to one command (including movements) per server tick, so this value can be used to adjust the responsiveness of the game. If the network is too slow to keep up with players, their commands will get queued up, which can be annoying when trying to move. In this case, tick_lag should be increased so that the stored up movement commands are discarded. On the other hand, if you have a very fast network, you may wish to decrease tick_lag to speed up the response time to player commands. -This is the smallest unit of time (one server tick) measured in -1/10 seconds. The duration of events that take some finite amount of -time (like sleep) will be rounded to a whole number of ticks. +Often it is more convenient to set world.fps instead of world.tick_lag, since fps (frames per second) is an easier way to think of server ticks. world.tick_lag is 10 / world.fps and vice-versa, so a tick_lag of 0.25 is equal to 40 fps. - -Players are limited to one command (including movements) per -server tick, so this value can be used to adjust the responsiveness of -the game. If the network is too slow to keep up with players, their -commands will get queued up, which can be annoying when trying to move. -In this case, tick_lag should be increased so that the stored up -movement commands are discarded. On the other hand, if you have a very -fast network, you may wish to decrease tick_lag to speed up the response -time to player commands. - -Often it is more convenient to set -world.fps instead of world.tick_lag, since fps (frames per second) is an -easier way to think of server ticks. world.tick_lag is 10 / world.fps -and vice-versa, so a tick_lag of 0.25 is equal to 40 fps. - -If -you set client.tick_lag or client.fps to a value other than 0, you can -make the client tick at a different (usually faster) rate. - -> [!TIP] -> **See also:** -> + [fps var (world)](/ref/world/var/fps.md) -> + [tick_lag var (client)](/ref/client/var/tick_lag.md) -> + [tick_usage var (world)](/ref/world/var/tick_usage.md) -> + [sleep proc](/ref/proc/sleep.md) \ No newline at end of file +If you set client.tick_lag or client.fps to a value other than 0, you can make the client tick at a different (usually faster) rate. +*** \ No newline at end of file diff --git a/ref/world/var/tick_usage.md b/ref/world/var/tick_usage.md index ec5154c8..fd7e53a5 100644 --- a/ref/world/var/tick_usage.md +++ b/ref/world/var/tick_usage.md @@ -1,22 +1,7 @@ -## tick_usage var (world) -###### BYOND Version 510 +## tick_usage (var) +*** +This is the approximate percentage of the server tick that has been used already. A value under 100 means there's time to do more calculations, which can include any pending procs that are still waiting to run on this tick. When the value is over 100, the tick is running long and your world will experience lag. -This is the approximate percentage of the server tick that has -been used already. A value under 100 means there\'s time to do more -calculations, which can include any pending procs that are still waiting -to run on this tick. When the value is over 100, the tick is running -long and your world will experience lag. - -Keep in mind that -sending maps to clients is the last thing that happens during a tick, -except for handling any events such as player commands that might arrive -before the next tick begins. Therefore in a verb, `tick_usage` might -have a higher value than you would expect to see in a proc that loops -and sleeps. - -> [!TIP] -> **See also:** -> + [cpu var (world)](/ref/world/var/cpu.md) -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) -> + [Tick proc (world)](/ref/world/proc/Tick.md) \ No newline at end of file +Keep in mind that sending maps to clients is the last thing that happens during a tick, except for handling any events such as player commands that might arrive before the next tick begins. Therefore in a verb, `tick_usage` might have a higher value than you would expect to see in a proc that loops and sleeps. +*** \ No newline at end of file diff --git a/ref/world/var/time.md b/ref/world/var/time.md index 468b77a8..23dd6073 100644 --- a/ref/world/var/time.md +++ b/ref/world/var/time.md @@ -1,15 +1,5 @@ -## time var (world) - -This gives the amount of time (in 1/10 seconds) that the world -has been running. In actual fact, it is the number of server ticks that -have passed multiplied by world.tick_lag. Therefore if the server sleeps -(when no players are connected) this time is not counted. Also, if the -server runs overtime during a tick (because procs take longer than -tick_lag to finish) this still only counts as one tick. This value is -therefore a measure of "game time" rather than real time. - -> [!TIP] -> **See also:** -> + [realtime var (world)](/ref/world/var/realtime.md) -> + [tick_lag var (world)](/ref/world/var/tick_lag.md) \ No newline at end of file +## time (var) +*** +This gives the amount of time (in 1/10 seconds) that the world has been running. In actual fact, it is the number of server ticks that have passed multiplied by world.tick_lag. Therefore if the server sleeps (when no players are connected) this time is not counted. Also, if the server runs overtime during a tick (because procs take longer than tick_lag to finish) this still only counts as one tick. This value is therefore a measure of "game time" rather than real time. +*** \ No newline at end of file diff --git a/ref/world/var/timeofday.md b/ref/world/var/timeofday.md index 24fcfaa5..cbc15917 100644 --- a/ref/world/var/timeofday.md +++ b/ref/world/var/timeofday.md @@ -1,13 +1,5 @@ -## timeofday var (world) - -This is the time (in 1/10 seconds) since 00:00:00 GMT today. It -is basically identical to `world.realtime` but doesn\'t include any -information about the date. This is a much smaller number; hence it is -more accurate. - -> [!TIP] -> **See also:** -> + [realtime var (world)](/ref/world/var/realtime.md) -> + [time var (world)](/ref/world/var/time.md) -> + [time2text proc](/ref/proc/time2text.md) \ No newline at end of file +## timeofday (var) +*** +This is the time (in 1/10 seconds) since 00:00:00 GMT today. It is basically identical to world.realtime but doesn't include any information about the date. This is a much smaller number; hence it is more accurate. +*** \ No newline at end of file diff --git a/ref/world/var/timezone.md b/ref/world/var/timezone.md index 99bca093..76619654 100644 --- a/ref/world/var/timezone.md +++ b/ref/world/var/timezone.md @@ -1,14 +1,5 @@ -## timezone var (world) -###### BYOND Version 514 - -This is the time offset from UTC, in hours, for the world\'s -time zone. It can be used in the `time2text()` proc, although it is the -default time zone for that proc. - -> [!TIP] -> **See also:** -> + [realtime var (world)](/ref/world/var/realtime.md) -> + [timeofday var (world)](/ref/world/var/timeofday.md) -> + [timezone var (client)](/ref/client/var/timezone.md) -> + [time2text proc](/ref/proc/time2text.md) \ No newline at end of file +## timezone (var) +*** +This is the time offset from UTC, in hours, for the world's time zone. It can be used in the `time2text()` proc, although it is the default time zone for that proc. +*** \ No newline at end of file diff --git a/ref/world/var/turf.md b/ref/world/var/turf.md index 2d46757a..977a64c7 100644 --- a/ref/world/var/turf.md +++ b/ref/world/var/turf.md @@ -1,7 +1,5 @@ -# turf var (world) -**Default value:** -+ /turf. - -This is the default turf type to be placed on the map wherever -no turf is specified. A value of 0 turns off the default turf. \ No newline at end of file +## turf (var) +*** +This is the default turf type to be placed on the map wherever no turf is specified. A value of 0 turns off the default turf. +*** \ No newline at end of file diff --git a/ref/world/var/url.md b/ref/world/var/url.md index b88a18dc..2ad51bdc 100644 --- a/ref/world/var/url.md +++ b/ref/world/var/url.md @@ -1,9 +1,5 @@ -## url var (world) - -This is the full network address of the world. (For example, -byond://dan.byond.com:6005.) - -> [!TIP] -> **See also:** -> + [address var (world)](/ref/world/var/address.md) \ No newline at end of file +## url (var) +*** +This is the full network address of the world. (For example, byond://dan.byond.com:6005.) +*** \ No newline at end of file diff --git a/ref/world/var/version.md b/ref/world/var/version.md index 370f778a..687dd858 100644 --- a/ref/world/var/version.md +++ b/ref/world/var/version.md @@ -1,22 +1,7 @@ -## version var (world) +## version (var) +*** +If you are distributing your game to players, you can use this variable to automatically notify them of new releases. To do so, you will first need to set world.hub to the hub path of your game. You can then advertise the current version by configuring that value in your hub console. -**Default value:** -+ 0 - - -If you are distributing your game to players, you can use this -variable to automatically notify them of new releases. To do so, you -will first need to set [`world.hub`](/ref/world/var/hub.md) to the hub path of -your game. You can then advertise the current version by configuring -that value in your [hub -console](https://secure.byond.com/members/?command=edit_hub). - - -When players boot up an outdated version of your game (as -indicated by comparing `world.version` with the version advertised by -BYOND hub), they will be notified of the new release. - -> [!TIP] -> **See also:** -> + [hub var (world)](/ref/world/var/hub.md) \ No newline at end of file +When players boot up an outdated version of your game (as indicated by comparing world.version with the version advertised by BYOND hub), they will be notified of the new release. +*** \ No newline at end of file diff --git a/ref/world/var/view.md b/ref/world/var/view.md index b0cf1998..52582065 100644 --- a/ref/world/var/view.md +++ b/ref/world/var/view.md @@ -1,31 +1,11 @@ -## view var (world) -**Default value:** -+ 5 +## view (var) +*** +This is the default map viewport range. The default value of 5 produces an 11x11 viewport. A value of -1 turns off the map display altogether. The client may automatically scale down icons in order to conveniently fit the map on the player's screen. -**Possible values:** -+ -1 to 34 or "WIDTHxHEIGHT" +For non-square views, you can assign this to a text string of the form "WIDTHxHEIGHT". For example, "11x11" is equivalent to a view depth of 5, but you could make it wider like this: "13x11". -This is the default map viewport range. The default value of 5 -produces an 11x11 viewport. A value of -1 turns off the map display -altogether. The client may automatically scale down icons in order to -conveniently fit the map on the player\'s screen. +This setting also affects the default range of the view(), oview(), range(), and orange() procedures. -For non-square views, you can assign this to a text string of the form -"WIDTHxHEIGHT". For example, "11x11" is equivalent to a view depth -of 5, but you could make it wider like this: "13x11". - -This setting also affects the default range of the `view()`, `oview()`, -`range()`, and `orange()` procedures. - -If the entire map is small enough to fit on one screen (arbitrarily defined -to be 21x21 orless), the default `view` is automatically adjusted to fit -the map. In this case, `client.lazy_eye` is also automatically turned on -by default, since you probably don\'t want the map to scroll around. - -> [!TIP] -> **See also:** -> + [lazy_eye var (client)](/ref/client/var/lazy_eye.md) -> + [show_map var (client)](/ref/client/var/show_map.md) -> + [view proc](/ref/proc/view.md) -> + [view var (client)](/ref/client/var/view.md) +If the entire map is small enough to fit on one screen (arbitrarily defined to be 21x21 or less), the default view is automatically adjusted to fit the map. In this case, client.lazy_eye is also automatically turned on by default, since you probably don't want the map to scroll around. +*** \ No newline at end of file diff --git a/ref/world/var/visibility.md b/ref/world/var/visibility.md index 4b8a582f..7628447d 100644 --- a/ref/world/var/visibility.md +++ b/ref/world/var/visibility.md @@ -1,16 +1,5 @@ -## visibility var (world) -**Default value:** -+ 1 (visible) - - -This controls whether the world advertises itself in the [BYOND -Hub](http://www.byond.com/games/) when it has an open network port for -accepting players. The visibility of the world still depends on whether -any of the connected players has their location reporter turned on, and -that in turn relies on the pager being turned on. - -> [!TIP] -> **See also:** -> + [OpenPort proc (world)](/ref/world/proc/OpenPort.md) -> + [hub var (world)](/ref/world/var/hub.md) \ No newline at end of file +## visibility (var) +*** +This controls whether the world advertises itself in the BYOND Hub when it has an open network port for accepting players. The visibility of the world still depends on whether any of the connected players has their location reporter turned on, and that in turn relies on the pager being turned on. +*** \ No newline at end of file diff --git a/ref/world/world.md b/ref/world/world.md deleted file mode 100644 index 78c08694..00000000 --- a/ref/world/world.md +++ /dev/null @@ -1,12 +0,0 @@ -## world - - -The world node is used to define some global properties for the -world. Like the other types, the world has overridable vars and procs. -New vars and procs cannot be defined under world though; to make global -vars and procs, use /var and /proc instead. - -> [!TIP] -> **See also:** -> + [procs (world)](/ref/world/proc.md) -> + [vars (world)](/ref/world/var.md) \ No newline at end of file diff --git a/ref_splitter/dm_ref.py b/ref_splitter/dm_ref.py new file mode 100644 index 00000000..3c56d47f --- /dev/null +++ b/ref_splitter/dm_ref.py @@ -0,0 +1,37 @@ +''' +Data Class to fetch the DM Reference from the BYOND web server +loads the file into into a DMRef object, +which can then be passed to the RefSplitter class for processing +''' + +from dataclasses import dataclass +import requests + +@dataclass +class DMRef: + '''Grabs and stores info.html from the byond webserver''' + + dm_ref_url: str = "https://www.byond.com/docs/ref/info.html" + headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" + } + timeout_seconds: int = 10 + timeout_error_message = "Timeout exceeds maximum value (10 seconds)" + + ref_info: str = "" + + def __post_init__(self) -> None: + if self.timeout_seconds > 10: + raise ValueError(self.timeout_error_message) + + def fetch_web_ref(self) -> str: + ''' + Attempts to fetch the reference from the BYOND webserver + + Raises: + requests.RequestException if the network request fails or times out + ''' + response = requests.get(self.dm_ref_url, headers=self.headers, timeout=self.timeout_seconds) + response.raise_for_status() + self.ref_info = response.text + return self.ref_info diff --git a/ref_splitter/export.py b/ref_splitter/export.py new file mode 100644 index 00000000..f5c7cefc --- /dev/null +++ b/ref_splitter/export.py @@ -0,0 +1,258 @@ + +import pathlib +from .ref_tree import RefTree +from .token_table import INLINE_TOKEN_TABLE, P_CLASS_TOKEN_TABLE +from enum import Enum +import logging +from tqdm import tqdm +import shutil + +logger = logging.getLogger(__name__) + +class MDFlavour(Enum): + NOTE = "NOTE" + TIP = "TIP" + IMPORTANT = "IMPORTANT" + WARNING = "WARNING" + CAUTION = "CAUTION" + +class MDPage: + def __init__(self, ref_id: str, content: str, is_index: bool): + self.id = ref_id + self.content = content + self.is_index = is_index + +class ExportMD: + '''Exports the RefTree into a collection of md files''' + + export_root: pathlib.Path + export_format: str = "md" + + def __init__(self, exp_path: pathlib.Path | str) -> None: + self.export_root = pathlib.Path(exp_path) + self.prepared_pages: list[MDPage] = [] + + def clean_filepath(self, text: str) -> str: + '''removes invalid characters from filepaths''' + text = text.replace("%2e", ".") + text = text.replace("%3e", ">") + text = text.replace("%3c", "<") + text = text.replace("%3f", "?") + text = text.replace("%25", "%") + text = text.replace(">", "RIGHT") + text = text.replace("<", "LEFT") + text = text.replace("*", "STAR") + text = text.replace(":", "COLON") + text = text.replace("|", "PIPE") + text = text.replace("?", "QMARK") + text = text.replace("{", "") + text = text.replace("}", "") + text = text.replace("toc", "") + text = text.replace("\"", "") + text = text.replace("/", "\\") + text = text.replace("%", "PERCENT") + return text + + def format_tree(self, tree: RefTree) -> None: + '''exports all of the pages that the reftree contains''' + + for node in tqdm(tree.nodes, desc="Processing Pages", bar_format="{l_bar}{r_bar}"): + + meta_header: str = "" # the content of the header metadata. This will be assigned based on the GithubPages framework + content: str = "" # the content of the markdown file + + # Compile page content + source_content: str = self.format_source_content(node.entry.content) + + proc_format: str = self.format_string_list(node.entry.format, "Format") + returns: str = self.format_string_list(node.entry.returns, "Returns") + args: str = self.format_string_list(node.entry.args, "Arguments") + called_when: str = self.format_string_list(node.entry.when, "Called When") + default_action: str = self.format_string_list(node.entry.default_action, "Default Action") + default_value: str = self.format_string_list(node.entry.default_value, "Default Value") + related_pages: str = self.format_string_list(node.entry.see_also, "Related Pages") + + # build and format page content + content += meta_header + '\n' + content += f'## {node.entry.title} ({node.entry.entry_type})\n' + content += proc_format + content += args + content += returns + content += called_when + content += default_action + content += default_value + content += "***" + content += source_content + content += "***" + content += related_pages + content = self.format_tokens(content) + content = self.format_codeblocks(content) + content = self.format_links(tree.links, content) + + self.prepared_pages.append(MDPage(node.entry.ref_id, content, node.is_index)) + + def format_string_list(self, str_list: list[str], header: str) -> str: + '''parses a list of strings from the RefEntry + uses
as the header, if specified + returns an empty string is str_list is empty''' + parsed: str = "" + if len(str_list) > 0: + if header == "": + raise ValueError("Header cannot be an empty string") + parsed += f'\n**{header}:**' + for l in str_list: + parsed += f'\n+ {l}' + parsed += '\n' + return parsed + + def format_source_content(self, content: list[str]) -> str: + '''parses the content list into a string of paragraphs + returns an empty string is content is empty''' + parsed = "" + if len(content) > 0: + for p in content: + parsed += '\n'+p+'\n' + return parsed + + def season_string(self, content: str, flavour: MDFlavour) -> str: + ''' + seasons a string with a markdown alert + to season a list, format it to a string first using format_string_list + ''' + seasoned: str = f'\n> [!{flavour.value}]' + seasoned += content.replace('\n', '\n> ') + return seasoned + + def format_tokens(self, content: str) -> str: + '''replaces tokens with their markdown counterparts from the TOKEN_TABLE''' + for row in INLINE_TOKEN_TABLE: + token = row["TOKEN"] + tag = row["md"] + # removes whitespace added during parsing. This can be removed when that is fixed + content = content.replace(f"[{token}] ", f"{tag}") + content = content.replace(f" [/{token}]", f"{tag}") + # once we've cleared the spaced out tokens, we can clear out non-spaced tokens + content = content.replace(f"[{token}]", f"{tag}") + content = content.replace(f"[/{token}]", f"{tag}") + + for row in P_CLASS_TOKEN_TABLE: + token = row["TOKEN"] + tag = row["md"] + + start_token = f'[{token}]' + end_token = f'[/{token}]' + + while True: + start_idx = content.find(start_token) + if start_idx == -1: + break + + end_idx = content.find(end_token, start_idx) + if end_idx == -1: + raise ValueError(f'p class token ({token}) at index {start_idx} does not close') + + paragraph_start = start_idx + len(start_token) + format_content = '\n' + content[paragraph_start:end_idx] + seasoned_paragraph = self.season_string(format_content, MDFlavour(tag)) + + content = content[:start_idx] + seasoned_paragraph + content[end_idx + len(end_token):] + + return content + + def format_codeblocks(self, content: str) -> str: + '''converts codeblock tokens into markdown codeblocks with the dm annotation''' + content = content.replace("[CODEBLOCK]", "\n```dm\n") + content = content.replace("[/CODEBLOCK]", "\n```\n") + return content + + def format_links(self, tree_links: dict[str, str], text: str) -> str: + '''replaces link tokens with their proper markdown links provided by the RefTree's link LUT''' + start_token = "[LINK]" + end_token = "[/LINK]" + + while True: + start_idx = text.find(start_token) + if start_idx == -1: + break + + end_idx = text.find(end_token, start_idx) + if end_idx == -1: + raise ValueError(f'Link token ({start_token}) at index {start_idx} does not close') + + path_start = start_idx + len(start_token) + link_path = text[path_start:end_idx] + + link_text = tree_links.get(link_path, link_path) + + ## adding a space because links don't respect whitespace for some reason. + ##TODO: look into why + markdown_link = f" [{link_text}](/ref{link_path})" + text = text[:start_idx] + markdown_link + text[end_idx + len(end_token):] + + return text + + def clear_export_dir(self) -> None: + '''Wipes the export root folder before writing fresh''' + target_dir = self.export_root + + if target_dir.exists(): + logger.info(f"Clearing export directory: {target_dir}") + shutil.rmtree(target_dir) + + def export_pages(self): + '''exports all of the prepared pages to disk''' + if len(self.prepared_pages) == 0: + raise ValueError("Cannot export pages: No pages prepared.") + + self.export_root.mkdir(parents=True, exist_ok=True) + + current_page = None + try: + for page in tqdm(self.prepared_pages, desc="Writing Pages", bar_format="{l_bar}{r_bar}"): + current_page = page + self.export_page(page) + except Exception as e: + self.clear_export_dir() + page_info = f" (Page ID: {current_page.id})" if current_page else "" + raise RuntimeError(f'Export Aborted{page_info}, temp folder has been cleared.\nError: {e}') from e + + def export_page(self, page: MDPage): + '''exports the page content to a markdown file''' + clean_ref_id = page.id.lstrip("\\/") + clean_filepath = self.clean_filepath(clean_ref_id) + + if page.is_index: + export_file = self.export_root / "ref" / clean_filepath / "index.md" + else: + parts = clean_filepath.replace("\\", "/").split("/") + export_file = self.export_root / "ref" / pathlib.Path(*parts).with_suffix(".md") + + #logger.info(f"Writing {export_file}") + export_file.parent.mkdir(parents=True, exist_ok=True) + with open(export_file, "w", encoding="utf-8") as file: + file.write(page.content) + + def move_to_main_folder(self): + '''Safely replaces the repo's main ref folder. + If this fails, the old ref is reinstated''' + repo_ref_dir = pathlib.Path("./ref").resolve() + temp_ref_dir = (self.export_root / "ref").resolve() + backup_ref_dir = pathlib.Path("./ref_backup_twp").resolve() + + if not temp_ref_dir.exists(): + raise FileNotFoundError(f"Source temp directory not found at {temp_ref_dir}") + if repo_ref_dir.exists(): + shutil.move(str(repo_ref_dir), str(backup_ref_dir)) + + try: + shutil.move(str(temp_ref_dir), str(repo_ref_dir)) + if backup_ref_dir.exists(): + shutil.rmtree(backup_ref_dir) + + except Exception as e: + if backup_ref_dir.exists(): + if repo_ref_dir.exists(): + shutil.rmtree(repo_ref_dir) + shutil.move(str(backup_ref_dir), str(repo_ref_dir)) + + raise RuntimeError(f"Something went terribly wrong moving the folders. Rollin' back.\nError: {e}") from e \ No newline at end of file diff --git a/ref_splitter/main.py b/ref_splitter/main.py new file mode 100644 index 00000000..5d394da5 --- /dev/null +++ b/ref_splitter/main.py @@ -0,0 +1,60 @@ +''' +Main File to extract and parse the DM reference from remote +''' + +from .dm_ref import DMRef +from .ref_splitter import RefSplitter +from .ref_tree import RefTree +from .export import ExportMD + +import logging +import warnings +from tqdm import tqdm + +class TqdmLoggingHandler(logging.Handler): + def emit(self, record): + try: + msg = self.format(record) + tqdm.write(msg) # Safely prints above any active progress bar + self.flush() + except Exception: + self.handleError(record) + +root_logger = logging.getLogger() +root_logger.setLevel(logging.INFO) +root_logger.addHandler(TqdmLoggingHandler()) + +logging.captureWarnings(True) +logging.getLogger("py.warnings").setLevel(logging.CRITICAL) +logging.getLogger("py.warnings").addHandler(TqdmLoggingHandler()) + + +print("Fetching remote reference material...") +ref = DMRef() +raw_content = ref.fetch_web_ref() + +print("Splitting and parsing reference entries...") +splitter = RefSplitter(raw_content) +splitter.prep_pages() +splitter.build_ref_entries() + +print("Building hierarchical reference tree...") +ref_tree: RefTree = RefTree() +ref_tree.build_tree_from_entries(splitter.entries, splitter.links) + +print("Formatting tree structure for Markdown conversion...") +export = ExportMD("_tmp_md_export") +export.format_tree(ref_tree) + +assert len(export.prepared_pages) > 0, "Export did not prepare any pages" + +print("Exporting Pages to temporary directory...") +export.export_pages() + +print("Safely overwriting production 'ref' folder...") +export.move_to_main_folder() + +print("Cleaning up temporary export directory...") +export.clear_export_dir() + +print("Pipeline executed successfully! Ready to push to GitHub.") \ No newline at end of file diff --git a/ref_splitter/ref_splitter.py b/ref_splitter/ref_splitter.py new file mode 100644 index 00000000..35d28c53 --- /dev/null +++ b/ref_splitter/ref_splitter.py @@ -0,0 +1,328 @@ +''' +Ref Splitter class. +The Ref Splitter takes in a string given by the file i/o module and processes it into a RefTree +''' +from bs4 import BeautifulSoup, Tag +import warnings +from .token_table import INLINE_TOKEN_TABLE, P_CLASS_TOKEN_TABLE +import logging +from tqdm import tqdm + +logger = logging.getLogger(__name__) + +class RefEntry: + ''' + An intermediate representation of a single page entry from the DM reference + providing a standardized format that can be used in different formatting methods + (ie: Official DM Reference, dm_open_ref) + It holds members related to important data extracted from the reference, such as + - Page content + - Related Pages (extracted from "See Also") + - Links within the page contents + ''' + + def __init__(self, eid: str, pid: int): + self.ref_id = "NO_ID" # the name of the RefEntry as found in the DM reference tag (ie: /client/proc/New()) + self.pid = pid # the page ID. Each page has a unique pid coresponding to the order in which it was processed + self.content = [] # A list of content delimited by

tags + self.title: str = "" # The title for the reference entry, derived from ref_id + self.ref_path: list[str] = [] # The path to this page in the original DM referene + self.entry_type: str # the type of entry this is: "Info", "Proc", "Var", "Object" + + self.related_links = {} + self.page_links = {} + + # Standard DM Reference fields + self.see_also: list[str] = [] # links to related pages + # proc-only fields + self.format: list[str] = [] # the format that the proc takes + self.returns: list[str] = [] # return value of the proc + self.args: list[str] = [] # arguments of the proc + self.when: list[str] = [] # when the proc is normally invoked + self.default_action: list[str] = [] # default behaviour + # var-only fields + self.default_value: list[str] = [] # variable default value + + self.ref_id = eid + self.set_ref_path() + self.set_title() + self.entry_type = self.set_ref_entry_type() + + def set_title(self) -> None: + '''Sets the title based on the path''' + #print(self.ref_path) + title_index = len(self.ref_path) - 1 + if title_index >= 0: + self.title = self.ref_path[title_index] + else: + self.title = "[NO_TITLE]" + + def set_ref_path(self) -> None: + '''Uses the ref_id to populate the ref_path list where each + consecutive element is the next branch on the DM Reference's node tree''' + self.ref_path = self.ref_id.split('/') + self.ref_path.pop(0) + + def set_ref_entry_type(self) -> str: + '''sets the entry type based on the ref_path''' + # TODO add in "Object" for byond built-in object types (datum, atom, client, etc.) + + if "var" in self.ref_path: + return "var" + if "proc" in self.ref_path: + return "proc" + return "info" + + def get_path(self) -> str: + '''Returns ref_path rebuilt into a string in the format "/a/b/c"''' + return '/'.join(self.ref_path) + +class RefSplitter: + ''' + Scans through the file, identifying individual reference entries + For each entry, it performs the following steps: + extracts the entry's information + strips away formatting + creates and populates a Ref Entry with the relevant information + Creates a Ref Node using the Ref Entry + Finally, adds the RefNode to the RefTree and assigns its parent + ''' + + # For mapping dt tags to field attributes + field_mapping = { + "Format:": "format", + "Returns:": "returns", + "See also:": "see_also", + "Args:": "args", + "When:": "when", + "Default action:": "default_action", + "Default value:": "default_value", + } + + def __init__(self, doc_str: str): + print("new ref splitter") + self.soup = BeautifulSoup(doc_str, "lxml") + self.entries: list[RefEntry] = [] + self.pages: list[str] = [] + self.links = {} + self.elems_to_remove = [] + + self.pages_to_parse: list[Tag] = [] + + def prep_pages(self, length: int | None = None) -> None: + for page in self.soup.find_all('a', attrs={"name":True}, limit = length or None): + self.pages_to_parse.append(page) + + def save_pretty_soup(self): + '''saves the pretty soup to a text file + useful for reading through and seeing what we're working with''' + with open("pretty_soup.txt", "w", encoding="utf-8") as file: + file.write(self.soup.prettify()) + + def print_pages(self, length: int): + '''prints up to 'length' pages from the soup''' + pages = self.soup.find_all('a', attrs={"name":True}, limit = length) + for i, page in enumerate(pages): + content_text: str = page.get_text(separator = '\n', strip = True) + print(f"{i}:\n\t{content_text}") + + def save_pages(self): + '''Saves all of the pages that have been parsed''' + for i, page in enumerate(self.pages): + with open(f"pages/{i}.txt", "w", encoding="utf-8") as file: + file.write(page) + + def save_entry(self, entry: RefEntry): + '''Saves a Ref Entry to a text file''' + content: str = "\n\n".join(entry.content) + with open(f"entries/{entry.title}.txt", "w", encoding="utf-8") as file: + file.write(content) + + def purge_elements(self) -> None: + '''removes the tags found in `elems_to_remove` from the soup''' + for tag in self.elems_to_remove: + tag.decompose() + + def build_ref_entries(self): + '''Builds Ref Entries for each page found in the soup + `length` is an optional parameter to limit the number of pages built''' + if len(self.pages_to_parse) == 0: + raise ValueError("You must call prep_pages() before building ref entries") + + current_page_num = 0 + for page in tqdm(self.pages_to_parse, desc="Processing Pages", bar_format="{l_bar}{r_bar}"): + current_page_num += 1 + entry_refpath: str = str(page.attrs["name"]) + #logger.info(f'Parsing Page ({current_page_num}/{len(self.pages_to_parse)}): {entry_refpath}') + + desc_lists = self.format_description_lists(page) + self.purge_elements() + + entry = RefEntry(entry_refpath, current_page_num) + + content = self.extract_content(page) + entry.content = content + self.set_common_fields(entry, desc_lists) + + self.entries.append(entry) + #self.pages.append('\n\n'.join(content)) + + #pprint(entry.desc_lists) + + def set_common_fields(self, entry: RefEntry, desc_lists: dict[str, list[str]]) -> None: + '''initializes field_mappings on the RefEntry''' + for field, content in desc_lists.items(): + if attr_name := self.field_mapping.get(field): + if not hasattr(entry, attr_name): + raise AttributeError(f'{attr_name} is not declared on RefEntry') + setattr(entry, attr_name, content) + + def extract_content(self, page: Tag) -> list[str]: + '''Extracts all of the content contained within

tags, + converts common tags (, , ) to tokens + and formats the content into a single string. + + Returns the content as a list containing: + paragraphs coresponding to

tags + code blocks coresponding to xmp tags + description lists (that are not common fields)''' + if page is None: + raise ValueError("Cannot extract content from non-existant page") + + content = page.find_all(['p', 'xmp']) + if len(content) == -1: + raise ValueError("Page has no Content") + + content_list: list[str] = [] + for tag in content: + match tag.name: + case 'p': + raw_text = str(tag) + clean_text = self.clean_paragraph(raw_text) + tokenized_text = self.tokenize(clean_text) + if tokenized_text: + tokenized_text = self.tokenize_paragraph(tokenized_text, tag) + content_list.append(tokenized_text) + # xmp is handled here to properly tokenize the codeblocks. + # using the standard tokenizer will destroy the text inside the code block + case 'xmp': + content_list.append(f'[CODEBLOCK]{tag.get_text()}[/CODEBLOCK]') + case 'dl': + content_list.append(self.tokenize(str(tag))) + + return content_list + + def tokenize(self, text: str) -> str: + '''converts inline html tags as declared in INLINE_TAGS + to their tokenized counterpart''' + for row in INLINE_TOKEN_TABLE: + html_tag = row["html"] + token = row["TOKEN"] + text = text.replace(f'<{html_tag}>', f'[{token}]') + text = text.replace(f'', f'[/{token}]') + return text + + def tokenize_paragraph(self, paragraph: str, tag: Tag) -> str: + '''Tokenizes a paragraph block based on its class attribute''' + if p_classes := tag.get('class'): + for row in P_CLASS_TOKEN_TABLE: + p_class = row["html"] + if p_class in p_classes: + token = row["TOKEN"] + paragraph = f'[{token}]{paragraph}[/{token}]' + return paragraph + + def clean_paragraph(self, text: str) -> str: + '''checks for malformed tags and breaks the paragraph into a + single string with no newlines or additional formatting''' + if not text.startswith(". Source Text:\n{text}") + if not text.endswith("

"): + raise ValueError(f"Expected tag to close with

. Source Text:\n{text}") + + open_tag_terminator_index = text.find('>') + + if open_tag_terminator_index == -1: + raise ValueError("open tag is never terminated.") + + # This naive approach leaves undesired whitespace between each 'word' + # ie: "this is bold." becomes "this is [BOLD] bold [/BOLD] ." + # note how it introduces a space between the word and tag, as well as before the period. + # For now, this is acceptable, but there is downstream special handling for it, so when + # possible, this should be fixed. + text = text[open_tag_terminator_index+1:-4] + words = text.split() + return " ".join(words) + + def format_description_lists(self, page: Tag) -> dict[str, list[str]]: + '''parses description lists and extracts common fields''' + common_fields: dict[str, list[str]] = {} + + lists = page.find_all('dl') + + if(lists): + for dl_tag in lists: + # the dm reference entries, thankfully have a standard format for these lists. + # dt is consistently used for the name of the list, and dd for the entries in it. + + # DM Ref only ever has one term per list, so there's no need to parse more than one. + # this would need to be changed when the standard for the html ref is modernized + term_string = self.get_term_string(dl_tag) + + details: list[str] = [] + # Unfortunately, the composition of the tags in these desc lists is a thing that one would not wish to behold + # So we have to be very careful here. + for dd_tag in dl_tag.find_all('dd'): + dd_text = "".join(dd_tag.find_all(string=True, recursive=False)).strip() + a_tag = dd_tag.find('a', attrs={"href":True}, recursive=False) + if a_tag is not None: + link_path = self.encode_link(a_tag) + dd_text += f"[LINK]{link_path}[/LINK]" + details.append(dd_text) + + if len(details) == 0: + warnings.warn(f"Term '{term_string}' is being declared more than once for this page. They will be combined", + UserWarning) + details.append("EMPTY") + + if term_string in common_fields: + warnings.warn(f"Term '{term_string}' is being declared more than once for this page. They will be combined", + UserWarning) + common_fields[term_string].extend(details) + + common_fields[term_string] = details + self.elems_to_remove.append(dl_tag) + + return common_fields + + def get_term_string(self, dl_tag: Tag) -> str: + '''returns the text found within a dt tag''' + if dt_tag := dl_tag.find('dt'): + term_string: str = dt_tag.get_text(strip=True) + else: + term_string: str = "UNKNOWN_TERM" + warnings.warn("Expected a description term, but none was provided. Adding Placeholder", + UserWarning) + return term_string + + def encode_link(self, a_tag: Tag | None) -> str: + '''Encodes a hyperlink from an
tag into the links dictionary. + Dictionary Format is: "link text" : "link path" ''' + if a_tag is None: + raise TypeError("a Tag is 'None'") + if a_tag.name != 'a': + raise RuntimeError(f"Trying to encode an invalid tag ({a_tag.name}). Expected 'a'") + if "href" not in a_tag.attrs: + raise ValueError("a Tag does not have href attribute") + + link_path = str(a_tag.attrs["href"]) + link_path = link_path[1:] # strip out the # at the beginning of the paths + if len(link_path) == 0: + raise ValueError("Empty link path") + + link_text = a_tag.get_text(strip=True) + if len(link_text) == 0: + link_text = link_path + + self.links[link_path] = link_text + return link_path diff --git a/ref_splitter/ref_tree.py b/ref_splitter/ref_tree.py new file mode 100644 index 00000000..00eff04d --- /dev/null +++ b/ref_splitter/ref_tree.py @@ -0,0 +1,40 @@ +''' +RefNode and RefTree classes for organizing the parsed information into a digestible tree. +''' + +from .ref_splitter import RefEntry + +class RefNode: + '''A reference tree node for organizing the reference tree content''' + def __init__(self, entry: RefEntry) -> None: + self.entry: RefEntry = entry + self.is_index: bool = False + +class RefTree: + '''Manages the tree of reference nodes + The structure of this tree will denote the organization and pathing of pages when exported''' + _instance = None + + nodes: list[RefNode] = [] + links: dict[str, str] # format is: link_text : link_path + + def __init__(self) -> None: + print("RefTree created") + + def build_tree_from_entries(self, entries: list[RefEntry], links: dict[str, str]) -> None: + + self.links = links + tree_map: dict[str, int] = {} + + # populate the tree with entries + for entry in entries: + tree_map[entry.ref_id] = entry.pid + self.nodes.append(RefNode(entry)) + + # check for index entries (pages that share a path with a directory) + for idx, entry in enumerate(entries): + has_children = any(path.startswith(entry.ref_id + '/') for path in tree_map) + if has_children: + self.nodes[idx].is_index = True + + print(f"RefTree built with {len(self.nodes)} nodes") \ No newline at end of file diff --git a/ref_splitter/token_table.py b/ref_splitter/token_table.py new file mode 100644 index 00000000..e61fedbe --- /dev/null +++ b/ref_splitter/token_table.py @@ -0,0 +1,23 @@ + +INLINE_TOKEN_TABLE = [ + {"TOKEN" : "BOLD", "html" : "b", "md" : "**" }, + {"TOKEN" : "ITALIC", "html" : "i", "md" : "*" }, + {"TOKEN" : "UNDERLINE", "html" : "u", "md" : "__" }, + {"TOKEN" : "CODE", "html" : "tt", "md" : "`" }, + {"TOKEN" : "CODE", "html" : "var", "md" : "`" }, + {"TOKEN" : "DESC_TERM", "html" : "dt", "md" : "**" }, + {"TOKEN" : "DESC_DETAIL", "html" : "dd", "md" : "DD" } + + # this is handled in the ref_splitter; the standard tokenizer destroys the code inside the block + #{"TOKEN" : "CODEBLOCK", "html" : "xmp", "md" : "```" }, +] + +P_CLASS_TOKEN_TABLE = [ + {"TOKEN" : "P_COMPATIBILITY", "html" : "compatibility", "md" : "TIP"}, + {"TOKEN" : "P_PERFORMANCE", "html" : "performance", "md" : "TIP"}, + {"TOKEN" : "P_TIP", "html" : "tip", "md" : "TIP"}, + {"TOKEN" : "P_NOTE", "html" : "note", "md" : "NOTE"}, + {"TOKEN" : "P_DIDYOUKNOW", "html" : "didyouknow", "md" : "TIP"}, + {"TOKEN" : "P_DEPRECTATED", "html" : "deprecated", "md" : "WARNING"}, + {"TOKEN" : "P_SECURITY", "html" : "security", "md" : "CAUTION"} +] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..b8df22dd Binary files /dev/null and b/requirements.txt differ diff --git a/tests/test_data/mouse_down_input_sample.txt b/tests/test_data/mouse_down_input_sample.txt new file mode 100644 index 00000000..160e4bf7 --- /dev/null +++ b/tests/test_data/mouse_down_input_sample.txt @@ -0,0 +1,183 @@ + +

+ MouseDown proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (atom) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseDown(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseDown(location,control,params). +
+
+

+ This is called when the a mouse button is pressed while pointing to the +object. Note that MouseUp() will always be called after MouseDown() is +called, even if over empty space. That means + + object + + and + + location + + may be null. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Most operations can be done through + + Click() + + , + + DblClick() + + , and + + MouseDrop() + + . The other +procedures are simply available for completeness. +

+

+ The argument format for this verb is: +

+ + MouseDown(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +

+ Note: In BYOND 3.5 this procedure took three different +arguments: + + location + + , + + icon_x + + , and + + icon_y + + . Since + + icon_x + + and + + icon_y + + have been replaced, old code will need to +be modified. Games compiled before this change will still work normally. +

+
+ \ No newline at end of file diff --git a/tests/test_data/ref_client_input_sample.txt b/tests/test_data/ref_client_input_sample.txt new file mode 100644 index 00000000..de8ab120 --- /dev/null +++ b/tests/test_data/ref_client_input_sample.txt @@ -0,0 +1,7140 @@ +
+ +

+ client +

+
+
+ + See also: + +
+
+ + client var (mob) + +
+ + key var (mob) + +
+ + procs (client) + +
+ + vars (client) + +
+ + + +
+

+ Each connected player has a corresponding client object. It has +variables and procedures which control aspects of player input/output. This +object is also responsible for linking the player up to a mob. +

+

+ The client can be reassigned from its original mob M to a new mob N by +setting N.client = M.client. This process disconnects the player from M +(calling M.Logout()) and connects the player to N (calling N.Login()). +Setting the mob's key has the same effect. +

+

+ Additional vars, procs, and verbs may be added to the client in order to +give the player properties that are independent of the mob. +

+
+ + +

+ procs (client) +

+

+ Built-in client procs: +

+
+
+ client/proc +
+
+ + AllowUpload + +
+ + Center + +
+ + CheckPassport + +
+ + Click + +
+ + Command + +
+ + DblClick + +
+ + Del + +
+ + East + +
+ + Export + +
+ + GetAPI proc + +
+ + Import + +
+ + IsByondMember + +
+ + MeasureText + +
+ + MouseDown + +
+ + MouseDrag + +
+ + MouseDrop + +
+ + MouseEntered + +
+ + MouseExited + +
+ + MouseMove + +
+ + MouseUp + +
+ + MouseWheel + +
+ + Move + +
+ + New + +
+ + North + +
+ + Northeast + +
+ + Northwest + +
+ + RenderIcon + +
+ + SendPage + +
+ + SetAPI proc + +
+ + SoundQuery + +
+ + South + +
+ + Southeast + +
+ + Southwest + +
+ + Stat + +
+ + Topic + +
+ + West + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +

+ AllowUpload proc (client) +

+
+
+ + See also: + +
+
+ + input proc + +
+
+
+
+ + Format: + +
+
+ AllowUpload(filename, filelength) +
+
+
+
+ + When: + +
+
+ Called when the player attempts to upload a file to the server, through input() or a command. +
+
+
+
+ + Default action: + +
+
+ Allows the upload by returning 1. +
+
+

+ The client who owns this proc (src) is the one trying to upload the file. +If this proc returns a true value, the upload will be allowed. Otherwise, it +will be rejected. +

+

+ Example: +

+ + client + AllowUpload(filename, filelength) + if(filelength &gt;= 524288) // 512K (0.5M) + src &lt;&lt; "[filename] is too big to upload!" + return 0 + return 1 + +
+ + +

+ Center proc (client) +

+
+
+ + See also: + +
+
+ + walk proc + +
+
+
+
+ + Format: + +
+
+ Center() +
+
+
+
+ + When: + +
+
+ Called when the player presses the "center" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Cancels any automated movement by calling walk(usr,0). +
+
+
+ + +

+ CheckPassport proc (client) +

+
+
+ + See also: + +
+
+ + IsSubscribed proc (world) + +
+ + IsByondMember proc (client) + +
+ + GetAPI proc (client) + +
+ + SetAPI proc (client) + +
+ + + +
+
+
+ + Format: + +
+
+ CheckPassport(passport_identifier) +
+
+
+
+ + Args: + +
+
+ passport_identifier: a text string assigned to you by the BYOND hub (or an ID/token for a different API; see below). +
+
+

+ This built-in procedure checks to see if the user is subscribed to a +particular BYOND hub entry. If the user is subscribed, the result is the +number of days left (rounded up) on their subscription, or -1 for lifetime +subscribers. +

+

+ Example: +

+ + world + hub = "My.Hub" //change this to your own hub entry + +mob/var + full_access + +mob/Login() + if(client.CheckPassport("0123456789abcdef")) + full_access = 1 + else + src &lt;&lt; "For full access, + <a href="\"> + subscribe + </a> + !" + return ..() + +

+ Note that in general the value of world.hub has nothing to do with the +passport you happen to check. This example assumes the passport number +belongs to world.hub just for the purpose of forwarding the user to the +appropriate subscription page. +

+

+ Other APIs +

+

+ You can use this with other APIs that are supported by BYOND, which +currently only applies to Steam and only if the game is specially built for +Steam support. +

+

+ To check ownership of a Steam game or DLC (must be the current game's ID +or one of its DLCs), use + + "steam: + + NNNNNN + + " + + for the passport +string, where + + NNNNNN + + is a Steam app ID. Note that the user must be +logged into Steam for this to work. +

+
+ + +

+ Click proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (atom) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_over_pointer var (atom) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + + +
+
+
+ + Format: + +
+
+ Click(object,location,control,params) +
+
+
+
+ + When: + +
+
+ Called when the player clicks on the map or in the stat panels. +
+
+
+
+ + Args: + +
+
+ object: the object clicked +
+ location: the client stat panel, location (turf) of object on map, grid cell, or other control-specific info +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.Click(location,control,params). +
+
+

+ Example: +

+ + client + Click(O) + usr &lt;&lt; "You clicked [O]" + ..() // do default action + +

+ Note that due to network lag, it is possible when clicking on moving +objects for the location of those objects to have changed by the time the +Click() proc is executed. That is the reason for the location argument. It +tells you where the click originally took place. +

+

+ The argument format for this verb is: +

+ + Click(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ Command proc (client) +

+
+
+ + Format: + +
+
+ Command(command as command_text) +
+
+
+
+ + When: + +
+
+ Called when the player types in something that is not understood as a +valid command, or if the player is connected via telnet. +
+
+
+
+ + Default action: + +
+
+ None. +
+
+

+ If this proc is used, players will be able to connect to your world via +telnet. All telnet users' commands are routed through this proc instead of +being parsed into verbs. Players who join the world through Dream Seeker +will have their commands parsed as verbs first, and those commands will end +up here only if there is no applicable verb. +

+

+ Note that text received by this proc is not interpreted beforehand, so +quotes " and backslashes \ should come through unaltered. +

+

+ This proc is primarily useful if you want to handle parsing yourself (like +for a MUD), or if your world is a chat server and verbs are not used much. +

+
+
+ +

+ DblClick proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (atom) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_over_pointer var (atom) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + + +
+
+
+ + Format: + +
+
+ DblClick(object,location,control,params) +
+
+
+
+ + When: + +
+
+ Called when the player double-clicks on the map or in the stat panels. +
+
+
+
+ + Args: + +
+
+ object: the object double-clicked +
+ location: the client stat panel, location (turf) of object on map, grid cell, or other control-specific info +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.DblClick(location,control,params). +
+
+

+ Example: +

+ + client + DblClick(O) + usr &lt;&lt; "You double-clicked [O]" + ..() // do default action + +

+ Note that due to network lag, it is possible when clicking on moving +objects for the location of those objects to have changed by the time the +DblClick() proc is executed. That is the reason for the location argument. +It tells you where the click originally took place. +

+ + DblClick(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ Del proc (client) +

+
+
+ + See also: + +
+
+ + Logout proc (mob) + +
+
+
+
+ + Format: + +
+
+ Del() +
+
+
+
+ + When: + +
+
+ Called when the player disconnects from the world. +
+
+
+
+ + Default action: + +
+
+ If the player is connected to a mob, call mob.Logout() to disconnect. +If the player's connection to the world is still not dead, kill it. +
+
+

+ Note that this does not automatically delete the player's mob. If you want +to do that, you could do so in mob.Logout(). +

+
+ + +

+ East proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ East() +
+
+
+
+ + Returns: + +
+
+ 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "right" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the east. +
+
+
+ + +

+ Export proc (client) +

+
+
+ + See also: + +
+
+ + Import proc (client) + +
+ + New proc (client) + +
+ + hub var (world) + +
+ + savefile + +
+ + + +
+
+
+ + Format: + +
+
+ client.Export(file) +
+
+
+
+ + Args: + +
+
+ file: file to send to client +
+
+

+ This stores the file on the user's computer in a special location unique to +each registered + + world.hub + + setting. This is most +useful for writing a client-side savefile, but any type of file may be stored. +The purpose of this is to exchange information between different worlds running +under the same hub path. +

+

+ When a file is exported to the player's computer, it replaces any +previous file stored by a game with the same + + world.hub + + value. +This should not be used for anything requiring high security, because any +other world could make use of the same hub path and access the file. It +is also possible for the user to tinker with the file, since it resides on +their computer. +

+

+ To delete the client-side file completely, call + + client.Export() + + with no argument at all. +

+

+ Example: +

+ + mob/verb/save() + var/savefile/F = new() + F &lt;&lt; usr //write the player's mob + usr.client.Export(F) + +client/New() + var/client_file = Import() + if(client_file) + var/savefile/F = new(client_file) //open it as a savefile + F &gt;&gt; usr //read the player's mob + return ..() + +
+ + +

+ GetAPI proc (client) +

+
+
+ + See also: + +
+
+ + SetAPI proc (client) + +
+ + CheckPassport proc (client) + +
+ +
+
+
+ + Format: + +
+
+ GetAPI(Api, Name) +
+
+
+
+ + Args: + +
+
+ Api: the name of the API (e.g. "steam") +
+ Key: the name of the value to read +
+ +
+

+ Interfaces with supported external APIs to read information. Currently this +only has meaning for Steam, for specially built games that have a Steam app ID. +

+

+ This proc returns null any time the call or its results are invalid: for +instance, trying to query a Steam stat from a user who isn't logged into +Steam. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Key + + Return type + + Description +
+ + "steam" + + API +
+ Requires that the server and client are using a valid Steam app ID, such as when a game is built for standalone distribution. +
+ id + + text + + Returns the user's numeric Steam ID, if any. Because this number is too big to fit in BYOND's numbering system, it is returned as text. +
+ name + + text + + Returns the user's persona name on Steam. +
+ stat: + + Name + + + num + + Returns the value of the stat called + + Name + + . +
+ achievement: + + Name + + + num + + Returns the date (for use with + + time2text + + ) the achievement called + + Name + + , or 0 if it hasn't been earned. +
+ achievement-data: + + Name + + + list + + Returns information about the achievement called + + Name + + . The result is an associative list with named values + + name + + (display name), + + desc + + (description), and optionally + + hidden + + and + + icon + + . (This call is the same no matter which client you call it for.) +
+ achievements + + list + + Returns a list of all possible achievements. Each item in the list is the internal name of the achievement, and it is associated with a list in the form described for + + achievement-data: + + Name + + + . (This call is the same no matter which client you call it for.) +
+
+ +

+ Import proc (client) +

+
+
+ + See also: + +
+
+ + Export proc (client) + +
+ + New proc (client) + +
+ + savefile + +
+ + +
+
+
+ + Format: + +
+
+ client.Import(Query) +
+
+
+
+ + Args: + +
+
+ Query: optional query parameters +
+
+

+ When no query parameters are given, this returns the client-side file last +exported with + + client.Export() + + . This comes as an entry in the +resource cache, which can be opened as a savefile among other things. If +there is no file, null is returned. For an example, see + + client.Export + + . +

+

+ When there are query parameters, these may be used to import a file from +some alternate source. Currently this is not supported. +

+
+ + +

+ IsByondMember proc (client) +

+
+
+ + Format: + +
+
+ IsByondMember() +
+
+
+
+ + Args: + +
+
+ None. +
+
+

+ This built-in procedure checks to see if the user is a BYOND Member. +Use it to give special in-game rewards to those who support BYOND. +

+

+ If the user is a Member, the result is the number of days left (rounded +up) on their Membership, or -1 for lifetime Members. +

+

+ Example: +

+ + mob/var + special_features + +mob/Login() + if(client.IsByondMember()) + special_features = 1 + else + src &lt;&lt; "For special features, + <a href="\"> + become a BYOND Member + </a> + !" + return ..() + +
+
+ +

+ MeasureText proc (client) +

+
+
+ + See also: + +
+
+ + maptext var (atom) + +
+ + maptext_width var (atom) + +
+ + maptext_height var (atom) + +
+ + +
+
+
+ + Format: + +
+
+ MeasureText(text, style, width=0) +
+
+
+
+ + Args: + +
+
+ text: The text to be measured +
+ style: Stylesheet to be used (leave blank to use the default map control's styles, if any) +
+ width: Width limit, if you only want to measure height; 0 means no limit +
+ + +
+
+
+ + Returns: + +
+
+ A size value in + + "[width]x[height]" + + format, e.g. "60x16" +
+
+

+ Because maptext rendering may vary by client, + + MeasureText + + lets +you get a measurement of how text will be laid out, so you can adjust + + maptext_width + + and + + maptext_height + + accordingly. +

+
+ + +

+ MouseDown proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (atom) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseDown(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseDown(location,control,params). +
+
+

+ This is called when the a mouse button is pressed while pointing to the +object. Note that MouseUp() will always be called after MouseDown() is +called, even if over empty space. That means + + object + + and + + location + + may be null. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Most operations can be done through + + Click() + + , + + DblClick() + + , and + + MouseDrop() + + . The other +procedures are simply available for completeness. +

+

+ The argument format for this verb is: +

+ + MouseDown(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +

+ Note: In BYOND 3.5 this procedure took three different +arguments: + + location + + , + + icon_x + + , and + + icon_y + + . Since + + icon_x + + and + + icon_y + + have been replaced, old code will need to +be modified. Games compiled before this change will still work normally. +

+
+ + +

+ MouseDrag proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (atom) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseDrag(src_object,over_object,src_location,over_location,src_control,over_control,params) +
+
+
+
+ + Args: + +
+
+ src_object: the object being dragged +
+ over_object: the object under the mouse pointer +
+ src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged +
+ over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer +
+ src_control: The id of the skin control the object was dragged from +
+ over_control: The id of the skin control the object was dragged over +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + + + + +
+
+
+ + Default action: + +
+
+ Call object.MouseDrag(over_object,src_location,over_location,src_control,over_control,params). +
+
+

+ This is called while dragging an object by pressing and holding the left +mouse button over the object and moving the mouse. The over_object may be +null if dragging over a stat panel or over other empty space. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Most operations can be done through +Click(), DblClick(), and MouseDrop(). The other procedures are simply +available for completeness. +

+

+ The argument format for this verb is: +

+ + MouseDrag(src_object as null|atom in usr.client,\ + over_object as null|atom in usr.client,\ + src_location as null|turf|text in usr.client,\ + over_location as null|turf|text in usr.client,\ + src_control as text, over_control as text, params as text) + +
+ + +

+ MouseDrop proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (atom) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseDrop(src_object,over_object,src_location,over_location,src_control,over_control,params) +
+
+
+
+ + Args: + +
+
+ src_object: the object being dropped +
+ over_object: the object under the mouse pointer +
+ src_location: the turf, stat panel, grid cell, etc. from where the src object was dragged +
+ over_location: the turf, stat panel, grid cell, etc. containing the object under the mouse pointer +
+ src_control: The id of the skin control the object was dragged from +
+ over_control: The id of the skin control the object was dropped onto +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + + + + +
+
+
+ + Default action: + +
+
+ Call object.MouseDrop(over_object,src_location,over_location,src_control,over_control,params). +
+
+

+ This is called when a mouse button is released after dragging an +object. The over_object may be null if dropping over a stat panel or over +other empty space. +

+

+ The argument format for this verb is: +

+ + MouseDrag(src_object as null|atom in usr.client,\ + over_object as null|atom in usr.client,\ + src_location as null|turf|text in usr.client,\ + over_location as null|turf|text in usr.client,\ + src_control as text, over_control as text, params as text) + +
+ + +

+ MouseEntered proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (atom) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseEntered(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseEntered(location,control,params). +
+
+

+ This is called when no mouse buttons are pressed while pointing to the +object. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Defining it on only the objects that +require it reduces overhead. +

+

+ The argument format for this verb is: +

+ + MouseEntered(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ MouseExited proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (atom) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseExited(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseExited(location,control,params). +
+
+

+ This is called when the mouse moves off of an object. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Defining it on only the objects that +require it reduces overhead. +

+

+ The argument format for this verb is: +

+ + MouseExited(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ MouseMove proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (atom) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseMove(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseMove(location,control,params). +
+
+

+ This is called when no mouse buttons are pressed while pointing to the +object, and the mouse has moved. The first time the mouse moves over the +object, MouseEntered() is called instead. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Defining it on only the objects that +require it reduces overhead. +

+

+ The argument format for this verb is: +

+ + MouseMove(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ MouseUp proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (atom) + +
+ + MouseWheel proc (client) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + show_popup_menus var (client) + +
+ + + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseUp(object,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ location: the turf, stat panel, grid cell, etc. containing the object where it was clicked +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + +
+
+
+ + Default action: + +
+
+ Call object.MouseUp(location,control,params). +
+
+

+ This is called when a mouse button is released while pointing to +an object. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. Most operations can be done through + + Click() + + , + + DblClick() + + , and + + MouseDrop() + + . The other +procedures are simply available for completeness. +

+

+ The argument format for this verb is: +

+ + MouseUp(object as null|atom in usr.client,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +

+ Note: In BYOND 3.5 this procedure took three different +arguments: + + location + + , + + icon_x + + , and + + icon_y + + . Since + + icon_x + + and + + icon_y + + have been replaced, old code will need to +be modified. Games compiled before this change will still work normally. +

+
+ + +

+ MouseWheel proc (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + MouseWheel proc (atom) + +
+ + mouse_opacity var (atom) + +
+ + mouse_pointer_icon var (client) + +
+ + + + + + + + + + + +
+
+
+ + Format: + +
+
+ MouseWheel(object,delta_x,delta_y,location,control,params) +
+
+
+
+ + Args: + +
+
+ object: the object under the mouse pointer +
+ delta_x,delta_y: amount of wheel movement +
+ location: the turf, stat panel, grid cell, etc. containing the object +
+ control: the name of the skin control involved +
+ params: other parameters including mouse/keyboard flags, icon offsets, etc.; see + + mouse handling + +
+ + + + +
+
+
+ + Default action: + +
+
+ Call object.MouseWheel(delta_x,delta_y,location,control,params). +
+
+

+ This is called when the mouse wheel is moved while over an object or +control. It is NOT called if over a browser control, or any control that is +currently scrollable. +

+

+ Positive values of delta_x and delta_y refer to scrolling right or up, +respectively. Negative values are left and down, respectively. +

+

+ Don't define this unless you need it, because it generates extra +communication that is otherwise avoided. If you only need wheel support on +specific objects, use atom.MouseWheel() instead which is more selective. +

+

+ The argument format for this verb is: +

+ + MouseWheel(object as null|atom in usr.client,\ + delta_x as num, delta_y as num,\ + location as null|turf|text in usr.client,\ + control as text, params as text) + +
+ + +

+ Move proc (client) +

+
+
+ + See also: + +
+
+ + East proc (client) + +
+ + Move proc (movable atom) + +
+ + North proc (client) + +
+ + Northeast proc (client) + +
+ + Northwest proc (client) + +
+ + South proc (client) + +
+ + Southeast proc (client) + +
+ + Southwest proc (client) + +
+ + West proc (client) + +
+ + + + + + + + +
+
+
+ + Format: + +
+
+ Move(loc,dir) +
+
+
+
+ + Returns: + +
+
+ 1 on success; 0 on failure +
+
+
+
+ + When: + +
+
+ Called by the direction procs. +
+
+
+
+ + Default action: + +
+
+ Calls src.mob.Move(). Also cancels any automated movement by + calling walk(usr,0). +
+
+
+ + +

+ New proc (client) +

+
+
+ + See also: + +
+
+ + Export proc (client) + +
+ + Import proc (client) + +
+ + Login proc (mob) + +
+ + New proc (datum) + +
+ + Topic proc (client) + +
+ + mob var (world) + +
+ + savefile + +
+ + + + + + +
+
+
+ + Format: + +
+
+ New(TopicData) +
+
+
+
+ + Returns: + +
+
+ The newly connected mob, client.mob, or null to disallow the connection. +
+
+
+
+ + When: + +
+
+ Called when the player first tries to connect to the world. +
+
+
+
+ + Args: + +
+
+ usr: The mob in the world with the same key as the player, if it exists. +
+ TopicData: If the player accessed the world with a "connection topic", + this is the topic text. Otherwise it is null. +
+ +
+
+
+ + Default action: + +
+
+ Look for an existing mob with the same key as the player. If found, + connect the player to that mob (mob.Login()). Otherwise, look for a + prototype mob with the same key as the player. If found, create a mob of + that type and connect the player to it. Otherwise, create a mob of type + world.mob, give it the same name and gender as the player's key, and + connect the player to it. If TopicData is not null, call + client.Topic(TopicData). Finally, the player's mob is returned. +
+
+

+ This is a fairly low-level procedure that you would only want to override +if you cannot accomplish the same thing in + + mob/Login() + + or + + mob/New() + + . One reason to override + + client/New() + + is +if player mobs are created from a savefile. In that case, you don't need a +temporary mob to be created first. +

+

+ Example: +

+ + client/New() + if(usr) return ..() //reconnecting to existing mob + else + var/player_sav = "players/[ckey].sav" + if(length(file(player_sav))) //if player savefile exists + var/savefile/F = new(player_sav) //open it + F &gt;&gt; usr //create saved mob + return ..() //creates a new mob if necessary +mob/Logout() + var/player_sav = "players/[ckey].sav" + var/savefile/F = new(player_sav) + F &lt;&lt; src + del src + +

+ If you want to do any user-interaction before loading the saved mob, you +will have to create a temporary mob first in order to interact with the +player. In that case, you are better off doing things in + + mob/Login() + + , rather than + + client/New() + + . +

+

+ Note that for the above example to work, you + + must + + make +proper use of the + + tmp + + flag when defining new object +variables. Otherwise, this can end up sucking large portions of your world +into each player savefile, which can have all sorts of unexpected +consequences! +

+
+ + +

+ North proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ North() +
+
+
+
+ + Returns: + +
+
+ 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "up" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the north. +
+
+
+ + +

+ Northeast proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ Northeast() +
+
+
+
+ + Returns: + +
+
+ 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "up-right" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the northeast. +
+
+
+ + +

+ Northwest proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ Northwest() +
+
+
+
+ + Returns: + +
+
+ Returns 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "up-left" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the northwest. +
+
+
+ + +

+ RenderIcon proc (client) +

+
+
+ + See also: + +
+
+ + vis_contents var (atom) + +
+ + Filter effects + +
+ +
+
+
+ + Format: + +
+
+ RenderIcon(object) +
+
+
+
+ + Args: + +
+
+ object: An atom or appearance to render. +
+
+
+
+ + Returns: + +
+
+ A single-image icon file in which the object is rendered with all its +overlays, visual contents, etc. +
+
+

+ Use this proc to render an atom or an appearance as a single icon. This is +a client proc because the server is not capable of rendering anything on its +own. +

+

+ Any overlays, image objects known to this client that are attached to the +object, visual contents, maptext, and so on will be included in the render. +The returned icon is sized to fit all of the above, and to include room for +any expansion due to filter effects. +

+

+ Example: +

+ + mob/proc/GetFlatIcon() + return client?.RenderIcon(src) + +

+ Important notes regarding this proc: +

+
    +
  • + The returned icon is a cache file, + + not + + an + + /icon + + datum. +
  • +
  • + If + + object + + is an + + + /image + + object + + , the + image must be known to the client. Otherwise the return value is null. +
  • +
  • + If this object doesn't appear on the client's map, it will be sent to them + on the next map tick, along with any visual contents. The server will hold a + reference to the object until the map tick ends, so an object you create + temporarily should remain valid long enough to be rendered. +
  • +
  • + + render_source + + will not + work unless the corresponding + + render_target + + appears in the + same render stack. That is, this object or appearance will be rendered in an + isolated "scene" rather than as part of the map, so it won't be able to use + other objects on the map as render sources. +
  • +
+
+ + +

+ SendPage proc (client) +

+
+
+ + Format: + +
+
+ SendPage(msg,recipient,options) +
+
+
+
+ + Returns: + +
+
+ Returns number of recipients successfully contacted. +
+
+
+
+ + Args: + +
+
+ msg: text to send +
+ recipient: key or list of keys to page +
+ options: text string containing key=value options +
+ + +
+

+ The user is prompted to authorize sending of the pager message. The +recipient may easily respond or jump to the sender's location by clicking on +the link in the pager message. The effect is identical to that of the +sending a page through the Dream Seeker pager. +

+

+ The options are encoded in the same format read by text2params(). The +valid options are: +

+
+
+ summon (0/1) +
+
+ If not included in the options, this is 0. If included in the options +without assigning it to anything, it is 1. A value of 1 sends the recipient +the sender's location so they can join by clicking on the message. +
+
+ email (0/1) +
+
+ If not included in the options, this is 0. If included in the options +without assigning it to anything, it is 1. A value of 1 sends causes the +message to be delivered as email. If this is not possible, it is delivered as +a long-lived pager message. Normally, pager messages expire within a short +time after being sent (half an hour). +
+
+ subject +
+
+ For email messages, this specifies the subject to use. +
+
+
+
+ +

+ SetAPI proc (client) +

+
+
+ + See also: + +
+
+ + GetAPI proc (client) + +
+ + CheckPassport proc (client) + +
+ +
+
+
+ + Format: + +
+
+ SetAPI(Api, Key, Value) +
+
+
+
+ + Args: + +
+
+ Api: the name of the API (e.g. "steam") +
+ Key: the name of the value to change +
+ Value: the new value to set +
+ + +
+

+ Interfaces with supported external APIs to write information. Currently this +only has meaning for Steam, for specially built games that have a Steam app ID. +

+

+ This proc returns null any time the call or its results are invalid. +

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ Key + + Return type + + Description +
+ + "steam" + + API +
+ Requires that the server and client are using a valid Steam app ID, such as when a game is built for standalone distribution. +
+ stat: + + Name + + + num + + Changes the value of the stat called + + Name + + . Returns 1 on success. This may fail if the stat change is too much or is out of range. +
+ achievement: + + Name + + + num + + Earns the achievement called + + Name + + , or clears it. Value is expected to be a number, or number in text form, where 0 will clear the achievement and 1 will earn it. +
+
+ +

+ SoundQuery proc (client) +

+
+
+ + See also: + +
+
+ + /sound datum + +
+ + sound proc + +
+ +
+
+
+ + Format: + +
+
+ SoundQuery() +
+
+
+
+ + Args: + +
+
+ none +
+
+
+
+ + Returns: + +
+
+ A list of + + /sound + + datums with information about currently playing sounds. +
+
+

+ This proc is used to ask a client about sounds that are playing. The + + /sound + + datums in the returned list have the following vars set: +

+
    +
  • + file: Sound/music file, or null if none +
  • +
  • + channel: Channel of sound, if one was set when the sound was played +
  • +
  • + repeat: The + + repeat + + value of the sound +
  • +
  • + status: Status flags active for this channel; currently only + + SOUND_PAUSED + + is supported +
  • +
  • + offset: Current time index, in seconds, of the sound at the current frequency +
  • +
  • + len: Total duration, in seconds, of the sound at the current frequency +
  • +
  • + wait: Total duration of sounds queued to play later on this channel (does not apply to channel 0) +
  • +
+

+ Not all info about the sounds is retrieved, such as + + volume + + , + + frequency + + , etc. If those are needed, it should be a simple matter to +keep track of them in your code. The main purpose of + + SoundQuery() + + is +to ascertain the current status of playing sounds. +

+
+ + +

+ South proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ South() +
+
+
+
+ + Returns: + +
+
+ Returns 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "down" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the south. +
+
+
+ + +

+ Southeast proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ Southeast() +
+
+
+
+ + Returns: + +
+
+ 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "down-right" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the southeast. +
+
+
+ + +

+ Southwest proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ Southwest() +
+
+
+
+ + Returns: + +
+
+ Returns 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "down-left" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the southwest. +
+
+
+ + +

+ Stat proc (client) +

+
+
+ + See also: + +
+
+ + Stat proc (atom) + +
+ + stat proc + +
+ + statobj var (client) + +
+ + statpanel proc + +
+ + statpanel var (client) + +
+ + Info control (skin) + +
+ + + + + +
+
+
+ + Format: + +
+
+ Stat() +
+
+
+
+ + When: + +
+
+ Called periodically by the client to update the stat window. +
+
+
+
+ + Default action: + +
+
+ Call statobj.Stat(). +
+
+

+ If this procedure sleeps (or engages in some other waiting operation), it +will not be called again until it finally returns. This allows you to +effectively decrease the frequency of calls to the proc. You might want to +do that if it is a fairly lengthy procedure, and frequent calls are slowing +things down. +

+

+ To increase the frequency of stat updates, you can lower + + world.tick_lag + + . +

+

+ Note: Typically only the currently viewed statpanel is updated, which +saves on some network activity and a little time. If however the proc +sleeps, you need to be sure that any pending updates are displayed once +the right panel is available. Therefore if you're resetting a var that +indicates the proc should sleep next time, it should not be reset unless +you know the player is looking at the right statpanel and has received +the updates. +

+

+ Example +

+ + client/var/updategold = 1 // set to 1 if gold changes +client/var/updateinventory = 1 // set to 1 if inventory changes + +client/Stat() + // if not ready to update, Stat() won't be called again till sleep is done + while(!updategold &amp;&amp; !updateinventory) + sleep(5) + if(statpanel("Gold")) // switch to Gold panel and ask if player is looking at it + stat("Gold", mob.gold) + updategold = 0 // we updated, so turn this flag back off + if(statpanel("Inventory")) + stat(mob.contents) + updateinventory = 0 + +

+ Because sleeping in Stat() requires more thinking through, it's best to do +so only in cases where Stat() has to do a lot of intensive calculations. +

+
+ + +

+ Topic proc (client) +

+
+
+ + See also: + +
+
+ + New proc (client) + +
+ + Topic proc (datum) + +
+ + link proc + +
+ + ref text macro + +
+ + + +
+
+
+ + Format: + +
+
+ Topic(href,href_list[],hsrc) +
+
+
+
+ + When: + +
+
+ Called when a player connects to a world with a "connection topic" or + when the player runs a hyperlink in the current world by clicking one + embedded in text or generated by the link() instruction. +
+
+
+
+ + Args: + +
+
+ href: The topic text (everything after the '?' in the full href). +
+ href_list: List of key/value pairs in href (produced from params2list(href)). +
+ hsrc: The object referenced by the "src" parameter in href or null if none. +
+ + +
+
+
+ + Default action: + +
+
+ Call the hsrc object's own Topic() proc. +
+
+

+ The following example uses a very simple href value. +

+

+ Example: +

+ + mob/Login() + src &lt;&lt; "Click + <a href="?source"> + here + </a> + to download the source code." + return ..() + +client/Topic(href) + if(href == "source") + usr &lt;&lt; file("world.dm") + usr &lt;&lt; file("world.rsc") + else ..() + +

+ Be sure to call the default handler unless you want to prevent rerouting +of topics to other objects. +

+

+ Always validate the input in + + Topic() + + calls +to make sure it's correct and the query you're recieving is legitimate. For +security reasons, you will probably want to control which objects a player has +access to, since a player could spoof a topic link containing any arbitrary +object reference. (Never trust those sneaky players!) +

+

+ The next example demonstrates an href that gets handled by another object. +This is how you would normally want to do things. It is best not to override +client/Topic() (as in the example above) unless you need to intervene in the +low-level details of routing the request to the right object. +

+

+ You specify the object that will handle the request by using a parameter +called "src". +

+

+ Example: +

+ + mob/Login() + src &lt;&lt; "Click + <a href="?src=\ref[src];action=startgame"> + here + </a> + to start." + return ..() + +mob/Topic(href,href_list[]) + switch(href_list["action"]) + if("startgame") + usr &lt;&lt; "Starting game..." + else + return ..() + +

+ Although it is slightly more complex, the use of the parameter list allows +you to easily include extra data and new functionality. Just remember that +the data in the list is always stored as text, so if you are expecting a +number or an object, you must convert it yourself (with text2num(), locate(), +or whatever). +

+
+ + +

+ West proc (client) +

+
+
+ + See also: + +
+
+ + Move proc (client) + +
+
+
+
+ + Format: + +
+
+ West() +
+
+
+
+ + Returns: + +
+
+ Returns 1 on success; 0 on failure. +
+
+
+
+ + When: + +
+
+ Called when the player presses the "left" key or cursor. +
+
+
+
+ + Default action: + +
+
+ Calls src.Move() towards the west. +
+
+
+ + +

+ vars (client) +

+

+ Built-in client vars: +

+
+
+ client/var +
+
+ + address + +
+ + authenticate + +
+ + bounds + +
+ + byond_build + +
+ + byond_version + +
+ + CGI + +
+ + ckey + +
+ + color + +
+ + command_text + +
+ + connection + +
+ + control_freak + +
+ + computer_id + +
+ + default_verb_category + +
+ + dir + +
+ + edge_limit + +
+ + eye + +
+ + fps + +
+ + gender + +
+ + glide_size + +
+ + images + +
+ + inactivity + +
+ + key + +
+ + lazy_eye + +
+ + mob + +
+ + mouse_pointer_icon + +
+ + perspective + +
+ + pixel_x + +
+ + pixel_y + +
+ + pixel_w + +
+ + pixel_z + +
+ + preload_rsc + +
+ + screen + +
+ + script + +
+ + show_map + +
+ + show_popup_menus var + +
+ + show_verb_panel + +
+ + statobj + +
+ + statpanel + +
+ + tick_lag + +
+ + timezone + +
+ + verbs + +
+ + view + +
+ + virtual_eye + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +

+ CGI var (client) +

+

+ In CGI mode, DreamDaemon is normally being executed by a web server and +accessed by a web browser. The CGI object is an add-on to the basic client +object for handling this case. +

+

+ The CGI object is defined and documented in a separate code library + + html/CGI.dm + + . You can find the current version at + + www.byond.com + + . +

+
+ + +

+ address var (client) +

+
+
+ + Default value: + +
+
+ The network address of the player's client. +
+
+

+ This is a read-only value which contains the player's network address. +

+
+
+ +

+ authenticate var (client) +

+

+ This value may be set to 0 at compile-time to disable BYOND hub-based +authentication of users. The default value is 1, which enables +authentication. Hub authentication provides an additional level of +assurance that the user is really the owner of the BYOND key in question. +

+

+ When a world requests certification, Dream Seeker generates a random +password and passes it through the hub (for certification) to the world. +The certificate is saved for faster access in the future and for protection +against possible hub outages. +

+

+ Some applications do not depend on the validity of the user's identity. +In that case, it would be more efficient to turn off the extra level of +authentication. In other situations, the hub may not be available, such as +from behind a firewall or on a LAN without internet access. In those cases, +all hub access (including authentication) can be disabled by entering the +command ".configuration hub-address none" in Dream Seeker. +

+

+ Connections to worlds on the same machine are not hub-authenticated to +allow for convenient offline testing. +

+
+
+ +

+ bounds var (client) +

+ (Also + + bound_x + + , + + bound_y + + , + + bound_width + + , and + + bound_height + + .) +
+
+ + See also: + +
+
+ + bounds proc + +
+
+

+ The read-only bounds var returns the map coordinates, in pixels, covered +by the client's viewport when accounting for pixel offsets, eye, step, etc. +(The coordinates are only relevant to the default + + client.dir + + value of + + NORTH + + , and the + + TOPDOWN_MAP + + or + + SIDE_MAP + + map +formats.) +

+

+ If the viewport is not currently on the map (for instance, when the eye is +at a null location), the var reads as null. Otherwise, it is a list with +five values (x, y, width, height, z) in the same form used by the bounds proc. +

+

+ The alias vars bound_x, bound_y, bound_width, and bound_height can also +be used to retrieve the individual values from the list. They too will be +null if the viewport is not on the map. +

+
+ + +

+ byond_build var (client) +

+
+
+ + See also: + +
+
+ + DM_VERSION macro + +
+ + byond_version var (client) + +
+ + byond_version var (world) + +
+ + +
+

+ This is the build number (minor version) of BYOND being run by this client. +Typically this is not useful information, but it can come in handy when +diagnosing issues reported by players using a beta build. +

+

+ Clients running versions of BYOND prior to 512 (major version) will not +have this information. It is also not guaranteed to exist for non-Dream Seeker +connections. When not available, byond_build is 0. +

+
+ + +

+ byond_version var (client) +

+
+
+ + See also: + +
+
+ + DM_VERSION macro + +
+ + byond_build var (client) + +
+ + byond_version var (world) + +
+ + system_type var (world) + +
+ + + +
+

+ This is the version of BYOND being run by this client. A game designed to +work around known bugs in older versions could use this to adapt its behavior +accordingly. It is also possible to prevent players with much older versions +from joining the game. +

+
+ + +

+ ckey var (client) +

+
+
+ + See also: + +
+
+ + ckey proc + +
+ + key var (client) + +
+ +
+

+ This is a read-only value that is the canonical form of the player's key +(ie the value returned by ckey()). Among other things, this could be used +as a unique directory name in a server-side save file for storing player +information. See the ckey() proc for an example. +

+
+ + +

+ color var (client) +

+
+
+ + See also: + +
+
+ + color var (atom) + +
+ + appearance_flags var (atom) + +
+ +
+

+ Casts a color multiplication or + + matrix + + effect over the entire main map. This behaves exactly the same as +atom.color, and will be combined with atom.color (which comes first) where +present. See + + atom.color + + for more information. +

+

+ If a matrix is used, the alpha column and row will have no effect. +

+

+ Icons that have the NO_CLIENT_COLOR value in appearance_flags will not be +subject to client.color. This can be useful for HUD objects. +

+

+ This value can be animated. +

+

+ Example: +

+ + mob/proc/DayNight(is_day) + if(client) + client.color = is_day ? \ + null : \ + list(0.2,0.05,0.05, 0.1,0.3,0.2, 0.1,0.1,0.4) + +
+ + +

+ command_text (client) +

+
+
+ + See also: + +
+
+ + arguments (verb) + +
+ + command parameter + +
+ + macros (client script) + +
+ + Input control (skin) + +
+ + command parameter (skin) + +
+ + macros (skin) + +
+ + + + + +
+
+
+ + Default value: + +
+
+ null +
+
+

+ Note: In BYOND 4.0 this var is deprecated. The + + command + + parameter for an + + Input control + + can be set to + + !command + + ( + + ! + + in front of your default command) which does the +same thing. +

+

+ This text is placed onto the command line, to be followed by whatever the +user may type. It is usually the name of a verb followed by a space, such +as + + "say " + + . The user can clear this and enter a different command by +hitting backspace, escape, delete, or + + / + + . +

+

+ Example: +

+ + client + command_text = "say " + + verb/say(T as text) + world &lt;&lt; "[usr] says, '[T]'" + +

+ It is also possible to turn on macro mode, in which each keypress +executes a + + keyboard macro + + , by setting + + command_text + + to + + ".alt " + + . That stands for the + + Alt + + key, which can be used to execute macros in normal mode. +

+

+ This variable could also be used to create a specialized command prompt. +For example, a traditional style MUD command-line could be implemented like +this: +

+

+ Example: +

+ + client + command_text = "&gt; " + verb/command(C as command_text) + set name = "&gt;" + usr &lt;&lt; "Your command: [C]" + +

+ This example uses the + + command_text + + input type, which accepts raw +text, with no quoting, escaping, or translating, so that you can invent +whatever syntax you want. +

+
+ + +

+ computer_id var (client) +

+
+
+ + Default value: + +
+
+ A unique numerical identifier for the player's computer. The value is in text form. +
+
+

+ This is a read-only text value which contains a unique numerical identifier for the player's computer. +Its primary purpose is to detect if players are connecting to a server with multiple +accounts on the same machine, while still allowing for multiple accounts on the same network (eg, +through a router). +

+
+
+ +

+ connection var (client) +

+

+ This is a read-only var describing the type of client that is connected. +

+
+
+ + Possible values: + +
+
+ "seeker" - The player is connected through Dream Seeker +
+
+ "telnet" - The player is connected through telnet +
+
+ "world" - The client is actually a world.Export() connection from another server +
+
+ "cgi" - The client is connected via CGI (irrelevant to most worlds) +
+
+ "web" - The client is connected via the Web client +
+
+ "http" - The client is an HTTP connection (used by the Web client's virtual server) +
+
+

+ Other values may be supported in the future. +

+

+ An empty value means the connection type is unknown because a full handshake hasn't been completed yet. +

+
+
+ +

+ control_freak (client) +

+
+
+ + See also: + +
+
+ + User interface skins + +
+ + macros (skin) + +
+ + macros (client script) + +
+ + +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This var lets you set flags to turn off options that are normally present +for the end user. You can combine these flags with the + + | + + operator. +The value 1 is equivalent to + + CONTROL_FREAK_ALL + + and will disable +everything. +

+
+
+ CONTROL_FREAK_ALL +
+
+ If this value is used, it affects all the options below. +
    +
  • + User-defined macros may not be used. +
  • +
  • + Only the world's skin or the default BYOND skin will be loaded, not a user-customized version. +
  • +
  • + The Options & Messages window in Dream Seeker is inaccessible. It will only come up while first connecting to a remotely hosted world, or if a world takes a long time to load. The .options command will not make it appear. +
  • +
  • + The menu items from Options & Messages are unavailable in Dream Seeker's system menu. +
  • +
  • + The default F2 macro for the .screenshot command is turned off. The command is then only accessible through the skin you create. +
  • +
+
+
+ CONTROL_FREAK_SKIN +
+
+ Toggles the ability to create a custom version of the skin. +
+
+ CONTROL_FREAK_MACROS +
+
+ Toggles the ability to use and define custom macros. +
+
+

+ Using + + CONTROL_FREAK_ALL + + will default to disabling everything, and +the other flags will reenable only the features you want. For example, + + CONTROL_FREAK_MACROS + + alone will disable the ability to use your own +macros but nothing else. + + CONTROL_FREAK_ALL | CONTROL_FREAK_MACROS + + will disable everything + + except + + macros. +

+

+ This value can be changed at runtime. +

+

+ Note: If you define your own skin for the world, and disable the ability to +use a custom skin or user-defined macros, you must be sure to define any +macros your world may need. For instance, arrow keys may be needed for +movement. +

+
+ + +

+ default_verb_category var (client) +

+
+
+ + See also: + +
+
+ + category setting (verb) + +
+ + show_verb_panel var (client) + +
+ +
+
+
+ + Default value: + +
+
+ "Commands" +
+
+

+ All verbs with category "" (the default value) are treated as though they +had this category setting instead. In other words, this is the name of the +panel that contains them. You could even turn that panel off by setting this +value to null. +

+
+ + +

+ dir var (client) +

+
+
+ + Default value: + +
+
+ NORTH +
+
+

+ This defines the relationship between the world's coordinate system and the +player's screen. The default means that the player sees the map exactly as it +was created (in the map-editor or at runtime). Changing it to one of the +other directions causes the player to see the map as if it were rotated to +that direction. This means that a player with client.dir = SOUTH would see +the map inverted relative to a person with client.dir = NORTH. That's handy +in two-player board games where you want both players to see their side in the +same place. +

+

+ Note that this does not turn icons upside down! The map is rotated, but +the icons on the map remain in their normal orientation. +

+

+ Movement keys are remapped so that a player with client.dir = SOUTH hitting +the up arrow will generate a call to client.South() rather than the usual +client.North(). +

+
+
+ +

+ edge_limit var (client) +

+
+
+ + See also: + +
+
+ + eye var (client) + +
+ + lazy_eye var (client) + +
+ + perspective var (client) + +
+ + view var (client) + +
+ + screen_loc var (movable atoms) + +
+ + + + +
+
+
+ + Default value: + +
+
+ null +
+
+

+ This value determines the limits that a client's eye will display. +If + + client.perspective + + uses the + + EDGE_PERSPECTIVE + + flag, +the view shouldn't scroll beyond the bounds set by + + edge_limit + + . If +the bounds of + + edge_limit + + are as big as or smaller than the +client's view, no scrolling will occur even if + + EDGE_PERSPECTIVE + + is not used. Normally this value is null, which provides freedom for the eye +to move anywhere on the map. It may be changed to a text value describing the +limits in more detail. +

+

+ The format is similar to + + atom.screen_loc + + which uses + + "[x1],[y1] to [x2],[y2]" + + . It can also use directions +such as + + "SOUTHWEST to NORTHEAST" + + , which refer to the +limits of the map. +

+

+ Example: +

+ + area/house + var/x1,x2,y1,y2 + + Entered(mob/M) + if(ismob(M) &amp;&amp; M.client) + M.client.edge_limit = "[x1],[y1] to [x2],[y2]" + + Exited(mob/M) + if(ismob(M) &amp;&amp; M.client) + M.client.edge_limit = null + +
+ + +

+ eye var (client) +

+
+
+ + See also: + +
+
+ + edge_limit var (client) + +
+ + lazy_eye var (client) + +
+ + mob var (client) + +
+ + perspective var (client) + +
+ + glide_size var (client) + +
+ + view var (client) + +
+ + virtual_eye var (client) + +
+ + view var (world) + +
+ + step_x var (movable atom) + +
+ + step_y var (movable atom) + +
+ + + + + + + + + +
+
+
+ + Default value: + +
+
+ The connected mob, client.mob. +
+
+

+ This value determines the center of the player's map. The default value +simply means that the visible region is normally centered on the player's mob. +Effects such as setting + + perspective + + to + + EDGE_PERSPECTIVE + + or using + + lazy_eye + + can move the map +off-center temporarily. The eye is the + + ideal + + center, not +necessarily the actual center; to find the actual center, use + + virtual_eye + + . +

+

+ The eye's step_x/y vars, if present, are also used to allow smooth +scrolling of the map. These also obey lazy_eye and edge_limit. +

+

+ Note that the visibility of objects is still computed from the point of +view of the mob rather than the eye. This allows the use of + + lazy_eye + + or similar effects that control the panning of the map +while still having the player see only what the mob can see. To determine +visibility from the eye, you can change the value of + + client.perspective + + . +

+

+ If a player connects to a new mob M, client.eye automatically changes to M. +

+

+ Example: +

+ + client + eye = locate(5,5,1) + +

+ This fixes the center of the player's map at the turf coordinate (5,5,1). +Since the eye is fixed, the map will not scroll even as the player's mob +moves out of the visible range. +

+
+ + +

+ fps var (client) +

+
+
+ + See also: + +
+
+ + fps var (world) + +
+ + tick_lag var (client) + +
+ + Pixel movement + +
+ + +
+
+
+ + Default value: + +
+
+ 0 (uses world.fps value) +
+
+

+ This is a client version of world.fps, so that the client can run at a +faster speed for animations. For example, setting client.fps to 40 while +world.fps is the default 10 will mean that all animations and glides are +smoothed out and displayed at 40 FPS, even though the server still runs at +10 FPS. The result is a nicer-looking game with no additional impact on the +server. +

+

+ When this value is 0, the client and server tick at the same rate. +

+
+ + +

+ gender var (client) +

+
+
+ + See also: + +
+
+ + New proc (client) + +
+ + gender var (atom) + +
+ + key var (client) + +
+ + macros (text) + +
+ + + +
+

+ This is the client's gender, which is an attribute of the player's key. +By default, when a new mob is made for a player (in client.New()), the new +mob gets the same name and gender as the player's key. This influences text +macros like + + \he + + , which may expand to "it", "he", "she", or +"they". Valid values are: +

+ + "neuter" +"male" +"female" +"plural" + +
+ + +

+ glide_size var (client) +

+
+
+ + See also: + +
+
+ + eye var (client) + +
+ + glide_size var (movable atoms) + +
+ +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ Note: The way this setting is used depends on + + world.movement_mode + + . See + + Gliding + + for more details. +

+

+ This controls the number of pixels the map is moved in each step during +scrolling of the map. The default value of 0 chooses automated control over +this value, which generally results in a minimum step of 4 pixels that is +increased when necessary to keep up with motion of the map. +

+

+ Be careful about using small step sizes. Icons with high contrast +pixel-level detail can look pretty ugly when displaced by short distances. +

+

+ This was renamed from + + pixel_step_size + + . +

+
+ + +

+ images var (client) +

+
+
+ + See also: + +
+
+ + image objects + +
+ + image proc + +
+ +
+

+ This is a list of images that are displayed to the user. The output +operator is one way to add entries to this list. Deleting an image object +will automatically remove it from the display, but if you want to retain an +image (so other people can still see it), it can be removed by directly +modifying this list. +

+

+ Example: +

+ + var/image/I = new('image.dmi',usr) +usr.client.images += I //display it +sleep(50) +usr.client.images -= I //remove it from the display + + Displaying the image can also be achieved like this: + + usr &lt;&lt; I + +
+ + +

+ inactivity var (client) +

+
+
+ + See also: + +
+
+ + tick_lag var (world) + +
+
+

+ This is equal to the amount of time (in server ticks, which default to +1/10s) since the player's last action (such as executing a verb, moving, +clicking an object, or selecting a topic link). This value is reset to 0 +after each new action so you can use it to determine the time that has passed +since the last one. +

+

+ Example: +

+ + mob/verb/inactivity() + usr &lt;&lt; "You have been inactive for [client.inactivity/10] seconds." + +
+ + +

+ key var (client) +

+
+
+ + See also: + +
+
+ + key var (mob) + +
+
+
+
+ + Default value: + +
+
+ The player's key identity. +
+
+

+ This is a read-only value that contains the player's key. Once the +player is attached to a mob M, M.key == M.client.key. +

+
+ + +

+ lazy_eye var (client) +

+
+
+ + See also: + +
+
+ + view var (client) + +
+ + view var (world) + +
+ +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This is the maximum "lag" between client.eye and client.mob. The mob can +stray up to this many tiles before the eye will move to keep it in view. The +default value of 0 means that the eye always moves as the mob moves, keeping +the mob at the center of the player's map. +

+

+ Setting this value to a non-zero value automatically initializes client.eye +to client.mob.loc (or to the center of the full map if that is possible). +Thereafter, client.eye will stray from the mob as it moves about the map, +making one big jump to catch up whenever the mob gets out of range. +

+

+ Example: +

+ + client + lazy_eye = 5 + +

+ This setting allows client.mob to move onto the entire 11x11 visible +region without changing the value of client.eye. The moment it steps out of +this region, the entire region will shift 5 tiles in the direction of motion. +

+

+ You can assign lazy_eye to any value valid as a view size, so, for example, +if you have a non-square setting for client.view, say, "17x11", you could +apply a similar setting to lazy_eye. You can even make one dimension lazy and +the other one strictly centered: "0x5". +

+
+ + +

+ mob var (client) +

+
+
+ + Default value: + +
+
+ Determined in client.New(), by default world.mob. +
+
+

+ This is the mob to which the client is connected. The client and its +connected mob have the following symmetry: +

+ + client == mob.client +client.mob == mob +client.key == mob.key + +
+
+ +

+ mouse_pointer_icon var (client) +

+
+
+ + See also: + +
+
+ + Click proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseUp proc (client) + +
+ + mouse_drag_pointer var (atom) + +
+ + mouse_drag_pointer var (atom) + +
+ + mouse_drop_zone var (atom) + +
+ + mouse_over_pointer var (atom) + +
+ + + + + + + + +
+
+
+ + Default value: + +
+
+ null +
+
+

+ This is an icon file (.dmi) containing custom mouse cursors to use in place +of the standard ones. The different possible mouse states are distinguished +by special icon state names: +

+
+
+ "" +
+
+ Activated when over empty space or an object with mouse_over_pointer = MOUSE_INACTIVE_POINTER. +
+
+ "over" +
+
+ Activated when over an object with mouse_over_pointer = MOUSE_ACTIVE_POINTER. +
+
+ "drag" +
+
+ Activated when dragging an object with mouse_drag_pointer = MOUSE_ACTIVE_POINTER. +
+
+ "drop" +
+
+ Activated when dragging an object over with mouse_drop_pointer = MOUSE_ACTIVE_POINTER and the object underneath has mouse_drop_zone set. +
+
+ "all" +
+
+ Always activated, no matter what the state of the mouse. +
+
+
+ + +

+ perspective var (client) +

+
+
+ + See also: + +
+
+ + eye var (client) + +
+ + mob var (client) + +
+ +
+
+
+ + Default value: + +
+
+ MOB_PERSPECTIVE +
+
+
+
+ + Possible values: + +
+
+
    +
  • + MOB_PERSPECTIVE +
  • +
  • + EYE_PERSPECTIVE +
  • +
  • + EDGE_PERSPECTIVE +
  • +
+
+
+

+ This controls the eye's apparent center and what can be seen by the client. +

+

+ EYE_PERSPECTIVE determines how visibility calculations are performed when + + client.eye + + and + + client.mob + + are different. Normally, +visibility is done from the position of the mob, rather than from the eye +(which is actually just the center of the map view). The alternative flag is +MOB_PERSPECTIVE, the default. +

+

+ EDGE_PERSPECTIVE limits scrolling to the bounds of the map (1,1 to +world.maxx,world.maxy), and does not keep the mob centered if it strays near +the edge. +

+

+ The above values can be used together via the | operator. +

+
+ + +

+ pixel_x var (client) +

+
+
+ + See also: + +
+
+ + glide_size var (client) + +
+ + pixel_y var (client) + +
+ + pixel_w var (client) + +
+ + pixel_z var (client) + +
+ + + +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This displaces the player's viewpoint on the x-axis by the specified number of +pixels. Can be animated with the animate() proc. +

+
+ + +

+ pixel_y var (client) +

+
+
+ + See also: + +
+
+ + glide_size var (client) + +
+ + pixel_x var (client) + +
+ + pixel_w var (client) + +
+ + pixel_z var (client) + +
+ + + +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This displaces the player's viewpoint on the y-axis by the specified number of +pixels. Can be animated with the animate() proc. +

+
+ + +

+ pixel_w var (client) +

+
+
+ + See also: + +
+
+ + glide_size var (client) + +
+ + pixel_x var (client) + +
+ + pixel_y var (client) + +
+ + pixel_z var (client) + +
+ + map_format var (world) + +
+ + + + +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This displaces the player's viewpoint horizontally by the specified number +of pixels. This value is meant to be used when world.map_format is not set to +a default top-down view. Can be animated with the animate() proc. +

+
+ + +

+ pixel_z var (client) +

+
+
+ + See also: + +
+
+ + glide_size var (client) + +
+ + pixel_x var (client) + +
+ + pixel_y var (client) + +
+ + pixel_w var (client) + +
+ + map_format var (world) + +
+ + + + +
+
+
+ + Default value: + +
+
+ 0 +
+
+

+ This displaces the player's viewpoint vertically by the specified number of +pixels. This value is meant to be used when world.map_format is not set to a +default top-down view. Can be animated with the animate() proc. +

+
+ + +

+ pixel_step_size var (client) +

+

+ Renamed to + + glide_size + + . +

+
+ + +

+ preload_rsc var (client) +

+
+
+ + Default value: + +
+
+ 1. +
+
+

+ This variable controls whether resource files (icons and sounds) are +automatically downloaded by Dream Seeker when first connecting, or whether +they should be downloaded as needed. Resource files are cached (in +byond.rsc) for future use, so this should only affect people who have not +played the game before or who have not played it for some time. +

+

+ The three possible settings are: +

+
+
+ 0 +
+
+ do not preload any resources +
+
+ 1 +
+
+ preload compiled-in resources only +
+
+ 2 +
+
+ preload all resources including those uploaded by players +
+
+ URL +
+
+ preload resources from specified file +
+
+

+ Preloading resource files will eliminate delays later on, but may cause +a very long initial delay when logging in. +

+

+ Resources may also be distributed from a website to save bandwidth on the +machine hosting the game. Simply zip up the .rsc file, upload it to a web +site, and put the URL here. +

+

+ Example: +

+ + client/preload_rsc = "http://dan.byond.com/mygame_rsc.zip" + +

+ Instead of putting the .rsc file in the .zip, you can also put the +individual resource files there. This would allow you to select specific +files that you would like to be preloaded. For example, you could create a +different resource package for different parts of the game world and assign +client.preload_rsc dynamically as the player moves into each different area. +

+

+ Once Dream Seeker has downloaded a resource package, it caches it and will +not download it again, even if you upload a new version of the file. This +allows you to make small changes without forcing a complete refresh. Any +files which are not found in the preload package are simply downloaded from +the game server directly. +

+

+ If you want to force a complete refresh, simply change the name of the +resource package. For example, you could put a version number in the name of +the file: + + mygame_rsc_01.zip + + , + + mygame_rsc_02.zip + + , and so on. +

+
+
+ +

+ screen var (client) +

+
+
+ + See also: + +
+
+ + HUD / screen objects + +
+ + screen_loc var (movable atoms) + +
+ +
+

+ This is a list of objects that are displayed on the user's screen. The +object's screen_loc variable controls where it appears (if it appears at all). +This allows one to create the elements of a graphical user interface, with +such features as buttons, drag/drop areas, and stat monitors. +

+

+ Screen objects (visible or otherwise) may also be used to make verbs +available to users. To make them accessible, define verbs on the screen +object like this: +

+ + set src in usr.client.screen + +
+ + +

+ script var (client) +

+
+
+ + See also: + +
+
+ + #include directive + +
+ + PASSWORD_TRIGGER (client script) + +
+ + URL (client script) + +
+ + aliases (client script) + +
+ + browser configuration + +
+ + command_text (client) + +
+ + macros (client script) + +
+ + macros (skin) + +
+ + style sheets + +
+ + style sheets (in scripts) + +
+ + + + + + + + + +
+
+
+ + Default value: + +
+
+ none +
+
+

+ Client scripts are mini-programs used to configure the client. The +language they use is called DM Script, and will undoubtedly expand in the +future. Currently, client scripts can be used to define style sheets, +command aliases, and macros. When executed directly by a player, they can +also be used to specify an initial URL to open and a password trigger (for +some ancient telnet worlds that don't suppress password echo). +

+

+ For the specific syntax of DM Script, see the relevant reference sections +listed above. +

+

+ The + + client.script + + variable may be assigned to script code in +a text string (double quotes) or in a file (single quotes). You can also +simply include the file in your project or explicitly use the + + #include + + statement. Files containing DM Script should have the +extension + + .dms + + . +

+

+

+

+ Example: +

+ + client/script = " + <style> + BODY {font: monospace} + </style> + " + +

+ This example selects a default monospace font for all output to the +terminal. +

+

+ In addition to scripts loaded via + + client.script + + , the player +may have + + client-side + + scripts. These are either called + + connection + + scripts or + + post-connection + + scripts depending on +whether they are used to automatically connect to a world or whether they +are executed automatically after connecting to a world. In either case, the +player's scripts are always executed before the designer's + + client.script + + script, so style sheets from the designer have +higher precedence by default. +

+

+ There are three post-connection client-side scripts for the three types +of worlds the client can connect to: + + byond.dms + + , + + telnet.dms + + , and + + irc.dms + + . These are automatically +executed if the player connects directly to a world without using a +connection script to do so. The intention is to load any standard +configurations such as style sheets and command aliases. +

+
+ + +

+ PASSWORD_TRIGGER (client script) +

+
+
+ + Format: + +
+
+ #define PASSWORD_TRIGGER "assword:" +
+
+

+ This defines a special text + + trigger + + used to detect when the user +is being prompted for a password in telnet mode. Most MUDs automatically +suppress password echo, but if they do not, it is necessary to use this +setting to hide it. Multiple triggers may be defined as necessary. +

+

+ The example above is more robust than the more polite version because it +works whether they capitalize the 'P' or not... +

+
+
+ +

+ URL (client script) +

+
+
+ + Format: + +
+
+ #define URL "byond://byond.com:6000" +
+
+

+ Defining a URL in a script, specifies the world to connect to when the +script is executed by the player. This is referred to as a connection +script, because the player uses it to connect to a world. Other +post-connection scripts such as + + byond.dms + + or a script loaded +through + + client.script + + are only used to configure the client +after it has connected to a world. In those cases, the URL setting has no +effect. +

+

+ It is important to enclose the URL in double quotes. Otherwise, the + + // + + symbol would be mistaken for a comment. +

+
+
+ +

+ browser configuration +

+
+
+ + See also: + +
+
+ + URL (client script) + +
+
+

+ DM Script can be used to effectively make a hyperlink in a web document +to a BYOND world. This is done by making a DM Script file that defines the +desired URL. It need do nothing more than that. When a user clicks on the +link in a web browser, DreamSeeker will pop up, execute the script, and +connect to the specified URL. +

+

+ Some browsers may need to be configured to know what to do with a DM +Script file. For example, in Netscape, you can add an entry to the list of +helper applications. You should add a MIME type called +' + + application/x-dms + + ' with the description 'DM Script' and the +extension + + dms + + . Have this execute DreamSeeker with the + + .dms + + file as an argument. +

+

+ Example: +

+

+ myworld.dms +

+ + /*If your browser shows you this, you either need + to install BYOND (it's free!) from www.byond.com, + or you need to configure your browser to execute + DreamSeeker with DM Script (.dms) files. +*/ +#define URL "byond://myworld" + +

+ myworld.html +

+ + <title> + Welcome to My World + </title> + <p> + You can connect to my world + <a href="myworld.dms"> + here + </a> + . + </p> + +
+ + +

+ aliases (client script) +

+
+
+ + See also: + +
+
+ + macros (client script) + +
+ + script var (client) + +
+ + verbs + +
+ + +
+

+ Command aliases have a syntax similar to verbs. They define a command +and a series of arguments which can then be used to execute a new command. +The most common use for this is in a telnet world like a MUD. By defining +aliases corresponding to the MUD commands, the player can have primitive +command expansion and help. +

+

+ The syntax of an alias definition is best illustrated by the following +example: +

+ + alias/say(msg as text) + set desc = "speak your mind" + return "say [msg]" + +

+ As you can see, it is just like a verb. Alias have all the same +properties as verbs, except the + + src + + setting is always equal to +the player. +

+

+ The value returned by an alias is executed as a command. In telnet mode, +the command to execute is often simply the same as the command that was +entered (since the alias was only defined to provide command expansion and +help). Since that is such a common case, the return value defaults to the +alias name followed by each of the arguments. The example above, for +instance, would have the same effect without an explicit return statement. +

+

+ Note that commands executed via an alias are never interpreted as +aliases. Otherwise, examples such as the one above would result in an +infinite loop. +

+
+ + +

+ macros (client script) +

+
+
+ + See also: + +
+
+ + macros (skin) + +
+ + aliases (client script) + +
+ + command_text (client) + +
+ + script var (client) + +
+ + verbs + +
+ + + + +
+

+ Macros are just like aliases, except that they are triggered by a single +key (or combination of keys) instead of a full command. When a macro is +executed, it returns a text string which is then executed as a command. So +a macro is just a short-cut for entering a command. +

+

+ The following example illustrates the syntax for entering a typical set +of macros. +

+

+ Example; +

+ + macro + ALT+I return "inventory" + ALT+SHIFT+I return "inventory\nequipment" //multiple commands + ALT+s return "say \..." //command to be edited + +

+ Note: In old versions of BYOND, character keys required +the Alt key to be pressed to trigger the macro, and did not include + + "ALT+" + + to do so. This behavior has changed, and the name of the macro +is just like the format used in skin files. You can now use a key name, and +modifiers like + + SHIFT+ + + , + + CTRL+ + + , + + ALT+ + + , + + +REP + + , +and + + +UP + + . Old .dms and + + client.script + + files (prior to +version 507) should be updated accordingly when recompiling in a newer +version. +

+
+ + +

+ style sheets (in scripts) +

+
+
+ + See also: + +
+
+ + script var (client) + +
+ + style sheets + +
+ +
+

+ Style sheets may be included in DM Script by putting the style sheet +inside the HTML tags + + <STYLE> + + and + + </STYLE> + + . In general, any text enclosed in start +and end tags will be sent to the player's terminal, so you could use + + client.script + + to output a welcome message as well as loading a +style sheet. +

+

+

+

+ Example: +

+ + client/script = " + <style> + BODY {background: black; color: aqua} + </style> + " + +

+ This example style sheet makes the player's terminal have a black +background and aqua colored text. When changing the background color, it is +important to change the color of system and link text as well. See the +section on + + style sheets + + for an example. +

+
+ + +

+ show_map var (client) +

+
+
+ + See also: + +
+
+ + show_verb_panel var (client) + +
+ + view var (client) + +
+ + view var (world) + +
+ + +
+
+
+ + Default value: + +
+
+ 1 +
+
+

+ This variable may be used to turn off the view of the map in Dream Seeker. +This could be useful for making text MUDs where the rooms are turfs (ie most +rooms can be laid out on a grid but you don't want the user interface to show +the map in any way). +

+

+ The following example shows one useful combination of settings. Note that +setting + + world.view=-1 + + also disables the map, but it also sets +the default value of the + + view() + + depth in such a way as to always +return an empty list. +

+

+ Example: +

+ + client + show_map = 0 //Text is best! +world + view = 0 //You can interact only with objects in same turf. +mob + density = 0 //Allow multiple mobs in a room. + +
+ + +

+ show_popup_menus var (client) +

+
+
+ + See also: + +
+
+ + right-click parameter (skin) + +
+ + Click proc (client) + +
+ + DblClick proc (client) + +
+ + MouseDown proc (client) + +
+ + MouseDrag proc (client) + +
+ + MouseDrop proc (client) + +
+ + MouseEntered proc (client) + +
+ + MouseExited proc (client) + +
+ + MouseMove proc (client) + +
+ + MouseUp proc (client) + +
+ + + + + + + + + +
+
+
+ + Default value: + +
+
+ 1 +
+
+

+ This variable may be used to turn off the popup "context" menus that are displayed by default when +an object on the map or stat panels is right-clicked. If client.show_popup_menus==0, then right-clicks +will instead be passed to the various mouse functions. +

+
+ + +

+ show_verb_panel var (client) +

+
+
+ + See also: + +
+
+ + category setting (verb) + +
+ + default_verb_category var (client) + +
+ + show_map var (client) + +
+ + +
+
+
+ + Default value: + +
+
+ 1 +
+
+

+ Setting this to 0 turns off the verb panel in Dream Seeker. You might +want to do that, for instance, if you've only got one verb (like "say") and +the panel looks stupid with just one verb in it. +

+

+ Example: +

+ + client + show_verb_panel = 0 + +
+ + +

+ statobj var (client) +

+
+
+ + See also: + +
+
+ + Stat proc (client) + +
+ + stat proc + +
+ + statpanel proc + +
+ + statpanel var (client) + +
+ + Info control (skin) + +
+ + + + +
+
+
+ + Default value: + +
+
+ client.mob (the player's mob). +
+
+

+ This value indicates which object the player currently has loaded in the +stat panels. +

+
+ + +

+ statpanel var (client) +

+
+
+ + See also: + +
+
+ + Stat proc (client) + +
+ + stat proc + +
+ + statobj var (client) + +
+ + statpanel proc + +
+ + Info control (skin) + +
+ + + + +
+
+
+ + Default value: + +
+
+ null +
+
+

+ This value indicates which stat panel is currently visible to the player. +You can assign it to force a different panel to become the top panel. The +special value "verbs" activates the panel of commands. +

+
+ + +

+ tick_lag var (client) +

+
+
+ + See also: + +
+
+ + tick_lag var (world) + +
+ + fps var (client) + +
+ + Pixel movement + +
+ + +
+
+
+ + Default value: + +
+
+ 0 (uses world.tick_lag value) +
+
+

+ This is a client version of world.tick_lag, so that the client can run at +a faster speed for animations. For example, setting client.tick_lag to 0.25 +while world.tick_lag is the default 1 will mean that all animations and +glides are smoothed out and displayed at 40 FPS, even though the server still +runs at 10 FPS. The result is a nicer-looking game with no additional impact +on the server. +

+

+ When this value is 0, the client and server tick at the same rate. +

+
+ + +

+ timezone var (client) +

+
+
+ + See also: + +
+
+ + realtime var (world) + +
+ + timeofday var (world) + +
+ + timezone var (world) + +
+ + time2text proc + +
+ + + +
+

+ This is the time offset from UTC, in hours, for the client's time zone. It +can be used in the + + time2text() + + proc. +

+
+ + +

+ verbs list var (client) +

+
+
+ + See also: + +
+
+ + list + +
+
+
+
+ + Default value: + +
+
+ The list of verbs defined for the client. +
+
+

+ This is a list of the client's verbs. Initially, it contains all of the +verbs defined for the client. It may be used to add and remove verbs at +runtime. +

+
+ + +

+ view var (client) +

+
+
+ + See also: + +
+
+ + lazy_eye var (client) + +
+ + show_map var (client) + +
+ + view proc + +
+ + view var (world) + +
+ + + +
+
+
+ + Default value: + +
+
+ world.view (which is 5 by default) +
+
+
+
+ + Possible values: + +
+
+ -1 to 34 or "WIDTHxHEIGHT" +
+
+

+ This controls the size of the map window in Dream Seeker. Normally, you +would simply compile with world/view assigned to whatever you want, but in +some cases, you might want to customize the map size for different players, +such as admins or subscribed users. +

+

+ Like all other view sizes in DM, this may either be a + + view depth + + or an absolute size. A view depth is a single number that determines how far +from a center point the edges of a square viewable region extend. A value of +5 creates edges which are 2*5+1 = 11 tiles long. +

+

+ The newer, more flexible syntax is a text string of the form +"WIDTHxHEIGHT". For example, a view depth of 5 corresponds to "11x11". Using +this syntax, you can create non-square views as well. +

+

+ The maximum view size is about 5000 tiles, or roughly 70x70. +

+
+ + +

+ virtual_eye var (client) +

+
+
+ + See also: + +
+
+ + edge_limit var (client) + +
+ + eye var (client) + +
+ + lazy_eye var (client) + +
+ + mob var (client) + +
+ + perspective var (client) + +
+ + view var (client) + +
+ + + + + +
+
+
+ + Default value: + +
+
+ client.eye +
+
+

+ This value determines the actual center of the player's map display. It is +based on + + client.eye + + and whenever possible matches it; however it +may instead be a turf, or null, when the eye is off-center. +

+

+ The value of + + virtual_eye + + is read-only. +

+
+ +
\ No newline at end of file diff --git a/tests/test_encode_link.py b/tests/test_encode_link.py new file mode 100644 index 00000000..c37a6e14 --- /dev/null +++ b/tests/test_encode_link.py @@ -0,0 +1,66 @@ +''' +Series of tests ran on the ref_splitter's encode_link() function +''' + +import pytest +from ref_splitter.ref_splitter import RefSplitter +from bs4 import Tag + +@pytest.mark.unit +def test_encode_link() -> None: + '''confirms that refsplitter can create correct links''' + mock_html = 'mouse handling' + splitter = RefSplitter(mock_html) + mock_a_tag: Tag | None = splitter.soup.find('a') + + # couple quick tests to make sure bs4 is working + assert mock_a_tag is not None + assert mock_a_tag.name == "a" + + splitter.encode_link(mock_a_tag) + + assert len(splitter.links) == 1 + assert '/DM/mouse' in splitter.links + assert splitter.links['/DM/mouse'] == "mouse handling" + +@pytest.mark.unit +def test_encode_link_none_input(): + '''confirms that we get an error when the tag is passed as None''' + splitter = RefSplitter("") + + with pytest.raises(TypeError, match="a Tag is 'None'"): + splitter.encode_link(None) + +@pytest.mark.unit +def test_encode_link_invalid_tag(): + '''confirms that we raise a value error when we pass in a non tag''' + splitter = RefSplitter('
Not an A tag
') + invalid_tag = splitter.soup.div + + with pytest.raises(RuntimeError, match="Trying to encode an invalid tag"): + splitter.encode_link(invalid_tag) + +@pytest.mark.unit +def test_encode_link_missing_href(): + '''confirms that we get an error when the href attribute is missing''' + splitter = RefSplitter('
No Href') + missing_href_tag = splitter.soup.a + + # Verifies it raises ValueError when href attribute is missing + with pytest.raises(ValueError, match="a Tag does not have href attribute"): + splitter.encode_link(missing_href_tag) + +@pytest.mark.unit +@pytest.mark.parametrize("html_input", [ + 'Empty Path', + 'Empty Path', + 'Empty Path' +]) +def test_encode_link_empty_paths(html_input: str): + '''confirms that we get a value error when the path is only a 1 character long''' + splitter = RefSplitter(html_input) + target_tag = splitter.soup.a + + # Verifies it raises ValueError when path is just "#" (becomes empty string) + with pytest.raises(ValueError, match="Empty link path"): + splitter.encode_link(target_tag) diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py new file mode 100644 index 00000000..6bd6775f --- /dev/null +++ b/tests/test_end_to_end.py @@ -0,0 +1,33 @@ + +import pytest +from ref_splitter.ref_splitter import RefSplitter +from ref_splitter.ref_tree import RefTree +from ref_splitter.export import ExportMD + +@pytest.mark.e2e +def test_export_file_structure(tmp_path, client_sample_path): + # runs happypath test + with open(client_sample_path, 'r', encoding='utf-8') as f: + content = f.read() + + ref_splitter = RefSplitter(content) + ref_splitter.prep_pages() + ref_splitter.build_ref_entries() + + ref_tree = RefTree() + ref_tree.build_tree_from_entries(ref_splitter.entries, ref_splitter.links) + + export = ExportMD(tmp_path) + export.format_tree(ref_tree) + export.export_pages() + + expected_dir = export.export_root / "ref" / "client" + index_file = expected_dir / "index.md" + + assert expected_dir.is_dir() + assert index_file.exists() + assert not (tmp_path / "some_node_folder.md").exists() + + #technically unecessary, but confirms that this functions at the correct time + export.clear_export_dir() + assert not export.export_root.exists(), "export temp folder was not cleaned up!" diff --git a/tests/test_export.py b/tests/test_export.py new file mode 100644 index 00000000..c6342698 --- /dev/null +++ b/tests/test_export.py @@ -0,0 +1,113 @@ +''' +Tests the markdown export script +''' +import pytest +from pathlib import Path, PurePosixPath +from unittest.mock import patch +from ref_splitter.export import ExportMD, MDFlavour, MDPage +from ref_splitter.token_table import INLINE_TOKEN_TABLE, P_CLASS_TOKEN_TABLE + +@pytest.fixture(scope="module") +def export_instance(): + '''module scoped export md instance''' + return ExportMD("_tmp_test") + +MOCK_TOKEN_TABLE: list[dict] = [ + {"TOKEN" : "BOLD", "md" : "**"}, + {"TOKEN" : "CODE", "md" : "`"}, + {"TOKEN" : "ITALIC", "md" : "*"} + # Any invalid data here will be flagged in the following test, aborting the suite. + ] + +@pytest.mark.unit +def test_mock_token_table_is_correct_subset_of_inline_token_table(): + '''Ensures mock rows exist exactly as defined in the inline table''' + inline_lookup = {} + for row in INLINE_TOKEN_TABLE: + inline_lookup[row["TOKEN"]] = row["md"] + + for mock_row in MOCK_TOKEN_TABLE: + for key in mock_row: + if key not in ["TOKEN", "md"]: + pytest.exit(f'Aborting suite: Unexpected key "{key}" in MOCK_TOKEN_TABLE row: {mock_row}', returncode=1) + token = mock_row["TOKEN"] + if token not in inline_lookup: + pytest.exit(f'Aborting suite: {token} is not present in source token table', returncode=1) + if mock_row["md"] != inline_lookup[token]: + pytest.exit(f'Aborting suite: MOCK_TOKEN_TABLE does not match source token table. ({mock_row["md"]} != {inline_lookup[token]})', returncode=1) + +@pytest.mark.unit +def test_format_string_list(export_instance) -> None: + '''ensures format_string_list formats a string list correctly''' + data: list[str] = [ + "test1", + "test2" + ] + expected = "\n**TEST:**\n+ test1\n+ test2\n" + assert export_instance.format_string_list(data, "TEST") == expected + +@pytest.mark.unit +@pytest.mark.parametrize("flavour", list(MDFlavour)) +def test_string_seasoning(flavour: MDFlavour, export_instance) -> None: + data = "\ntest1\ntest2\ntest3" + expected = f'\n> [!{flavour.value}]\n> test1\n> test2\n> test3' + assert export_instance.season_string(data, flavour) == expected + +@pytest.mark.unit +@pytest.mark.parametrize("row", MOCK_TOKEN_TABLE) +def test_format_tokens(row, export_instance) -> None: + '''ensures that format_tokens() properly replaces + tokens with their md counterparts in the MOCK_TOKEN_TABLE''' + data: str = f'[{row["TOKEN"]}]test[/{row["TOKEN"]}]' + expected: str = f'{row["md"]}test{row["md"]}' + + assert export_instance.format_tokens(data) == expected + +@pytest.mark.unit +@pytest.mark.parametrize("row", MOCK_TOKEN_TABLE) +def test_format_tokens_removing_whitespace(row, export_instance) -> None: + '''ensures that format_tokens() properly removes whitespace inside the token''' + data: str = f'[{row["TOKEN"]}] test [/{row["TOKEN"]}]' + expected: str = f'{row["md"]}test{row["md"]}' + + assert export_instance.format_tokens(data) == expected + +@pytest.mark.integration +@pytest.mark.parametrize("row", INLINE_TOKEN_TABLE) +def test_format_inline_tokens(row, export_instance) -> None: + '''ensures the INLINE_TOKEN_TABLE is not malformed + and it can be reformatted correctly''' + data: str = f'[{row["TOKEN"]}] test [/{row["TOKEN"]}]' + expected: str = f'{row["md"]}test{row["md"]}' + + assert export_instance.format_tokens(data) == expected + +@pytest.mark.unit +def test_format_codeblock(export_instance) -> None: + '''ensures codeblocks are formatted correctly''' + data: str = "[CODEBLOCK]proc/foo() {bar}[/CODEBLOCK]\n[CODEBLOCK]proc/foo()\n\tbar[/CODEBLOCK]" + expected: str = "\n```dm\nproc/foo() {bar}\n```\n\n\n```dm\nproc/foo()\n\tbar\n```\n" + + assert export_instance.format_codeblocks(data) == expected + +@pytest.mark.unit +def test_format_links(export_instance) -> None: + '''ensures links are paarsed to the correct markdown format''' + test_dict = {"/path" : "text"} + data: str = "[LINK]/path[/LINK]" + expected: str = " [text](/ref/path)" + + assert export_instance.format_links(test_dict, data) == expected + +@pytest.mark.unit +def test_export_page_configurable(tmp_path) -> None: + '''ensures exporting a page properly writes a file to disk''' + injector = ExportMD(exp_path=tmp_path) + + page = MDPage("test/page", "test content", False) + injector.export_page(page) + + expected_file = tmp_path / "ref" / "test" / "page.md" + assert expected_file.exists() + assert expected_file.read_text(encoding="utf-8") == "test content" + \ No newline at end of file diff --git a/tests/test_sample_ref.py b/tests/test_sample_ref.py new file mode 100644 index 00000000..7bf23d66 --- /dev/null +++ b/tests/test_sample_ref.py @@ -0,0 +1,156 @@ +'''Integration test to ensure that RefSplitter can properly parse a test file''' +import pytest +from bs4 import BeautifulSoup +from ref_splitter.ref_splitter import RefSplitter, RefEntry +from ref_splitter.token_table import INLINE_TOKEN_TABLE, P_CLASS_TOKEN_TABLE + +@pytest.mark.unit +@pytest.mark.dependency(name="desc_list") +def test_desc_list_parsing(splitter) -> None: + '''confirms that desc_lists is populating correctly''' + + # DM Ref only ever has one term per list, so there's no need to parse more than one. + # this would need to be changed when the standard for the html ref is modernized + sample: str = ''' +
+
+
term1
+
1
+
2
+
3
+
4
+
5
+
+
+ ''' + soup = BeautifulSoup(sample, "lxml") + tag = soup.find('div') + + desc_lists = splitter.format_description_lists(tag) + + assert isinstance(desc_lists, dict) + assert len(desc_lists) == 1, f'desc_lists size is incorrect. expected 1, got {len(desc_lists)}\ndesc_lists = {desc_lists}' + + assert isinstance(desc_lists["term1"], list) + assert len(desc_lists["term1"]) == 5 + +@pytest.mark.integration +@pytest.mark.dependency(depends=["desc_list"]) +@pytest.mark.parametrize("input_field", [ + field + for field in RefSplitter.field_mapping +]) +def test_common_field_parsing(splitter, input_field) -> None: + '''ensures that the description lists are parsed into common fields properly''' + soup = BeautifulSoup(f'
{input_field}
test
', "lxml") + tag = soup.find('div') + + desc_lists = splitter.format_description_lists(tag) + entry: RefEntry = RefEntry("/test", 0) + splitter.set_common_fields(entry, desc_lists) + + attr_name = splitter.field_mapping[input_field] + attr_value = getattr(entry, attr_name) + + assert isinstance(attr_value, list) + assert len(attr_value) > 0 + + +@pytest.mark.unit +@pytest.mark.parametrize( + "html_input, expected_output", + [ + ("bold", "[BOLD]bold[/BOLD]"), + ("italic", "[ITALIC]italic[/ITALIC]"), + ("underline", "[UNDERLINE]underline[/UNDERLINE]"), + ("typetext", "[CODE]typetext[/CODE]"), + ("var", "[CODE]var[/CODE]"), + ("
term
", "[DESC_TERM]term[/DESC_TERM]"), + ("
detail
", "[DESC_DETAIL]detail[/DESC_DETAIL]") + ], +) +def test_inline_tag_tokenization(splitter, html_input, expected_output) -> None: + '''ensures that inline tokens are generated correctly''' + assert splitter.tokenize(html_input) == expected_output + +@pytest.mark.integration +def test_page_parsing(splitter) -> None: + '''ensures that a page parses correctly, including tokenization and code formatting''' + sample_text = ''' +
+

+ This is bold and code. +

+ + proc/foo() + return bar() + +

+ Another paragraph element here. +

+
+ ''' + expected = [ + "This is [BOLD]bold[/BOLD] and [CODE]code[/CODE].", + "[CODEBLOCK]\n proc/foo()\n return bar()\n [/CODEBLOCK]", + "Another paragraph element here." + ] + soup = BeautifulSoup(sample_text, "lxml") + tag = soup.find('div') + + result = splitter.extract_content(tag) + + assert result == expected + +@pytest.mark.unit +@pytest.mark.parametrize("bad_input", [ + '

no close', + 'no open

', + 'p>malformed None: + ''' + ensures page parsing will throw an exception when + it encounters a non-existant or malformed tag + ''' + + with pytest.raises(ValueError): + splitter.clean_paragraph(bad_input) + +@pytest.mark.unit +def test_inline_token_table_values() -> None: + ''' + Ensures structural values inside the token table are + clean, not empty, and don't have formatting artifacts + ''' + for row in INLINE_TOKEN_TABLE: + html = row["html"] + token = row["TOKEN"] + markdown = row["md"] + + assert html.strip(), "Found an empty 'html' tag configuration" + assert token.strip(), f"Found an empty token configuration for tag '{html}'" + assert markdown.strip(), f"Found an empty token configuration for tag '{html}'" + + assert "<" not in html and ">" not in html, f"Remove bracket symbols from html configuration key: '{html}'" + assert "[" not in token and "]" not in token, f"Remove bracket symbols from TOKEN configuration value: '{token}'" + assert "[" not in markdown and "]" not in markdown, f"Remove bracket symbols from TOKEN configuration value: '{markdown}'" + +@pytest.mark.unit +def test_pclass_token_table_values() -> None: + ''' + Ensures structural values inside the token table are + clean, not empty, and don't have formatting artifacts + ''' + for row in P_CLASS_TOKEN_TABLE: + token = row["TOKEN"] + html = row["html"] + markdown = row["md"] + + assert html.strip(), "Found an empty 'html' tag configuration" + assert token.strip(), f"Found an empty token configuration for tag '{html}'" + assert markdown.strip(), f"Found an empty token configuration for tag '{html}'" + + assert "<" not in html and ">" not in html, f"Remove bracket symbols from html configuration key: '{html}'" + assert "[" not in token and "]" not in token, f"Remove bracket symbols from TOKEN configuration value: '{token}'" + assert "[" not in markdown and "]" not in markdown, f"Remove bracket symbols from TOKEN configuration value: '{markdown}'" \ No newline at end of file diff --git a/tests/test_unit.py b/tests/test_unit.py new file mode 100644 index 00000000..59672b0e --- /dev/null +++ b/tests/test_unit.py @@ -0,0 +1,27 @@ +'''Unit Test suite for open_dm_ref_splitter''' + +import re +import pytest +from ref_splitter.dm_ref import DMRef + +@pytest.mark.unit +def test_byond_remote_url() -> None: + '''ensures that DMRef is checking the correct url''' + ref: DMRef = DMRef() + assert ref.dm_ref_url == "https://www.byond.com/docs/ref/info.html" + print("BYOND reference URL is correct") + +@pytest.mark.unit +@pytest.mark.parametrize("timeout", [10.1, 11, 15]) +def test_timeout_safeguard_failing_bounds(timeout: int) -> None: + '''Ensures values strictly greater than 10 seconds raise a ValueError.''' + safe_regex: str = re.escape(DMRef.timeout_error_message) + with pytest.raises(ValueError, match=safe_regex): + DMRef(timeout_seconds=timeout) + +@pytest.mark.unit +@pytest.mark.parametrize("timeout", [0, 5, 10]) +def test_timeout_safeguard_passing_bounds(timeout: int) -> None: + '''Ensures values less than or equal to 10 seconds pass successfully.''' + ref = DMRef(timeout_seconds=timeout) + assert ref.timeout_seconds == timeout diff --git a/tests/test_webscrape.py b/tests/test_webscrape.py new file mode 100644 index 00000000..5cfe4572 --- /dev/null +++ b/tests/test_webscrape.py @@ -0,0 +1,21 @@ +""" +Network related tests +currently only checks if the BYOND reference can be accessed +""" + +import pytest +from ref_splitter.dm_ref import DMRef +import os + +@pytest.mark.network +@pytest.mark.skipif( + os.getenv("GITHUB_ACTIONS") == "true", + reason="Skipping network test on GitHub runner to avoid 403 blocks" +) +def test_fetch_ref_from_byond_server() -> None: + """creates a DMRef object and attempts to download the reference from BYOND remote""" + ref: DMRef = DMRef() + ref.fetch_web_ref() + + assert len(ref.ref_info) > 0 + print(f"reference file is {len(ref.ref_info)} characters long")