teletubby5e
Technical User
Hey folks,
I am sure that I am missing something here, but basically, am trying to input the starting and ending numbers of a range of numbers to build in a switch, have the script convert these strings to base 10 numbers in order to do a for x = y upto z counter. then convert that number back to a string back to a string to build the lines, then increment one, and start all over. but my script is failing the integer math part. please help.
here is the basic script, some repetitive functions are removed:
PROC MAIN
STRING STARTNUM
STRING ENDNUM
STRING NUMBER_STR
STRING DIDNUMADD
STRING STATUS
STRING MODE
STRING MODE2
INTEGER STARTNUM_NUM
INTEGER ENDNUM_NUM
INTEGER NUMBER_NUM
SDLGINPUT "ENTER" "FIRST NUMBER OF RANGE (i.e. 2145551212):" STARTNUM
SDLGINPUT "ENTER" "LAST NUMBER OF RANGE (i.e. 2145559999):" ENDNUM
STRTONUM STARTNUM STARTNUM_NUM 10 ; CONVERTS STRING TO A BASE 10 NUMBER TO PERFORM MATH
STRTONUM ENDNUM ENDNUM_NUM 10 ; CONVERTS STRING TO A BASE 10 NUMBER TO PERFORM MATH
SDLGINPUT "ENTER" "NEW DIDs, OR CHG EXISTING, OR OUT? (NEW/CHG/OUT):" STATUS
STRFMT MODE2 "%s!" STATUS
FOR NUMBER_NUM=STARTNUM_NUM UPTO ENDNUM_NUM ; 2145551212 UPTO 2145559999 FOR LOOP
NUMTOSTR STARTNUM_NUM STARTNUM 10 ; CONVERTS FIRST NUMBER TO A STRING
NUMTOSTR ENDNUM_NUM ENDNUM 10 ; CONVERTS LAST NUMBER TO A STRING
NUMTOSTR NUMBER_NUM NUMBER_STR 10 ; CHANGES TOTAL FROM A NUNMBER TO A STRING
STRFMT DIDNUMADD "TN=%.10s!" STARTNUM
STRFMT MODE "FORM=1V5&%s!" STATUS
TRANSMIT MODE
WAITFOR ": " FOREVER
TRANSMIT DIDNUMADD
WAITFOR ": " FOREVER
TRANSMIT MODE2
WAITFOR ": " FOREVER
STARTNUM_NUM=STARTNUM_NUM++ ; ADD 1 TO VALUE OF 2145551212 BEFORE NEXT LOOP
ENDFOR
TRANSMIT "END;"
ENDPROC
many thanks. jeff
I am sure that I am missing something here, but basically, am trying to input the starting and ending numbers of a range of numbers to build in a switch, have the script convert these strings to base 10 numbers in order to do a for x = y upto z counter. then convert that number back to a string back to a string to build the lines, then increment one, and start all over. but my script is failing the integer math part. please help.
here is the basic script, some repetitive functions are removed:
PROC MAIN
STRING STARTNUM
STRING ENDNUM
STRING NUMBER_STR
STRING DIDNUMADD
STRING STATUS
STRING MODE
STRING MODE2
INTEGER STARTNUM_NUM
INTEGER ENDNUM_NUM
INTEGER NUMBER_NUM
SDLGINPUT "ENTER" "FIRST NUMBER OF RANGE (i.e. 2145551212):" STARTNUM
SDLGINPUT "ENTER" "LAST NUMBER OF RANGE (i.e. 2145559999):" ENDNUM
STRTONUM STARTNUM STARTNUM_NUM 10 ; CONVERTS STRING TO A BASE 10 NUMBER TO PERFORM MATH
STRTONUM ENDNUM ENDNUM_NUM 10 ; CONVERTS STRING TO A BASE 10 NUMBER TO PERFORM MATH
SDLGINPUT "ENTER" "NEW DIDs, OR CHG EXISTING, OR OUT? (NEW/CHG/OUT):" STATUS
STRFMT MODE2 "%s!" STATUS
FOR NUMBER_NUM=STARTNUM_NUM UPTO ENDNUM_NUM ; 2145551212 UPTO 2145559999 FOR LOOP
NUMTOSTR STARTNUM_NUM STARTNUM 10 ; CONVERTS FIRST NUMBER TO A STRING
NUMTOSTR ENDNUM_NUM ENDNUM 10 ; CONVERTS LAST NUMBER TO A STRING
NUMTOSTR NUMBER_NUM NUMBER_STR 10 ; CHANGES TOTAL FROM A NUNMBER TO A STRING
STRFMT DIDNUMADD "TN=%.10s!" STARTNUM
STRFMT MODE "FORM=1V5&%s!" STATUS
TRANSMIT MODE
WAITFOR ": " FOREVER
TRANSMIT DIDNUMADD
WAITFOR ": " FOREVER
TRANSMIT MODE2
WAITFOR ": " FOREVER
STARTNUM_NUM=STARTNUM_NUM++ ; ADD 1 TO VALUE OF 2145551212 BEFORE NEXT LOOP
ENDFOR
TRANSMIT "END;"
ENDPROC
many thanks. jeff