Author Topic: Help a new scripter our please.  (Read 5617 times)

0 Members and 2 Guests are viewing this topic.

Offline xeonon

  • Street Thug
  • *
  • Posts: 7
    • View Profile
Help a new scripter our please.
« on: January 08, 2009, 02:22:26 am »
Hey everyone. I most of the time run a server called Monopoly RPG, however I'm having troubles with scripts, I have no clue how to even start the frame of a script for a RPG, falcons rpg script has no instructions, could someone please give me a tutorial on how to script, for a VCMP server, not just a standard mIRC tutorial.

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Help a new scripter our please.
« Reply #1 on: January 11, 2009, 06:04:46 am »
Well first of all, you will need the following:
VCMP Server Software
VCMP Client Software
mIRC Software

When the VCMP Server Software is running, it enables other people to connect to your server.
(You may need to make some changes to other software for others to actually be able to connect to your server, such as opening ports in your router and firewall.)

The VCMP client server simply allows you to connect to another computer running the VCMP server software.

mIRC.
Designed for chatroom stuff, but thanks to it's amazing built-in scripting language features, it has the ability to send/receive data to other software such as the VCMP server software.



Scripting is based on events.  Events are simply things that happen.  A few examples of events are:
A player gets into a vehicle.
A player leaves a server.
A player types some text.
A player kills another player.

When certain events occur, the VCMP server software sends data to all the mIRCs connected to the VCMP server software.
mIRC receives that data, and depending on what that data is, mIRC will know which event just happened!
The VCMP server software also sends event-specific data to mIRC.
Such as if the event was "A player gets into a vehicle", the other data sent would be the ID of the player that got into the vehicle, and the ID of the vehicle that the player got in to.

So basically:
Event occurs in VCMP -> Inform mIRC of the event


mIRC will then read your script, and execute the code in it.

--

Lets say for example, I wanted to kick a player when they typed !kickme
Here is the code that should work with GUS 9.0

on *:SIGNAL:vcmp.command:{
  if ($2 == !kickme) vcmp.kick $1
}

So the first line is: on *:SIGNAL:vcmp.command:{
There are 3 parts to this line, each part is seperated by a colon.

First part: on *
The word "on" tells mIRC that the code is an event.
The * is something to do with the chatroom-side of mIRC, so don't worry about that.

Second part: SIGNAL
This word just tells mIRC that the event is a signal.
(This is needed because there are other types of events apart from Signals in mIRC.)

Third part: vcmp.command
This is simply the name of the Signal.
Different Signal names are used for different events.
For example, using GUS 9.0, the Signal name for a player spawning is: vcmp.spawn


The 2 brackets { and } simply surround code.
When the vcmp.command signal occurs, the code inside those curly brackets will be executed.


Now the line of code inside these curly brackets is: if ($2 == !kickme) vcmp.kick $1

This is a basic if statement.
A basic if statement works by comparing 2 values.
The 2 values in this if statement are "$2" and "!kickme"

$2 is an identifier.
The $ sign tells mIRC that it is an identifier.
The number to the right of the $ sign, tells mIRC which value to fetch.

Remember earlier I mentioned about the VCMP server software sending data to mIRC, and it also sends other data, such as the ID of the player and the ID of the vehicle?
Well this is how we fetch that other data.

When mIRC reads an identifier, it will replace it with it's actual value.

Inside the vcmp.command signal, here are the values sent to the signal:
$1 is the ID of the player who typed the command.
$2 is the command the player typed.
$3 is the first word the player typed after the command.
$4 is the second word the player typed after the command.
$3- is all the words the player typed after the command.


Now back to the if statement.
Remember what we originally wanted.  To kick the player if they typed !kickme
So we won't need to use $3, as we don't care what the player typed after the command.
We will need to use $2, because $2 contains the command that the player typed.
If the player didn't type !kickme, then we don't want the "vcmp.kick $1" code being executed

The if statement: if ($2 == !kickme)
is just like saying: if the player typed the command !kickme, then do some code

Now the code to do, is: vcmp.kick $1
Remember, $1 holds the ID of the player who typed the command
When mIRC reads "vcmp.kick $1" it will kick the player who has the ID $1 (if $1 holds the value 7, it will kick the player with ID 7)

So to sum it all up:
VCMP event happens in client (player types !kickme) -> VCMP client tells VCMP server what happened -> VCMP server tells mIRC what happened -> mIRC reads your script -> mIRC tells the VCMP server to kick the player

There's alot more to mIRC scripting than that ofcourse.

Anyway, hope it has helped you. :)


Edit:
If you want to know more about the features of mIRC scripting or the VCMP possibilites, just say so ;)
« Last Edit: January 11, 2009, 06:07:49 am by Mex »

Offline Jack_Bauer

  • Wiseguy
  • **
  • Posts: 58
  • GTA:MP Clan Revolution
    • View Profile
    • Battlefield Vice City
Re: Help a new scripter our please.
« Reply #2 on: January 11, 2009, 06:11:34 am »
* Jack_Bauer claps at Mex



Offline Faramir

  • Street Thug
  • *
  • Posts: 15
    • View Profile
Re: Help a new scripter our please.
« Reply #3 on: January 11, 2009, 11:42:50 pm »
Well i understood all that u explained right now....
can u explain more of them by examples???

u explain it far good then it were in earlier sections..   ;)

thanx  :)

Offline Mex

  • Wiseguy
  • **
  • Posts: 63
    • View Profile
Re: Help a new scripter our please.
« Reply #4 on: February 01, 2009, 02:35:53 am »
can u explain more of them by examples???

sure
what do you want me to explain?

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Help a new scripter our please.
« Reply #5 on: February 03, 2009, 09:34:25 am »
can u explain more of them by examples???

sure
what do you want me to explain?
    lol mex he wants you to explain everything heh!! :) Anyways the best way to learn is still the same isnt it ? Mex had told me only one thing: Read the script till you understand. Thats enough.
    And hey mex thanks for the great big huge nice post. :P

Chezor

Scripts: Fuel system in vehicles, Speedometer, Spawnback, Improved Copwork, Improved Jailing, Improved phone with sms, and many more. Coming soon..

Offline Anshul

  • Street Thug
  • *
  • Posts: 2
    • View Profile
Re: Help a new scripter our please.
« Reply #6 on: January 09, 2010, 06:16:58 pm »
And could you tell me where i could get these softwares (i've already installed mirc) and a tutorial on how to use them together to make them work ?

Thanx a lot for the information!

Offline thijn

  • LU testers
  • VC:MP Veteran
  • *
  • Posts: 667
  • Im proud to be pro.
    • View Profile
    • Vice Underdogs
Re: Help a new scripter our please.
« Reply #7 on: January 10, 2010, 01:29:36 am »
What software?
You mean scripts?
Try browsing the Scripts Showroom ;)