? gosub (Page 1) ● SmileBASIC Source Forums

Sign In

Register
*Usernames are case-sensitive
Forgot my password
What's going on?? See: Site Update March 2022

gosub

  • #1 ✎ 29 funcooldudes101 How do i stop a gosub after a certain amount of time? I would like to do that and then it continues the script Posted
  • #2 ✎ 477 SquareFingers Do you know how to 'stop a gosub'? Do you know how to measure elapsed time? Posted Edited by SquareFingers
  • #3 ✎ 29 funcooldudes101
    Do you know how to 'stop a gosub'? Do you know how to measure elapsed time?
    no. not in sb... is there a certain script for doing so?
    Posted
  • #4 ✎ 477 SquareFingers Do you even know what the word 'script' means? Please stop posting nonsense, and read http://smilebasic.com/en/reference/ Posted
  • #5 ✎ 29 funcooldudes101
    Do you even know what the word 'script' means? Please stop posting nonsense, and read http://smilebasic.com/en/reference/
    well excuse me... i didn't get any knowledge from that
    Posted
  • #6 ✎ 477 SquareFingers
    Do you even know what the word 'script' means? Please stop posting nonsense, and read http://smilebasic.com/en/reference/
    well excuse me... i didn't get any knowledge from that
    If you don't find it worth your effort to learn how to return from a subroutine, when it's quite plainly shown in the reference documentation, don't expect that others will find it worth their effort.
    Posted
  • #7 ✎ 29 funcooldudes101
    Do you even know what the word 'script' means? Please stop posting nonsense, and read http://smilebasic.com/en/reference/
    well excuse me... i didn't get any knowledge from that
    If you don't find it worth your effort to learn how to return from a subroutine, when it's quite plainly shown in the reference documentation, don't expect that others will find it worth their effort.
    but can you continue script under the go sub??
    Posted
  • #8 ✎ 102 LohadL Amazing Contributor Someone thinks I'm an awesome person who has done so much for the community! Achievements Staff Pick "Your program is one of our favorites!" - Staff Achievements Pokemon Is Awesome! I love Pokemon! Express Yourself Load [SYS] -> EX7ALIEN and look at the code, specifically from Line 38. As long as you have RETURN in each labeled subroutine, you can continue whatever code you want. Posted Edited by LohadL
  • #9 ✎ 29 funcooldudes101
    Load [SYS] -> EX7ALIEN and look at the code, specifically from Line 38. As long as you have RETURN in each labeled subroutine, you can continue whatever code you want.
    thanks
    Posted
  • #10 ✎ 13 SpaceKadeta This excerpt is descriptive too. It is the script to read the keyboard buttons as string K$ Dim N$ are instantly checked At the start of the script I is set as a timer counter And then I is given a Bouliean condition of Recursing or UnRecursing(i.e resetting the timer/counter) K$ = INKEY$() IF K$=="" GOTO @LOOP I=0 @KLOOP IF K$==N$[I] GOTO @PLAY I=I+1 IF I<KCNT GOTO @KLOOP GOTO @LOOP a rewrite could make use of GOSUB @KLOOP I = 0 @NLOOP @LOOP @STRINGIFY K$ = INKEY$() IF K$=="" GOSUB @PLAY GOTO @KLOOP ELSE GOSUB @INC GOTO @NLOOP ENDIF GOTO @LOOP @INC I=I+1:IF I<KCNT THEN RETURN ELSE GOTO STRINGIFY ENDIF: @PLAY K$==N$[I] P=F*I BEEP V,P RETURN !??!?!?!??!? I have no idea, the program faults @STRINGIFY because goto as gosub it is like the 1+2+3+4 into infinity forever thing something to do with bytestrings... and the memory usage of gosubs 5 words or its unlucky or something nobody knows. Posted
  • #11 ✎ 412 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies Stop a GOSUB after a certain amount of time? Try doing this.. VAR N=120 'Can be any number @LOOP T=T+1 IF T<=N THEN GOSUB @LOOP2 ENDIF VSYNC V GOTO @LOOP @LOOP2 BEEP RETURN This will repeat the loop until T is greater than or equal to N. Posted
  • #12 ✎ 477 SquareFingers
    Try doing this..
    Have you tried doing this?
    Posted
  • #13 ✎ 412 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Third Year My account is over 3 years old Website Reading I like to read books! Hobbies
    Try doing this..
    Have you tried doing this?
    Uh no. Not at the moment. I've used this in the past plenty of times to know it works.
    Posted
  • #14 ✎ 477 SquareFingers
    Try doing this..
    Have you tried doing this?
    Uh no. Not at the moment. I've used this in the past plenty of times to know it works.
    Ah, I think I understand. Your code will stop repeatedly executing GOSUB. I had interpreted the original question, how to stop "a gosub", differently (a run-time instance, rather than a textual instance). Perhaps I misunderstood.
    Posted