OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Acecool on 05 Aug 2008, 06:12:59

Title: Ok so this one has stumped me... STRING TO INT
Post by: Acecool on 05 Aug 2008, 06:12:59
I captured data from a dialog, I can display it fine, but when I try to compare it (atm script) then it says it is a string.....

I have tried the call "bull = " + shoot tricks and all that, I can not get anything to work... any ideas?

Code: [Select]
_name = "civ1"
_cash = call format ["%1_cash", _name]
_bank = call format ["%1_bank", _name]
_withdrawinput = _this select 0
_with = -1
call {"""_with = format [%1, _withdrawamount]"""}

if (_bank < _with OR _bank < 1) then { Goto "nomoney" }

_cash = _cash + _with
_bank = _bank - _with

Hint Format ["%1 ... %2 .... %3", _cash, _bank, _with]

call format ["%1_cash=%2", _name,_cash]
call format ["%1_bank=%2", _name,_bank]
call format ["%1 groupChat ""%1 you now have: $%2 in your pocket and $%3 in your bank account.""",_name,_cash,_bank]
Exit


#nomoney
Hint "No Money!"
Exit
Title: Re: Ok so this one has stumped me... STRING TO INT
Post by: Mr.Peanut on 07 Aug 2008, 19:02:51
Which line causes the problem? And which variable is the string you want to convert to an int? Try:
Code: [Select]
_with = call _withdrawamount
Title: Re: Ok so this one has stumped me... STRING TO INT
Post by: Acecool on 08 Aug 2008, 00:22:31
basically that gives me
civ1 you now have: $scalar bool array string 0xfcffffef in your pocket and $scalar bool array string 0xfcffffef in your bank account.
Title: Re: Ok so this one has stumped me... STRING TO INT
Post by: Mr.Peanut on 08 Aug 2008, 14:09:21
http://www.ofpec.com/forum/index.php?topic=3156.0 (http://www.ofpec.com/forum/index.php?topic=3156.0)
Title: Re: Ok so this one has stumped me... STRING TO INT
Post by: Acecool on 08 Aug 2008, 18:26:33
Ive tried that too, and it didnt work... I settled this problem by just using buttons on the atm dialog...

Deposit all, Withdraw All, then 1000, 5000, 10000, 25000, 50000, 100000