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 03-19-2007, 09:10 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Simple Chat-Based Bank

Hey! I've been learning to script lately, and Twinny asked me to make a bank. So I've been working on this for about 30 mins or so with a bit of help from Twinny and some from PFA.

Not exactly working out.

The general idea is to open the account, deposit, withdraw or close the account all with chat.

PHP Code:
function onActionserverside() {

  if (
params[0] == "open") {
    
Test.(@"account_" player.account) += params[1];

}

  else if (
params[0] == "deposit") {
    
Test.(@"account_" player.account) += params[1];

}
 
  else if (
params[0] == "withdraw") {
    
Test.(@"account_" player.account) -= params[1];
 
  }
}
  
//#CLIENTSIDE
function onPlayerchats() {
  
  if (
player.chat == "/openbankaccount") {
    if(
player.gralats 300) {
      
player.gralats 300;
      
this.startmoney 300;
      
triggeraction(0,0,"serverside",this.name,"open",this.startmoney);
  }
}

  else if (
player.chat == "/closebankaccount") {
    
Test.(@"account_" player.account).clear();

}

  else if (
player.chat.starts("/deposit")) {
    
this.depmoney player.chat.substring(10);
    
triggeraction(0,0,"serverside",this.name,"deposit",this.depmoney);

}

  else if (
player.chat.starts("/withdraw")) {
    
this.witmoney player.chat.substring(11);
    
triggeraction(0,0,"serverside",this.name,"withdraw",this.witmoney);

  }

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #2  
Old 03-19-2007, 09:29 AM
contiga contiga is offline
Graal2001 Administration
contiga's Avatar
Join Date: Jul 2004
Location: Netherlands
Posts: 419
contiga is an unknown quantity at this point
Send a message via ICQ to contiga Send a message via AIM to contiga Send a message via MSN to contiga Send a message via Yahoo to contiga
Test.( @ "account_" @ player.account).clear(); should be on the serverside, player.gralats should be player.rupees and should be moved to the serverside also.
__________________
AIM: Contiga122
MSN: [email protected]
Status:
Quote:
Originally Posted by unixmad View Post
I am also awake 3AM to help correct problems.
Quote:
Originally Posted by Bomy Island RC people
Daniel: HoudiniMan is a bad guy =p
*Bell: rofl. I first read that as houdini is a bad man. like the little kid that wants his mommy to keep her away from that boogie man
Daniel: xD
*Rufus: I wouldn't want my kids around him.
Reply With Quote
  #3  
Old 03-19-2007, 09:15 PM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by contiga View Post
player.gralats should be player.rupees and should be moved to the serverside also.
The wiki and scriptfunctions_client.txt state to use 'gralats' instead of 'rupees':
rupees - integer - better use 'gralats'

You should throw as much as this in the serverside as possible, if not all of it.
Reply With Quote
  #4  
Old 03-19-2007, 11:31 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 03-20-2007, 12:18 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Angel_Light View Post
instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^
Not sure how to use clientr.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #6  
Old 03-20-2007, 02:54 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
replace player. with clientr.
to start off
Reply With Quote
  #7  
Old 03-20-2007, 06:31 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Angel_Light View Post
instead of player.gralats/rupees use a clientr.var much better in my opnions. ^-^
Depends if the rest of his systems use player.gralats.... could be a nasty change .
Reply With Quote
  #8  
Old 03-20-2007, 07:26 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
Quote:
Originally Posted by Twinny View Post
Depends if the rest of his systems use player.gralats.... could be a nasty change .
Could download all the .txt/.nw files then do a mass find/replace I guess.

But sometimes player.rupees are desirable b/c writes to it are really easy to log.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #9  
Old 03-20-2007, 07:45 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by napo_p2p View Post
But sometimes player.rupees are desirable b/c writes to it are really easy to log.
As soon as Stefan takes heed to my suggestion and brings protected vars, to hell with player.gralats!
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 11:11 PM.


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