-
Content Count
1,023 -
Joined
-
Last visited
-
Days Won
26
Content Type
Profiles
Forums
Blogs
Downloads
Calendar
Gallery
Everything posted by kellessdee
-
ruby Learning Ruby -- Master Topic
kellessdee replied to kellessdee's topic in Programming & Web Development
Haha, no worries. When I tried looking for them to repost it took me a bit to find them... xD and I wrote this lol. -
What's a retry script? I have never heard of wortana's retry script..... http://www.rmxpunlimited.net/forums/topic/7166-script-request-guidlines/
-
You have an extra end on your case statement: case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end end unmatched ends are usually the hardest of errors to find. well, of syntax errors anyways
- 2 replies
-
- scripting
- rpgmaker xp
-
(and 1 more)
Tagged with:
-
Best commercial EVER (and it's weetabix, just for you mark) http://youtu.be/2YpOw8o34BM
-
:o I'm digging the new detailed work (well, I'm diggin it allll!!). The minimalism/simplicity, balanced with the intricate details adds a new layer of depth to it. KEEP IT UP MADANCHI :D
- 12 replies
-
- new game
- innovative
-
(and 7 more)
Tagged with:
-
I think the fact that you love FLCL is interesting enough for me :D FLCL is AMAZING. And I think, as long as you have fun and enjoy using the maker, you should stick to it. People always try to say how "limited" it is, but I disagree. Sure, it has certain limits, but in the grand scheme of things, I think it can be very, VERY powerful. With or without scripting. And of course, welcome...officially! Hope you enjoy your time here :)
-
Burning CDs/DVDs is the exact same process, so as long as you have: 1. DVD burner 2. Blank DVD This should work.
-
So you are currently running windows xp? Let's leave this burning software behind for a moment. Apparently Windows XP also has built-in burning capabilities. (it's been a while lol) Instructions from http://support.microsoft.com/kb/306524 for windows XP EDIT: Although, I have no idea why none of those programs you mentioned work.... Do you have a CD/DVD drive, with writing/burning capabilities? If you don't have a CD/DVD burner, it's not gonna work, no matter what software you get.
-
ruby Learning Ruby -- Master Topic
kellessdee replied to kellessdee's topic in Programming & Web Development
Are you asking about this week's challenges? Or Last Week's? Or was that joke to imply they weren't challenging enough? lol Although, in this topic they may be harder to find, considering it's all buried. If you use my blog, it's probably easier to read through. Last week's challenges were in Lesson 4, and this week's are in Lesson 6. (I just realized, it took me a bit to find them in my own topic xD) So here ya go. You are probably ahead of these lessons Bigace, but I think working out a word problem is always good practice. So if you, or anyone is looking for more challenges (or harder ones) let me know. I got a lot lying around I could put to use :3 Also, I am not sure if I have said this before, but: If ANYONE feels like the current explanation of something or lesson is lacking (meaning, you still don't get what I am trying to say or I just sucked at explaining or whichever way you think it might be lacking) PLEASE LET ME KNOW. I want to create a beginner-friendly (so non-programmer) tutorial to work with, while still allowing them to learn exactly what they are doing. I notice, that *MOST* of the time, when someone teaches a language (online or offline) they tend to do a good job of teach one what to do or how to do something...but ALWAYS fail to teach WHY or what is REALLY happening when you do that. I believe, that to become REALLY good or master a language, one needs to know how it works. And, I found that the main difficulty people I've met have had with programming, is that they don't know why they're doing these things, so it doesn't stick; and causes later problems. I mean, ruby is open source, and one could say "Oh, if you wanna know -- just read the source code!" But, that doesn't benefit those just learning the language, or especially not those who have no previous programming knowledge. I think most teachers fail to recognize the fact that knowing how a language really works is just as important as knowing how to use it. EVEN for those just beginning, if not moreso! Whoa, that rant was not orginally intended to be so rant-y xD HERE's the challenges lol. Last Week's Challenges: This Week's Challenges: -
Quick Scripting Problem with an amazing CASH PRIZE
kellessdee replied to Elvshire's question in Support
Oh, LOL. Bigace ftw! I am not familiar with any of these custom scripts. Good thing someone is! xD -
ah thanks guys :3 However, it seems no one likes the other kellessdee :o @bigace: bahaha yes, that made me LOL @bob: i'm your cat >:D
-
Nero won't burn it? Are you getting any errors or any specific messages? Make sure you burn as a data disc, and just open the CD/DVD on the other pc. Which version of Windows do you have? If Nero doesn't burn it, I believe Windows Vista/7 has built-in software for burning CD/DVDs... you could always try that!
-
HOLY CRAP HOLY CRAP O_O
-
Upon reading it, my mind was split into 2 separate entities, shortly after both minds were blown into obscurity. True story bro
- Show next comments 27 more
-
Welcome! Bob is right, this is a great place to start. I hope you enjoy your time here, and hope you stick around :) Don't hesitate to ask if you have any questions or concerns.
-
Quick Scripting Problem with an amazing CASH PRIZE
kellessdee replied to Elvshire's question in Support
I never laugh at the simplicity of ANYONE's problems. We all gotta start somewhere don't we? (besides, you're already half way there!) :D Anyways, I'll tell you how to do this. But I require ONE SINGLE CONDITION.....and that is you don't give me money. So, first off, this won't be the most efficient way to solve this...however, it will be the simplest, and it will be easiest to implement. Now, I can't promise this will work right away -- it will depend on whether/how any other scripts you have might affect the Window_Item class. Anyways, try this on for size (add below all other scripts): class Window_Item < Window_Selectable # ========================= # Image Name Configuration # ========================= BG_IMG = "filename" # Set to the name of picture, in pictures folder alias :new_init_bg :initialize unless method_defined? :new_init_bg def initialize new_init_bg if $game_temp.in_battle @background_sprite = Sprite.new @background_sprite.bitmap = RPG::Cache.picture(BG_IMG) @background_sprite.x, @background_sprite.y = self.x, self.y self.opacity = 0 end end # Just in case the window gets repositioned # these methods will trigger the background image # to move with it def x=(x) super if @background_sprite @background_sprite.x = x end end def y=(y) super if @background_sprite @background_sprite.y = y end end # Dispose background when window is disposed def dispose super if @background_sprite @background_sprite.dispose end end end Just change BG_IMG = "filename" to the filename of the background you would like to use. (MUST be in quotations " ", the file extension (.bmp/.png/etc) is not necessary though.) Lemme know if that works, and works the way you want it. This *SHOULD* work in a default script environment, but I can't guarantee its behaviour with custom scripts (should still be okay though) Some tweaking may be required in terms of size -- though if your background image is the same size as the battle item window, then it should be okay. -
[GDU]One step forward, two steps backwards
kellessdee commented on Marked's blog entry in RMU Development Blog
Oh dear, I hate when these kinds of things happen q_q Good luck :D -
ruby Learning Ruby -- Master Topic
kellessdee replied to kellessdee's topic in Programming & Web Development
Added 2 new lessons: - Lessons 5: Intro to boolean Logic - Lessons 6: Flow Control - Decision Making Will hopefully be adding: - Solutions to last week's challenges - Intro to the Ruby Interpreter - Coding Convention Later today. -
Lesson 6: Flow Control - Decision Making In the previous lesson, I taught you about boolean logic. Hopefully, you have a good basis to the concept. This lesson will actually put that logic to good, practical use. This lesson is the first part in the series on Flow Control. Now, for the obligatory "What is flow control...?" At this point, all your programs have had a very basic flow, just execute each line, one by one. However, when you start making real applications/programs, you'll find that this one directional program flow is too simple for your application. This is where flow control comes in, we want to be able to control the flow of the program. The most basic form of flow control is decision making. In programming, decision making is possible through the use of `if` statements. An if statement is what we use to make our boolean expressions do something. "if this, then do that." So, in ruby... if <condition> # What we want to do end where <condition> is an expression. note that an if statement must be closed with the "end" keyword. The code we embed within the "if clause" or "if statement" is tabbed, or by ruby's conventions, 2 spaces from the left margin. This is not necessary for the code to run, but as a coding convention this makes your code much easier to read and understand. What happens when the Ruby interpreter reaches an if statement? The interpreter will first evaluate <condition>, if <condition> evaluates to true, the code inside the statement will be executed. If the <condition> is false, the code inside the statement will be ignored, and the interpreter will continue from the line with "end" What about this? if 1 puts "1 is true" end If you were to run this code, the output would be: 1 is true But why? 1 is not a boolean! Well, this is because of how ruby handles boolean expressions. When the interpreter gets to the "if ..." it assumes the expression to be a boolean expression, and with ruby, anything except nil and false is interpreted as true, and nil and false interpreted as false. So, when the interpreter gets to "if 1", it evaluates the expression, in this case 1 returns 1, and since the value is not nil and not false (1), the code within the if statement is executed. So, let's try an example. I want you to create a script this time, call it "age.rb" So let's do some decision handling. We are going to make a program that takes the user's age, and tells them if they can buy alcohol. In Canada, where I live, you need to be 19 or older. You can incorporate your local age limit for drinking into the program if you'd like. # Prompt the user to enter their age # we use print as that does not append a new line character print ("Enter your age: ") # Now we should get the users age # and convert to an integer: age = gets.to_i # Lets see if the user is old enough if (age >= 19) # They are of age! puts ("You are old enough to buy alcohol.") end So, why not try it out! ruby age.rb Upon running your script, you will notice, unless you enter 19 or greater, the script will just end. Only if you enter age greater than or equal to 19, you will get "You are old enough to buy alcohol." Well, we should let the user know if they aren't old enough to buy alcohol as well...and hey, why not let them know how many more years until they can? The next part of the "if" statement, is the "else" clause. if <condition> # Code if condition true else # Code if condition not true end The block of code in the "else" clause will only be executed if the original block or any other block within the if statement is NOT executed. In this case, if the <condition> is false, the first block will not be executed. Because of this, the second block under "else" will be executed instead. if (age >= 19) # They are of age! puts ("You are old enough to buy alcohol.") else # They are not of age! years_left = 19 - age # How many years until they can buy alcohol puts ("You are not old enough. Come back in #{years_left} years!") end If you add that to your age.rb script, you will notice if you enter an age less than 19, the program will print out "You are not old enough. Come back in X years!" So now, you can test a value, and can act based upon whether or not that test is true. But, what if we want to act depending on several possibilities? This is where "elsif" come into play. The "elsif" clause allows us to create multi-sided responses, based on multiple conditions. if <condition> # Code elsif <condition> # Code else # Code end The ruby interpreter will first enter the if statement at "if <condition>," if that condition is true, it will execute the following block of code, then jump to the "end." If that condition is false, the interpreter will then move to the first "elsif <condition>." If that condition is true, the interpreter will execute the block of code within the elsif clause, then jump to the "end." If false, the interpreter will continuously check any following "elsif" and if none are true, finally the "else" block will be executed instead. So, this means you could have any arbitrary number of elsifs: if <condition> # Code elsif <condition> # Code elsif <condition> # Code elsif <condition> # Code else # Code end With the if statement, you can have as many elsif clauses as you'd like, however you can only have ONE if clause, and ONE else clause. You should also know, that the else clause is optional, whereas the if clause is NOT optional Be careful, if you have programmed in other languages, you may notice that the "elsif" equivalent may be represented differently, ex. else if © or elif (python), in ruby it is "elsif" So, why might you need to test multiple conditions? Well, let's try this example: Let's pretend we want to make a guessing game. The Game will have a set number, and the user will try to guess which number is set. If they guess too low, the program will say: "Too low!" and if the number is too high, the program will say: "Too high!", and if the number is equal, the computer will say "Wow! You got it!" We will not be making this guessing game fully functional just yet, in a real guessing game, you'd want the number to be different each time, and probably want the program to run until the user quits. We will finish this game in later lessons So, how would we do this? # Set a number to guess number = 10 # Prompt the user to guess what number it is: print ("I am thinking of a number. What is it? ") # Get the guess guess = gets.to_i if guess < number puts ("Too low!") elsif guess > number puts ("Too high!") else puts ("Wow! You got it!") end Try putting this in a script called "guessinggame.rb" and running it. As you may have noticed, the if statement could have also been written like this: if guess < number elsif guess > number elsif guess == number end This would work exactly the same. However, I chose to catch that in an else clause, as we know that if guess is NOT less than number, and NOT greater than number, it HAS to be equal to number. So, it would be more efficient to group that code under an else clause. In order to determine whether to execute a block under an if/elsif, the interpreter has to execute and evaluate the condition. With else, that condition is not executed, saving us some CPU processing. Let's try another example. Let's make a program that gets the current month as a number, and prints out the English name of that month. # Get month: prints ("Please enter the current month as a number: ") month = gets.to_i if month == 1 puts ("January") elsif month == 2 puts ("February") elsif month == 3 puts ("March") elsif month == 4 puts ("April") elsif month == 5 puts ("May") elsif month == 6 puts ("June") elsif month == 7 puts ("July") elsif month == 8 puts ("August") elsif month == 9 puts ("September") elsif month == 10 puts ("October") elsif month == 11 puts ("November") elsif month == 12 puts ("December") end Whew, that was a lot of work. It works, but that seems like an awful a lot for a simple translation. As you can see, in some cases you may want to test for a specific value, and each value could represent something specific. Well, thankfully, ruby has a much more elegant way of doing this, with "switch" or "case" statements. case <variable> when value then #code when value then #code when value then #code else #code end So how does this work? The case statement takes <variable> then tests that variable against each value, testing if they are equal to each other. The first value that matches, it's corresponding code is executed. You can have an arbitrary number of when clauses, and else works exactly like in if. If no other values are equal to <variable> then else will be executed. Like in the if statements, else is optional here as well. The "then" part of "when value then" is optional, as long as you have the block of code on a new line. when value # Code must be here However, with the "then" portion, you can actually put the block on the same line: when value then # Code could be here Also, I would like to point out that the "else" portion SHOULD NEVER have a "then," if you want to put the else block on the same line, use a semi-colon (;) (ruby interprets this as a line terminator) else; # Code could be here So, lets fix our nasty if statement: case month when 1 then puts ("January") when 2 then puts ("February") when 3 then puts ("March") when 4 then puts ("April") when 5 then puts ("May") when 6 then puts ("June") when 7 then puts ("July") when 8 then puts ("August") when 9 then puts ("September") when 10 then puts ("October") when 11 then puts ("November") when 12 then puts ("December") end Well, that looks much neater. It's still long, but neater and a little less typing. However, I feel that the output is too "hard coded." What if later, we decide we want to put the month into a variable, for later usage? We'd have to change each "puts" to "variable =." With modern IDEs, this would be a simple task, but still unnecessary. One major rule of the ruby community (or even any programming community) is "Don't Repeat Yourself", and I feel both "puts" or "variable =" that many times, is repeating yourself. Conveniently, we can get around this. Remember how everything in ruby is an object? And every expression returns an object? Well, case is no different. case will "return" (or send back what the block returns) whichever block of code passes the test. In this case, it sends back "puts ("month")". Well, as you may know, the line of code "string" will return a string object, with the value "string." So what about this: puts case month when 1 then "January" when 2 then "February" when 3 then "March" when 4 then "April" when 5 then "May" when 6 then "June" when 7 then "July" when 8 then "August" when 9 then "September" when 10 then "October" when 11 then "November" when 12 then "December" end Now, that, is much neater. Normally, we would want to put the block of code in a when ... clause on the next line, but in the case where we are simply returning a single string, I find it actually more readable like this. Then, if we wanted to change it to store the month in a variable: # Get month prints ("Please enter the current month as a number: ") month_no = gets.to_i month_word = case month when 1 then "January" when 2 then "February" when 3 then "March" when 4 then "April" when 5 then "May" when 6 then "June" when 7 then "July" when 8 then "August" when 9 then "September" when 10 then "October" when 11 then "November" when 12 then "December" end puts ("The month is #{month_word}.") Now we only had to change one line of code, rather than 12 lines of code. You'll probably find yourself using "if" statements MUCH more than case/switch statements; however for certain things, especially menus (where you have several choices, and the current choice is stored in a single variable) case statements are much easier to employ. The case/switch statement is mainly used to test a single variable against multiple different values, however it IS possible to use it like an if...elsif statement: case when variable == 5 when other_variable < 5 end However, this isn't often used, as if...elsif would be preferred in this case. The case/switch statement uses the === operator to test the variable against when value rather than the == operator. For the most part, === works EXACTLY like ==. The reason for this is so one can define their own object's "case" behavior. I will explain how one can take advantage of this in later lessons; so do not worry about it for now. I just wanted to give you a heads up, in case you might be learning with other tutorials as well. One last thing I would like to teach you, is the "conditional assignment operator." As you start writing your own programs, you may find yourself in a situation where you only wish to assign a variable a certain value, depending on one condition, otherwise, set it to something else. This is called conditional assignment. For example, what if we want the absolute (non-negative) value of a number? We could do something like this: if number < 0 absolute = -number else absolute = number end That works, and is neat; but it's a lot of extra typing. This is where the conditional assignment operator comes in. It's a little bit trickier than if statements, but can save a lot of typing. variable = <condition> ? <true> : <false> <condition> is any boolean expression <true> is the value assigned to variable if <condition> is true <false> is the value assigned to variable if <condition> is false The important things to watch for is, <condition> MUST be followed by a `?` and must be separated by spaces. The true / false values MUST be separated by `:` So, let's try our example: absolute = number < 0 ? -number : number So, if number is less than 0, give absolute the value of -number (which would be positive, since number is < 0) otherwise, just give absolute the value of number. Now, it looks a bit neater, and much less typing. You do not NEED to use conditional assignment. However, if you are comfortable with using it, I would suggest doing so, as it can save you a lot of typing in the long run. There are also other "forms" of conditional assignment, that are used less often. I will leave those out for now, and include them at another time. So, that's it for now. Before I go, I would like to leave you with a few practice coding challenges: The following challenges are borrowed from "Practical C Programming" by Steve Oulline. I feel these are vary practical and challenging uses of decision making, and couldn't think of anything better :( (and I wanted you to have a lot more practice at this point) (By the way, they are actually easier to solve in ruby than in C) 1. Write a program that takes a student's grade as a number/percentage, and prints out their letter grade. Grade Table Letter Grade Numeric Grade F 0-60 D 61-70 C 71-80 B 81-90 A 91-100 (HINT: Remember how the interpreter executes an if statement) 2. Modify the previous program, to also display a + or - after the letter. The +/- modifier is based on the last digit of the numeric grade: Grade Modifications Last Digit Modifier 1-3 - 4-7 <blank> 8-0 + ex. 81 = B-, 94 = A, 68 = D+. Remember, and F is only an F, you cannot get an F- (HINT: Remember the modulus operator? `%` ? EVEN BIGGER HINT: 3. Given an amount of money (less than $1.00), compute the number of quarters, dimes, nickels, and pennies needed. 4. A leap year is any year divisible by 4, unless the year is divisible by 100, but not 400. Write a program to tell if a year is a leap year. 5. Write a program that, given the number of hours an employee worked and the hourly wage, computes the employee's weekly pay. Count any hours over 40 as overtime at time and a half. 6. EXTRA HOMEWORK CHALLENGE: If the previous challenges did not satisfy you, here's the REAL challenge. For this challenge, you will need to go out and learn about Ruby's "Range" data type. Do not worry, I will teach you about this data type in the future. http://www.ruby-doc.....9.3/Range.html Now, the challenge will be to redo the first 2 challenges, using the Range class. HINTS MORE ON IF STATEMENTS: The following is a few extra points about "if" statements. These are non-essentially to learning if statements, but you may find them QUITE useful (I know I do). I left them out of the main lesson because I didn't want to overload you with too much. I would advise that you first ensure you are comfortable with using if statements, before learning these.
-
Lesson 5: Intro to Boolean Logic You may remember from Lesson 2 (Data types) the "Boolean" data type. If you don't, that's okay; we didn't do much with them. But after this lesson, I promise: you will be on your way to becoming a boolean master. Money back guarantee! (yes, I do know you aren't paying anything for this...MUAHAHAHA!!! err, ahem..) So, like I mentioned before, a boolean is either "true" or "false" in ruby. Really though, all a boolean is, is a representation of two possible values: true or false, on or off, 0 or 1, etc. For you RPG Maker users, you might notice a boolean is quite similar to a switch. In fact, they are the same thing. Fun Fact: In older, and more lower-level languages (ex. C) boolean types actually do not exist, and rather than being represented by an abstract "true" or "false," booleans were represented by integers: 0 or 1. Additionally, to show where this comes from, computers at the lowest level, really only understand binary (0s and 1s), a single Binary Digit (or bit) is either 1 (on) or 0(off). So, how are booleans useful? Well, as you will learn, booleans and boolean logic is very useful in determining a program's state and can be used in decision making. However, before we get into that, I would like you to know how boolean logic works. I apologize that this lesson will be a little more conceptual than the previous lesson, but it is necessary you understand boolean logic before we begin the next lesson. If you can master boolean logic, you will be ahead of the game. So, let's begin. Now, we know that a boolean represents two values: true and false. But where do these values come from? First, we must look at boolean expressions, expression that generate a boolean value. You can think of a boolean expression, almost like a question, or more specifically: a boolean question. A question could be: "How are you today?" "What is your name?" These questions, however, could have many answers. A boolean question, would ask something more specific: "Are you 18 years of age?" "Do you own a computer?" "Is your name Kellessdee?" These questions, although in real life we may answer these in different ways, ultimately are looking for one answer, either "yes" or "no." But how do we ask these kinds of questions in ruby? Well, in programming, rather than looking at the question as a whole, you have to look at what data is really being tested. "Is age equal to 18?" "Is number of computers greater than 0?" "Is name equal to 'Kellessdee'?" While computers are terrible at interpreting human language, computers are REALLY good at comparing data or values. To write these comparisons into a program, the language in question will provide us with various comparative operators. We can create boolean expressions with these operators, which will evaluate to boolean values. In ruby's case: > - Greater than >= - Greater than or equal to < - Less than <= - Less than or equal to == - Equal to != - Not equal to There are other ruby comparison operators, however those are usually special operators, and I will explain them in later lessons You can use these operators with nearly any object. Some of these may behave differently depending on the object, and for now I will only go over Numeric values and String values. So back on those previous questions; how might we represent them in ruby? irb(main):001 > age = 18 => 18 irb(main):002 > age == 18 => true irb(main):003 > number_of_computers = 0 => 0 irb(main):004 > number_of_computers > 0 => false irb(main):005 > name = 'kellessdee' => "kellessdee" irb(main):006 > name == 'Kellessdee' => false So, as you can see, we use a variable to store the value, and we can compare that value based on the question we are asking. You do not need to use a variable, and can compare literal values: irb(main):007 > "hello" == "hello" => true However, you should never do this. There is no sense in using the computer's resources to compare values that are already known to the programmer. We will use variables, to simulate a value that could be any value You might be wondering why the last expression evaluated to false. Well, as you may have known or guessed by now, when comparing strings, ruby compares each character and if all are equal, then the string is equal. Each character is actually represented by an integer (ASCII value), and thus, 'k' and 'K' are not the same. Luckily, ruby strings have a useful method we can use to get around this - string.upcase and string.downcase These methods convert each character in a string to it's upper-case or lower-case equivalent, and returns the new string. So, if you wanted to check the equality of two strings, but not depend on the case: irb(main):008 > name = "KeLlEsSdEe" => "KeLlEsSdEe" irb(main):009 > name.downcase == "kellessdee" => true or irb(main):010 > name = "KELLESSDEE" => "KELLESSDEE" irb(main):011 > other = "kellessdee" => "kellessdee" irb(main):012 > name.downcase == other.downcase => true irb(main):013 > name.upcase == other.upcase => true Another thing to remember about comparing strings, if you use the >, >=, <, <= to compare strings, ruby will compare the LENGTH (number of characters) of the two strings. irb(main):017 > "one" < "three" => true "one" is 3 characters, and "three" is 5 characters: 3 < 5 == true A few other tips to keep in mind: Be careful with > and >= or < and <= when two values are compared with >= or <=, if they are equal, the expression will return true. With < or >, if they are equal the expression will return false. So there we have it. We can now ask ruby simple questions, and receive boolean answers. Now, for the hard part. What if we want to ask ruby a more complex question? "Is your name kellessdee and are you over 18?" In reality, this is two questions. However, there is still only one answer. Yes or No. In my case, my name is kellessdee (well, username teehee) and I am 22, which means I am over 18. So, I would answer yes. Easy enough for us to simply process...but what about a computer? Well, think about it this way. There are actually two individual questions, with individual answers: name == kellessdee? Yes. age > 18? Yes. So really, the answer is Yes and yes. or true and true. So, we could make two separate comparisons, and go from there, or we could use ruby's (conveniently) built-in "logical" operators. They are: && - logical AND || - logical OR ! - logical NOT and - logical AND or - logical OR not - logical NOT So you have a couple options here to join simple boolean expressions, to form complex boolean expressions. Most RPG Maker scripts use the English versions "and" "or" and "not". Because of this, and that these versions are easier to read, I will teach you with the English versions. Due to the way ruby handles the order of precedence, "and" "or" and "not" actually do not behave the same way as "&&" "||" and "!". In order of precedence, ! > && > ||, like it should be...however, not = and = or. The English operators have the same precedence in ruby. To be safe, always use parentheses to group your expressions in the order you want them to be evaluated. I will follow this tactic in my lessons. If you are comfortable with &&, ||, !; I would advise to use this form, as they work how they should. AND and returns true if all expressions are true, otherwise returns false irb(main):018 > true and true => true irb(main):019 > true and false => false irb(main):020 > false and false => false OR or returns true if one expression is true, and false only if all expressions are false irb(main):021 > true or true => true irb(main):022 > true or false => true irb(main):023 > false or false => false NOT not is special, it is a unary operator (meaning it only operates on one value), and simply inverses the result of the expression or returns the opposite. irb(main):024 > not true => false irb(main):025 > not false => true So, lets try the complex question again: irb(main):026 > name = "Kellessdee" => "Kellessdee" irb(main):027 > age = 22 => 22 irb(main):028 > (age > 18) and (name.downcase == "kellessdee") => true And that, is the basics of boolean logic. Now, the problem with this, is it's one thing to explain and read about boolean logic, but it is harder to practice. It will be easier to understand once we apply it to decision-making, but for now, I would like to leave you with some practice questions (try to get the answer without putting these into IRB or a script). 1. true or (false and (true and false)) ANSWER 2. false and (true or false) ANSWER 3. false or (true and false) or (true and (false or (true and (false or false)))) ANSWER 4. (true or (false and true) or false) and (true or (false and false)) ANSWER 5. (true and (true or false)) and (true or (true and (true and (false or false))) or true ANSWER Quick Technical Info on and/or One thing every programmer should know about and, or; is that they are what we would refer to as "short-circuiting." If you may have noticed, with and, if any of the expressions are FALSE the entire expression will be false. With or on the other hand, if any expression is TRUE, the entire expression will be true. Therefore, the ruby interpreter will evaluate the expressions, from left to right - if it finds an OR expression and hits a true, it will stop evaluating that expression - it already knows the entire expression will be true. Same goes for AND...when it hits a false value, it will stop evaluating because it knows the entire expression will be false. With that in mind, with any complex AND expression - you should test the values MOST likely to be false first (false most of the time) and with any complex OR expression - you should test the values MOST likely to be true first (true most of time)
-
Whoa, that's awesome! I really like the balance between the orchestra sound and driving rock sound. I can see myself battling to this! Very well produced! Give yourself a pat on the back.
-
I don't mean to derail Dragon's thread here, but I never understood the reasoning behind drug laws. If it's really to protect us, then why is alcohol, cigarettes, coffee, etc legal? These drugs are far more addictive and harmful than most illegal drugs. I have been around many a sketchbag, and have been around people on various sorts of drugs. Now, while I'm not claiming this cannot happen with heavy drug users, I find it interesting that the only time I've ever seen someone pull a knife on anyone else, was when my girlfriend (at the time)'s alcoholic father pulled a knife...while he was drunk...on his own son. Nothing bad came of it (thankfully), as once he realized what he was doing, he dropped the knife and calmed down a bit... So I don't really get it. Anyways, sorry to drop off topic there Dragon.... I agree with mark, but on a greater scale. I would not be able to call the police, and potentially put them in jail/ruin their life, on ANYONE, if they have not harmed/ruined anyone else's life. I just don't have it in me, I would not be able to live with the guilt.
-
Breaking the law may be breaking the law...and if you use society's morals as a basis, then turning them in would be the right thing to do. However, your morals don't necessarily follow society's morals. I can tell, that you don't really have TOO much of a problem with the marijuana/usage, or at least is seems, you are more worried about how it could affect your life. I understand that, but you need to ask yourself then: "How would I feel if I put my family in jail?" I'm not trying to be harsh, but remember YOU have to live with your decisions, so I think you should be completely sure of what you want to do, before doing it. It's unfortunate you have to be put in this situation, and I wish you luck with your decision. If you wanted to know what I would do, I would not turn them in. To me, as long as you aren't hurting those around you, you should have the right to do whatever you want to your own body (including, putting whatever you want in it). Also, in my eyes, marijuana is the least harmful of recreational drugs (including alcohol), so to me, there's no ESSENTIAL difference between drinking booze, smoking pot, snorting cocaine, injecting heroin, etc. Sure, the dangers vary and the reactions vary, but at the very essence of it all, the user is simply trying to get high. They're all drugs. Of course, then again, Canada has much more laid-back drug policies... So you could move in with me and then you don't have to worry anyways! :D
-
Unfortunately, I have no idea where to get these facesets, though someone else might be able to help. But just so you know (in regards to the accidental double post), regular members cannot delete any posts, however if you ever need to, you can message a moderator/admin and explain the situation. I cleaned up your other post for you :)
-
Ah, yes, it is quite easy to get overwhelmed in designing a level in a game; and even easier with large levels. Another tip, might be: -Design the abstract, general overview of the level -Separate the level into logical, smaller "levels" -Design each smaller level/section individually -Put together levels, and make any minor tweaks so the sections all flow together nicely If you focus on the smaller "major" sections of the level, rather than the level as a whole, it might be less overwhelming.
-
Yes and no. You would be able to do this, however, the way that RPG Maker's default menu is set up; it draws the player's sprite onto the window's bitmap; and there isn't a way to target that window or it's bitmap. (Neither are of the RPG::Sprite type) 2 (simple) ways to get around this (there are many ways, these are probably easiest to implement in an existing menu): 1. Create an empty RPG::Sprite, and position it to the same location as where the player's sprite is drawn, then call the animation. 2. Change the existing code to create the player's sprite AS a RPG::Sprite instead of drawing it to the bitmap, and position it in the right place; then call the animation. Lemme know if you need more help/example on how to do this.