Eduardo
Apprentice
Posts: 6
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Sep 2013
Reputation: 0
|
ATM Machine
Hi guys,
I'm having some troubles with my atm machine. if i put in <ARGS> a value like 1111111111 it deposites that amount of gold even if i don't have it and I have this exception:
IF <ARGS> > 50000
SRC.SYSMESSAGE Your maximum deposite is 50000 gps.
Return 1
The script is:
Code:
// First you must put 'i_bank_mem' somehow //
// on the player for example in skillclass: //
//ON=@LOGIN
// IF !<findid(i_bank_mem)> //
// NEWITEM i_bank_mem //
// SRC.ACT.EQUIP //
// ENDIF //
[ITEMDEF i_bank_mem]
ID=i_memory
NAME=custom bank
TYPE=T_EQ_SCRIPT
LAYER=30
ON=@CREATE
MORE=//Gold amount stores here (in case You want to put starting money or other)
MOREY=//Last amount taken from the bank
MOREX=//Last amount deposited to the bank
MORE2=//The highest amount been in the bank
MORE3=10
[FUNCTION withdraw]
SRC.ACT=<findid(i_bank_mem).uid>
IF <ARGS> > 50000
SRC.SYSMESSAGE Your maximum withdraw is 50000 gps.
Return 1
ELSE
IF <ARGS> > <SRC.ACT.MORE>
SRC.SYSMESSAGE You don't have that much money!
ELSE
SRC.ACT.MORE=<SRC.ACT.MORE>+-<ARGS>
SRC.ACT.MOREY=<ARGS>
SRC.NEWITEM i_gold
NEW.AMOUNT <ARGS>
NEW.BOUNCE
IF <ARGS> <= 1
SRC.SYSMESSAGE You withdraw <ARGS> gp from the ATM.
ELSE
SRC.SYSMESSAGE You withdraw <ARGS> gps from the ATM.
ENDIF
ENDIF
[FUNCTION deposite]
SRC.ACT=<findid(i_bank_mem).uid>
IF <ARGS> > 50000
SRC.SYSMESSAGE Your maximum deposite is 50000 gps.
Return 1
ELSE
IF !(<RESTEST i_gold <ARGS>>)
SRC.SYSMESSAGE You don't have that much money!
ELSE
IF <ARGS>+<SRC.ACT.MORE> > <SRC.ACT.MORE2>
SRC.TAG.MOST=<ARGS>+<SRC.ACT.MORE>
SRC.ACT.MORE2=<SRC.TAG.MOST>
SRC.TAG.MOST=
ENDIF
SRC.ACT.MORE=<SRC.ACT.MORE>+<ARGS>
SRC.ACT.MOREX=<ARGS>
SRC.CONSUME i_gold <ARGS>
SRC.SOUND 50
IF <ARGS> <= 1
SRC.SYSMESSAGE You deposite <ARGS> gp to the ATM.
ELSE
SRC.SYSMESSAGE You deposite <ARGS> gps to the ATM.
ENDIF
ENDIF
[DIALOG d_bank]
0,0
PAGE 0
RESIZEPIC 200 200 3500 400 300
PAGE 1
GUMPPIC 340 370 0988
GUMPPIC 340 400 0988
DTEXT 220 220 03f <var.blankline>
DTEXT 220 220 03f <SRC.NAME>'s Automated Teller Machine
DTEXT 250 270 03f Gold In ATM: <eval(<src.findid(i_bank_mem).more>)>
DTEXT 250 310 03f Most Gold In ATM: <eval(<src.findid(i_bank_mem).more2>)>
DTEXT 250 370 03f Withdraw:
TEXTENTRY 356 375 600 20 1152 1 0
DTEXT 250 400 03f Deposite:
TEXTENTRY 356 403 600 20 1152 2 0
BUTTON 380 450 047f 0480 1 0 0
BUTTON 510 375 04b9 04ba 1 0 1
BUTTON 510 405 04b9 04ba 1 0 2
[DIALOG d_bank TEXT]
[DIALOG d_bank BUTTON]
ONBUTTON=1
SRC.WITHDRAW <ARGTXT[1]>
ONBUTTON=2
SRC.DEPOSITE <ARGTXT[2]>
(This post was last modified: 10-04-2013 08:54 AM by Mordaunt.)
|
|
10-04-2013 08:32 AM |
|
|
Mordaunt
Super Moderator
Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35
|
RE: ATM Machine
First of all, lose the memory item, you really don't need it. If you want to store such information, store it on the player in tags, it'll be simpler.
Secondly, don't use VARs, they are global and can be messed up if someone else is performing the same funtion at the same time.
I see this one is VAR.blankline, there is no purpose in it as far as I can make out, just remove it.
Thirdly, never set anything as SRC.ACT, it's liable to get messed up during the process, if it is a UID store it as REF1
|
|
10-04-2013 09:03 AM |
|
|