42
L2.Net User Guide – by CPP User Interface Summary and Guide Each number is a section; please visit the next 4 pages... Each page is a different section stating various information about the section. There is also a “section” for the File/Command/etc. menu. The guide for that section is after the 4 first sections.

User Guide

Embed Size (px)

Citation preview

Page 1: User Guide

L2.Net User Guide – by CPP

User Interface Summary and Guide

Each number is a section; please visit the next 4 pages...

Each page is a different section stating various information about the section.

There is also a “section” for the File/Command/etc. menu. The guide for that

section is after the 4 first sections.

Page 2: User Guide

Section 1

This section contains information regarding your character and his current state.

It can help with skills, items, your clan and your self-stats.

Each “tab” is clickable, and each contains new information.

Char tab

o Contains information such as Name, P. atk and other stats. o Is displayed much like in the game Lineage 2.

Inv tab o Contains information regarding your inventory and equipped items. o States the item’s count, item id, if it is equipped, and much more. o It is possible to “use” an item by double clicking on it in your

inventory list. To equip an item, you must use it. Skills tab

o Contains information regarding your skills. o This will state the skill name, level, id, passive/active and more. o It is double click-able, which will use the skill… Make sure it is an

active skill, because if it isn’t then it won’t do anything. Clan tab

o Contains information regarding your clan specifically the members. o This is useful for when you want to see who is online, but I don’t

think it has much other uses.

Page 3: User Guide

Section 2

This section mostly contains information about things that are around you.

These things include items, players, NPC’s, and specific details about yourself.

There are also several tabs in this section; each containing new information.

Map tab

o This tab is edit-able, and is used to adjust the “Map” L2.Net has. o You can adjust the zoom by dragging the scroll bar. o You can turn off the display of names. o If you click CTRL or SHIFT, then anything you do (skills or

actions) will act like your holding CTRL or SHIFT. As in, if you press CTRL and double click a player, it will let you flag.

o If socials are checked, it will say when someone/thing uses an emoticon like “Dance”.

Char tab o This tab contains very specific information about your character. o There is a lot of information, too much to state… If you would like

to look at it, it is all easy to understand names and such. Players tab

o This tab contains information about other players around. o Information includes ATK Spd, CAST spd, war status, class status,

and much more information all listed in the box. o You can double click on a player, and it will be as if you double

clicked on him in-game. If you have CTRL checked, it will attack. Items tab

o This tab contains information about items around you. o You can double click on the item and it will try to grab it for you.

But be aware, if there is a wall it will just walk through it. Very easy to be caught while doing that…

o You can also see the item id, and the amount as well as the name. NPCs tab

o It contains the same information as players tab and has the same functions. The only difference is that it is for NPCs around you.

Page 4: User Guide

Section 3

This contains the chat box provided in L2.Net.

Information stated includes errors and chat from the game.

You can use the text box to say something (put text in text box and press say).

If you change the combo box, it will say it in what you choose like “Shout” without

the “!” needed.

Page 5: User Guide

Section 4

This section contains 2 boxes, one for your target and one for yourself.

The first box (on the top) is for your target and includes hp, mp, cp and name.

The second box (on the bottom) is your self and includes the same thing but in a

graphical colored box as well as in plain text.

If you aren’t in party with a player, chances are you won’t be able to see his hp/mp.

Page 6: User Guide

Menu Section Guide

This provides you to do many commands in L2.Net.

You can change a lot of information using this, I will go through it briefly.

Most of it is easily understandable, in fact all of it is self-explanatory but here is

a quicky guide to help you out.

Each Tab (ex: File or Command) has its own page and information for it. There is a

guide for logging in, under the FILE section.

Page 7: User Guide

File

This, in my opinion, is the most important tab of all. It contains the button used to

login, as well as to see the map for your game.

Logon Window (How to logon)

o IG means you play with a Lineage 2 Client with L2.Net running in the back and OOG means you only use L2.net to run the game.

How to login using OOG o Click File Logon Window. o Click “OOG” and ignore the combo box. o After that, there is a text box for your server’s ip address. o Leave the rest alone until the last 2 boxes. o The first is for your user name, the second is for your password. o Click “Logon” o Click your server in the list and click “Select Server”. o Click on the character you want to use and click “Select Char”. o Go to File Game Window in order to move around and see where

you are. It is a 2-d topographical view of you in L2. How to login using IG

o Click File Logon Window. o Click “IG” o Put in your server’s IP in the first box. o Click Listen. o Start up Lineage 2 regularly and then play. (The Game Window and

other options in L2.Net are possible once you login as usual). Report Window

o Doesn’t work because Slothmo is a lazy bum… xD. Overlay Window

o Shows target information such as name, hp, cp, and mp. o To close the window, click on File Overlay Window again.

Shortcut Window o Shows your shortcut bar. o Works like in-game L2, but you click once not twice to use skills.

