05-24-2013, 04:12 AM
Hello, I am having trouble returning values from a function back to the macros. Within the function the values are calculated correctly, but when returned they are empty (well equal zero). I have read and re-read the help, but I can not get it to work. I need to return 3 values back to the macro. Any help would be greatly appreciated.
Macro Call_Calc_Bet
Function Calculate_Bet
chipValue, chipAmount and Remainder all return as 0, even though within the function their values are calculated as 5, 3 and 4.2
Kind Regards
Matt
Macro Call_Calc_Bet
str toPlay="SL_Auto_Low"
int chooseCasino=0
double nextBet=19.2
/int chipAmount
/double chipValue
/double Remainder
rep
,Calculate_Bet(toPlay chooseCasino nextBet chipAmount chipValue Remainder)
,mes chipValue
,mes chipAmount
,mes Remainder
,if Remainder=0
,,break
Function Calculate_Bet
;/
function ~toPlay #chooseCasino ^nextBet #chipAmount ^chipValue ^Remainder
if chooseCasino=0
,ARRAY(double) unit
,sel toPlay
,,case "SL_Auto_Low"
,,unit.create(6)
,,unit[0]=0.10
,,unit[1]=0.50
,,unit[2]=1
,,unit[3]=5
,,unit[4]=25
,,unit[5]=100
,
,,case "SL_Auto"
,,unit.create(6)
,,unit[0]=1
,,unit[1]=5
,,unit[2]=10
,,unit[3]=25
,,unit[4]=50
,,unit[5]=100
,,unit[6]=500
,
,,case "SL_Live"
,,unit.create(6)
,,unit[0]=1
,,unit[1]=5
,,unit[2]=10
,,unit[3]=25
,,unit[4]=50
,,unit[5]=100
,,unit[6]=500
,,
,,case "Dublinbet_.10"
,,unit.create(5)
,,unit[0]=0.10
,,unit[1]=0.50
,,unit[2]=1
,,unit[3]=2
,,unit[4]=5
,
,,case "Dublinbet_1"
,,unit.create(5)
,,unit[0]=0.10
,,unit[1]=0.50
,,unit[2]=1
,,unit[3]=2
,,unit[4]=5
,
,,case "Dion"
,,unit.create(6)
,,unit[0]=0.50
,,unit[1]=1
,,unit[2]=2
,,unit[3]=5
,,unit[4]=25
,,unit[5]=100
,chooseCasino=1
spe -1
int inc
Remainder=nextBet
,for inc 0 unit.len
,,if unit[inc]>=Remainder
,,,if unit[inc]=Remainder
,,,,chipValue=unit[inc]
,,,,break
,,,chipValue=unit[inc-1]
,,,break
,,else
,,,chipValue=unit[unit.len-1]
,chipAmount=Remainder/chipValue
,Remainder=Remainder-(chipAmount*chipValue)
,Remainder=Round(Remainder 2)
,/if Remainder=0
,,/break
,ret
chipValue, chipAmount and Remainder all return as 0, even though within the function their values are calculated as 5, 3 and 4.2
Kind Regards
Matt