Author Topic: Basic Tutorial [Maybe helpful]  (Read 3785 times)

0 Members and 1 Guest are viewing this topic.

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Basic Tutorial [Maybe helpful]
« on: September 23, 2008, 09:24:54 pm »
Well after looking at poor beginners, i feel to share some basic knowledge. Im not good at explaining things but i really feel bad for beginners.. so a beginner tutorial wud be nice for them. So heres it, i would like to post..

Creating Alias

1] normal alias

alias vcmp.version !return v1.0
alias vcmp.<aliasname> !return <msg to return>

2] readini alias

alias vcmp.cash !return $iif($readini(vcmp.cash.ini,CASH,$vcmp.name($1)),$v1,0)
alias vcmp.<aliasname> !return $iif($readini(<filename>,<section-in-file>,$vcmp.name($1)),$v1,<else-to-return-if-readini=nothing>)


Commands

on *:SIGNAL:vcmp.command:{

if ($2 == !test) {
vcmp.say Testing Completed
}

elseif ($2 == !hello) || ($2 == !pmhello) {
vcmp.cmdsay $2 %id Hello Everyone
}

elseif ($2 == !test2) {
vcmp.msg %id Test 2 completed
}

else vcmp.msg %id Invalid Command.
}


Now in the commands give above:

Chezor: !test
Testing Completed
Chezor: !hello
Hello Everyone
Chezor: !pmhello
pm >> Hello Everyone
Chezor: !test2
pm >> Test 2 Completed
Chezor: !blablabla
pm >> Invalid Command.


A fill in the blank for beginner :P

elseif ($2 == !<command>) {
vcmp.say <Type here what it will message when command is typed>
}


Some Info

$1 == Server
$2 == Command
$3 == Word after command. Example: !command word.
$4 == Word after word. Example: !command word word2.
and so on

Working with INI

!writeini -n <filename> <SECTION> %name yes
for example !writeini -n vcmp.test.ini TEST %name yes
it will create file vcmp.test.ini
[TEST]
Chezor=yes

!remini -n <filename> <SECTION> %name
it will remove the name from file..
[TEST]


Extras

>= Greater than or equal to
<= Less than or equal to
== Equal to
!=  Does not equal to
<  Less than
>  Greater than


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

Offline Knucis

  • Wiseguy
  • **
  • Posts: 82
  • u wot m9
    • View Profile
Re: Basic Tutorial [Maybe helpful]
« Reply #1 on: September 24, 2008, 11:19:09 pm »
Nice tutorial Chezor ;) now i can "Understand" better some commands... (yes im a noob scripter :P)

Offline ReVilo

  • Wiseguy
  • **
  • Posts: 64
  • Master of All that is Holy
    • View Profile
Re: Basic Tutorial [Maybe helpful]
« Reply #2 on: September 25, 2008, 01:54:01 am »
You should specify what kind of script this works with, because alot of your information is only true to some scripts.
Btw, an alias doesn't need to start with "vcmp.", it can be anything.
Also your example for readini alias, is not really all that complete. The first example is fine as an exmaple, but the second you left "$vcmp.name($1))". You should specify what type of code should replace that because that's not always what will be used..

Offline Chezor

  • Wiseguy
  • **
  • Posts: 90
  • RPG Planet Scripter
    • View Profile
    • RPG Planet
Re: Basic Tutorial [Maybe helpful]
« Reply #3 on: September 25, 2008, 11:45:50 am »
You should specify what kind of script this works with, because alot of your information is only true to some scripts.
Btw, an alias doesn't need to start with "vcmp.", it can be anything.
Also your example for readini alias, is not really all that complete. The first example is fine as an exmaple, but the second you left "$vcmp.name($1))". You should specify what type of code should replace that because that's not always what will be used..

Yes it doesnt need to start with vcmp.
but this is only basic [based on GUS, i have learned everything from GUS]
trust me some people dont even know this much..

and yes you are right about that $vcmp.name($1)
But i have only given basic man..

!writeini -n vcmp.test.ini TEST %name yes

[TEST]
Chezor=yes


!remini -n vcmp.test.ini TEST %name

[TEST]



while readin ini  can be anything which we wrote in ini..
if i wrote the following
!writeini -n vcmp.test.ini TEST %name yes

the following read ini can be used..
($readini(vcmp.test.ini,TEST,%name) == yes)

if ($2 == !check) {
if ($readini(vcmp.test.ini,TEST,%name) == yes) vcmp.msg %id Theres some text in the test file
else {
vcmp.msg %id Theres no text in test file..
}
}




You should specify what type of code should replace that because that's not always what will be used..
yeah you r right..

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

Offline ReVilo

  • Wiseguy
  • **
  • Posts: 64
  • Master of All that is Holy
    • View Profile
Re: Basic Tutorial [Maybe helpful]
« Reply #4 on: September 25, 2008, 02:47:57 pm »
Ok that's fine man, it's just that in the first post you didn't say that it was based on GUS, thus that signal etc would be invalid