Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How can I make this better??
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JMSS041




PostPosted: Tue Dec 16, 2008 3:06 pm   Post subject: How can I make this better??

I would like to know if anyone out there knows how i can make this better.

Here is the program:


Turing:

View.Set ("title: StormNexus (The Turing RPG), position: middle, middle, nobuttonbar")

%Declare Variables
var Name : string

%Input for Name
put "Enter Your Chosen Name: " ..
get Name : *
cls

%Declare Variables
var Gendre : string

%Input for Gendre
put "Enter Your Gendre (Male/Female): " ..
get Gendre
cls

%Declare Variable
var Proffession : string

%Checks Gendre then displays possible proffessions
if Gendre = "Male" then
    put "Choose Your Proffession Wisely:"
    put "Fighter"
    put "Barbarian"
    put "Bard"
    put "Cleric"
    put "Wizard"
    put "Sorcerer"
    put "Palidan"
    put "Monk"
    put "Druid"
    put "Ranger"
    put "Rogue"
    put "Choice: " ..
    get Proffession
    cls
end if

if Gendre = "Female" then
    put "Choose Your Proffession Wisely:"
    put "Fighter"
    put "Barbarian"
    put "Bard"
    put "Cleric"
    put "Witch"
    put "Sorceress"
    put "Palidan"
    put "Monk"
    put "Druid"
    put "Ranger"
    put "Rogue"
    put "Choice: " ..
    get Proffession
    cls
end if

%Declare Variable
var Alliance : string

%Choosing Alliance
put "Choose Your Alliance Wisely:"
put "Dark Alliance"
put "Free Alliance"
put "Nothern Alliance"
put "Unallied"
put "Choice: " ..
get Alliance : *
cls


%Declare Variables
var weapon : string
var shield : string
var movement : string
var hitpoints : int := 0
var distance : int := 0
var ac : int := 0
var level : int := 1
var experience_points : int := 0
var heal : int := 0

%Checks Proffession inputed, and makes bio for char
if Proffession = "Fighter" then
    weapon := "Longsword"
    shield := "Tower Shield"
    ac := 15
    hitpoints := 13
    level := level
    experience_points := experience_points
    heal := 11
end if

if Proffession = "Palidan" then
    weapon := "Greatsword"
    shield := "Nothing"
    ac := 13
    hitpoints := 13
    level := level
    experience_points := experience_points
    heal := 11
end if

if Proffession = "Wizard" or Proffession = "Witch" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
    weapon := "Mage Staff"
    shield := "Nothing"
    ac := 10
    hitpoints := 7
    level := level
    experience_points := experience_points
    heal := 5
end if

if Proffession = "Cleric" then
    weapon := "Mace"
    shield := "Tower Shield"
    ac := 15
    hitpoints := 10
    level := level
    experience_points := experience_points
    heal := 8
end if

if Proffession = "Barbarian" then
    weapon := "Greataxe"
    shield := "Nothing"
    ac := 13
    hitpoints := 14
    level := level
    experience_points := experience_points
    heal := 12
end if

if Proffession = "Bard" or Proffession = "Rogue" then
    weapon := "Short Sword"
    shield := "Small Shield"
    ac := 12
    hitpoints := 8
    level := level
    experience_points := experience_points
    heal := 6
end if

if Proffession = "Druid" then
    weapon := "Quarterstaff"
    shield := "Nothing"
    ac := 11
    hitpoints := 9
    level := level
    experience_points := experience_points
    heal := 7
end if

if Proffession = "Monk" then
    weapon := "Unarmed"
    shield := "Nothing"
    ac := 14
    hitpoints := 10
    level := level
    experience_points := experience_points
    heal := 8
end if

if Proffession = "Ranger" then
    weapon := "Longbow"
    shield := "Nothing"
    ac := 13
    hitpoints := 11
    level := level
    experience_points := experience_points
    heal := 9
end if

