Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Twisted

#1
Thanks a lot for pointing out the reward mix up. Also thanks for showing the "while" option. I'm pretty new to this. I picked AGS two days ago so i still have to learn alot.  Anyway i am planning to make animations for the slots but I thought, before i begin with animating i want the basic script to work so that way i would be easier for me to see what's wrong if it doesn't work.
#2
Sorry for the double post. I've got it up and running after screwing with it for a while. I've translated it to english so you guys can use it if you want (it still needs some tweaking and i still have to find out how to actually put my money in the inventory)

// room script file
// room = Slot Machine

int cash = 100; // your ammount of money
int reward; //the prize that you've won
int slot1; //the first slot
int slot2; //the second slot
int slot3; //the third slot
int costs = 1; //the cost to play slots

function hHotspot1_Interact()
{
slot1 = Random(3); //assigns random number to slot in wich 0 = bar,  1 = cherry, 2 = seven and 3 = orange.
slot2 = Random(3);
slot3 = Random(3);
cash = (cash - costs); //puts a coin in the slot machine


  if(cash < 0)
  {
    Display("Sorry,  you're out of cash!");
  }
  else
  {
  if (slot1 == 0) //slot 1 = bar
    {
      object[0].SetView(2, 0, 0); //sets animation of slot 1 to bar
    }

  if (slot1 == 1) //slot 1 = cherry
  {
      object[0].SetView(2, 0, 2); //sets animation of slot 1 to cherry
  }

  if (slot1 == 2) //slot 1 = seven
  {
      object[0].SetView(2, 0, 1); //sets animation of slot 1 to seven
  }

  if (slot1 == 3) //slot 1 = orange
  {
      object[0].SetView(2, 0, 3); //sets animation of slot 1 to orange 
  }

  if (slot2 == 0)  //slot 2 = bar
  {
      object[1].SetView(2, 0, 0); //sets animation of slot 2 to bar
  }

  if (slot2 == 1)  //slot 2 = cherry
  {
      object[1].SetView(2, 0, 2); //sets animation of slot 2 to cherry
  }

  if (slot2 == 2) //slot 2 = seven
  {
      object[1].SetView(2, 0, 1); //sets animation of slot 2 to seven
  }

  if (slot2 == 3) //slot 2 = orange
  {
      object[1].SetView(2, 0, 3); //sets animation of slot 2 to orange
  }

  if (slot3 == 0) //slot 3 = bar
  {
      object[2].SetView(2, 0, 0); //sets animation of slot 3 to bar
  }

  if (slot3 == 1) //slot 3 = cherry
  {
    object[2].SetView(2, 0, 2); //sets animation of slot 3 to cherry
  }

  if (slot3 == 2) //slot 3 = seven
  {
    object[2].SetView(2, 0, 1); //sets animation of slot 3 to seven
  }

  if (slot3 == 3) //slot 3 = orange
  {
    object[2].SetView(2, 0, 3); //sets animation of slot 3 to orange
  }
 
  if (slot1 == 1 && slot2 == 1 && slot3 == 1) // three bars in a row
  {
    reward = 100; //the prize that is won
    cash = (cash+reward); //the new ammount of cash
    return cash;
  }
   
   if (slot1 == 3 && slot2 == 3 && slot3 == 3) // three sevens in a row
  {
    reward = 50; //the prize that is won
    cash = (cash+reward); //the new ammount of cash
    return cash;
  }
 
   if (slot1 == 3 && slot2 == 3 && slot3 == 3) // three oranges in a row
  {
    reward = 40; //the prize that is won
    cash = (cash+reward); //the new ammount of cash
    return cash;
  } 
   
    if (slot1 == 2 && slot2 == 2 && slot3 == 2) // three cherry's in a row
  {
    reward = 30; //the prize that is won
    cash = (cash+reward); //the new ammount of cash
    return cash;
  }
   
   if (slot1 == 2 && slot2 == 2) // two cherry's in a row
  {
    reward = 20; //the prize that is won
    cash = (cash+reward); //the new ammount of cash
    return cash;
  }
 
  }
  DisplayAt(155,  33,  300, "Your current cash is %d dollar", cash);
 
}
#3
Okay, i'll take a look at it. If i find that it won't work i'll rename my int's and comments to english to make it more understandable for you because it's written in dutch  ;). At least i won't be bored today.

edit: And if it does work i'll post the script anyway incase you guys might want to use a slot machine in one of your games.
#4
I'm not at home right now so i used this script as an example, maybe i just got it right this tie by luck  :).

The actual script is a little bit more complex than this one, i'll browse through it again when i get home. If i still find that i'm having problems, would it be ok to post the actual script? (it's a bit long)
#5
I am trying to make a slot machine with AGS but for some reason the reward system isn't working.
my script looks somewhat like this, what is wrong with it?

int cash;           // your money
int reward1 =20;   // the prize you win for three cherry's in a row
int slot1;      // the first slot
int slot2;      // the second slot
int slot3;      // the third slot

slot1 = random(3);  //gives the slot a number in wich 0 = bar, 1 = cherry, 2 = lime etc.
slot2 = random(3);
slot3 = random(3);

if(slot1 == 1 && slot2 == 1 && slot3 ==1) //three cherry's in a row
{
cash = (cash + reward1); // the prize added to your money
return cash;       // your new amount of money
}
#6
Thanks for the quick reply. It works perfect now.
#7
Could someone explain to me how to post multiple strings?
example: string name1 = "Bob";
                string name2 = "Bill";

Display("Hello "  name1 " and" name2);

I'm not sure how to script it but I hope this gives you an idea of what I'm trying to accomplish.
SMF spam blocked by CleanTalk