Launch Lineage 2 o Runs L2 if you put the path in Options Setup.

Exit o It exits the L2.Net Client.

Page 8: User Guide

Command

This contains commands that can let you do special things in L2.

Cancel Target

o Works like “ESC” in L2, ends/cancels your target. Toggle Botting

o Turns the bot off, but not the scripts. Restart

o Sends you back to the character login list, (Go to Login Window to see it). Only possible with OOG.

Logout o Logs your character out of the game.

Close Client o Sends your character out of the game and exits.

Kill Threads o Takes your character out of the game.

Force Log o Basically is Kill Threads as far as I’m aware.

Page 9: User Guide

Options

This will let you change options and interface features.

Bot Options

o There are a lot of options you can change in Bot Options, here is a quick help tutorial for you.

o To active follow: You must put the person’s Name and click “active follow”. You can change the options, they will change how you move.

o To buff/heal: You have to use a Shortcut in your action bar, so make sure it is a shortcut. Set the Page the shortcut is on and the number the shortcut is on as well. Set the trait such as HP and then under XX < %, put the % you want the hp to be lower than to use the skill. Set the delay in seconds, and the MP needed to use the skill and then click “Apply”. You can add multiple and they will all work at the same time.

o There is much more, but you need to check the forums or learn yourself because this guide can’t handle writing all of everything…

Sound Alerts o All the wars are just triggers asking you if it wants to make a

sound when someone is at a certain war status. o The HP/MP/CP are all alerts if your hp is under a certain %. o Clan/Player are for if a certain player from a clan arrives or a

certain player… The text box is for the name of the clan/player. o Check the checkbox for the alert to actually go/be on.

Save Interface o Wait until you read the next menu button “Setup”…

Setup o Setup will let you change the voice (The voice that says things). o Minimize to Tray will make L2.Net minimize and go near your time

clock with an icon instead of just regular minimizing. o I’d just leave Allow Script I/O on if I were you, don’t mess with it. o Lineage 2 Path is for when you click File Launch Lineage 2. o Toggle Key will turn on/off botting (NOT scripting). o Product key is for a key if you have one. o White Names will change the color of text for names to white. o Click Save Interface so you don’t have to change options again.

Page 10: User Guide

Scripting

Scripting is the most powerful feature in L2.net. This tab will let you use scripting.

A lot of it won’t make sense unless you know how to script…

Set Script Main

o Lets you set the current script to a file. Start Script

o Starts a script. Reset Script

o Re-Loads script (does update file in-case changes were made). Script Editor

o Opens up a script editor with an edit box and 4 buttons. Each button is self-explanatory. This menu is used to make scripts.

Script Debugger o Debugs script (only usable with a key). o Allows “pause/resume” script as well as “snapshot”.

Debug Mode o Debug mode will tell you certain things in the chat box that you

wouldn’t normally see. One useful part of this is that it tells you how to use NPC chat.

Dump Mode o Dump mode will do what Debug Mode does. However, it will display

more different commands, and will also display it in Hex. Very useful with the “INJECT” command.

Page 11: User Guide

Help

Help is useful for its hosts function along with Force Collect. Here is more info…

Donate

o Opens up a link to the website where you can donate to L2.Net. o As a personal note, I love L2.Net and highly recommend anyone to

donate to L2.Net. I may have and will make fun of Slothmo, but he spends a lot of time in this program and deserves some gratitude. Please, if possible, donate… If you can’t donate, please contribute by sending all bug reports and also learn/help others with their scripts. Thanks for reading, I just really wanted to speak my mind.

o -- No offense to anyone else that helps out L2.Net or deserves an honorable mention… But Slothmo is just the only one I’ve ever talked to/seen who works on L2.Net.

About o This shows a box stating information about L2.Net. You should

check it out at least once… Hosts

o Opens up notepad with your hosts file. You can edit it and then save strait to your hosts file.

Language o Opens a dialog letting you change the current Language.

Force Collect o Cleans up memory being used by L2.Net and Lineage 2. There is

sometimes memory that needs to be “freed” and this does that for you. Very useful if your using IG and your lagging a lot.

That does it for the User Interface Guide. If you would like to learn any more, I

highly encourage anyone to take the next step and start scripting. I have 12

lessons below, and after them all you should be able to make your own high-quality

scripts.

Thanks for your time,

CPP

Page 12: User Guide

Scripting Tutorial and Guide

Basics

o Hello World o Variables and Integers o Strings and Doubles o Global Variables

Intermediate o IF statements o IF statements with commands (potion script) o Error-Proofing o Looping

Advanced o Learning Commands o Variable Change o Functions o SCRIPT_EVENT uses

Extra o Math o Lists o Messages o File Writers o Proper script etiquette

INDEX o Categorized o Non-Categorized

Scripting must be done while logged into a server unless you obtain a key…

Scripting is the most powerful, useful and abundant tool in L2.Net.

