Interfaceby Forum_account |
|
Provides a better way to interact with interface controls than the built-in winset/winget procs. [More] |
To download this library for your Linux/Mac installation, enter this on your command line:
DreamDownload byond://Forum_account.Interface##version=10 Emulator users, in the BYOND pager go to File | Open Location and enter this URL:byond://Forum_account.Interface##version=10 |
Version 2.7 (posted 07-12-2012)
Version 2.5 Posted!
Version 2.4.1 Posted! This is a minor update that adds type checking to JavaScript-to-DM function calls. Previously when calling a DM function from JavaScript all arguments would be text strings (calling src.build(3) from JS would pass "3" to the player's build proc). This now properly handles numbers, strings, and object references (sorry lists, you'll have to wait). html-demo was updated to showcase this new feature. When you click on a link to build it calls src.build(my_turf, 'wood');. The JavaScript code passes a DM object reference to the player's build proc. I also added the List proc for grid controls. This is just a shortcut for displaying a list. About the Library This library started as a way to abstract out the details of calling winset and winget to create a better API but quickly grew. The library also introduces some shortcut functions for dealing with certain controls. For example, here's how you set the contents of a cell in a grid control with and without the library: // without the library this is what you have to do: You can store a reference to the grid control on the mob so you can always easily update their interface. The library grew to include functions to facilitate interaction between JavaScript running in a browser control and the DM program running on the server. The Browser object lets you easily call JavaScript functions and you can even call DM functions from JavaScript! Version 2.2.0 I created a demo that is separate from the library. It uses the library to handle interaction between a jQuery plugin and the DM program. download the demo Added support for calling procs of the owner and global procs from JavaScript. The html-demo example shows how to call procs of the owner. To call a global proc named "myproc" you'd use the JS function world.myproc(). Added better JavaScript-to-DM support. Arguments can now be passed from JS to DM also. There is still some work to do here (all arguments end up as text strings in DM). Future updates will address this (version 2.4.1 fixed this). Also added the Browser.Cache proc to eliminate use of browse_rsc. If you pass only a filename as the argument it will be cached by that name. If you pass an icon and icon state as arguments it will cache a .png image of that icon. For example: // This puts the file icons.mob.png in the client's cache so you can reference it in HTML. Version 2.1 Two demos were added showing how to implement Lesson 2 and Lesson 4 of Lummox's skin tutorials. Some features were added to accommodate these new demos: • The Grid.Cell(x,y,value) proc was added to handle the details of setting the value of a single cell. • The Output.Output proc was added to handle outputting text. It takes two parameters. One is the text to output, the other is who you want to output to (src, world, view, etc.). If the target is omitted it defaults to the control's owner. • Support for the Child type of control was added. Version 2.0 Version 2 adds some neat features for browser controls. To output HTML to a browser control you can do this: var/Browser/browser = new("window1","browser",src) With that Browser object you can also call JavaScript functions:
browser.JavaScript("update_loc", loc)
This example calls the "update_loc" JavaScript function and passes it your location as a parameter. The library encodes the DM object as a JavaScript object so you can reference your location's properties in JavaScript just like in DM. You can even call DM procs from JavaScript! // In JavaScript: Old Notes This library provides a layer of abstraction between you and the awful winset/winget procs. Instead of commands like this: winset(player, "window1.label1", "text=Hello+world!") You can do this: window1.label1.Text("Hello world!") These procs handle the details of generating and parsing the parameter strings that winset/winget use. They also create objects to represent data when appropriate (for colors, positions, sizes, and lists). The library does make some sacrifices. To speed things up it caches the values of certain properties. If you use a client-side command to update a property the server won't know about it and won't request the new value. Because client-side commands are ugly to deal with, I've sacrificed them to create a decent interface API. |
Please support BYOND through Membership or a donation!
|
Related Libraries
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
More Libraries by Forum_account
|
Copyright © 2024 BYOND Software.
All rights reserved.