June 23, 2018, 12:32:42 am

Author Topic: How to start scripting in squirrel.  (Read 4704 times)

0 Members and 1 Guest are viewing this topic.

Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • *
  • Posts: 4148
  • Country: 00
    • View Profile
    • Awards
How to start scripting in squirrel.
« on: July 25, 2011, 03:46:17 pm »
Squirrel files are .nut files. They pretty much just text files and thus can be edited by any text editor, though the recommended one is notepad++

You can download it for free here: http://notepad-plus-plus.org/

Once you've downloaded and installed it download the Squirrel for Notepad++ language file. Extract the .zip and move the file userDefineLang.xml to Notepad++'s AppData directory.  
The AppData directory for Notepad++ is either:
C:\Users\your user\AppData\Roaming\Notepad++
or
C:\Users\your user\AppData\Notepad++
depending on the operating system.

When viewing a .nut file, if the program hasn't done it automatically go to the language tab at the top, click it and click Squirrel, which should be near the bottom.

Unlike PAWN, squirrel does not require compiling so you can just save the .nut file and run the server.

As a starting point I would recommend looking at this example: http://liberty-unleashed.co.uk/VCWiki/Scripting/Squirrel/Examples/SQLite

Reading through that a few times and trying it out yourself is one of the best ways to get familiarised with the syntax of both Squirrel and the in built SQLite features.

Another useful tool is the SQLite browser. This allows you to create and sort through your databases. It can be easier than always using the SQLite script functions.
« Last Edit: November 20, 2011, 07:50:07 pm by Cutton »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


CoLa_z0r

  • VW7 - Gas Monkey Garage
  • Crazy Man
  • *
  • Posts: 486
  • Country: kr
  • Agape z0r
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #1 on: July 26, 2011, 11:24:22 am »
Sorry for this post being totally irrelevant but...


hey,

is that my brother's voice I'm hearing through the internet??????????
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor





>VC:MP Since 2007.
>Founder & Leader of DU (2008~).
>Highest Spree: 90 (@LW) | Highest Score: 1100 Kills (@SvM), 341 Kills (@LW).

Crossfire|OutlawZ

  • Crazy Man
  • *****
  • Posts: 805
  • Country: 00
  • Wubba Lubba DUBB DUBBB BIAAAAATCH!!
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #2 on: July 26, 2011, 11:37:33 am »
Sorry for this post being totally irrelevant but...


hey,

is that my brother's voice I'm hearing through the internet??????????
yes its the

Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • *
  • Posts: 4148
  • Country: 00
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #3 on: July 26, 2011, 12:10:10 pm »
Sorry for this post being totally irrelevant but...


hey,

is that my brother's voice I'm hearing through the internet??????????

Indeed it is.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts


Knucis

  • Vice Underdog
  • Crazy Man
  • *
  • Posts: 1757
  • Country: pt
    • View Profile
    • Project Klaws
    • Awards
Re: How to start scripting in squirrel.
« Reply #4 on: July 26, 2011, 06:08:55 pm »
Well, the best way to start scripting, in my opinion, is, not only to download a simple gamemode and edit some stuff, but to actually try to make what the author did, in your own way. You will earn lots of logic through this.

A Good way to start:

  • Read lots of archives and tutorials - This is my opinion is VERY IMPORTANT. Use google for fuck sake.
  • Find functions on the wiki and test them - I believe that this is also very important, this helped me alot to comprehend LUA and Squirrel.
  • Make EVERYTHING YOURSELF - Obviously --', Try ALWAYS to make your own functions. Unless it's something mathematical and you don't understand it that well (for example Charley's direction function)
  • "ZOMG I HAZ ERROR PLS SCRIPTER HELP MI" - Don't do this. You won't learn if you are asking others to do your own code. If something isn't working, dont give up just yet! Try to fix it, read everything again. If it still doesn't work, rewrite the code again. IF IT STILL doesnt work THEN post it up and we'll see what's wrong.
  • Try to keep the code clean and simple - If you are learning how to script it is VERY USEFUL if you comment stuff on everything you do. For example: (A code I didn't test, but I am sure it will work LOL)
Code: [Select]
function PrintMessage()
{
       local Name = "Fred"; //My variable Name will return Fred!
       local Age = 1337; //My variable Age will return 1337, Damn he's old!
       print("My name is " + Name + " and I am " + Age); //This will print in my console the local variables I assigned :D
}
    Doing this will make your life 100000000000000000000x easier to understand.
.

Yey, I might add some moar stuff I dunno. But seriously the stuff I wrote here HELPED ME ALOT while I was learning LUA/Squirrel.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Thijn

  • Forum Administrator
  • Crazy Man
  • *
  • *
  • *
  • Posts: 2821
  • Country: nl
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #5 on: July 31, 2011, 02:03:04 pm »
Yey, I might add some moar stuff I dunno. But seriously the stuff I wrote here HELPED ME ALOT while I was learning LUA/Squirrel.
And you still suck *runs fast*
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

I'm not totally useless,
I can be used as an bad example ;)

