Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Casino Script Help! (https://forums.graalonline.com/forums/showthread.php?t=86151)

Duck 06-02-2009 08:46 PM

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);

}

Novice 06-02-2009 08:50 PM

Quote:

Originally Posted by Duck (Post 1496451)
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.

Chompy 06-02-2009 09:00 PM

Quote:

Originally Posted by Novice (Post 1496452)
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 :)

Duck 06-02-2009 09:12 PM

Didn't work man.

Duck 06-02-2009 09:13 PM

Can someone else help me?

Frankie 06-02-2009 09:53 PM

is there a reason why you're doing

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

twice?

fowlplay4 06-03-2009 12:31 AM

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?

cbk1994 06-03-2009 12:43 AM

The safe money adding ... how are you displaying the balance?

Novice 06-03-2009 03:48 AM

Quote:

Originally Posted by Chompy (Post 1496454)
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?


All times are GMT +2. The time now is 03:13 PM.

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