L2.Net scripting gives you a lot of power, and you do things yourself. It is like making your own bot, being able to do everything yourself and not limited by someone else.

Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Page 13: User Guide

Lesson 1 – Hello World

Scripts are typically stored in your L2.Net folder in a folder named

“scripts”. This is the default save/open path for the script editor in L2.Net. There are also other reasons to use this folder, which you will find out in other lessons.

Let’s first make the Hello World function… Simply go to Scripting

Script Editor. This will open a big text file along with 4 buttons at the top. Load, Save, Top and Close… All of them being the obvious definitions…

To start, write this into the big box for text…

PRINT_TEXT "Hello World" END_SCRIPT

Now click “Save Script”. As the file name write something like “Hello World”.

Click “Close” and then go to the main window now. Go to scripting Set Script

Main… Find the file you saved and then click “Open”. Go to Scripting Reset

Script. Then go to Scripting Start Script.

These are the things you must do in order to start a script… and here is a quick

easy reference for each of the scripting buttons…

Start Script will, of course, start a script…

Reset Script will reset the script to the first line and renew the text file… As in,

say you add a line to a text file, you don’t need to set script, you can just reset.

Set Script will set your script to a *.l2s file.

It should display “Hello World” into the chat box in your main L2.Net Window.

PRINT_TEXT “TEST” will display whatever is in the quotes into the L2.Net Chat

Box.

END_SCRIPT will simply end the script when called.

Page 14: User Guide

Lesson 2 – Variables and Integers.

An integer is simply a variable for a number. All you need to know

is a variable is something you can use to call to an integer, string, etc. Here is an example using an integer variable…

DEFINE INT VARINT 20 PRINT_TEXT “<&VARINT&>” END_SCRIPT

DEFINE will define a certain type of variable to have a name and value.

“DEFINE INT VARINT 20” will make an integer with the name VARINT and set it

to 20.

PRINT_TEXT is something we learned before, but we did not go over the

<&VARNAME&> command. This, when used in quotes, is a reference to a variable.

You must reference to the name of the variable, and it will grab the variables value

and place it in the quotes as if it were text.

END_SCRIPT, as we learned, ends the script.

Save/Load the script like in Lesson 1 and it should display “20”.

Page 15: User Guide

Lesson 3 – Strings and Doubles

There are many more variables that can be used in L2.Net… Such

as STRING, DOUBLE and FLOAT… Most importantly, String and Double… Here is a quickie example for them…

DEFINE STRING MYSTRING "Test String" DEFINE DOUBLE MYDOUBLE 10.50 PRINT_TEXT "MYSTRING is <&MYSTRING&> and MYDOUBLE is

<&MYDOUBLE&>" END_SCRIPT

Sometimes, you will find yourself doing this…

DEFINE INT TEMP 500 IF CHAR_CUR_HP > TEMP PRINT_TEXT “<&CHAR_CUR_HP&> is greater than 500” ENDIF END_SCRIPT

L2.net has added a nice little feature to take away the temp integer

which will cause unwanted speed reduction and extra lines of code. Because of this, L2.Net placed in the “i” command as I like to call

it. What it does is it makes a temporary variable for you and then erases it immediately after the IF statement or whatever. So, using this you can write the same script but as…

IF CHAR_CUR_HP > i500 PRINT_TEXT “<&CHAR_CUR_HP&> is greater than 500” ENDIF END_SCRIPT

Also, you should know that when I use the text “ONE” or “ZERO”…

It is much different then actually placing 1 or 0. ONE and ZERO were added for the same reason the “i” function was added… The difference is that ONE and ZERO are Global Variables placed in naturally. In an IF statement, you must use variables only (local and global is fine).

Page 16: User Guide

Also, there is more than just the “i” command, there is also the “$”

command for strings such as…

IF STRING == $String

Also, there is the command for double which is “d”…

IF DOUBLE == d0.50

Page 17: User Guide

Lesson 4 – Global Variables.

You have learned the basic of basics… Here is the last lesson to

learn for basics… L2.Net has a set of basic variables that you can use for your script. These contain important information, such as your HP and MP. Here is an example of using one of the Global Variables…

PRINT_TEXT "<&CHAR_CUR_HP&>" END_SCRIPT

This is one of the “built-in” variables. This is your current HP; it should simply

display your current hp.

That is it for the basics, hopefully it wasn’t too hard and you can brace yourself for the more difficult parts of scripting.

Page 18: User Guide

Lesson 5 – IF statements

You have learned about variables and how to use script files. You

have learned about global variables as well, now you need to learn about how to use these variables.

L2.Net offers many ways to use variables… Such as, to only do

something when your hp is at a certain number…

IF CHAR_CUR_HP == CHAR_MAX_HP PRINT_TEXT "HP is full… <&CHAR_CUR_HP&> /

<&CHAR_MAX_HP&>" ELSE

PRINT_TEXT "HP is not full… <&CHAR_CUR_HP&> / <&CHAR_MAX_HP&>"

