View Full Version : Ruby guide?
Monsoon
09-09-2009, 09:57 AM
I'd like to learn more about writing my own Lich scripts. Does anyone know of a good beginner's guide to Ruby that goes well with the Lich documentation (http://lichproject.com/wiki/Docs)?
SpiffyJr
09-09-2009, 10:39 AM
There isn't really a guide that goes with the Lich documentation because the Lich documentation contains custom definitions that only work with Lich. You could try http://lmgtfy.com/?q=Beginner+Ruby+Tutorial and use links 1-5 which I skimmed over and seem pretty relevant. A lot of those guides will have you doing basic stuff like outputting text using puts. If you want to output text in Lich you should use echo or respond instead.
For example:
# test.lic
echo 'Test';
> [test.lic] Test
# test.lic
respond 'Test';
> Test
You can see the difference. The only way to start learning Lich is just to jump in. Find something easy you want to do and then write a script to do it. Once you conquer a few of the simple things move on from there. Feel free to shoot me PM's if needed (or better yet post here so that everyone can benefit).
Alorn15
09-09-2009, 12:25 PM
"The Pickaxe Guide" is supposed to be the de facto standard book for learning ruby. It's technically called something else, but if you type 'the pickaxe guide' into Amazon or Google you'll get what you're looking for.
Having said that, it seems to be for programmers. In other words, I wouldn't recommend it if you don't already know another similar-level language.
DaCapn
09-10-2009, 04:39 AM
Writing a script in ruby?
(1) Learn by example off of someone else's scripts
(2) Go to http://www.google.com and search about what you're trying to do
(3) Go to the official ruby page http://www.ruby-lang.org/ and read their documentation
It doesn't matter what language you're writing anything in. Those are the most fundamental ways to get from A to B when using any programming language. In terms of lich-specific scripting, (1) will get you a lot of mileage (special functions built into modules imported by the lich ruby interpreter, how to call arguments, etc).
Reading tutorials doesn't get you anywhere when learning a language. When I was like 10 I tried to teach myself python by reading tutorials and it was totally worthless despite my efforts. I never learned python until I actually had python scripts I wanted to write and use for specific applications.
Samueljewelry
09-10-2009, 08:14 AM
You may read some books about ruby, then you will know more about the topic and feel more freely to write something about it.
http://chinajewelrygemstone.blog.com/wp-admin/upload.php
Monsoon
09-10-2009, 09:15 AM
Reading tutorials doesn't get you anywhere when learning a language. When I was like 10 I tried to teach myself python by reading tutorials and it was totally worthless despite my efforts.
Maybe because you were 10? :p
Cephalopod
09-10-2009, 10:54 AM
If you're just dabbling, it's kinda fun to play with:
http://tryruby.sophrinix.com/
The other guides already linked are a good start -- also, with anything Ruby, Google is your friend. There are millions of tutorials, although if you're doing this just for Lich you'd probably do best to avoid Ruby on Rails tutorials.
Fallen
09-10-2009, 11:16 AM
Best advice I can give for learning how to write scripts is take a look at a script you know well, and look carefully how it is written. Copy/Paste parts and see what they do, then just adapt the script as needed. No need to learn the language from the ground up, just take what you need and leave the rest to the hardcore coders.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.