Planetfall BWEND
Planetfall BWRELEND
HomeRELENDREF
HomeBDREF
SABDREF
Planetfall Planetfall SABD
It's To-Po!


Site Games Miscellaneous /
Apr 20, 2024 10:47 ESTReply | Topic List | Forums List | Edit Profile | Help | Sign Up

Forums :: R.E. League :: Aauuugh!

<- Prev Post   -   Next Post ->
Page:  1  2 
LieutenantEagle

Posts: 953
Member #27

Sep 23, 2002 20:34
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  MintMan, I seek your wisdom here.
  
  You see, I am having a problem with the RE League. Whenever I enter a battle, I get a blank screen and an error message. This works on every battle, that is, Wild, Trainer, and Gym. I've tried all these places and it doesn't work.
  
  The error message says: "Line 54, Char 1: Object Expected"
  
  Do not tell me that I do not have JavaScript turned off, because I was able to log-in to my Pokébox normally - although I got an error message there too: "Line 174, Char 1: Object Expected".
  
  Will someone please explain what is going on? BTW, I have been experiencing this error in the Trainer battles in the Warped Gym since when I entered the Warped Gym.
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Sep 23, 2002 22:40
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Nurtz. As soon as you said it, I knew exactly what I had done wrong.
  
  I wonder why it didn't pop-up after I started battling right after I made the change. I mean, I hit refresh and everything.... many times. Man, that thing was in there for a couple days, too. Why don't people report these things sooner? Thanks a lot, LE. If people like you never spoke up, things would be broken and RE reputation would become quickly marred.
  
  The error was a missing parenthesis. I hate those half-circle dastards so much.
"I've known so much evil...." - Gudrun's Incitement, stanza 18
LieutenantEagle

Posts: 953
Member #27

Sep 24, 2002 24:38
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  So I can go kill dragonsayer now? Yippee!!!
  
  Oh, and I'm with you for the parentheses. DIE PARENTHESES!!! I hate JavaScript, because of the parentheses!
  
  Or not...well today I realized that programming is easier than I thought, considering the fact that I will want to enter thousands of variables. But isn't it something along the lines of this?
  
  var char_hp == 20;
  var char_maxhp == 20;
  function hit();
   {
  char_hp--
   }
  if (char_hp = 0)
   {
  document.write('Game over')
   }
  else
   {
  document.write('You have ' + char_hp + ' Health remaining')
   }
  
  -----
  Let me just hope that the above scriptlet produces the effect that the variable "char_hp" drops 1, and then the document writes how much you have remaining. I don't care about hit chances, critical strikes, or anything like that...I'm just wondering if I got the major point. I know this post has nothing to do with the RE League, but I'm just interested.
  -----
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
  
  
  [Editted by LieutenantEagle on Sep 26, 2002 2:00]
SailorSassyStar

Posts: 419
Member #19

Sep 24, 2002 8:05
E-Mail Web Site Master Account Battling Dragons R.E. League Reply w/ Quote Edit Post

  MM, does that mean that it is a good thing that I have so many problems? I just had to ask that. It seems like I'm always reporting something or other wrong, but not so much recently...that is most likely a good thing.
If there is something wrong, it's probably my fault.
   *SailorSassyStar*
  PurpleStarPink

MintMan

Posts: 4061
Member #1

Sep 24, 2002 14:02
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Not reporting things is good when there is nothing to report for that itself is a good thing. If there is a problem, report it ASAP. Ya don't want those things lingering around.
  
  Okay, LE, that is the gyst of it, but here are your errors:
  
  - You used the assignment operator (=) instead of the equivilence operator (==, note how it is two equals signs) in your if statement. That would assign that things health to zero, thus returning false in the statement, and the game would never end although nothing had any life left after struck once!
  You also should have used the decrement operator instead of assigning something the value of itself minus one. Just putting variablename-- has the same effect.
  And then when you put the health display thing, you didn't put spaces on either side of the quotation makes in the string. That would produce something like "You have5health remaining" as one long jumble rather than the supposed "You have 5 health remaining."
  
  Other than that, tho', it seems all good.
  
  
  EDIT: Wait, no its not. You shouldn't end your function declaration with a semi-colon, and your if statement to check for death isn't inside the hit function because the curly braces end before it.
  Also, when using single-line products of if statements, you don't need to use curly braces. You could just say:
  if(something)
   something_else();

  But for multiple statements, ya still gotta:
  if(something)
  {
   something_else();
   something_yet_again();
  }

  
  [Editted by MintMan on Sep 24, 2002 19:05]
writer77

Posts: 409
Member #4