ENDIF END_SCRIPT

IF Statements are very important in L2.Net… They allow you the ability to only do

certain things at certain times or when they are needed. For example, if your hp is

full it will say “HP is full 1000/1000” and if it isn’t full, it will ignore that command.

-- As an extra note, if requires the “==” indicator which is two equal signs and not

one.

ELSE statements are used with IF statements… They allow you to do a command

only if the if-statement isn’t used. So, in other words, if the HP isn’t full it will do

the commands in the ELSE statement.

ENDIF indicates the end of both the if and the else command.

Page 19: User Guide

Lesson 6 – IF statements with commands (potion script)

We have learned the basics; it’s time for the building block of

scripts… The basic use potion script… Here is how you would do this… There is a list of “functions” that are built into L2.Net. These

functions can do things from walking to using items and many more as well.

Here is an example of how to use a function named “USE_ITEM”

which simply uses the item with the id that you give it.

IF CHAR_CUR_HP < CHAR_MAX_HP USE_ITEM 1061 // Use Healing Potion

ENDIF PRINT_TEXT "DONE" END_SCRIPT

The “<” is the same as “==” as to where it is placed in an if statement. The

difference is that < is less than, so if our current hp is less than our max hp then it

does whatever is in the if statement.

USE_ITEM is a function found in L2.Net. Like I said before, it simply uses the

item with the id that we tell it to. By placing “1061” after it, I am telling it to use

the item with the ID of 1061. This item is the Healing Potion btw.

So, in other words, if our hp is lower than our max hp use a healing potion and then

print “done” and then end our script.

Page 20: User Guide

Lesson 7 – Error-Proofing

Now, we need to try and take away all errors that could possibly

occur in our program. Like, for example, if they don’t have any healing potions. Which, we will use ITEM_COUNT for…

DEFINE INT ITEMCOUNT 0 ITEM_COUNT ITEMCOUNT 1061 IF ITEMCOUNT > ZERO

IF CHAR_CUR_HP < CHAR_MAX_HP USE_ITEM 1061 // Use Healing Potion ENDIF ELSE

PRINT_TEXT "You have no healing potions 8(“ ENDIF PRINT_TEXT "DONE" END_SCRIPT

First, we need to make a variable to hold the item count. We put the DEFINE in

for that, and we made it 0 just for a temporary number. You have to add

something, and 0 is just what I chose.

Next, we have to find the item count… ITEM_COUNT will put the amount of items

into the variable you give it in the first “parameter”. In the second parameter, you

place item id… We put 1061 because we want to see how many Healing Potions we

have.

Then, if we have more than zero healing potions, it uses one… If not (the else

statement), it tells the user that we have no healing potions so he knows about it.

It then prints done, and ends the script…

Page 21: User Guide

Lesson 8 – Looping

We have another error with our script, we only get the hp potion

one time and it only checks our hp one time… But we want it to keep going and going so that we can go play while it continuously checks our hp… A loop will help us with that, a loop is like an if statement but it continuously does the code until it meets a certain requirement.

We don’t want that requirement to ever be fulfilled (because we

want infinite). So we are going to make an infinite loop by doing…

DO -- Code -- LOOP ONE == ONE

DO and LOOP are the commands used in a loop… This statement

will loop and do the codes in between them until ONE == ONE is not true… In other words, when ONE does not equal ONE.

This is our script with the loop idea added to make it in infinite.

DEFINE INT ITEMCOUNT 0 DO

ITEM_COUNT ITEMCOUNT 1061 IF ITEMCOUNT > ZERO IF CHAR_CUR_HP < CHAR_MAX_HP USE_ITEM 1061 // Use Healing Potion ENDIF ELSE PRINT_TEXT "You have no healing potions 8(“ ENDIF PRINT_TEXT "DONE" LOOP ONE == ONE END_SCRIPT

We place the DEFINE out of the do statement, because we only

need to define our variable one time. The rest is all like the old script; the only difference is it will be continuously done until our user clicks “stop script”.

Page 22: User Guide

You now know the intermediate part of scripting. To be honest, with what you have learned you can do MANY different scripting feats. However, I do recommend reading the advanced part simply because it isn’t that big and you can learn a little more about scripting.

Page 23: User Guide

Lesson 9 – L2.Net Command Thread

There is a pretty extensive “guide” on the forums, with many

commands that you can learn and use yourself. These are practically the A-Z for L2.Net, if you ever need to know more about a command or how to use a command… This thread has got all you need.

The problem is you need to understand how to use it… So I made

this small lesson just to help you out with that. Here is an example of how to use/read this guide.

SLEEP [ui]

[ui] The length of time in miliseconds to sleep. EX: SLEEP 1000

First, you need to know “SLEEP [ui]” means that there is 1

parameter (ui) for the command SLEEP. What you should automatically think is, “What do I have to put in

