if(usr.V==1)
Problem description:
it keeps saying invalid expression, and i tried everything i know and it just made it worse, so how do i fix it
ID:145484
Mar 6 2006, 2:12 pm
|
|
Code:
if(usr.V==1)
Problem description: it keeps saying invalid expression, and i tried everything i know and it just made it worse, so how do i fix it |
In response to Vito Stolidus
|
|
Vito, he probably didn't understand any of that.
|
In response to KirbyRules
|
|
NO I DIDNT LOL
|
In response to LeeZein
|
|
Create_Character() check if there is anything wrong plz |
In response to LeeZein
|
|
Did i confuse you? sorry. Maybe I should use smaller words...
Anyway, I found it. if(usr.V==3) // <-- You need lines after an if statement. for form, see my obfuscating post. See it? Since there isn't anything after the if(), it says there's an error. If the code following the if() is supposed to be inside it (AKA only activated if the conditional returns true) you have to indent it. EDIT: Looking at those input lines, you'll have problems there in the future. You want an alert line - For an alert, the first argument (text) is the question, the second (text) is the box's heading, and the rest (all text) are buttons. switch(alert("[Question]", "[Title]", "[Button1]", "[Button2]")) --Vito |
In response to Vito Stolidus
|
|
wait give me an example of the line thing, or maybe i just didnt get you lol, sry
|
In response to LeeZein
|
|
Okay...
Optional: For one line after an if() statement you put the line directly after the if(): if(A && (B || C)) return For a few short lines, you enclose them in brackets and seperate them with semicolons ";" similar to what you'd do in C++ or Java: if(A && (B || C)) { usr << "Ha!"; usr.sp --; return; } Not optional: For any number of lines, you just indent once and DM assumes brackets and semicolons: if(A && (B || C)) Does that simplify things? (For simplicity, the third method woreks for any number of lines - you can use it for all three. the other two are to shorten your code.) --Vito |
In response to Vito Stolidus
|
|
okay, okay so how would u fix my problem like write down what would u do because, u confuse me, if i saw u ull confuse me like ur confusing me right now just talking to u confusion king lol
|
In response to LeeZein
|
|
It's not hard. You have two options right now:
A) If the lines after the if() statement are supposed to execue only if, say, V == 1
|
In response to LeeZein
|
|
Rule 0 of posting code: Never use only one space where a tab belongs. Use at least two spaces per tab. Above all else, your code must be readable--particularly because you've obviously got an indentation error.
Lummox JR |
In response to Lummox JR
|
|
Lummox JR wrote:
Rule 0 of posting code: Never use only one space where a tab belongs. Use at least two spaces per tab. Above all else, your code must be readable--particularly because you've obviously got an indentation error. Lummox got it. if(usr.V) //There's that darn indentation error. =/ |
In response to Vito Stolidus
|
|
okay okay big words man, ill i need u to do is to write down the correction not explain how to correct it, i need my game done as soon as possible so i pasted all your confusing good words to study it k, i appriciate for ur help tho
|
In response to LeeZein
|
|
Sorry. forgot the big words thing.
you have: if(usr.V == 1) you need: if(usr.V == 1) Simple enough? Also, note that the shortening of "you" to "u" and other IMer abbrevations are not good etiquette on these forums and you probably should take the time to make your posts (sorry, all you AIM-ers out there) more civilized. --Vito |
In response to Vito Stolidus
|
|
i did but still the same :(
Create_Character() |
In response to LeeZein
|
|
Double-click on the error message. Which line does it highlight?
Note - please use 2-4 spaces to represent tabs, it makes these posts so much more readable. --Vito |
In response to Vito Stolidus
|
|
the line with the if(usr.V==1)
|
In response to LeeZein
|
|
Oh. That if() statement is indented once two many, as are, I'll bet, all the lines after it. You're not supposed to indent before an if(), only after it.
--Vito |
In response to Vito Stolidus
|
|
so how would u fix it(in english XD)
|
In response to LeeZein
|
|
'untab' the if() statement and probably all the lines 'tabbed-in' to the if() statement.
Note that the words I used in the last few posts were about as 'dumbed-down' as such topics can be. I suggest getting to know programming lingo, as the language of this forum is not "2-bit IM". Also, something to help when someone suggests code you've never heard of - the DM Guide. If someone tells you to use, say, the rgb() function to do something, this will tell you how to use it. It may help with that pseudo-language barrier problem (Whoops, sorry, that's long words...), too. --Vito |
if(usr.V)
otherwise, check to see if V is a defined variable for all mobs and that you aren't using this in a part of the program where usr is null (most procs - New(), Login(), user-defined).
Also, if statements must have following lines, or else it will be an error:
Check all of that.
--Vito