• Log in or sign up for an account here: https://www.sythe.org/login

Looking for someone to debug a game.....

ZamorakianFaith

Forum Addict
Joined
Apr 28, 2005
Sythe Gold
0
Messages
406
Location
In your hard drive.
basically i've coded for days and tried so many new things that I dont recognize my own code.... so can someone debug this for me?


Known bugs:

Experience System
Combat System
Laggy interface



thanks- heres the code:

Code:
{//////////////////////////////////////////////////////////////////////')
{//  //      //    //////////////////////////////////    //      //  //
{//    /////////////         RPG By ZFaith       ///////////////    //
{//  //      //    //////////////////////////////////    //      //  //
{//////////////////////////////////////////////////////////////////////

Please set up your stats if you want to start out ahead
of the game, or if you are continuing from a previous game.

The stats setup section starts at line 23.
}

program RPG;
var
yourcurrentxp,xp,yourcurrenthp,monsterint:integer;
weapon,answer2,monst:string;
m:array [1..15] of string;
chance,at,st,df,es,hp,hitpoints:integer;


procedure declarestats;
begin
//SET UP STATS HERE\\
HP:= 10;
AT:= 1;
ST:= 1;
DF:= 1;
ES:= 1;
chance:= 3; // if chance = 7 then you have a 1:7 chance of combat
weapon:= 'Dildo'
//DID YOU SET UP YOUR STATS?\\
end;

function anim(text:string):boolean;
var
t:integer;
begin
result:=true
repeat
writeln(text)
writeln('-')
wait(100)
cleardebug;
writeln(text)
writeln('\')
wait(100)
cleardebug;
writeln(text)
writeln('|')
wait(100)
cleardebug;
writeln(text)
writeln('/')
t:=t+1
wait(100)
cleardebug;
until(t=5)
end;



procedure start; forward;
procedure fight; forward;
procedure declaremonsters; forward;



procedure idle;
var
answer:string;prob:integer;
begin
  prob:=random(chance)
  writeln(inttostr(prob))// debug
  anim('...you venture further into the dungeon...')
  anim('...you venture further into the dungeon...')
  if prob = 0 then
  begin
    DeclareMonsters;
    hitpoints:=random(hp)
    if hitpoints = 0 then
    begin
    hitpoints:= 1
    end;
    writeln('You have encountered a level '+inttostr(hitpoints)+' '+monst+'!')
    wait(3000)
    cleardebug
    anim('Get Ready')
    answer:=readln('What do you want to do? type "Run" or "Fight"')
    if answer = 'run' then
    begin
      cleardebug
      anim('You run away...')
      idle
    end;
    if answer = 'fight' then
    begin
      cleardebug
      wait(500)
      fight
    end else
    anim('You find nothing of interest...')
  end else
  anim('You find nothing of interest...')
end;

//Readys the monster list for usage
Procedure declaremonsters;
begin
MonsterInt := Random(14);
  case Random(14) of
0: Monst :='Wolf'
1: Monst :='Bat'
2: Monst :='Spider'
3: Monst :='Rouge'
4: Monst :='Spirit'
5: Monst :='Slime'
6: Monst :='Soul Collecter'
7: Monst :='Reaper'
8: Monst :='Mage'
9: Monst :='Swordsman'
10: Monst :='Dwarf'
11: Monst :='Elf'
12: Monst :='Bowman'
13: Monst :='Valkrie'
14: Monst :='Sythe'
end;

end;


procedure reportstats;
begin
writeln('/////////////////////////')
writeln('//      Your Stats     //')
writeln('/////////////////////////')
writeln('')
writeln('    AT:'+inttostr(at))
writeln('    ST:'+inttostr(ST))
writeln('    DF:'+inttostr(df))
writeln('    HP:'+inttostr(hp))
writeln('    Weapon:'+weapon)
writeln('')
writeln('/////////////////////////')
end;

procedure lvlup;
var
stat:string;
begin
stat:=readln('You have enough XP to increase a level! what do you want to increase? (AT, DF, ST, HP)')
if stat='AT' then
  begin
  at:=at+1
  xp:=xp-100
  end;
if stat='ST' then
  begin
  st:=st+1
  xp:=xp-100
  end;
if stat='DF' then
  begin
  df:=df+1
  xp:=xp-100
  end;
if stat='HP' then
  begin
  hp:=hp+1
  xp:=xp-100
  end;
end;


procedure fight;
var
lasthit,lasthit2,currentxp,currenthp:integer;
begin
  begin
    repeat
    wait(2500)
    currenthp:=hitpoints-(lasthit-random(at+st*2))
    lasthit:=hitpoints-currenthp
    anim('You attack the '+monst+' with your '+weapon+'. You have dealt a total of '+inttostr(hitpoints-currenthp)+' damage so far.')
    anim('You attack the '+monst+' with your '+weapon+'. You have dealt a total of '+inttostr(hitpoints-currenthp)+' damage so far.')
    wait(2500)
    yourcurrenthp:=hp-(lasthit2-random(hitpoints-df))
    lasthit2:=hp-yourcurrenthp
    anim('The '+monst+ ' lunges at you ferociously. It has dealt a total of '+inttostr(hp-yourcurrenthp)+' damage so far.')
    anim('The '+monst+ ' lunges at you ferociously. It has dealt a total of '+inttostr(hp-yourcurrenthp)+' damage so far.')
    until(currenthp or yourcurrenthp=0)
    if currenthp<=0 then
      begin
      currentxp:=xp+(hitpoints/2)
      anim('You killed a level '+inttostr(hitpoints)+' with your '+weapon+' and gained '+inttostr(currentxp)+' experience!')
      xp:=currentxp
      if xp>100 then
        begin
        lvlup
        end;
      end;
    if yourcurrentxp=0 then
      begin
      anim('You have died....  GAME OVER')
      reportstats
      terminatescript
      end;
  end;
end;



procedure start;
begin
writeln('//////////////////////////////////////////////////////////////////////')
writeln('//  //      //    //////////////////////////////////    //      //  //')
writeln('//    /////////////    Welcome to RPG By ZFaith  ///////////////    //')
writeln('//  //      //    //////////////////////////////////    //      //  //')
writeln('//////////////////////////////////////////////////////////////////////')
wait(5000)
cleardebug
wait(500)
repeat
anim('Press F11 to start')
until(isfkeydown(11)=true)
anim('You face the opening to an unknown dungeon...')
anim('You face the opening to an unknown dungeon...')
anim('You face the opening to an unknown dungeon...')
repeat
anim('Press F11 to enter the dungeon.')
until(isfkeydown(11)=true)
anim('You warily enter the dungeon- '+weapon+' in hand.')
anim('You warily enter the dungeon- '+weapon+' in hand.')
repeat
idle
answer2:=readln('Continue into the dungeon? type "yes" or "no" (your stats will be saved until you stop the script)')
until(answer2='no')
end;


begin
cleardebug
writeln('Please Wait While The Game Compiles...')
wait(3000)
cleardebug
wait(500)
anim('Loading')
declarestats;
anim('Loading')
declaremonsters;
anim('Loading')
repeat
start
until(false)
end.
 
I didn't understand the game[play] very well, so hopefully my editings will help you even a little. :P

Here you go mate:

Code:
{//////////////////////////////////////////////////////////////////////')
{//  //      //    //////////////////////////////////    //      //  //
{//    /////////////         RPG By ZFaith       ///////////////    //
{//  //      //    //////////////////////////////////    //      //  //
{//////////////////////////////////////////////////////////////////////

Please set up your Stats if you want to Start out ahead
of the game, or if you are continuing from a previous game.

The Stats setup section Starts at line 23.}

program RPG;

procedure Start; forward;
procedure Fight; forward;
procedure declareMonsterers; forward;

var
  YourCurrentXP, xp, YourCurrentHP, Monstererint, Chance, at, st, df,
   es, hp, HitPoints: Integer;
  Weapon, Answer2, Monster: string;

procedure declareStats;
begin
  //SET UP StatS HERE\\
  HP:= 10;
  AT:= 1;
  ST:= 1;
  DF:= 1;
  ES:= 1;
  Chance:= 3; // if Chance = 7 then you have a 1:7 Chance of combat
  Weapon:= 'Dildo';
  //DID YOU SET UP YOUR StatS?\\
end;

procedure Animation(text: string; TimeToRun: Integer);
var
  i, t: Integer;
  Symbol: array[0..3] of string;
  sTime: Integer;
begin
  Symbol[0]:= '-';
  Symbol[1]:= '\';
  Symbol[2]:= '|';
  Symbol[3]:= '/';
  sTime:= GetSystemTime;
  while GetSystemTime - sTime < TimeToRun do
  begin
    for t:= 0 to 5 do
      for i:= 0 to 3 do
      begin
        WriteLn(text);
        WriteLn(Symbol[i]);
        Wait(100);
        ClearDebug;
        if(GetSystemTime - sTime >= TimeToRun)then
          Exit;
      end
  end
end;

procedure idle;
var
  Answer: string;
  prob: Integer;
begin
  prob:= Random(Chance);
  WriteLn(IntToStr(prob)); // debug
  Animation('...you venture further into the dungeon...', 1000);
  if(prob = 0)then
  begin
    DeclareMonsterers;
    HitPoints:= Random(hp);
    if(HitPoints = 0)then
      HitPoints:= 1;
    WriteLn('You have encountered a level ' + IntToStr(HitPoints) + ' ' + Monster + '!');
    Wait(3000);
    ClearDebug;
    Animation('Get Ready', 1000);
    Answer:= ReadLn('What do you want to do? type "Run" or "Fight"');
    if(LowerCase(Answer) = 'run')then
    begin
      ClearDebug;
      Animation('You run away...', 1000);
      idle;
    end
    if(LowerCase(Answer) = 'fight')then
    begin
      ClearDebug;
      Wait(500);
      Fight;
    end else
      Animation('You find nothing of interest...', 1000);
  end else
    Animation('You find nothing of interest...', 1000);
end;

//Readys the Monsterer list for usage
procedure declareMonsterers;
begin
  MonstererInt:= Random(14);
  case Random(14) of
    0: Monster:= 'Wolf';
    1: Monster:= 'Bat';
    2: Monster:= 'Spider';
    3: Monster:= 'Rouge';
    4: Monster:= 'Spirit';
    5: Monster:= 'Slime';
    6: Monster:= 'Soul Collecter';
    7: Monster:= 'Reaper';
    8: Monster:= 'Mage';
    9: Monster:= 'Swordsman';
    10: Monster:= 'Dwarf';
    11: Monster:= 'Elf';
    12: Monster:= 'Bowman';
    13: Monster:= 'Valkrie';
    14: Monster:= 'Sythe';
  end
end;

procedure ReportStats;
begin
  WriteLn('/////////////////////////');
  WriteLn('//      Your Stats     //');
  WriteLn('/////////////////////////');
  WriteLn('');
  WriteLn('    AT:' + IntToStr(at));
  WriteLn('    ST:' + IntToStr(ST));
  WriteLn('    DF:' + IntToStr(df));
  WriteLn('    HP:' + IntToStr(hp));
  WriteLn('    Weapon:' + Weapon);
  WriteLn('');
  WriteLn('/////////////////////////');
end;

procedure LvlUp;
var
  Stat: string;
begin
  Stat:= ReadLn('You have enough XP to increase a level! What do you want to increase? (AT, DF, ST, HP)');
  case LowerCase(Stat) of
    'at': at:= at + 1;
    'st': st:= st + 1;
    'df': df:= df + 1;
    'hp': hp:= hp + 1;
  end
  xp:= xp - 100;
end;

procedure Fight;
var
  LastHit, LastHit2, CurrentXP, CurrentHP: Integer;
begin
  begin
    repeat
      CurrentHP:= HitPoints - (LastHit - Random(at + st * 2));
      LastHit:= HitPoints - CurrentHP;
      Animation('You attack the ' + Monster + ' with your ' + Weapon + '. You have dealt a total of ' + IntToStr(HitPoints - CurrentHP) + ' damage so far.', 2500);
      YourCurrentHP:= hp - (LastHit2 - Random(HitPoints - df));
      LastHit2:= hp - YourCurrentHP;
      Animation('The ' + Monster + ' lunges at you ferociously. It has dealt a total of ' + IntToStr(hp - YourCurrentHP) + ' damage so far.', 2500);
    until(CurrentHP = 0)or(YourCurrentHP = 0);
    if(CurrentHP <= 0)then
    begin
      CurrentXP:= xp + (HitPoints / 2);
      Animation('You killed a level ' + IntToStr(HitPoints) + ' with your ' + Weapon + ' and gained ' + IntToStr(CurrentXP) + ' experience!', 2000);
      xp:= CurrentXP;
      if(xp > 100)then
        LvlUp;
    end
    if(YourCurrentXP = 0)then
    begin
      Animation('You have died.... GAME OVER', 2000);
      ReportStats;
      TerminateScript;
    end
  end
end;

procedure Start;
begin
  WriteLn('//////////////////////////////////////////////////////////////////////');
  WriteLn('//  //      //    //////////////////////////////////    //      //  //');
  WriteLn('//    /////////////    Welcome to RPG By ZFaith  ///////////////    //');
  WriteLn('//  //      //    //////////////////////////////////    //      //  //');
  WriteLn('//////////////////////////////////////////////////////////////////////');
  Wait(3000);
  ClearDebug;
  while not(IsFKeyDown(11))do
    Animation('Press F11 to Start', 400);
  Animation('You face the opening to an unknown dungeon...', 1000);
  while not(IsFKeyDown(11))do
    Animation('Press F11 to enter the dungeon.', 400);
  Animation('You warily enter the dungeon- ' + Weapon + ' in hand.', 1000);
  repeat
    idle;
    Answer2:= ReadLn('Continue into the dungeon? type "yes" or "no" (your Stats will be saved until you stop the script)');
  until(LowerCase(Answer2) = 'no');
end;

begin
  ClearDebug;
  WriteLn('Please Wait While The Game Compiles...');
  Wait(3000);
  ClearDebug;
  Animation('Loading', 1000);
  declareStats;
  Animation('Loading', 1000);
  declareMonsterers;
  Animation('Loading', 1000);
  repeat
    Start;
  until(False);
end.

Sorry that I can't (right now) help you that much.

..I am also sorry already if it doesn't help you at ALL (which is very possible). :D

Edit: Oops, I forgot to say that, GOOD LUCK with the game! :)
 
Runescape Gamblingrunescape gambling
Back
Top