UI?”. Well, that is exactly what the next line tells us. The next line has [ui] and then a description of what you need to

place for that variable. A millisecond is simply 1000 of a second. In other words, 1000 milliseconds = a second.

Then, it also gives an example notated by “EX: “. That is an exact

way to use it, “SLEEP 1000”. That is all you really need to know, there are several more

commands, but they are all written like or exactly like this. So, now, all it takes is time for you to learn all the commands in L2.Net. ^_^.

Page 24: User Guide

Lesson 10 – Variable Change

Sometimes, you will find that you need to use a number that

changes. For example, our ITEMCOUNT script will change so we had to place the variable there to account for “variable change”.

Another good example is when we want to drop items. In order to

drop items, we don’t use the item id, instead we have to use the unique item id given to it from the server/game. That means that if we want to drop anything, we need to find the id and then have that number stored somehow. Obviously, we will use a variable and store the number to use later. We also, must have another variable for how many of that item we have in order to know how much to drop. On top of that, just for kicks, lets also make another variable to hold the regular ID of our item instead of having to write it 4 or 5 times. Here is how to do so…

DEFINE INT ITEMCOUNT 0 DEFINE INT ITEMID 1061 DEFINE INT UITEMID 0 ITEM_COUNT ITEMCOUNT "<&ITEMID&>" IF ITEMCOUNT > ZERO INVEN_GET_UID UITEMID "<&ITEMID&>" DROP_ITEM "<&UITEMID&>" "<&ITEMCOUNT&>" "<&CHAR_X&>"

"<&CHAR_Y&>" "<&CHAR_Z&>" ENDIF

Here we define all the variables we need, ITEMCOUNT in order to

hold the amount of items we have. ITEMID to place the item id, and UITEMID in order to hold the unique item id… Then, we use the ITEM_COUNT command to get the amount of items we have with that ID. Next, if we have more than zero of that item, we use INVEN_GET_UID in order to get the unique id of ITEMID and then store it in UITEMID. After all that, we finally use “DROP_ITEM” in order to drop ITEMCOUNT amount of our UITEMID and we drop onto our own CHAR_X, Y, and Z.

That concludes variable change.

Page 25: User Guide

Lesson 11 – Creating your own functions

As you write scripts, you will find yourself repeating code and

different things. A function is good because…

You can just have a call to a function which is less work than writing the whole

function.

Allows for a sense of “tidiness”, making it easier to read and use your code.

Others can place them into their scripts and use the functions for their own need.

Here is how to use a function…

DEFINE INT ADENAID 57 DEFINE INT CHECKINT 0 CALL DROP_ITEM CHECKINT 2 ADENAID CHAR_NAME IF CHECKINT == ZERO PRINT_TEXT "Didn't Work" ELSE PRINT_TEXT "Did work" PICKUP_NEAREST ENDIF END_SCRIPT FUNCTION DROP_ITEM 2 ITEMID TARGET DEFINE INT ITEMCOUNT 0 IF TARGET_NAME = TARGET ELSE COMMAND "/target <&TARGET&>" ENDIF ITEM_COUNT ITEMCOUNT "<&ITEMID&>" IF ITEMCOUNT > ZERO INVEN_GET_UID ITEMID "<&ITEMID&>" DROP_ITEM "<&ITEMID&>" "<&ITEMCOUNT&>" "<&TARGET_X&>"

"<&TARGET_Y&>" "<&TARGET_Z&>" RETURN 1 ELSE RETURN 0 ENDIF RETURN VOID

Page 26: User Guide

First, let’s look at how to make a function.

Let’s look at the line that says “FUNCTION DROP_ITEM”. This is used to create a

function… Here is an explanation of how to use it.

First off, you put “FUNCTION “ and then the name of the Function you want to

make. After that, you put how many variables you would like to use (2), and then

the names you want the variables to have.

On the next lines, you have the code being used. In order to end a function, you

must use the RETURN command. This will end the function and give output from

the function to the CALL.

Now that we have a function, we have to “CALL” it. By putting “CALL DROP_ITEM “

Next, we put a variable we already have made… This variable will hold whatever is

returned by the function.

Then we have the variables we are going to send, first off with the amount of

variables we have and next the name of the variables being sent. The variables

must be in order, and to explain this here is an example…

CALL DROP_ITEM CHECKINT 2 ADENAID CHAR_NAME FUNCTION DROP_ITEM 2 ITEMID TARGET

ADENAID will be turned into ITEMID, and CHAR_NAME will turn into TARGET.

These variables (ITEMID and TARGET) will only be usable while inside the

function and will be erased immediately after the function is over.

ADENAID and CHAR_NAME will be completely unchanged from the function.

After the function does a “RETURN”, it will change “CHECKINT” to whatever you

place after the RETURN. Like “RETURN 1” will end the function and change the

variable CHECKINT to 1.

That is it for functions… Please use them instead of SUB’s…

Page 27: User Guide

Lesson 12 – Script Event Uses

