This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2010-12-13 15:57:32

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

gbear605 wrote:

type in ruby zork.exe
if that doesn't work type zork.exe
if that doesn't work type zork.rb
if that doesn't work, google it.

That opens up it in a text editor

Offline

 

#27 2010-12-13 15:59:23

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

ProgrammingFreak wrote:

into cmd of windows or like ruby.exe? (exe is the extension for Windows)

Could you save it as ruby.rb please, thank you.  You can edit it in a text-editor like notepad, and then save it as .rb if you want.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#28 2010-12-13 16:01:14

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

ProgrammingFreak wrote:

gbear605 wrote:

type in ruby zork.exe
if that doesn't work type zork.exe
if that doesn't work type zork.rb
if that doesn't work, google it.

That opens up it in a text editor

Did you try ruby zork.exe


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#29 2010-12-13 16:02:56

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

gbear605 wrote:

ProgrammingFreak wrote:

into cmd of windows or like ruby.exe? (exe is the extension for Windows)

Could you save it as ruby.rb please, thank you.  You can edit it in a text-editor like notepad, and then save it as .rb if you want.

change the Ruby interperter?

Offline

 

#30 2010-12-13 16:05:43

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

ProgrammingFreak wrote:

gbear605 wrote:

ProgrammingFreak wrote:

into cmd of windows or like ruby.exe? (exe is the extension for Windows)

Could you save it as ruby.rb please, thank you.  You can edit it in a text-editor like notepad, and then save it as .rb if you want.

change the Ruby interperter?

I mean the thing you downloaded.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#31 2010-12-13 16:09:37

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

got to go.  hmm
heres what I finished:

Code:

 if TypeOfMagic == "light"
    #light tutoring
    puts "You appear in a room that looks like it's on a cloud"
    puts "Hello #{name.capitalize}.  My name is #{Tutor}."
    puts "My job is to teach you #{TypeOfMagic} magic."
    puts "The mysterious thing about the light is that it"
    puts "is everywhere. The dark are afraid of it."
    puts "Unless their knoledge in magic is stronger."
    puts "What would you like to learn first?"
    puts "'Force' or 'spells'?"
    firstlesson = gets.chomp
if firstlesson == "force"
    puts "You have chosen #{firstlesson}"
if firstlesson == "spells"
else
   puts "I did not understand that."

Offline

 

#32 2010-12-13 16:13:56

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

Ok, from now on lets just post the code (the whole file) in a code box like you did before.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#33 2010-12-13 16:35:42

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

new:

Code:

#!/usr/bin/env ruby
#intro
puts "Welcome to Zork"
#puts "What version of zork would you like?"
#TypeOfZork = get.chomp
#if TypeOfZork ==  
puts "What is your name?"
name = gets.chomp
puts "Okay, so, your name is #{name.capitalize}." 
#going in
puts "You appear in front of a large tower.  There is a sign saying it is the 'Tower of Magic'"
puts "Options: 'enter'"
x = gets.chomp
if x == "enter"
    puts "You enter the building"
    #choosing a tutor
    puts "Two men appear.  One has a staff and is bald.  The other has a black goatee and black hair."
    puts "Options: 'bald wizard' or 'goatee wizard'"
    x = gets.chomp
    if x == "bald wizard"
        TypeOfMagic = "light" 
        Tutor = "Gunnar"
        puts "The bald wizard use his staff to make you teleport away."
        #choosing a kind of staff
        puts "You appear in a wooded area.  The wizard tells you to find a tree."
        puts "Options: 'willow', 'maple', or 'oak'"
        staffType = gets.chomp
        puts "You choose a #{staffType} staff."
    else    
        if x == "goatee wizard"
            TypeOfMagic = "dark"
            Tutor = "Krolax"
            puts "The wizard with the goatee teleports you away with just his hands."
        else
            puts "You typed something that wasn't an answer!" 
            TypeOfMagic = "Fail"
        end
    end
else
    puts "You typed something that wasn't an answer!" 
    TypeOfMagic = "Fail"
end
#end intro
#begin tutoring

if TypeOfMagic == "light"
    #light tutoring
    puts "You appear in a room that looks like it's on a cloud"
    puts "Hello #{name.capitalize}.  My name is #{Tutor}."
    puts "My job is to teach you #{TypeOfMagic} magic."
    puts "The mysterious thing about the light is that it"
    puts "is everywhere. The dark are afraid of it."
    puts "Unless their knowledge in magic is stronger."
    puts "What would you like to learn first?"
    puts "Options: 'force' or 'spells'?"
    firstlesson = gets.chomp
    if firstlesson != "force" || "spells"
        if firstlesson == "force"
            puts "You have chosen #{firstlesson}."
        else
            if firstlesson == "spells"
                puts "You have chosen #{firstlesson}."
            end
        end
    else
            puts "I did not understand that."
    end