"Never do Today, What you can do Tomorrow"



Knucis

  • Vice Underdog
  • Crazy Man
  • *
  • Posts: 1757
  • Country: pt
    • View Profile
    • Project Klaws
    • Awards
Re: How to start scripting in squirrel.
« Reply #6 on: July 31, 2011, 02:04:39 pm »
 :'(
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Deso

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1964
  • Country: bg
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #7 on: August 01, 2011, 06:28:14 pm »
Yey, I might add some moar stuff I dunno. But seriously the stuff I wrote here HELPED ME ALOT while I was learning LUA/Squirrel.
And you still suck *runs fast*

lol


Btw, thx for the tips. I might start learning scripting since I'm done exploring vc-mp (and it's getting boring...).
My whish is to make a server dedicated to the medieval ages. Where, like they are two territories.
There is a car with a pink market near it. You stand on the market and some constrols pop up to adjust the car at X, Y. Then you press a key to fire the car and the car launches it self to the enemy terrirory while been in flames. Something like a catapult.

That'll be awesome  :D
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor



aXXo

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • *
  • *
  • Posts: 2400
  • Country: in
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #8 on: August 01, 2011, 07:21:22 pm »
Btw, thx for the tips. I might start learning scripting since I'm done exploring vc-mp (and it's getting boring...).
My whish is to make a server dedicated to the medieval ages. Where, like they are two territories.
There is a car with a pink market near it. You stand on the market and some constrols pop up to adjust the car at X, Y. Then you press a key to fire the car and the car launches it self to the enemy terrirory while been in flames. Something like a catapult.

That'll be awesome  :D

Hmmm... ok..

Go to the enemy territory and throw a grenade?  ???
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor


Deso

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 1964
  • Country: bg
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #9 on: August 02, 2011, 06:25:25 am »
Btw, thx for the tips. I might start learning scripting since I'm done exploring vc-mp (and it's getting boring...).
My whish is to make a server dedicated to the medieval ages. Where, like they are two territories.
There is a car with a pink market near it. You stand on the market and some constrols pop up to adjust the car at X, Y. Then you press a key to fire the car and the car launches it self to the enemy terrirory while been in flames. Something like a catapult.

That'll be awesome  :D

Hmmm... ok..

Go to the enemy territory and throw a grenade?  ???

No no no, no modern weapons.......

Smth like Knights vs Samurais. The Samurai's weapons could be katanas and........ I dunno if you'll agree, but python as a bow? :D Their will be only 4 players with a "bow", standing on a wall or smth.
The Knight's weapons could be Machete and again - 4 players with a python.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor



Skirmant

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • Posts: 676
  • Country: il
  • Ignorance is bliss.
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #10 on: November 19, 2011, 08:08:13 pm »
I don't want to be hatin' on WindLord, or anything. But after spending 20 minutes watching these tutorials, I consumed very little information and became rather depressed. The video was rather slow and a bit uncoordinated. I also find it weird that he started of these tutorials with stuff like structures, why not start with the basics of the syntax and variables?
« Last Edit: November 19, 2011, 08:10:35 pm by Skirmant »
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

"C++ is a horrible language" - Linus Torvalds, creator of Linux

Quote
<SLC> nope. changed my mind. squirrel still sux dix
<SLC> it's just a piece of sh!t
* SLC has quit (Connection closed)

Charley

  • Vice Underdog
  • Crazy Man
  • *
  • *
  • *
  • Posts: 4148
  • Country: 00
    • View Profile
    • Awards
Re: How to start scripting in squirrel.
« Reply #11 on: November 20, 2011, 07:49:09 pm »
Actually I agree, I first watched Windlord's first video when I had already written the script for XE and most of it was new to me. The videos aren't a good starting point for learning how things work, they're better to look at after you've learnt to see why things work.

I'll remove them from the first post.
Agree Disagree Funny Winner Pwnt Informative Friendly Useful Optimistic Artistic Late Brain Donor

Writer of excessively long posts