ID:173945
 
I've only been playing BYOND games for about 2 weeks now, and I found some Zeta rips for YADG...so i decided to check out the coding and test it on my comp...the problem(s) I have are this:
if ("Immortality")
usr.maxpowerlevel = 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 9999999999999999999
usr.overlays = 'elec.dmi'
if (usr.alignment = "Good")
usr << "You are now an Immortal, Protect and avenge those around you in the universe"
world << "[usr] is now immortal! They are now the protector of the universe!"
if (usr.alignment = "Evil")
usr << "You are now immortal, let the spree begin!!"
world << "[usr] is now immortal! They shall now attempt to destroy the universe!"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
with the code like this I keep getting an inconsistent indentation with the line {usr << "You are now an Immortal, Protect and avenge those around you in the universe"}
I can fix that error by adjusting the indentation of that line but with the coding looking like this:
if ("Immortality")
if ("Immortality")
usr.maxpowerlevel = 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 999999999999999999999999999999999999999999999999999999999999 9999999999999999999
usr.overlays = 'elec.dmi'
if (usr.alignment = "Good")
usr << "You are now an Immortal, Protect and avenge those who around you in the universe"
world << "[usr] is now immortal! They are now the protector of the universe!"
if (usr.alignment = "Evil")
usr << "You are now immortal, let the spree begin!!"
world << "[usr] is now immortal! They shall now attempt to destroy the universe!"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I get two new errors that I have no idea on how to correct...those errors are missing expressions with the lines {if (usr.alignment = "Good")} and {if (usr.alinment = "Evil")}
(Note:This coding was NOT originally in the zeta rip I downloaded, I actually did code this piece of code from scratch...I told you I am a quick learner. ^_^)
I will explain why you are getting the errors with those "ifs".

You have if(this=that), which is not what you want. "=" is used to set a variable to equal the expression on the right of it, which you cannot do inside of an "if" in byond. The "==" operator is what you are looking for, as that evaluates the expressions on both sides of it and returns true if they are equal or false if they are not equal. Thus, if(this==that) is what you want.

[edit]
Also, I suggest you fix that whole 100-digit 9 thing. That number is not needed and only wastes resources. If you were ever doing some serious programming and had lots of objects in your game all with some variable set to an integer that high, you would burn out your memory before gameplay got very far. Of coarse it will work for the li'l dbz game you have there, but I would advise against doing stuff like that in the future unless you really need it. A simple 9999999 would suffice and only takes up 3 bytes of memory.
In response to Loduwijk
Thank you....i was in a hurry and also trying to get the stat page to read 1.#inf, which i typed in and (obviously) did not work. Thank you again. ^_^
In response to Rashka
1.INF# automatically comes up. like your 999999999999999999999999999999999999999999999999999999 would = 1.INF#. OMG I REMEBERED THAT lol
In response to Leahcim
lol!! thanks for that bit of info...as you prolly guessed, im actually trying to code immortality (which of course can be taken away by a gm)
In response to Rashka
Oh, by the way, is there anything else wrong with the code? i had to copy and paste it into Dream Maker, and now i keep getting 8 errors, all within that coding, and it is inconsistent indentation...besides that, is there anything else i need to do to the code?
In response to Rashka
Copy and paste = bad. You will get inconsistent indentation errors when doing that from the forums. Instead, you should make the changes themselves.

If you've got rid of your previous code and replaced it with the one from the forums, then you have to fix the indents. Turning on "Show tabs" (in the options menu) should help with that. (That's one option I think should be on by default, it's so darn useful!)