Sep 24, 2002 19:19
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  YES!!!! We all hate parentheses.... but what we hate more... is when cookies are being read, and coming up as null, right Mintman?
  
  By the way... I never managed to fix that code.
  
  Oh, and for those who are wondering what I'm talkin' 'bout... it's just a conversation me and Mintman had last week about a very evil code, who has tormented me endlessly.
Endless Horizon: http://www.angelfire.com/rpg/verdegym
  "It looks like I'm going to die as I have lived.... completely surrounded by morons!"
  -Bl. Mage
LieutenantEagle

Posts: 953
Member #27

Sep 25, 2002 20:57
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  I've edited the code above. Is that better?
  
  Also, one more JS question. I've been wondering how you assign those chances of a creature being hit or missed. Here's what I think you do:
  
  var char_agility == 40
  var chance == Math.rand
  if (chance<=char_agility)
  {
  document.write('The attack missed.')
  }
  -----
  Okay, that's probably VERY bad programming. Here's my question: How do you get the computer to do the following: give me a random INTEGER from 1 to 100? Isn't it something like "Math.rand.Int(1,100)"? Am I even near the mark?
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Sep 26, 2002 24:07
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Wow, that's some bad programming.
  
  I made sure to differentiate between the equivilence operator (==) and the assignment operator (=). In your code, you have some lines that are returning ones! To assign a value, use one equals sign. To see if two values are equal, use two. It has purpose; trust me.
  
  Okay, to randomize numbers, you have two choices. It depends on how your random number generator works. In JScript, Math.rand() returns a number in between zero and one. So, in order to get a workable number out of it, you do something like:
  
  var randomizednumber = Math.round(Math.rand() * HIGH_POINT);
  
  That makes it work. What you did is a very curious system of working hit chance. Typically, you have some sort of hit-raising value if you have a decreasing one like Agility. Otherwise, it becomes an unmatched category.
LieutenantEagle

Posts: 953
Member #27

Sep 26, 2002 24:23
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Ohh....I get it now. (about time)
  
  So basically, if I go like:
  
  var chance = Math.rand() * 100
  
  Without any rounding, and I get, say 43.791, and that's over 40 (the agility value), then the attack will not miss. I'll figure it out after some time...I mean, I read my JavaScript book over and over and over and only you finally made me understand it. Thank you!!!! Can I pay you 100,000 yen now (in RE funds)?
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Sep 26, 2002 14:13
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Well, you would want to end that line with the traditional semi-colon. I know JScript doesn't push it much, but it is nonetheless wise to include it at the end of a statement.
  
  Also, it usually helps to round off the number to an integer value. Well, typically, you would make a function like:
  
  function randomize (seed) { return Math.round((seed-1)*Math.rand()+1); }
  
  That gives you a number from one to the highest-bound instead of zero, which I usually don't care to use much.
LieutenantEagle

Posts: 953
Member #27

