RE: including files
[OFF TOPIC]
Don't use those PHP converted functions you find on that webpage to do script programming for Plus! (or Windows in general) just like that and without the knowledge of what those functions exactly do and for what they are meant.
PHP is meant for web development. JScript (and JavaScript) can also be used for web development, but are also used for Windows command line scripting. Windows scripting is different than scripting for the web since the script is not based upon a html page. So you don't have the same objects at your disposal. For example, in a web script you would output your data to html, obviously in command line scripting there is no html/web page to output to. So stuff like window.location.href don't even exist in command line scripting (there is no browser window and thus no URL location).
Furthermore, the functions you'll find on that website are converted to JavaScript. This is not entirly the same as JScript. Plus! scripting uses JScript, not JavaScript and thus some things (although not that much) are different.
---------------------------
If, in the Plus! scripting documentation, it is stated that function X::Y does something, then Y is a property or a method of the object X.
So you call that function like X.Y
And if there is another function which states Y::Z, then you call that function like X.Y.Z.
What the type of the return value of that function is, is stated in the 'syntax' between square brackets in front of the function name. The same with parameters for that function.
This is a general way in describing functions in programming language documentation so that everybody, no matter what language they come from, can understand it without confusion.
It's true that some descriptions can use some examples, but for things like the MsgPlus::LoadScriptFile function an example wouldn't show anything new or more than what is already said in the description. It's just a function with 1 parameter.
eg:
MsgPlus::LoadScriptFile
[boolean] LoadScriptFile(
[string] ScriptFile
);
Means you call it like this:
var retValue = MsgPlus.LoadScriptFile("subdirectory\\scriptfile.js");
or simply:
MsgPlus.LoadScriptFile("subdirectory\\scriptfile");
if you don't need to know the return value.
"subdirectory\\scriptfile.js" is obviously a string (see [string] in syntax)
reValue is a boolean (see [boolean] in syntax) and thus will be either True or False according to the success of the function.
---------------------------
An enumeration ([enum]) is just a collection of constants. It means that the parameter in question can only contain predefined values. These values make up the enumeration.
eg:
OnEvent_MenuClicked
OnEvent_MenuClicked(
[string] MenuItemId,
[enum] Location,
[object] OriginWnd
);
From this you know that the function is an event. Events are functions which are automatically called when a certain thing happens. The parameters are filled in by Plus! and thus returned to your function. So this works in the opposite way as with functions like MsgPlus::LoadScriptFile where you need to fill in the parameters to send to the function.
The second parameter named 'Location' is an enumeration. Which means it will only return certain values (for what values, see the documentation). In the newer versions of Plus! you can also use the constant names of these variables instead of the numerical values themselfs to check on:
OnEvent_MenuClicked (sMenuItemId, eLocation, oOriginWnd) {
Debug.Trace("Menu with ID: " + sMenuItemId + " has been clicked");
// using the name of the constant:
If (eLocation === MENULOC_CONTACTLIST) {
Debug.Trace("This happened in the contactlist");
}
// or, using the numerical value:
If (eLocation === 2) {
Debug.Trace("This happened in a chat window");
}
}
[/OFF TOPIC]
This post was edited on 05-08-2008 at 04:51 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
|