Topic:   Operators in Silver Creator   (Read 1520 times)


0 Members and 2 Guests are viewing this topic.

Johna100


  • GMG-er

  • **


  • Posts: 103

  • Gan is so awesome.
    • View Profile
    • make a simple Rougelike
Operators in Silver Creator
« on: May 30, 2016, 04:35:33 AM »
EDIT:
Here are how I use operators in Silver Creator.

OPEN CARD

Code: [Select]
// CHANGE THE NUMBERS TO TRY DIFFERENT PROGRAMS 

// SET a TO ZERO
LET a = 0

// ADD FIVE TO THE VARIABLE a
LET a = a + 5

// SUBTRACT ONE FROM THE VARIABLE a
LET a = a - 1

// MULTIPLY THE VARIABLE a BY 5
LET a = a * 5

// DIVIDE THE VARIABLE a BY 2
LET a = a / 2


// DISPLAYS THE NUMBER AS A STR SO YOU CAN VIEW IT AS TEXT
PRINT "variable a is the Number " + STR$(a)

// DISPLAY WHERE THE VARIABLE a IS RELATIVE TO 5
IF a > 5 THEN
   PRINT "variable a is Greater than 5"
END IF

IF a < 5 THEN
   PRINT "variable a is Less than 5"
END IF

IF a = 5 THEN
   PRINT "variable a is the number 5"
END IF








OLD POST

Operators in Silver Creator
Im using > and < and bugs happen. Are these the correct operators for greater than and less than?

Is there only > or only the <

ANSWER

My old code had bugs that did not have to do with the operators.

You can use both > and < in Silver Creator
« Last Edit: August 15, 2020, 03:35:35 PM by Johna100 »

Johna100


  • GMG-er

  • **


  • Posts: 103

  • Gan is so awesome.
    • View Profile
    • make a simple Rougelike
My bug code
« Reply #1 on: May 30, 2016, 04:54:29 AM »
I can't really explain what the problem is since it looks like It should work to me.
The potions don't heal life. This is in the INPUT section.

// Menu
IF INPUT$ = "menu" THEN
   GOTOCARD 28
END IF
// Potions

IF player1Life > 0 THEN
   
   IF INPUT$ = player1$ + " use potion" THEN
      IF partyPotions > 0 THEN
         LET player1Life = player1Life + 50
         PRINT "Used a Potion"
         LET partyPotions = partyPotions - 1
      END IF
   END IF
   
   IF INPUT$ = player1$ + " use mana potion" THEN
      IF partyManaPotions > 0 THEN
         LET player1Magic = player1Magic + 20
         IF player1Magic > player1MaxMagic THEN
            LET player1Magic = player1MaxMagic
         END IF
         PRINT "Used a Mana Potion"
         LET partyManaPotions = partyManaPotions - 1
      END IF
   END IF
END IF

// WIN
IF win = 1 THEN
   IF INPUT = continue THEN
      GOTOCARD 30
   END IF
ELSE
   
   IF monsterLife < 1 THEN
      PRINT "Victory!"
      PRINT "Type continue"
      LET win = 1
   END IF
   
   // BATTLE PLAYER1
   IF INPUT$ = player1$ +" attack" THEN
      IF player1Life > 0 THEN
         IF monsterLife > 1 THEN
           
            LET activeAttack = player1Strength + player1WeaponAttack
            LET monsterLife = monsterLife - activeAttack
            PRINT player1$ + " attacks " + monsterName$ + " for " + STR$(activeAttack) + " with " + player1WeaponName$
           
         END IF
      END IF
   END IF
   // SPELLS PLAYER1
   IF player1Magic > 0 THEN
     
      IF player1Class = 1 THEN
         //REST
         IF INPUT$ = player1$ +" use rest" THEN
            IF player1Magic > 9 THEN
               LET player1Magic = player1Magic - 10
               LET player1Life = player1Life + 20
               PRINT "Used Rest and gained 20 Life for 10 Magic"
            END IF
         END IF
         
         //RUN
         IF INPUT$ = player1$ +" use run" THEN
            IF player1Magic > 19 THEN
               LET player1Magic = player1Magic - 20
               LET randRun = RANDOM(3)
               IF randRun = 1 THEN
                  GOTOCARD 30
               ELSE
                  PRINT "Run failed. Used 20 Magic"
               END IF
               
            END IF
         END IF
         
         
      END IF
     
      IF player1Class = 2 THEN
         //SLASH
         IF INPUT$ = player1$ +" use slash" THEN
            IF player1Magic > 19 THEN
               LET player1Magic = player1Magic - 20
               LET monsterLife = monsterLife - 30
               PRINT "Used Slash for 20 Magic. Enemy lost 30 Life."
            END IF
         END IF
         //UPPERCUT
         IF INPUT$ = player1$ +" use uppercut" THEN
            IF player1Magic > 29 THEN
               LET player1Magic = player1Magic - 30
               LET monsterLife = monsterLife - 40
               PRINT "Used Uppercut for 30 Magic. Enemy lost 40 Life."
            END IF
         END IF
      END IF
      //RAGE SLASH
      IF INPUT$ = player1$ +" use rage slash" THEN
         IF player1Magic > 34 THEN
            LET player1Magic = player1Magic - 35
            LET monsterLife = monsterLife - 45
            PRINT "Used Rage Slash for 35 Magic. Enemy lost 45 Life."
         END IF
      END IF
   END IF
   
   
   IF player1Class = 3 THEN
      //BASH
      IF INPUT$ = player1$ +" use bash" THEN
         IF player1Magic > 19 THEN
            LET player1Magic = player1Magic - 20
            LET monsterLife = monsterLife - 35
            PRINT "Used Bash for 20 Magic. Enemy lost 35 Life."
         END IF
      END IF
      //AGGRESSIVE BASH
      IF INPUT$ = player1$ +" use aggressive bash" THEN
         IF player1Magic > 49 THEN
            LET player1Magic = player1Magic - 50
            LET monsterLife = monsterLife - 60
            PRINT "Used Aggressive Bash for 50 Magic. Enemy lost 60 Life."
         END IF
      END IF
   END IF
   
   IF player1Class = 4 THEN
      //AIMED SHOT
      IF INPUT$ = player1$ +" use aimed shot" THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET monsterLife = monsterLife - 25
            PRINT "Used Aimed Shot for 10 Magic. Enemy lost 25 Life."
         END IF
      END IF
      //BURST SHOT
      IF INPUT$ = player1$ +" use burst shot" THEN
         IF player1Magic > 19 THEN
            LET player1Magic = player1Magic - 20
            LET monsterLife = monsterLife - 35
            PRINT "Used Burst Shot for 20 Magic. Enemy lost 35 Life."
         END IF
      END IF
      //RANGER SHOT
      IF INPUT$ = player1$ +" use ranger shot" THEN
         IF player1Magic > 39 THEN
            LET player1Magic = player1Magic - 40
            LET monsterLife = monsterLife - 75
            PRINT "Used Ranger Shot for 40 Magic. Enemy lost 75 Life."
         END IF
      END IF
   END IF
   
   IF player1Class = 5 THEN
      //STEAL
      IF INPUT$ = player1$ +" use steal" THEN
         IF player1Magic > 4 THEN
            LET player1Magic = player1Magic - 5
            LET partyGold = partyGold + 5
            PRINT "Used Steal for 5 Magic. You stole 5 Gold."
         END IF
      END IF
   END IF
   
   IF player1Class = 6 THEN
      //HEAL
      IF INPUT$ = player1$ +" use heal on " + player1$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player1Life = player1Life + 25
            PRINT "Used Heal on" + player1$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player2$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player2Life = player2Life + 25
            PRINT "Used Heal on" + player2$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player3$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player3Life = player3Life + 25
            PRINT "Used Heal on" + player3$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player4$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player4Life = player4Life + 25
            PRINT "Used Heal on" + player4$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      //HOLY HEAL
      IF INPUT$ = player1$ +" use holy heal on " + player1$ THEN
         IF player1Magic > 49 THEN
            LET player1Magic = player1Magic - 50
            LET player1Life = player1Life + 70
            PRINT "Used Holy Heal on" + player1$ + " for 50 Magic. Recovered 70 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use holy heal on " + player2$ THEN
         IF player1Magic > 49 THEN
            LET player1Magic = player1Magic - 50
            LET player2Life = player2Life + 70
            PRINT "Used Holy Heal on" + player2$ + " for 50 Magic. Recovered 70 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use holy heal on " + player3$ THEN
         IF player1Magic > 49 THEN
            LET player1Magic = player1Magic - 50
            LET player3Life = player3Life + 70
            PRINT "Used Holy Heal on" + player3$ + " for 50 Magic. Recovered 70 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use holy heal on " + player4$ THEN
         IF player1Magic > 49 THEN
            LET player1Magic = player1Magic - 50
            LET player4Life = player4Life + 70
            PRINT "Used Holy Heal on" + player4$ + " for 50 Magic. Recovered 70 Life."
         END IF
      END IF
      //HEAL ALL
      IF INPUT$ = player1$ +" use heal all" THEN
         IF player1Magic > 99 THEN
            LET player1Magic = player1Magic - 100
            LET player1Life = player1Life + 70
            LET player2Life = player2Life + 70
            LET player3Life = player3Life + 70
            LET player4Life = player4Life + 70
            PRINT "Used Heal All for 100 Magic. Everyone Recovered 70 Life."
         END IF
      END IF
   END IF
   
   IF player1Class = 7 THEN
      //FLAME
      IF INPUT$ = player1$ +" use flame" THEN
         IF player1Magic > 29 THEN
            LET player1Magic = player1Magic - 30
            LET monsterLife = monsterLife - 50
            PRINT "Used Flame for 30 Magic. Enemy lost 50 Life."
         END IF
      END IF
      //ICE
      IF INPUT$ = player1$ +" use ice" THEN
         IF player1Magic > 39 THEN
            LET player1Magic = player1Magic - 40
            LET monsterLife = monsterLife - 70
            PRINT "Used Ice for 40 Magic. Enemy lost 70 Life."
         END IF
      END IF
      //LIGHTNING
      IF INPUT$ = player1$ +" use lightning" THEN
         IF player1Magic > 59 THEN
            LET player1Magic = player1Magic - 60
            LET monsterLife = monsterLife - 100
            PRINT "Used Lightning for 60 Magic. Enemy lost 100 Life."
         END IF
      END IF
   END IF
   
   IF player1Class = 8 THEN
      //SING
      IF INPUT$ = player1$ +" use sing" THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player1Life = player1Life + 5
            LET player2Life = player2Life + 5
            LET player3Life = player3Life + 5
            LET player4Life = player4Life + 5
            PRINT "Used Sing on All for 10 Magic. Everyone Recovered 5 Life."
         END IF
      END IF
   END IF
   
   IF player1Class = 9 THEN
      //FLAME
      IF INPUT$ = player1$ +" use flame" THEN
         IF player1Magic > 29 THEN
            LET player1Magic = player1Magic - 30
            LET monsterLife = monsterLife - 50
            PRINT "Used Flame for 30 Magic. Enemy lost 50 Life."
         END IF
      END IF
      //HEAL
      IF INPUT$ = player1$ +" use heal on " + player1$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player1Life = player1Life + 25
            PRINT "Used Heal on" + player1$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player2$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player2Life = player2Life + 25
            PRINT "Used Heal on" + player2$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player3$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player3Life = player3Life + 25
            PRINT "Used Heal on" + player3$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
      IF INPUT$ = player1$ +" use heal on " + player4$ THEN
         IF player1Magic > 9 THEN
            LET player1Magic = player1Magic - 10
            LET player4Life = player4Life + 25
            PRINT "Used Heal on" + player4$ + " for 10 Magic. Recovered 25 Life."
         END IF
      END IF
   END IF
   
END IF

IF player1MaxLife < player1Life THEN
   LET player1Life = player1MaxLife
END IF


IF win = 0 THEN
   LET player1Life = player1Life - monsterAttack
   PRINT monsterName$ + " attacks " + player1$ + " for " + STR$(monsterAttack)
END IF


EqwanoX


  • GMG Extraordinaire

  • ***


  • Posts: 1174
    • View Profile
Re: Operators in Silver Creator
« Reply #2 on: July 06, 2016, 04:46:10 PM »
i could figure this out but you would have to upload the source code, i cant sit here and analyze 200 lines of code

Johna100


  • GMG-er

  • **


  • Posts: 103

  • Gan is so awesome.
    • View Profile
    • make a simple Rougelike
Re: Operators in Silver Creator
« Reply #3 on: September 12, 2016, 08:09:04 PM »
I found out how to make it work. Thanks for the support on my projects.
« Last Edit: August 15, 2020, 03:38:11 PM by Johna100 »

Johna100


  • GMG-er

  • **


  • Posts: 103

  • Gan is so awesome.
    • View Profile
    • make a simple Rougelike
Re: Operators in Silver Creator
« Reply #4 on: August 15, 2020, 03:39:27 PM »
From what I have learned the problem is somewhere in the part of the code dealing with spells. My bug in this section must create a problem that affects the rest of the code. Also it could have been that the monster attacked for the same amount as the potion healed and I did not realize this so I thought It was broken. Since the monster attacks the same run-through as the potion heals. With no display after the potion is used. This was a fault on my end.
« Last Edit: August 15, 2020, 03:43:23 PM by Johna100 »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4389
    • View Profile
Re: Operators in Silver Creator
« Reply #5 on: August 28, 2020, 10:17:34 AM »
Nice catch. A lot of the problems I run into are also my fault.

Johna100


  • GMG-er

  • **


  • Posts: 103

  • Gan is so awesome.
    • View Profile
    • make a simple Rougelike
Re: Operators in Silver Creator
« Reply #6 on: August 28, 2020, 03:24:10 PM »
Coding is a learning process.