Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
Sign in to follow this  
Ramenuzumaki

Ramen's Assignment

Recommended Posts

Well here is my assignment! :3 First is the vocabulary!

 

Vocabulary:

method - is a piece of script that triggers when it is called

class - is a collection of methods that all work together for a single purpose

$global_variable - is a variable used anywhere

print - pops up whatever is after it in a window

@@class_variable - is a variable that is usable throughout the entire class. It is a type of variable that is shared among the instance of a class, and must be initialized to a value before it is used.

Constant_Variable - is a variable exclusive to a class or method that can never change.

 

Script Assignment:

#Assignment for Leon's Script Class. Assignment 1.
#Requirements:
=begin
   * Make a working class that is called in a 'Call Script' named 'Class_Test' 
   (Don't forget the 'new'!)
   * In the class, there needs to be two methods: initialize and one of any 
   name you wish.
   * In the initialization, define 1 local variable and 2 instance variables, 
   and print hte local variable.
   * In the second method, print the other two instance variables.
=end

class Class_Test #Class name
 def initialize #Initialize method
 @MySkill=1 #local_variable
 @MyUnderstanding=2 #instance_variable
 @LeonPowerLevel=9532 #instance_variable
 print @MySkill #Print local_variable
 printmethod #Name of second method
 end #End Initialize Method

 def printmethod #Second method
 p @MyUnderstanding #Print instance_variable 1
 p @LeonPowerLevel #Print instance_variable 2
 end #End pringmethod Method, yay redundancy?
end #End class

 

Not sure if I was supposed to PM, or e-mail this to Leon or what not so I'm going to do like Kiriashi and post my own little thead. Not sure if I did this right. I added some comments in there to help myself keep organized. I'm not sure if i fully understand the difference between an instance_ and a local_variable. I understand the definition, but not how to spot them. Is a local_variable just not called/used in any other methods, but one?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...