Sep 27, 2002 21:06
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  MintMan...I'm sorry to ask for your help again, but...HELP!!!!
  
  You see, now I'm trying to make the darned ('darn' is not a profanity for S^3's sake) program do this: when the user inputs a value into a box, the value is stored as a certain variable. Check my code to see what I mean:
  (script begins here)
  var hp = undefined;
  var maxhp = undefined;
  var fp = undefined;
  var maxfp = undefined;
  var sp = undefined;
  var maxsp = undefined;
  var hfs = 60 - (maxhp + maxfp + maxsp);
  var valid1 = false;
  function check_it();
  {
  if (hfs>0)
  alert('The total is too low. Why not add some more points?')
  if (hfs<0)
  alert('The total is too high. Lower some of your stats.')
  if (hfs == 0)
  {valid1 = true; alert('Your stats are valid')
  }
  if (valid1 = true);
  {
  hp == maxhp;
  fp == maxfp;
  sp == maxsp;
  }
  (script ends here)
  
  Next I'll put up the HTML code. To prevent transformation, the < and > are replaced with /* and */
  
  /*FORM*/
  /*BR*/ Health: /*INPUT TYPE="text" NAME="hp" SIZE="4" ONCLICK="maxhp = this.form.hp.value"*/
  /*BR*/ Flower Pts.: /*INPUT TYPE="text" NAME="fp" SIZE="4" ONCLICK="maxfp = this.form.fp.value"*/
  /*BR*/ Star Pts.: /*INPUT TYPE="text" NAME="sp" SIZE="4" ONCLICK="maxsp = this.form.sp.value"*/
  /*BR*/ /*INPUT TYPE="button" VALUE="Check HP/FP/SP" ONCLICK=check_it()*/
  
  The same case repeats with Strength + Defense, Wisdom + Holiness, and Speed + Evasion + Strike. I also tried setting variable maxhp to "this.form.hp.value" but that did nothing. I also tried setting it to "this.document.form.hp.value" but that also did nothing. My best result was with the first case scenario, in which case it always told me "Your results are too low" even when I submitted HP = 20, FP = 20 and SP = 20.
  
  My suspicion is that the "maxsp = this.form.sp.value" causes the form value to become the JScript value; that is, Undefined.
  
  Please help me on this matter. If you want to see what it really does, I will rewrite the code to first case scenario on my file. The address is: http://smfc.vze.com/sbsr.html
  
  THANKS!!!
  
  [Editted by LieutenantEagle on Sep 29, 2002 22:55]
MintMan

Posts: 4061
Member #1

Sep 30, 2002 15:17
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Try this:
  
  
  var hp; //don't declare these as undefined; they are by default
  var maxhp;
  var fp;
  var maxfp;
  var sp;
  var maxsp;
  var hfs = 60 - (maxhp + maxfp + maxsp);
  var valid1 = false;
  function check_it();
  {
  if (hfs>0)
  alert('The total is too low. Why not add some more points?')
  if (hfs<0)
  alert('The total is too high. Lower some of your stats.')
  if (hfs == 0)
  {valid1 = true; alert('Your stats are valid')
  }
  if (valid1 == true) // You had an assignment operator here (=) instead of the equivilence operator (==) in the if-test and a semi-colon at the end of the if-statement, neither of which are good
  {
  hp = maxhp; // assignment operators, not equivilence operators here
  fp = maxfp;
  sp = maxsp;
  }
  

  
  So far as the HTML goes, just replace your onClicks with:
  
  onBlur="maxhp = value"
  
  replacing maxhp with the appropriate variable name. See, since you are making a local reference to the object's value, you have no need to supply "form" and all that stuff; just get to the value. Also, use the onBlur over onClick. OnClick would only work when the user clicks on the text box to enter a value, not after it's entered. OnBlur activates when focus is applied to something else on the screen, such as the final button.
  
  If I were you, I would have just make the final button assign each of the form values to the regular variables, but that's just me.
LieutenantEagle

Posts: 953
Member #27

Oct 1, 2002 23:04
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  THANK YOU ONCE MORE!!!!! I'll get to that...as soon as I finish my homework. That is, never.
  
  I didn't use onClick though. I used onChange. It didn't work though...
  
  Hmm..*lightbulb time*..
  
  Perhaps I should have buttons which let you get pre-made characters (e.g. Mario, Goombario, Watt, etc.) as well as making your own name and value.
  
  One more question (please don't kill me). Is the code below how you denote elemental superiority?
  
  char_element = 'water';
  enemy_element = 'fire';
  function water_gun();
  {
  if (enemy_element == 'fire');
   damage = damage * 1.5;
  if (enemy-element == 'grass');
   damage = damage * 0.5;
  //include all other plumbing
  }
  
  Something along the lines?
  
  And yet another question. Do you make the sign up things with Perl or with High JavaScript (Low JavaScript == what I use; High JavaScript == what MintMan uses)? If you only could answer this question, and I learn to program it that way, the SMFC will work a lot easier (right now, I have to check all forms by hand, with the stupid email)
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Oct 2, 2002 1:28
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  JScript lacks any ability to read or write files. You have to use Perl for that. All I do is use Perl to write files and generate pages that use JavaScript on them since Perl itself is a poor language for games (it would require constant reloading like Arena Terrae, which is interactive so has no other choice).
  
  Yes, you could do elemental effectiveness like that, although I'd use a switch-case statement. It kinda works like this:
  
  switch(enemy_type_variable)
  {
   case "Fire": damage*= 2; break;
   case "Plant": damage*= .5; break;
   // and so forth
  }

  
  Course, that's only useful if you have lots of things to check. I'd really recommend making an element-effectiveness function instead of repeating it for every attack.
  
  Also, I'd pass some of those values in the attack as arguments rather than declaring them before hand.
  
Ash10

Posts: 435
Member #3

Oct 2, 2002 8:12
Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  I have given up on Perl... PHP ALL THE WAY!
  
  It is so easy to use on the web compared to perl....
Experience the Game XP The Game
Forum Moderator at CnC Detonation
News Updater at CnC NZ.com, CnC Zone, RA2 Explosion
  
MintMan

Posts: 4061
Member #1

Oct 2, 2002 14:11
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  PHP, from what I've heard, is more like C which is a good thing for higher-level programmers, but it isn't accepted on all hosts (although that fact is quickly becoming not the case).
  
  Either way, my games need versitility for wherever I might have to move. Besides, I think Your-Site might actually make you pay for PHP.... maybe that was for SQL or something else. In either case, I know sucky Perl and unfortunately sucky Perl I shall have to stick with for a while.
LieutenantEagle

Posts: 953
Member #27

Oct 2, 2002 19:01
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  And I don't know Perl or PHP or whatever you people are talking about. Dang....MintMan, the tutorials on perl.com cost like 1.5 grand!! I don't have infinite money, you know. I would much rather have saved the name "smfc.com" instead of "smfc.vze.com", but then again that's an $80 difference per year.
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Oct 3, 2002 14:13
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  What? No! I'm talking about their free libraries, not their training sessions!
  
  There are pretty much slews of on-line books on that site that you can raid and absorb all of the knowledge from. That's what I had to do (and sometimes still do for advanced arrays) before I got some books for easy reference.
LieutenantEagle

Posts: 953
Member #27

Oct 3, 2002 21:55
E-Mail Web Site Master Account Battling Dragons Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Hey, guess what? I found an interesting method for the walkaround thing.
  
  var x_location = 4;
  var y_location = 0;
  function north();
  y_location++
  function south();
  y_location--
  function east();
  x_location++
  function west();
  x_location--
  /*Here's the tough part. Is it possible to program double ifs?*/
  if (x_location == 0, y_location == 0);
   document.write('You are in the corner of the world...good for you!')
  //repeat for all other millions of locations
  
  And then for the HTML: (note: { replaces <)
  {FORM}
  {INPUT TYPE="button" ONCLICK="north()" VALUE="North"}
  //and so on
  {/FORM}
  
  -----
  Well, of course the HTML wouldn't be like that. I would probably have a hidden 3x3 table, with the corners empty and the rest of the cells with the buttons. But still...my big question is in the "double if". Is that possible? If yes, is it written the way that I wrote it in the script?
  
  Hmm...Perl on-line books. Hey, you know what? Christmas is coming up in only two months. I'm asking my brother (although 'begging' is more appropriate) to get me a GameBoy Advance. My parents...I could ask them for a Perl book!!! Well, maybe my dad would kill me for that (he hates me programming, he hates my website, he hates Nintendo, he wants me to spend 8 days of the week studying for the SAT test to get a 1600).
  
  But then again...how do you post smileys in this forum?
LieutenantEagle
  ---
  Link: Yess!! I got the Master Sword!
  LTEagle: Hey can I see that for a second?
  Link: Nope...only servants of light may touch it.
  LTEagle: (takes out lightbulb)
  Link: Oh...okay. (hands Master Sword)
  LTEagle: Mwahahahahahhaaha...
MintMan

Posts: 4061
Member #1

Oct 4, 2002 14:27
E-Mail Web Site Master Account Battling Dragons Shadow Aura Endless Night's Dream R.E. League Reply w/ Quote Edit Post

  Sixteen-hundred? The fool! Does he know how difficult it is to get a perfect score on any test? No intelligent person ever gets those! It's always some semi-smart person that lucks out! The last 36 on the ACTs that came from an Ohioan took the test thrice: once a twenty-eight, next a twenty-nine, and then WHAM! thirty-six. See how that works?
  And I'm a programmer, and I got a 1430 on the SATs. That's, like, in the five or two percentile. I can't remember which, but it's pretty good for a programmer.
  
  Anywho, here's your code all fixed up:
  
  
  
  var x_location = 4;
  var y_location = 0;
  function north() // NO SEMICOLONS AFTER FUNCTION DECLARATION! NONE!
  y_location++; // here you can put your semicolon
  function south()
  { // although its better to enclose functions in brackets
   y_location--;
  }
  function east()
  {
   x_location++;
  }
  function west()
  {
   x_location--;
  }
  /* Double if? Use Logical Comparison
   * &&: if something AND something else is true
   * ||: if something OR something else is true
   * ^^: if something is true OR something else is true eXclusively, not both
  */
  if (x_location == 0 && y_location == 0) // NO SEMICOLON HERE, DAZNABBIT
   document.write('You are in the corner of the world... good for you!');
  // semicolon goes at the end of statements, not things that begin sets of them
  //repeat for all other millions of locations
  

"I've known so much evil...." - Gudrun's Incitement, stanza 18
  
  
  [Editted by MintMan on Oct 4, 2002 19:30]
<- Prev Post   -   Next Post ->
Page:  1  2 
Apr 20, 2024 10:47 ESTReply | Topic List | Forums List | Edit Profile | Help | Sign Up


Copyright © 1999-2022