Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 150
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: (WorkAround) do while bug in latestest openbor version....  (Read 314 times)

0 Members and 1 Guest are viewing this topic.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
(WorkAround) do while bug in latestest openbor version....
« on: September 08, 2012, 12:05:00 pm »
The do while command doesn't work properly any more.

There seem to be no proper pattern as to when it will stop. It seem to go through all the loops even if found is set to 1. then I tried removing the < 11 condition and just set it to keep going till the found condition changes to 1 but its all messed up. I also tried placing else statments before all if statements.

I'm not sure when this problem occured but it this very command use to work flawlessly.

Just a side note that its happening to other do while commands that I have tried.

Code: [Select]
void changeweaponnext(void self)
{
  void weaponnumber = getCurrentWeapon(self);
  void found = 0;
  if ( self != NULL() && weaponnumber < 11 && found == 0 ) {
    do {
      weaponnumber = weaponnumber+1;
      if ( weaponnumber == 1 && getBeserk_wAmmo(self) > 0 && getBeserk_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 1);found = 1;}
      if ( weaponnumber == 2 && getShotgun_wAmmo(self) > 0 && getShotgun_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 2) ; settextobj(1, 185, 14, 3, 1, ""+getShotgun_wAmmo(self));found = 1;}
      if ( weaponnumber == 3 && getSuper_Shotgun_wAmmo(self) > 0 && getSuper_Shotgun_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 3) ; settextobj(1, 185, 14, 3, 1, ""+getShotgun_wAmmo(self));found = 1;}
      if ( weaponnumber == 4 && getChaingun_wAmmo(self) > 0 && getChaingun_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 4) ; settextobj(1, 185, 14, 3, 1, ""+getChaingun_wAmmo(self));found = 1;}
      if ( weaponnumber == 5 && getRocket_Launcher_wAmmo(self) > 0 && getRocket_Launcher_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 5) ; settextobj(1, 185, 14, 3, 1, ""+getRocket_Launcher_wAmmo(self));found = 1;}
      if ( weaponnumber == 6 && getPlasma_Gun_wAmmo(self) > 0 && getPlasma_Gun_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 6) ; settextobj(1, 185, 14, 3, 1, ""+getPlasma_Gun_wAmmo(self));found = 1;}
      if ( weaponnumber == 7 && getBFG_9000_wAmmo(self) > 0 && getBFG_9000_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 7) ; settextobj(1, 185, 14, 3, 1, ""+getPlasma_Gun_wAmmo(self));found = 1;}
      if ( weaponnumber == 8 && getChainsaw_wAmmo(self) > 0 && getChainsaw_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 8);found = 1;}
      if ( weaponnumber == 9 && getFlamethrower_wAmmo(self) > 0 && getFlamethrower_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 9);found = 1;}
  if ( weaponnumber == 10 && getSuper_Chaingun_wAmmo(self) > 0 && getSuper_Chaingun_wOwned(self) > 0 ) { changeentityproperty(self, "weapon", 10) ; settextobj(1, 185, 14, 3, 1, ""+getShotgun_wAmmo(self));found = 1;}
    } while (weaponnumber < 11 && found == 0 );

  }
  if (found == 0) { changeentityproperty(self, "weapon", 0); setCurrentWeapon(self, 0); } else { setCurrentWeapon(self, weaponnumber); }
}
« Last Edit: September 21, 2012, 01:24:26 pm by MatMan »

Offline Damon Caskey

  • Hero Member
  • *****
  • Posts: 5335
    • The Gorge
Re: do while bug in latestest openbor version....
« Reply #1 on: September 08, 2012, 01:32:08 pm »
A lot of bug reports have come in on the latest version. Clearly something went wrong, but atm I could not tell you what.

DC
OpenBOR Wiki.

Coming Soon:
Spoiler
Fatal Fury Chronicals


Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: do while bug in latestest openbor version....
« Reply #2 on: September 08, 2012, 01:55:52 pm »
I try to go back to a older version of openBor but then the engine crashes without a error report so I'm kinda stuck  at the moment.

Its at a actual point where I want to download the source and start adding better reporting features (or actually missing) but I can't download from the svn.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: do while bug in latestest openbor version....
« Reply #3 on: September 21, 2012, 01:23:55 pm »
I landed changing the command to a for i command and it works  ;D

Code: [Select]


int i = 0;
  for(i=0; i< maxWeapons; i++)                                                         //Loop entity collection.
  {
    weaponnumber = weaponnumber+1;
    if ( weaponnumber == 1 && getBeserk_wAmmo(self) > 0 && getBeserk_wOwned(self) > 0 ) {
      found = 1; i = maxWeapons+1; } else
    if ( weaponnumber == 2 && getShotgun_wAmmo(self) > 0 && getShotgun_wOwned(self) > 0 ) {
      found = 2; i = maxWeapons+1;} else
    if ( weaponnumber == 3 && getSuper_Shotgun_wAmmo(self) > 0 && getSuper_Shotgun_wOwned(self) > 0 ) {
      found = 3; i = maxWeapons+1; } else
    if ( weaponnumber == 4 && getChaingun_wAmmo(self) > 0 && getChaingun_wOwned(self) > 0 ) {
      found = 4; i = maxWeapons+1; } else
    if ( weaponnumber == 5 && getRocket_Launcher_wAmmo(self) > 0 && getRocket_Launcher_wOwned(self) > 0 ) {
      found = 5; i = maxWeapons+1; } else
    if ( weaponnumber == 6 && getPlasma_Gun_wAmmo(self) > 0 && getPlasma_Gun_wOwned(self) > 0 ) {
      found = 6; i = maxWeapons+1; } else
    if ( weaponnumber == 7 && getBFG_9000_wAmmo(self) > 0 && getBFG_9000_wOwned(self) > 0 ) {
      found = 7; i = maxWeapons+1; } else
    if ( weaponnumber == 8 && getChainsaw_wAmmo(self) > 0 && getChainsaw_wOwned(self) > 0 ) {
      found = 8; i = maxWeapons+1; } else
    if ( weaponnumber == 9 && getFlamethrower_wAmmo(self) > 0 && getFlamethrower_wOwned(self) > 0 ) {
      found = 9; i = maxWeapons+1; } else
    if ( weaponnumber == 10 && getSuper_Chaingun_wAmmo(self) > 0 && getSuper_Chaingun_wOwned(self) > 0 ) {
      found = 10; i = maxWeapons+1;}
  }

 



 0%




mighty
SimplePortal 2.3.3 © 2008-2010, SimplePortal