L2.Net has added a handy feature called script events. A script

event will start or use a function when a certain event is triggered. A good example would be the SCRIPTEVENT_CHAT (Which is triggered when you receive any kind of chat to your character)

Along with being triggered, there is also a set of variables it makes

such as SCRIPTEVENT_CHAT gives the variables…

INT MESSAGETYPE

INT SENDERID

STRING SENDERNAME

STRING MESSAGE

Each variable is named accordingly… Meaning that “SENDERNAME” is simply the

name of the person who sent the message. MESSAGE is the message sent.

In order to use an event, you must use the command

“SET_EVENT”.

SET_EVENT "<&SCRIPTEVENT_CHAT&>" thisfile.l2s

thisfunction FUNCTION thisfunction 0 PRINT_TEXT “<&MESSAGE&> was sent by <&SENDERNAME&>” RETURN VOID END_SCRIPT

“<&SCRIPTEVENT_CHAT&>” is just one of the events put in L2.net.

The event will use a function found in a file. The file in this example is

“thisfile.l2s” and the function is “thisfunction”.

The file MUST be in the “scripts” folder in your L2.Net folder.

Page 28: User Guide

EXTRAS

After writing all the lessons, I am just thinking of several things that I would like others to learn about. So, I made this section in order to list them all… Please feel free to read them, they aren’t useless… They just aren’t used all the time, and aren’t a necessity.

Page 29: User Guide

EXTRA – Math

Math is a very useful function in L2.Net… It can allow you to add,

subtract, divide and multiply along with also reading and writing in files (but I won’t talk about those here).

DEFINE INT A 0 DEFINE INT B 0 DEFINE INT C 0 SET B 20 SET C 30 MATH A B ADD C

This will add 20 and 30 and put the result into A. ( A = 20 + 30 )

You can also do subtraction…

DEFINE INT A 0 DEFINE INT B 0 DEFINE INT C 0 SET B 20 SET C 10 MATH A B SUBTRACT C

This will subtract 20 from 10 and put the result into A.

Page 30: User Guide

EXTRA – Lists

Lists are a useful way to store information, but also a pain in the

neck to understand… (My example was simply grabbed from the

\scripts\tests\foreach.l2s file.) A list can be an array list and a sorted list. Here, I’ll show how to

use an array list.

DEFINE INT I0 1 DEFINE INT I1 2 DEFINE INT I2 3 DEFINE ARRAYLIST MYAL 0 MATH MYAL I0 add “i0” MATH MYAL I1 add “i1” MATH MYAL I2 add “i2” FOREACH A INT MYAL PRINT_TEXT “<&MYAL.A&>” NEXTEACH

So, first we define 3 ints and then an arraylist. After that, we add the integers to

the arraylist. Personally, every time I use a list I do the exact same thing… I

wouldn’t try and mess with it, like trying to add a different name integer etc.

Then there is the FOREACH… FOREACH will create an integer variable for you so

that you can use it. Then, you can grab that by using the local variable MYAL.A

