[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

MUSHclient scripting

Description of MUSHclient world function: world.WindowSetPixel


Name WindowSetPixel
Type Method
Summary Sets a single pixel in a miniwindow to the specified colour
Prototype long WindowSetPixel(BSTR WindowName, long x, long y, long Colour);
Description

Sets a single pixel in the miniwindow.

Note that changes to miniwindows will not become visible until the output window is redrawn. This happens when new (visible) lines arrive from the MUD, or if you call WindowShow, or Redraw.

Parameters:

WindowName - the name of an existing miniwindow.

x, y - the location of the pixel (x is horizontal, y is vertical)

Colour - the colour to set the pixel to. Note that the pixel which appears in the window may not necessarily be the exact one you chose, depending on the colour depth of your monitor. For example, for 16-bit colour depth, only 5 bits are used for each of red/green/blue, and thus a colour that cannot be exactly expressed in 5 bits will be rounded to the nearest colour.


Warning - although setting individual pixels is reasonably fast, if you need to set a lot (for example, to draw a line or a box), it would be much faster to use the appropriate dedicated function (such as WindowLine). This is because to draw boxes and lines, especially large ones, or filled ones, would take many, many calls to WindowSetPixel to achieve the same result.


Note: Available in version 4.36 onwards.


Lua example
for x = 1, 360 do
  local y = math.sin (math.rad (x)) * 100
  WindowSetPixel (win, x, y + 120, 0xFF0000)
end -- for
Returns eNoSuchWindow - no such miniwindow

eOK - success
Introduced in version 4.36

See also ...

Function Description
WindowArc Draws an arc in a miniwindow
WindowBezier Draws a Bézier curve in a miniwindow
WindowCircleOp Draws ellipses, filled rectangles, round rectangles, chords, pies in a miniwindow
WindowCreate Creates a miniwindow
WindowDrawImage Draws an image into a miniwindow
WindowGetPixel Gets the colour of a single pixel in a miniwindow
WindowLine Draws a line in a miniwindow
WindowPolygon Draws a polygon in a miniwindow
WindowRectOp Draws a rectangle in a miniwindow

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]