Leon 55 Report post Posted June 15, 2007 Ok, if you guys have any questions, here is the place to ask them, and I will answer them. Share this post Link to post Share on other sites
Zambatoh 0 Report post Posted August 5, 2007 The requirements for the code are the following: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. Can you explain these instructions to me? I dont know what a call script is or what you meant by "(Don't forget the 'new'!)" Share this post Link to post Share on other sites
Leon 55 Report post Posted August 6, 2007 Call script means the final option on the last page of the event comands called 'Script'. As for the don't forget the '.new', that means that when you use the a class named Leon_Class, and it has the initialize method, to activate it, with the 'Script' option, use use: Leon_Class.new Doe;s that help you? Share this post Link to post Share on other sites
Zambatoh 0 Report post Posted August 9, 2007 I think so. I'm still pretty new at coding in general. :P EDIT: whoops I came across a no method error. I'm not really sure what that means. I created an NPC on my map and then I used the "Call Script" command on him when you try to talk to him. A window pops up "Printing" the 3 variables and then it says NoMethodError occurred while running script. undefined method `call for #<Interpreter:0x2275ed0> Can you tell me what went wrong? The script I used class Class_Test def initialize @variable1 = 1 @variable2 = 2 localVariable = 3 print localVariable method_2 end def method_2 print @variable1 print @variable2 end end Share this post Link to post Share on other sites
Leon 55 Report post Posted August 10, 2007 Check your Call Script command. make sure you didnt put in a ' in the box, because i used: Class_Test.new and it worked for me. Share this post Link to post Share on other sites
Zambatoh 0 Report post Posted August 11, 2007 Check your Call Script command. make sure you didnt put in a ' in the box, because i used:Class_Test.new and it worked for me. I didn't use the ' in the box. Although I did figure out the problem. In the call script command I accidentally typed "call Class_test.new". I deleted the word call and it worked fine ;) So does this mean I passed the first assignment? :lol: Share this post Link to post Share on other sites
Leon 55 Report post Posted August 11, 2007 Si. But, the second assignment will still be a while... I am working on a site to put all of this on. Share this post Link to post Share on other sites
Maph 0 Report post Posted January 7, 2008 Oi! I've written out the code for your first assignment, but I can't figure out how to actually run it to see if it works. Share this post Link to post Share on other sites
Leon 55 Report post Posted January 7, 2008 Oi! I've written out the code for your first assignment, but I can't figure out how to actually run it to see if it works. It has been a long time since i looked at the assignment, can you post the code here so i may see? Share this post Link to post Share on other sites
Maph 0 Report post Posted January 7, 2008 Certainly! class Class_test.new def initialize taco=5 @snickers=3 @cheese=4 p taco mod2 end def mod2 p @snickers p @ cheese end end Share this post Link to post Share on other sites
Leon 55 Report post Posted January 7, 2008 Certainly! class Class_test.new def initialize taco=5 @snickers=3 @cheese=4 p taco mod2 end def mod2 p @snickers p @ cheese end end Ok, first, you remove the '.new' from the end of the class name. Instead, you use that to call it. Speaking of which, to do so, you use the Script... Command in an event. (The third page, bottom right corner). There, you would use Class_test.new Then, walk up to the event and press enter. You should get: 5, 3, 4 in that order. Share this post Link to post Share on other sites
Maph 0 Report post Posted January 8, 2008 Ah thanks. I have experience in programming with python, and I've found that RGSS isn't so different. I just needed to know how to actually run the thing. By the way, right on for promoting good structure and commenting. I didn't comment in a little test like that, but I can vouch for how much time it can save you. Share this post Link to post Share on other sites