School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 300,371 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,457 people online right now. Registration is fast and FREE... Join Now!




Text Adventure

 

Text Adventure

IceCastle

19 Jan, 2009 - 10:12 PM
Post #1

New D.I.C Head
*

Joined: 19 Jan, 2009
Posts: 3


My Contributions
Hi. I have recently been trying to learn ruby, and I have made a few simple programs. My main reason for learning Ruby is mostly just for fun, and I'm also interested in making games. I thought a good place to start might be to try making a simple text adventure. I couldn't really find anything useful on the internet, and I don't know where to start, so any help with getting started would be greatly appreciated. Since I want to add RPG elements I also want to include a variable for lighting for first strikes.

User is offlineProfile CardPM
+Quote Post


IceCastle

RE: Text Adventure

22 Jan, 2009 - 04:44 AM
Post #2

New D.I.C Head
*

Joined: 19 Jan, 2009
Posts: 3


My Contributions
I started the text adventure with a script I found on the internet that I'm using for now, since I couldn't make my own. Now I need to know how to name my charters with "gets", and make a 'party', and 'reserve' system. I'm not sure how far I'll get when I get to the even more complicated things, but I'd still like to try. I tried a few things for the naming, like:
CODE

def
if party < 3
party[] = gets.chomp
puts 'added new party member'
else if reserve < 3
reserve[] = gets.chomp
puts 'added new reserve member'
else
puts 'Your party, and reserve is full'
end

but once they're in a 'party' array, I don't know how to initialize them.
I also don't know how to implement a light variable. ex.
CODE

area_light.to_i += player_light_source.to_i

if area_light.to_i < leader_eyesight/reflexes.to_i  -= randomly_generated_number
enemy_first_strike

User is offlineProfile CardPM
+Quote Post

eflix

RE: Text Adventure

28 Jan, 2009 - 04:01 AM
Post #3

New D.I.C Head
*

Joined: 22 Jan, 2009
Posts: 6



Thanked: 1 times
My Contributions
QUOTE(IceCastle @ 22 Jan, 2009 - 04:44 AM) *

I started the text adventure with a script I found on the internet that I'm using for now, since I couldn't make my own. Now I need to know how to name my charters with "gets", and make a 'party', and 'reserve' system. I'm not sure how far I'll get when I get to the even more complicated things, but I'd still like to try. I tried a few things for the naming, like:
CODE

def
if party < 3
party[] = gets.chomp
puts 'added new party member'
else if reserve < 3
reserve[] = gets.chomp
puts 'added new reserve member'
else
puts 'Your party, and reserve is full'
end

but once they're in a 'party' array, I don't know how to initialize them.
I also don't know how to implement a light variable. ex.
CODE

area_light.to_i += player_light_source.to_i

if area_light.to_i < leader_eyesight/reflexes.to_i  -= randomly_generated_number
enemy_first_strike



Sounds like an interesting project! Perhaps it may be easier to implement if you think those entities you mentioned (party, character, reserve, etc.) as objects, and their names, strength and so on as attributes.
You may want to check this online book because there's a little text adventure game in their pages that you can get some ideas from.
Good luck!

User is offlineProfile CardPM
+Quote Post

IceCastle

RE: Text Adventure

7 Feb, 2009 - 04:12 PM
Post #4

New D.I.C Head
*

Joined: 19 Jan, 2009
Posts: 3


My Contributions
Okay, I'll look through it then.

Thanks for the reply.
User is offlineProfile CardPM
+Quote Post

Huw

RE: Text Adventure

11 Mar, 2009 - 01:23 PM
Post #5

New D.I.C Head
*

Joined: 19 Nov, 2006
Posts: 3


My Contributions
Here are links to a tutorial I wrote about creating text adventures in Ruby:

http://www.bitwisemag.com/2/Adventures-In-Ruby
http://www.bitwisemag.com/2/Adventures-In-Ruby-Part-2
http://www.bitwisemag.com/2/Adventures-In-Ruby-Part-3

You will also find some relevant info and tips (on data structures etc.) in The Book Of Ruby, which is a free eBook in 20 chapters which I also wrote:

http://www.sapphiresteel.com/The-Book-Of-Ruby

best wishes
Huw
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/7/09 09:11PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month