(local meaning you can’t use it after the FOREACH is over.

You can change A to B, but you also must use MYAL.B instead of A. NEXTEACH will

simply go to the next integer. Such as 1 to 2, which makes you use the next part of

the arraylist.

So, in other words, this function simply makes ints, puts them in a list, and then

goes through the list printing each variable found.

Page 31: User Guide

EXTRA – Messages

Messages are a pretty new feature, they allow you to open a

message box containing data you specify. It is useful, and a better way to inform your viewer of data as opposed to printing text. But, I do advise against using them unless in dangerous or needed situations due to it being a user-hassle to click OK over and over…

This is pretty small and not very informative, but I felt it was worth

mentioning as a feature… You can make/start a message box by using the command

MESSAGE_BOX "stop" "hammer time!" HAND

This will simply open a box that users can read and click OK to close.

To change the icon/sound of the message box, change the HAND part to an icon

you would like. (There is a list of them in INDEX under “TYPES”).

Page 32: User Guide

EXTRA – FILEWRITERS and READERS

DEFINE FILEREADER FR "Test" DEFINE INT TEMP TWO MATH FR TEMP READ MATH FR NULL CLOSE PRINT_TEXT “<&TEMP&>”

First, we define a variable named “FILEREADER” which simply reads text. Then,

we define an INT to read the text into.

MATH FR TEMP READ will read a line in FR and put it into TEMP.

MATH FR NULL CLOSE will close the file (you don’t need to know much except

that you should use this when your done with a file).

PRINT_TEXT “<&TEMP&>” simply prints whatever temp is.

You can also use FILEWRITER…

DEFINE FILEWRITER FW "Test" DEFINE INT TEMP TWO MATH FR TEMP WRITE MATH FR NULL FLUSH MATH FR NULL CLOSE

We define the FILEWRITER and the INT as normal…

But, this time instead of using READ we use WRITE which will write whatever is in

TEMP into FW.

Just like close, flush is just something you should do. So we place that and CLOSE.

Page 33: User Guide

Proper Script Etiquette

A lot of the time, I see people with some horrible script etiquette and other times I see people with some great etiquette… Hopefully this will help some of you with that…

First of all, Tabs are a very useful part of text. It allows for us to

see an IF or a WHILE much easier and also read it much more conveniently. Here is just a quick example…

IF ITEMCOUNT > i10 IF CHAR_CUR_HP < CHAR_MAX_HP USE_ITEM 1061 ENDIF ENDIF

IF ITEMCOUNT > i10 IF CHAR_CUR_HP < CHAR_MAX_HP USE_ITEM 1061 ENDIF ENDIF

Which do you think looks easier to read and more understandable? In a script, you

will have bugs and changes you want to make, which example would you like to

rather read 50-60 times? That’s the size of a script, and that’s why tabs are nice.

Tabs are used a line after an IF or a WHILE to indicate it is “inside” it.

Multiples IF’s mean multiple tabs, one tab per IF. (When I say IF, I also mean

Whiles’ and DO’s etc.

Tabs are not the only problem I see with scripts, there is also the

problem with not putting in any comments. Say you just wrote a 70-80 line script, and suddenly you realize

you made a typo at a certain part. Let’s just say it’s at your text sending part. Now, you have to read through all those lines and find that part. But, if you had comments, you could just look only at the small comments making it much easier. Also, comments help people

Page 34: User Guide

understand your code and even help you understand your own code that you wrote a few weeks/days ago. Here is an example…

IF TEMP > i10 IF TEMP2 > TEMP3 USE_ITEM 1061 // Use Healing Potion ENDIF ENDIF

// If you have more than 10 healing potions IF TEMP > i10 // If you have less than full hp. IF TEMP2 > TEMP3 USE_ITEM 1061 // Use Healing Potion ENDIF ENDIF

Very commonly you will have multiple variables and even you won’t remember what

all of them were referring to or doing at a certain part in your code.

If you had just looked at the first code example for the first time, would you

understand it? Of course not… But in the second one, you know exactly what’s

going on and it is right there in plain text.

(This code wouldn’t actually work by itself. It is just to show you how confusing

and long a script can be and why comments help so much with that.)

Just remember, everyone makes mistakes… What is important is that you make sure the mistakes aren’t too hard to fix. Comments help a lot to fix mistakes…

Page 35: User Guide

INDEX

This is a list of the global variables in L2.Net…

Categorized

o Channels o Script Events o Char o Target o Types (Including Variable and Message types)

Non-Categorized o Just a big list of a lot of stuff…

Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Kevin
Underline
Page 36: User Guide

Channels

These variables are used to describe a channel for text in L2.

Global Variable Name Description

CHANNEL_ALL Channel for all text possible. CHANNEL_SHOUT Channel for only shouts. CHANNEL_PRIVATE Channel for only private. CHANNEL_PARTY Channel for only party. CHANNEL_CLAN Channel for only clan. CHANNEL_GM Channel for only GM. CHANNEL_PETITION Channel for petition. CHANNEL_PETITIONREPLY Channel for replies to petition. CHANNEL_TRADE Channel for only trade. CHANNEL_ALLY Channel for only alliance. CHANNEL_ANNOUNCEMENT Channel for announcements. CHANNEL_BOAT Channel for boat and ferry. CHANNEL_PARTYROOM Channel for party rooms. CHANNEL_PARTYCOMMANDER Channel for party commander. CHANNEL_HERO Channel for heroes.

Page 37: User Guide

Script Events

These variables refer to script events and are only used in order to SET_EVENT.

Imagine if there was “When you” in front of every description.

Global Variable Name Description

SCRIPTEVENT_CHAT Receive chat. SCRIPTEVENT_SELFDIE You die. SCRIPTEVENT_SELFREZ Are resurrected. SCRIPTEVENT_SELFENTERCOMBAT Start fighting. SCRIPTEVENT_SELFLEAVECOMBAT Stop fighting. SCRIPTEVENT_SELFSTOPMOVE Stop moving. SCRIPTEVENT_SELFTARGETED Are targeted. SCRIPTEVENT_SELFUNTARGETED Are untargeted.

Page 38: User Guide

CHAR Global Variables

All Variables refer to only the character that L2Net is running on.

Global Variable Name Description

CHAR_NAME Current Name CHAR_TITLE Current Title (Clan) CHAR_SP Current Skill Points CHAR_XP Current Exp Points CHAR_LEVEL Current Level CHAR_CLASS Current Class CHAR_X Current X coordinate CHAR_Y Current Y coordinate CHAR_Z Current Z coordinate CHAR_DESTX X coordinate you are walking to CHAR_DESTY Y coordinate you are walking to CHAR_DESTZ Z coordinate you are walking to CHAR_MAX_MP Maximum MP CHAR_MAX_HP Maximum HP CHAR_MAX_CP Maximum CP CHAR_CUR_MP Current MP CHAR_CUR_HP Current HP CHAR_CUR_CP Current CP CHAR_MAX_LOAD Maximum Load (Weight) CHAR_CUR_LOAD Current Load (Weight) CHAR_RUN Current Status. 1=run, 0=walking

Page 39: User Guide

Target

These variables refer only to the object you are targeting at that time.

Global Variable Name Description

TARGET_NAME Current Name. TARGET_TITLE Current Title (Clan). TARGET_CLAN Current Clan Name. TARGET_ALLY Current Alliance name. TARGET_SP Current Skill Points. TARGET_XP Current Exp Points. TARGET_LEVEL Current Level. TARGET_CLASS Current Class. TARGET_X Current X coordinate. TARGET_Y Current Y coordinate. TARGET_Z Current Z coordinate. TARGET_DESTX X coordinate you are walking to. TARGET_DESTY Y coordinate you are walking to. TARGET_DESTZ Z coordinate you are walking to. TARGET_MAX_MP Maximum MP. TARGET_MAX_HP Maximum HP. TARGET_MAX_CP Maximum CP. TARGET_CUR_MP Current MP. TARGET_CUR_HP Current HP. TARGET_CUR_CP Current CP. TARGET_MAX_LOAD Maximum Load (Weight) TARGET_CUR_LOAD Current Load (Weight) TARGET_ID The ID of your target. TARGET_TYPEID The Type of your target. TARGET_TARGETID The ID set for your target. TARGET_KARMA Current Karma of target. TARGET_SPOILED Spoil status. 1=yes, 0=no TARGET_TYPE Type of target.

Page 40: User Guide

Types

The TYPE_ are used with TARGET_TYPE and other TYPE variables.

NULL to CLASS are all used for DEFINE.

The (Msg) are used for message box icons and sounds… The sounds are either a

click or a DUN sound. (Used in MESSAGE command).

Global Variable Name Description

TYPE_ERROR Error occurred while trying to find. TYPE_NONE Could mean death. TYPE_SELF If target is yourself. TYPE_PLAYER If target is a player TYPE_NPC If target is a NPC NULL Nothing INT Integer or Number DOUBLE Double (A number with a digit) STRING Anything not numbers only. FILEWRITER Writes to files FILEREADER Reads from files ARRAYLIST An unsorted list SORTEDLIST A sorted list STACK A stack will go last-first. QUEUE A queue will go first-last.CLASS An object w/ functions & variables. ASTERISK (Msg) Blue i sign ERROR (Msg) Red X Sign EXCLAMATION (Msg) Yellow ! sign HAND (Msg) Red X Sign INFORMATION (Msg) Blue i sign NONE (Msg) no icon QUESTION (Msg) Blue ? sign STOP (Msg) Red X sign WARNING (Msg) Yellow ! sign

Page 41: User Guide

Everything Else

This has a very long list of different types…

I grabbed all of it from Slothy’s Global Variable list, and honestly I don’t really

know that much about all of them.

This is more of the rejects that I don’t think are hard to understand or useful.

Global Variable Name Description

VOID None. ZERO 0 ONE 1 TWO 2 TRUE Boolean for True FALSE Boolean for false TOWN (Used in TAP_TO command) CLANHALL (Used in TAP_TO command) CASTLE (Used in TAP_TO command) SIEGEHQ (Used in TAP_TO command) NEAREST_ITEM_DISTANCE Nearest item’s distance NEAREST_NPC_DISTANCE Nearest NPC’s distance NEAREST_PLAYER_DISTANCE Nearest player’s distance COUNT_NPC_TARGETME Amount of NPC’s targeting you COUNT_PLAYER_TARGETME Amount of players targeting you. TICKS_PER_MS Used for time (milliseconds) TICKS_PER_S Used for time (seconds) TICKS_PER_M Used for time (minutes) TICKS_PER_H Used for time (hours) TICKS_PER_D Used for time (days) SHORTCUT_ITEM Indicates shortcut with ITEM SHORTCUT_SKILL Indicates shortcut with SKILL SHORTCUT_ACTION Indicates shortcut with ACTION SHORTCUT_MACRO Indicates shortcut with MACRO SHORTCUT_RECIPE Indicates shortcut with RECIPE RANDI Random int 0-100 RANDD Random double 0.0 and 1 PUBLIC PUBLIC PRIVATE PRIVATE PROTECTED PROTECTED PI Used to indicate PI (math)

Page 42: User Guide

E Used to indicate E (math) SYSTEM_THREADCOUNT Amount of threads SYSTEM_CURRENTFILE Current File SYSTEM_HANDLECOUNT Amount of handles SYSTEM_MEMORYUSAGE Amount of memory usage SYSTEM_MEMORYALLOCATED Amount of memory set/allocated SYSTEM_STACKHEIGHT The height of stack