Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-02-2009, 08:46 PM
Duck Duck is offline
Registered User
Join Date: May 2009
Posts: 3
Duck is on a distinguished road
Post Casino Script Help!

Hi, I am making a Slot Machine script and I am trying to make it to where when they grab the slot machine, it takes 6 bucks from the player, and it adds the 6 dollars to the store safe. Here's what I got so far. By the way, the only thing that isn't working is the adding money to the safe part.


function onActionGrab()
{
if (player.dir != 0)
return false;

if (this.inuse)
{
player.addMessage("This machine is currently inuse!");
return false;
}

if (player.rupees < 6)
{
player.addMessage("You need $6 to play!");
return false;
}

this.inuse = true;
player.rupees -= 6;
this.safe.money += 5;


player.rupees-= 6;
this.safe.money += 6;

scheduleEvent(random(2, 5), "determineoutcome", player);
setcharani("slotmachinespin", NULL);

}
Reply With Quote
  #2  
Old 06-02-2009, 08:50 PM
Novice Novice is offline
Developer
Join Date: Dec 2008
Posts: 90
Novice is an unknown quantity at this point
Send a message via MSN to Novice
Quote:
Originally Posted by Duck View Post
post
Please use PHP tags.
Try doing this:

PHP Code:
function onActionGrab()
{
    if (
player.dir != 0)
        return 
false;
    
    if (
this.inuse)
    {
        
player.addMessage("This machine is currently inuse!");
        return 
false;
    }
    
    if (
player.rupees 6)
    {
        
player.addMessage("You need $6 to play!");
        return 
false;
    }
       
    
this.inuse true;
    
player.rupees -= 6;
    
this.safeMoney += 5;
    
    
player.rupees -= 6;
    
this.safeMoney += 6;
    
    
scheduleEvent(random(25), "determineoutcome"player);
    
setcharani("slotmachinespin"NULL);
    

From what I know, there can't be a sub-varname after this.varname (aka this.varname.sub-varname) I may be wrong.
Reply With Quote
  #3  
Old 06-02-2009, 09:00 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Novice View Post
From what I know, there can't be a sub-varname after this.varname (aka this.varname.sub-varname) I may be wrong.
That's very wrong
__________________
Reply With Quote
  #4  
Old 06-02-2009, 09:12 PM
Duck Duck is offline
Registered User
Join Date: May 2009
Posts: 3
Duck is on a distinguished road
Didn't work man.
Reply With Quote
  #5  
Old 06-02-2009, 09:13 PM
Duck Duck is offline
Registered User
Join Date: May 2009
Posts: 3
Duck is on a distinguished road
Can someone else help me?
Reply With Quote
  #6  
Old 06-02-2009, 09:53 PM
Frankie Frankie is offline
xChugxLifex
Frankie's Avatar
Join Date: Feb 2008
Location: New York
Posts: 1,610
Frankie is a jewel in the roughFrankie is a jewel in the rough
Send a message via AIM to Frankie Send a message via MSN to Frankie
is there a reason why you're doing

player.rupees-= 6;
this.safe.money += 6;

twice?
__________________
*Sum41Freeeeek
*Frankie
Reply With Quote
  #7  
Old 06-03-2009, 12:31 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Your casino better be realistic and not let anyone leave with winnings.

Please re-post your code, and a detailed explanation of any problems you might have.

Is the safe a different NPC altogether?
How are you checking to see if the safe?
__________________
Quote:
Reply With Quote
  #8  
Old 06-03-2009, 12:43 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
The safe money adding ... how are you displaying the balance?
__________________
Reply With Quote
  #9  
Old 06-03-2009, 03:48 AM
Novice Novice is offline
Developer
Join Date: Dec 2008
Posts: 90
Novice is an unknown quantity at this point
Send a message via MSN to Novice
Quote:
Originally Posted by Chompy View Post
That's very wrong
:o Wow, what was I thinking when I posted that.
Was still on my sugar rush, not thinking.

Like what Chris said, how are you displaying it?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 05:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.