Home   Help Search Login Register  

Author Topic: Ok so this one has stumped me... STRING TO INT  (Read 1431 times)

0 Members and 1 Guest are viewing this topic.

Offline Acecool

  • Members
  • *
Ok so this one has stumped me... STRING TO INT
« 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

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Ok so this one has stumped me... STRING TO INT
« Reply #1 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
« Last Edit: 07 Aug 2008, 19:06:17 by Mr.Peanut »
urp!

Offline Acecool

  • Members
  • *
Re: Ok so this one has stumped me... STRING TO INT
« Reply #2 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.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
« Last Edit: 08 Aug 2008, 14:17:03 by Mr.Peanut »
urp!

Offline Acecool

  • Members
  • *
Re: Ok so this one has stumped me... STRING TO INT
« Reply #4 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