%Beginning of Bio, Makes your bio appear and asks for input
loop
    put "Welcome, ", Name, " ", Proffession, " of the ", Alliance
    put "Weapon: ", weapon
    put "Sheild: ", shield
    put "Armor Class: ", ac
    put "Hitpoints: ", hitpoints
    put "Level: ", level
    put "Experience Points: ", experience_points
    put "Distance: ", distance
    put "Movement: " ..
    get movement
    cls

    if movement = "Right" then
        distance := distance + 5
    end if

    if movement = "Left" then
        distance := distance - 5
    end if

    if movement = "Up" then
        distance := distance + 5
    end if

    if movement = "Down" then
        distance := distance - 5
    end if

    var thief_hitpoints : int := 0
    var action : string

    if level = 1 and distance = 30 then
        cls
        thief_hitpoints := thief_hitpoints + 20
        loop
            put "You have encountered a Theif!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 500 or hitpoints = 0
        end loop

    end if

    if level = 1 and distance = 60 then
        cls
        thief_hitpoints := thief_hitpoints + 20
        loop
            put "You have encountered a Theif!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 1000 or hitpoints = 0
        end loop

        if experience_points = 1000 then
            ac := ac + 1
            weapon := weapon
            level := level + 1
            hitpoints := hitpoints + hitpoints
        end if

    end if

    if level = 2 and distance = 90 then
        cls
        thief_hitpoints := thief_hitpoints + 30
        loop
            put "You have encountered a Knight!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 3
                thief_hitpoints := thief_hitpoints - 6
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 6
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 1500 or hitpoints = 0
        end loop

    end if

    if level = 2 and distance = 120 then
        cls
        thief_hitpoints := thief_hitpoints + 30
        loop
            put "You have encountered a Knight!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 3
                thief_hitpoints := thief_hitpoints - 6
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 6
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 2000 or hitpoints = 0
        end loop

        if experience_points = 2000 then
            ac := ac + 1
            weapon := weapon
            level := level + 1
            hitpoints := hitpoints + hitpoints + heal + 4
        end if

    end if

    if level = 3 and distance = 150 then
        cls
        thief_hitpoints := thief_hitpoints + 40
        loop
            put "You have encountered an Orc!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if
            if hitpoints = 0 then
                cls
                var font1 : int
                font1 := Font.New ("serif:40")
                drawfillbox (maxx, maxy, 0, 0, brightred)
                Draw.Text ("Your Dead", 300, 150, font1, white)
            end if
            exit when experience_points = 2500
        end loop
    end if

    if level = 3 and distance = 180 then
        cls
        thief_hitpoints := thief_hitpoints + 40
        loop
            put "You have encountered an Orc!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 3000 or hitpoints = 0
        end loop

        if experience_points = 3000 then
            ac := ac + 1
            weapon := weapon
            level := level + 1
            hitpoints := hitpoints + hitpoints + heal + 4
        end if
    end if

    if level = 4 and distance = 210 then
        cls
        thief_hitpoints := thief_hitpoints + 50
        loop
            put "You have encountered a Zombie!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 3500 or hitpoints = 0
        end loop
    end if

    if level = 4 and distance = 240 then
        cls
        thief_hitpoints := thief_hitpoints + 50
        loop
            put "You have encountered a Zombie!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", thief_hitpoints
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 2
                thief_hitpoints := thief_hitpoints - 5
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 1
                thief_hitpoints := thief_hitpoints - 5
            end if

            if thief_hitpoints = 0 then
                experience_points := experience_points + 500
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 4000 or hitpoints = 0
        end loop

        if experience_points = 4000 then
            ac := ac + 1
            weapon := weapon
            level := level + 1
            hitpoints := hitpoints + hitpoints + heal + 4
        end if
    end if

    var boss_hp : int := 0

    if level = 5 and distance = 270 then
        cls
        boss_hp := boss_hp + 200
        loop
            put "You have encountered a Dragon Knight!"
            put "Your Hitpoints: ", hitpoints
            put "Enemy Hitpoints: ", boss_hp
            put "Action (Attack/Heal/Cast Spell): " ..
            get action
            cls

            if action = "Attack" then
                hitpoints := hitpoints - 3
                boss_hp := boss_hp - 10
            end if

            if action = "Heal" then
                hitpoints := hitpoints - 2
                hitpoints := hitpoints + 1
            end if

            if action = "Cast Spell" and Proffession = "Witch" or Proffession = "Wizard" or Proffession = "Sorcerer" or Proffession = "Sorceress" then
                hitpoints := hitpoints - 2
                boss_hp := boss_hp - 10
            end if

            if boss_hp = 0 then
                experience_points := experience_points + 1000
                hitpoints := hitpoints + heal - 3
            end if

            exit when experience_points = 5000 or hitpoints = 0
        end loop
    end if
    exit when experience_points = 5000 or hitpoints = 0
end loop

if hitpoints = 0 then
    cls
    var font1 : int
    font1 := Font.New ("serif:40")
    drawfillbox (maxx, maxy, 0, 0, brightred)
    Draw.Text ("Your Dead", 175, 200, font1, white)
end if

if experience_points = 5000 then
    cls
    put "After numerous battles, ", Name, "faught brilliantly."
    put weapon, "s collided, wounds were opened."
    put "With the final blow, a great white light emerged,"
    put "And all that was left, was the cloak of ", Name
    put "Where has he gone? To be continued.."
end if


Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="Turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
S_Grimm




PostPosted: Tue Dec 16, 2008 3:59 pm   Post subject: RE:How can I make this better??

Turing:

procedure variableName

%code

end variableName
Parker




PostPosted: Thu Dec 18, 2008 8:48 am   Post subject: RE:How can I make this better??

You should make it so attacks are randomized. Everytime if you hit 5 damage and Oppenent hit 2, the result will always be the same. Say you could hit (2-5) and oppenent could hit (1-3) it would be more fun. As you went up levels etc you could hit (3-7) etc.
Sam_sam




PostPosted: Sun Dec 21, 2008 11:44 am   Post subject: RE:How can I make this better??

I Think the best way to fix this code is by expecting g the unexpected. Like when you gave people the options... what is they are being stupid and wasting time and put something other... you should write.. "not an option" and make them try again Smile

Just my look on things
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: