Help WIth My Pokemon Contest Thread

I need help with my Pokemon Contest code. I want the code to look like and use code copied from XanMag's game Good Night.
I have a few questions:

  1. What code should I use?
  2. Is this possible?

This is what I've came up with so far:

Ask {
 if Yes {
    MoveObject (player, contest hall)
    msg ("Welcome to the Novice Pokemon Contest! I am your host, Mr. Funman! We will start our contest off today with an examination of the contestant's Pokemon!
+1 health
+1 speed
+1 Cute
+1 Beauty
+1 Tough
+1 Cool
+1 Smart
+1 armour
+1 level")
Wait 1 second
      msg ("Next, we will compete with our second stage trivia game!")
      msg ("And finally, it's our main event! The Appeals Stage! Let's go!")
Wait 1 second
      Appeals Stage
      msg ("And we're done! Now, let's tally up the results!")
      if (game.w > game.x > game.y > game.z) {
        msg ("W won! W came in 1st place! X  came in 2nd place! Y came in 3rd place! Z came in 4th place!
W wins 50 pokedollars and 1 potion! W wins the Novice Contest Ribbon!")
        player.novicecontestribbon = true
        player.potion = player.potion + 1
        player.pokedollar = player.pokedollar + 50!
  if No
    msg ("Okay. Come again anytime!")

I have made minor improvements since yesterday. I thought maybe I could move the player to different rooms, while using the "after waiting 1 second option" function.

If the different stages of the game require player input, you'd likely be making a function to handle each, so that each stage triggers the next when it has finished.

 if (game.w > game.x > game.y > game.z) {

This is going to be tough to implement as it stands.

Do you have objects for the contestants? For example, a player object and 3 NPCs, or objects representing 4 different players?
If so, it would be easier to give each of them a score attribute.

Then you can do something like:

winners = ObjectListSortDescending (GetObjectList ("player;John;Bob;Sue"), "score")
OutputTextNoBr (GetDisplayName (winners[0]) +" won! ")
OutputTextNoBr (GetDisplayName (winners[0]) +" came in 1st place! ")
OutputTextNoBr (GetDisplayName (winners[1]) +"  came in 2nd place! ")
OutputTextNoBr (GetDisplayName (winners[2]) +" came in 3rd place! ")
OutputTextNoBr (GetDisplayName (winners[3]) +" came in 4th place! ")
msg (GetDisplayName (winners[0]) + " wins 50 pokedollars and 1 potion! "+GetDisplayName (winners[0])+" wins the Novice Contest Ribbon!")
if (winners[0] = player) {
  player.novicecontestribbon = true
  player.potion = player.potion + 1
  player.pokedollar = player.pokedollar + 50!
(this uses my GetObjectList function to quickly make a list of contestants; click for code)
<function name="GetObjectList" parameters="input" type="objectlist">
  if (TypeOf (input) = "string") {
    input = Split (input)
  output = NewObjectList()
  foreach (i, input) {
    list add (output, GetObject (i))
  return (output)

If you really don't want to use objects, I don't think there's an easy way to find the winner. You'd probably have to do something like:

first = ""
second = ""
third = ""
fourth = ""
foreach (i, Split ("w;x;y;z")) {
  position = 0
  foreach (j, Split ("w;x;y;z")) {
    if (GetInt (game, j) > GetInt (game, i)) {
      position = position + 1
  if (position = 0 and first = "") {
    first = CapFirst(i)
  else if (position <= 1 and second = "") {
    second = CapFirst(i)
  else if (position <= 2 and third = "") {
    third = CapFirst(i)
  else {
    fourth = CapFirst(i)
msg (first + " won! " + first + " came in 1st place! " + second + "  came in 2nd place! " + third + " came in 3rd place! " + fourth + " came in 4th place! " + first + " wins 50 pokedollars and 1 potion! " + first + " wins the Novice Contest Ribbon!")

Then to determine if the player gets a prize, just check whether the variable winner is the player's name.

Note that both of these methods will treat the player listed first as the winner in the event of a tie. If you want to have a tiebreaker, or allow two contestants to share the podium, that's easy enough to add.

I don't understand, but I'll try to save that code. Thank you.

This topic is now closed. Topics are closed after 60 days of inactivity.