else
    if TypeOfMagic == "dark"
        #dark tutoring
        puts "You appear in a room with stones on all sides."
        puts "Hello #{name.capitalize}.  My name is #{Tutor}."
        puts "My job is to teach you #{TypeOfMagic} magic."
        puts "#{Tutor} summons an imp."
        #some stuff about learning dark magic
    end
end


#You exit the tower.

#Adventure stuff

#During this time you meet your tutor some more and learn new stuff.
#That's it so far.

Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#34 2010-12-14 15:20:47

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

tell me where we are going with this!

Offline

 

#35 2010-12-14 15:28:28

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

ProgrammingFreak wrote:

tell me where we are going with this!

I think we should have some evil bad guy at the end.  I'll start making him.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#36 2010-12-14 15:31:46

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

We now will have the most recent code on the first post.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#37 2010-12-14 15:33:50

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

No I mean what are we going to do in the story?

Offline

 

#38 2010-12-14 15:37:06

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

ProgrammingFreak wrote:

No I mean what are we going to do in the story?

I think in general we will make up the story as we go along.  You can make it up if you want.  I fail at stories myself.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#39 2010-12-14 15:45:26

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

Code:

    
puts "Spells contain of one word"
                puts "such as 'Beloga'"
                puts "Suddenly fire appeared."
                puts "In battle these words will help."
                puts "Now you are ready for a lesson of the force."

put this after the  if firstlesson == "spells" puts "You have chosen #{firstlesson}."

Offline

 

#40 2010-12-14 15:51:15

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Zork.rb (ruby)

Heres the full text:

Code:

#!/usr/bin/env ruby
#intro
puts "Welcome to Zork"
#puts "What version of zork would you like?"
#TypeOfZork = get.chomp
#if TypeOfZork ==  
puts "What is your name?"
name = gets.chomp
puts "Okay, so, your name is #{name.capitalize}." 
#going in
puts "You appear in front of a large tower.  There is a sign saying it is the 'Tower of Magic'"
puts "Options: 'enter'"
x = gets.chomp
if x == "enter"
    puts "You enter the building"
    #choosing a tutor
    puts "Two men appear.  One has a staff and is bald.  The other has a black goatee and black hair."
    puts "Options: 'bald wizard' or 'goatee wizard'"
    x = gets.chomp
    if x == "bald wizard"
        TypeOfMagic = "light" 
        Tutor = "Gunnar"
        puts "The bald wizard use his staff to make you teleport away."
        #choosing a kind of staff
        puts "You appear in a wooded area.  The wizard tells you to find a tree."
        puts "Options: 'willow', 'maple', or 'oak'"
        staffType = gets.chomp
        puts "You choose a #{staffType} staff."
    else    
        if x == "goatee wizard"
            TypeOfMagic = "dark"
            Tutor = "Krolax"
            puts "The wizard with the goatee teleports you away with just his hands."
        else
            puts "You typed something that wasn't an answer!" 
            TypeOfMagic = "Fail"
        end
    end
else
    puts "You typed something that wasn't an answer!" 
    TypeOfMagic = "Fail"
end
#end intro
#begin tutoring

if TypeOfMagic == "light"
    #light tutoring
    puts "You appear in a room that looks like it's on a cloud"
    puts "Hello #{name.capitalize}.  My name is #{Tutor}."
    puts "My job is to teach you #{TypeOfMagic} magic."
    puts "The mysterious thing about the light is that it"
    puts "is everywhere. The dark are afraid of it."
    puts "Unless their knowledge in magic is stronger."
    puts "What would you like to learn first?"
    puts "Options: 'force' or 'spells'?"
    firstlesson = gets.chomp
    if firstlesson != "force" || "spells"
        if firstlesson == "force"
            puts "You have chosen #{firstlesson}."
            puts "The force is a strong element"
            puts "of magic. To use it, you must do so wisely."
            puts "Much destruction comes from one who uses the force foolishley."
            puts "To do the force, squeeze your hands (or for you from the other lands, type 'force')"
            puts "Practice:"
            prct = gets.chomp;
            if prct == "force"
            puts "Congratulations! You have used the force!"
            puts "The force has moved a bowl."
            end
        
        else
            if firstlesson == "spells"
                puts "You have chosen #{firstlesson}."
                puts "Spells contain of one word"
                puts "such as 'Beloga'"
                puts "Suddenly fire appeared."
                puts "In battle these words will help."
                puts "Now you are ready for a lesson of the force."
            end
            
        end
    else
            puts "I did not understand that."
    end
else
    if TypeOfMagic == "dark"
        #dark tutoring
        puts "You appear in a room with stones on all sides."
        puts "Hello #{name.capitalize}.  My name is #{Tutor}."
        puts "My job is to teach you #{TypeOfMagic} magic."
        puts "#{Tutor} summons an imp."
        #some stuff about learning dark magic
    end
end


#You exit the tower.

#Adventure stuff

#During this time you meet your tutor some more and learn new stuff.
#That's it so far.

Offline

 

#41 2010-12-14 16:11:57

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Zork.rb (ruby)

I put up a new version.  It contains a progress thing.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

Board footer