NWC24

WiiConnect24 functionality, directly within JS

To send mail via WiiConnect24 and query error code strings, you utilize wiiNwc24. With mail, you can send normal messages, or gift titles. And via error codes, you can provide a better user experience.

var nwc24 = new wiiNwc24();

Methods

Method NameDiscussion

nwc24.getFriendNum()

Returns the amount of friends on the user's friends list.

nwc24.getFriendInfo(num, type)

Queries information about the given friend list entry at num. For all possible type values, see Friends List.

nwc24.sendGiftMailAsync(friendIndex, urlPath, message, miiIndex)

Sends a mail using the gift design template with a body of the given message. The recipient is specified by friendIndex from the friends list. The sending user adds their Mii via miiIndex. urlPath is the URL this channel opens to when the Start button is clicked. Please see Async Handling for more information about the workflow for handling mail errors.

nwc24.sendReturnMailAsync(friendIndex, message, miiIndex)

Similar to the above, however lacking the url parameter. The gift return design template is used.

nwc24.sendNormalMailAsync(friendIndex, message, miiIndex)

Similar to the above. As the name implies, no mail design template is applied.

nwc24.isBusy()

Returns whether the internal mail engine is currently processing an operation.

nwc24.dispError(code, type)

Displays an error with code. There are 3 available types, though they appear ambiguous:

  • No type (or no arguments) displays an error screen with "Wii Menu" and "Reset Channel".

  • Type 2 appears to have a "Wii Menu" and "Reset Channel" button, though sometimes it does not.

  • Type 8 appears to only show "Reset Channel".

nwc24.doLeftBtn()

Handles function for the button displayed on the left within errors. Depending on the error type, the button either effectively goes to the last loaded page in history, or it resets the channel.

nwc24.doRightBtn()

Called whenever the button on the right within error pages is selected. Depending on the error type, it either loads the initially loaded URL (for example, /startup) or resets the channel.

Friends List

You query information about entries within the user's friends list via nwc24.getFriendInfo(num, type). There are three available query types:

Query TypeDiscussion

name

Returns the registered name for this friend as a string.

userId

Returns the registered friend code as a string.

miiImage

Returns a usable character ID for Mii image lookup. For more information, see CID.

Async Handling

Unlike ECProgress as utilized within EC, Nintendo chose yet another design. Users are expected to repeatedly query nwc24.isBusy() for

Properties (Get)

Property NameDiscussion

nwc24.myUserId

Returns a string with the current console's friend code.

nwc24.errCode nwc24.mailErrNo

Returns a number with the current registered mail error code.

nwc24.errCodeWithLabel

Returns a string with a formatted error code. For example, assuming a console with its language set to English, one might return "Error code: 123456".

nwc24.errMsg

Returns a localized string with a description of the error message.

nwc24.ready

Returns a boolean on whether an NWC24 error has been set. TODO: Is this fully what the function performs?

nwc24.sendable

Determines on whether a message can be sent at call time, i.e. if the scheduler is busy. TODO: Verify logic

nwc24.leftBtn nwc24.rightBtn

Returns a localized string to be displayed on the button within the given side of the page. The button's string is determined from several factors. For the right button:

  • Is there a pending NWC24 error?

    • If so, and the error is of type 4 or 10, the error is the localization of "Reset".

    • Otherwise, the string is the localization of "OK".

For the left button:

  • Is there a pending NWC24 error?

    • If so, and the current error minus seven (?) is greater than 2, or the current error is 10, localize "Try Again".

  • What is the current launch code for the channel?

    • If the launch code is 2 or 8, localize "Back".

    • Otherwise, localize "Wii Menu".

Last updated