Brisbane MapleStory
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Welcome to our Private Server! 30, 000 EXP 3, 000 MESO 10 DROP
 
HomeHome  Latest imagesLatest images  RegisterRegister  Log in  

 

 Tiffany's Coding Guide

Go down 
2 posters
AuthorMessage
Tiffany




Posts : 6
Join date : 2010-08-22

Tiffany's Coding Guide Empty
PostSubject: Tiffany's Coding Guide   Tiffany's Coding Guide EmptySun Aug 22, 2010 7:18 am

Welcome to the guide

Alright, to start off I would like to say, that ALL the NPC's have a "Method" which is defined by something called "NPCConversationManager" Or something along those lines, basically that is the source of your script, Anything you put in the source of the file (NPCConversationManager) Will work in any NPC script as long as it has been coded properly.

Anyway, So go to an NPC You would like to edit's .js script and open it. For example we will edit NPC 10293 (Random numbers - I don't know how it is)
You would put this at the top;

PHP Code:
var status = 0;

I believe it doesn't matter what you the number after the "=" is, I think putting a 0 just make it less messier and easier to read.

In an NPC script, accompanying the start is the action - Unless your coding some really retarded NPC some way that only you know how to do.. o-o.
The NPC Scripts I've observed when I was first trying to learn to script and failed I believe always had a -1 in it for the status, So the next chunk of code would like something like this;

PHP Code
:
function start() {
Status = -1;
action(1, 0, 0);
}

Your action method or else what your NPC Will do when you click it, for example talk, warp you somewhere, take something off you etc, This is where your NPCConversationManager comes in: This is where all the cm.dispose - cm.sendOk etc comes from, this is where all the original codes and data for the rest of the NPC Scripts comes from for it to work - Hopefully you catch my drift .
Note: Capitilization in the code matters one billion percent, cm.sendOK is DIFFERENT to cm.sendOk or cm.SENDok.
Again, that is defined by your NPCConversationManager.

After you finish method, you need to end it with a ";" (Without the " of course unless needed) or it won't work. Basically - Miss the semi colen and the whole thing will not work.
For example

PHP Code:
cm.sendOk("Put whatever you want your NPC to say here");

The ; Tells the script where the instruction starts and ends

Here are a list of commonly used commands in NPC scripts;
How to make an NPC talk
[PHP]cm.sendOk("Welcome to the realm of (Change to the name of your server)!"); [You must be registered and logged in to see this link.] Will determine What your NPC Will say when the user hits the next button

cm.sendNext("Enjoy your time here and use !help if you need to!"); //This will output Enjoy your time here and use !help if you need to when the user clicks the next button .

How to close a ChatBox once the instance with the NPC has finished


cm.dispose(); //This command will close the NPC chat box once the command is over, make
sure this is added at the end of the code or else the user may have to log out and log back in before he/she talks to another NPC before he/she talks to another NPC .

Thats all I'm gonna teach. Will code for more the Server

THANKS TO THOSE WHO READ MY APPLICATION!
Back to top Go down
iepic




Posts : 12
Join date : 2010-08-15

Tiffany's Coding Guide Empty
PostSubject: Re: Tiffany's Coding Guide   Tiffany's Coding Guide EmptySun Aug 22, 2010 2:14 pm

thats not an application.....
thats.....a very very simple guide >.<
Back to top Go down
Tiffany




Posts : 6
Join date : 2010-08-22

Tiffany's Coding Guide Empty
PostSubject: Tiffany's Guide Reason   Tiffany's Coding Guide EmptySun Aug 22, 2010 2:44 pm

i can't post images :\ that's why i made a guide than pictures of it.
Back to top Go down
Sponsored content





Tiffany's Coding Guide Empty
PostSubject: Re: Tiffany's Coding Guide   Tiffany's Coding Guide Empty

Back to top Go down
 
Tiffany's Coding Guide
Back to top 
Page 1 of 1
 Similar topics
-
» Coding examples.
» Runtime Error Fixing Guide

Permissions in this forum:You cannot reply to topics in this forum
Brisbane MapleStory :: Coder's Application [OPEN]-
Jump to: