View Full Version : n00b: Using gems in lich
Hyperjetta
01-27-2011, 01:57 AM
Ok, so I am pretty new to ruby in general. And I'm brand new to lich. I didn't see anything in the forums or the wiki about Ruby Gems so my question is two-fold:
1) Is it possible to use Gems in lich?
and
2) Where is a good place to get not only the API info, but info on built-in classes like Spellsong?
Joseph
01-27-2011, 04:43 AM
2) Where is a good place to get not only the API info, but info on built-in classes like Spellsong?
The best way to get info about any 'lich' built-in functionality is to open the lich.rb file with your favorite editor and search (in this case search for 'class Spellsong' and start reading from there.)
Hyperjetta
01-27-2011, 09:59 AM
Thanks for the info, I'm not sure why I didn't think to look there...but while I'm feeling rather stupid...heres another question.
Is there a way to get lich to run under ruby 1.9.2?
I'm pretty sure I'm doing this wrong, but anytime I install any version of ruby NOT provided on the lichproject webpage i'm getting nada. Is this a custom ruby install?
Tillmen
01-27-2011, 11:16 AM
Is there a way to get lich to run under ruby 1.9.2?
I'm pretty sure I'm doing this wrong, but anytime I install any version of ruby NOT provided on the lichproject webpage i'm getting nada. Is this a custom ruby install?
Lich should work with almost any version of Ruby. The problem is, Lich is unable to show any windows unless ruby-gtk bindings are installed. It can still work without showing any windows, but that's probably not what you want.
The ruby-gtk bindings installer sucks, and caused enough problems that I had to repackage it.
Some problems you might run into: ruby-gtk bindings compiled for Ruby 1.8 will not work on Ruby 1.9. Ruby may have to be installed to its installer's default location (c:\ruby). A separate install of GTK will likely conflict with the version Lich will try to use. Probably some other stuff I forgot about.
At some point I attempted to make an installer for Ruby 1.9.1 on Windows. Apparently, Ruby 1.9.1 is very slow on Windows. There was some issue where Ruby was using a robust (slow) string transformation on every line that came in from Simu, when all it wanted to do was change the line returns. I have no idea if this was fixed in Ruby 1.9.2.
Of course, none of this matters on Linux. Ruby 1.9 is supposed to be about twice as fast as Ruby 1.8, and you should only need to do something along the lines of sudo apt-get install ruby-gnome2
Hyperjetta
01-27-2011, 02:05 PM
Ok, thanks Tillmen for clearing that up.
I just recently started using ruby to develop web based applications via rails and was hoping I could somehow get all these things to play nicely on my windows machine. I have a few script ideas I'd like to try out but the easy way in getting them running requires a few gem I'd need to install.
Is there no way then to install any other gems to this ruby package?
I'm starting to think I'm getting in a little over my head. I don't have any experience with gtk so that part of it is shrouded in mystery.
Thanks again for putting up with my ignorance :P
Tillmen
01-27-2011, 05:43 PM
Using gems in a Lich script is the same as using them in any Ruby script, except that the Lich script will have to be trusted to access the arbitrary files. Here's how to do it for a mysql gem...
In a Windows command prompt and type:
gem install mysql
In Stormfront or WizardFE:
;trust <scriptname>
In the Lich script:
require 'rubygems'
require 'mysql'
Blushy
01-27-2011, 06:28 PM
Of course, none of this matters on Linux. Ruby 1.9 is supposed to be about twice as fast as Ruby 1.8, and you should only need to do something along the lines of sudo apt-get install ruby-gnome2
Unless you have an ATI video card. The speed bottleneck for me is the rate at which Wine renders the SF window with my pathetically undersupported video card. Lich with Ruby 1.8 totally outperforms my graphical response, which sucks.
Tillmen
01-27-2011, 06:31 PM
Unless you have an ATI video card. The speed bottleneck for me is the rate at which Wine renders the SF window with my pathetically undersupported video card. Lich with Ruby 1.8 totally outperforms my graphical response, which sucks.
That has more to do with Stormfront than your graphics card. You should be using the WizardFE on Linux.
Hyperjetta
01-27-2011, 08:31 PM
Ok, so I tried that. starting with a fresh install of the ruby package on lichproject.org and an unaltered lich.rbw, I updated the rubygems to the latest version and installed the gem via cmd.
I added the appropriate lines in lich.rbw to require them
now when I run lich.rbw nothing happens. If I comment out the require statements it works fine. any ideas?
Tillmen
01-27-2011, 08:34 PM
You shouldn't have to make any changes to lich.rbw. The require statements should be added to whatever script you're writing. It probably still won't work, but you should at least get an error message telling you why.
Blushy
01-27-2011, 08:46 PM
That has more to do with Stormfront than your graphics card. You should be using the WizardFE on Linux.
Are you sure? Firefox groans when it resizes images, and even native Linux games (like UFOAI) limp along and are nigh-unplayable. Does SF require a lot of graphics acceleration tricks that the Wizard doesn't?
Hyperjetta
01-27-2011, 10:40 PM
ok, so updated rubygems to 1.3.6 and created a script that does nothing other than
require 'rubygems'
require 'mysql'
and i get this when i run that script within stormfront:
Exception: can't convert Array into String
C:/Program Files/Ruby-1.8.6/lib/ruby/gems/1.8/gems/rack-1.2.1/lib/rack/utils.rb:138:in `union'
Hyperjetta
01-27-2011, 11:27 PM
after playing around a bit I think I've come to the conclusion that these gems all want ruby 1.9.x...which stinks haha.
I'm looking at the documentation for GTK and it looks daunting...guess I'll just stick to simpler stuff for now.
Are there any plans to update lich to the newer version of ruby?
Joseph
01-29-2011, 03:47 AM
to save you some search time I would recommend looking into rvm ruby version manager, although I am not sure if there is a working build for windows.
DaCapn
02-02-2011, 05:11 AM
Are you sure? Firefox groans when it resizes images, and even native Linux games (like UFOAI) limp along and are nigh-unplayable. Does SF require a lot of graphics acceleration tricks that the Wizard doesn't?
SF uses DirectX which is an API written by Microsoft. Anything like that running on a Linux system is a feat of reverse engineering and your results may vary. To be fair, I haven't played anything since Portal like 2-3 years ago but in the years leading up, I've seen nothing but improvements. Definitely never had issues on anything native.
I definitely had problems on ATI cards like 10-some years ago before ATI started writing drivers for the Linux kernel but that's really it. ATI has come a long way since. It sounds like you don't even have the proper driver installed. Windows would behave the exact same way under similar conditions.
Blushy
02-02-2011, 01:24 PM
I am lucky enough to have a Mobility Radeon X2300; more or less none of its acceleration features are supported by the xorg driver, and fglrx hasn't worked since, what, Hardy Heron? I am basically bwned. I guess I can give the Wizard a try, but I remember it lacking some nice features of SF, like the room window automatically updating without having to do a "look".
DaCapn
02-03-2011, 01:32 AM
I am lucky enough to have a Mobility Radeon X2300; more or less none of its acceleration features are supported by the xorg driver, and fglrx hasn't worked since, what, Hardy Heron? I am basically bwned. I guess I can give the Wizard a try, but I remember it lacking some nice features of SF, like the room window automatically updating without having to do a "look".
Try using a driver actually released by ATI.
You are kind of in the worst possible case scenario for hardware support. ATI has middling support for Linux and laptop hardware is ridiculous with custom boards and all of the integrated or specially designed cards. But hey, there was a time when ATI did not write drivers at all for Linux.
Blushy
02-03-2011, 05:23 AM
Try using a driver actually released by ATI.
Like I said, fglrx hasn't worked since spring of 2009.
You are kind of in the worst possible case scenario for hardware support. ATI has middling support for Linux and laptop hardware is ridiculous with custom boards and all of the integrated or specially designed cards. But hey, there was a time when ATI did not write drivers at all for Linux.
Yeah. I have a weird older laptop, too; it's an HP "business" model, which I chose because they keyboard was comfortable and it wasn't a "widescreen"; I got it mainly for work (word processing, text editing), so performance wasn't much of a consideration. I never dreamed I'd have issues playing a text-based game with it. I've been seriously considering getting the cheapest imaginable netbook and leaving Windows on it just for GS.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.