ID:2334972
 
(See the best response by Laser50.)
Any way to to execute code on the client side only?
Best response
Not possible.
In response to Laser50
Laser50 wrote:
Not possible.

Client-side commands
Several commands can be executed at runtime that are not verbs, but raw instructions for Dream Seeker.

.winset "[control.param=value;...]" - Sets parameters in response to a menu or button command (or a manually typed command). You can set more than one by separating them with semicolons.
.output control text - Sends output to a control. The text does not need quotes, but backslashes, newlines, and tabs should be escaped with a backslash. The control name can be in browser:script form to send to JavaScript; see output() in the DM Reference for details.
.options - Shows the Options and Messages box.
.reboot - Reboots the world.
.reconnect - Reconnects to the same world.
.host - Opens hosting options box.
.profile - Profiles the running time of procs.
.screenshot - Saves a screenshot of the map.
.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.
.command - Prompts the user to enter a command, which can be one of these commands as well.
.quit - Closes Dream Seeker.

What was that?
In response to Spunky_Girl
Spunky_Girl wrote:
Laser50 wrote:
Not possible.

> Client-side commands
> Several commands can be executed at runtime that are not verbs, but raw instructions for Dream Seeker.
>
> .winset "[control.param=value;...]" - Sets parameters in response to a menu or button command (or a manually typed command). You can set more than one by separating them with semicolons.
> .output control text - Sends output to a control. The text does not need quotes, but backslashes, newlines, and tabs should be escaped with a backslash. The control name can be in browser:script form to send to JavaScript; see output() in the DM Reference for details.
> .options - Shows the Options and Messages box.
> .reboot - Reboots the world.
> .reconnect - Reconnects to the same world.
> .host - Opens hosting options box.
> .profile - Profiles the running time of procs.
> .screenshot - Saves a screenshot of the map.
> .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.
> .command - Prompts the user to enter a command, which can be one of these commands as well.
> .quit - Closes Dream Seeker.
>

What was that?

Those are client side commands. He asked to be able to execute code on the client side.

Not possible.
You can use winset to call those on the client as well as use javascript to call winset commands. This isn't terribly useful besides resizing the client's screen automatically or popping up extra windows to annoy the player.
Javascript. It's very much possible. It's of questionable utility, however, unless you are doing... Things.

DM's subset of JS/HTML/CSS is just whatever IE browser is installed on their machine. Learn Microsoft's non-standard bullshit bastardizations of these markups/scripts and you'll know whether what you want to do will work or not.

Ishuri/Laser50 are only literally wrong. They aren't technically wrong.

Also, .output, .winset, and .winget are now available to the client. You can communicate between server, client, and browser using javascript winset/winget/output foo. Windows are capable of running a javascript function on show/hide/resize, on a tab change, on a button press, and on a keypress. You can also cleverly manipulate .url and use the browser to store information between connections if you are immensely clever.
Thanks guys. That helps heaps.
In response to Ter13
You could probably get away with using TypeScript for IE8+ support helping cover all browsers with minimal specific fixes.