Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
4 registered members (AndrewAMD, Quad, soulman3, Ayumi), 675 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Goto command something went wrong! -A7.05 #148567
08/16/07 20:58
08/16/07 20:58
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
I just tried to use Goto command, but it seems that it doesn't work right anymore. Here is a simple code:

Code:
 
function cha_tex_zahl() {
if (tex_zahl < 16) {
tex_zahl += 1;
goto (down);
}
tex_zahl = 1;
down :
aktualize_tex(max_tex_size*integer(sqrt(tex_zahl)+1),tex_zahl);
}



This is how it should work right. At least I can't see anything wrong here (the aktualize_tex function works right, I previously had a return instead of the goto command in the code, but I wanted the function to be executed everytime).

What happens is the engine gives a syntax_error message while starting.
I played around with it and finally found out that leaving the brackets in the command

goto down;

solves that problem. But then the command only accepts labels that stand in the function above the goto, what definitely can't be right.

EDIT: I don't know whether this problem already existed before A7.05 because I didn't use this command since A6.5

Last edited by RedPhoenix; 08/16/07 21:01.
Re: Goto command something went wrong! -A7.05 [Re: RedPhoenix] #148568
08/17/07 06:59
08/17/07 06:59
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
the Goto command is evil! Better not use it. And yes it was removed in A7.


BASIC programmers never die, they GOSUB and don't RETURN.
Re: Goto command something went wrong! -A7.05 [Re: bstudio] #148569
08/17/07 09:36
08/17/07 09:36
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
I have heard or seen this 'goto is evil' mantra often enough, and I believe I know why it is considered 'evil'. I accept the advice about good practices, but I disagree with the generalizations, or the manner in which the advice is packaged and delivered. Typically, I tend to consider it bad form to assign an instruction a moral alignment. A certain usage or arrangement of instructions, can be considered less than optimal, and some elements might be misused more than others, but I wouldn't put horns on such elements, and state that they 'demonic' or 'controlled by the devil'.
I think, to be consistent, if the instruction is available in C, it should be available in Lite-C. If the instruction is available in A6, it should be available in A7. For the most part, I believe, advice can be given, and suggestions can be offered, but the responsibility to use certain elements wisely, should be left up to the programmer. I argue that, in a few cases, the goto instruction was particularly useful in C-Script. If you are correct, and the 'goto' instruction was removed from A7 (particularly C-Script), then I now claim that it seems a hand of madness now often holds the reigns.

Re: Goto command something went wrong! -A7.05 [Re: testDummy] #148570
08/17/07 11:23
08/17/07 11:23
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
In C goto has no brackets, its "goto down" not "goto(down)".

Re: Goto command something went wrong! -A7.05 [Re: Tobias] #148571
08/17/07 11:38
08/17/07 11:38
Joined: Aug 2006
Posts: 652
Netherlands
bstudio Offline
User
bstudio  Offline
User

Joined: Aug 2006
Posts: 652
Netherlands
hmmm in the manual it still appears with brackets. Ah well, I don't use it anyway


BASIC programmers never die, they GOSUB and don't RETURN.
Re: Goto command something went wrong! -A7.05 [Re: bstudio] #148572
08/17/07 14:03
08/17/07 14:03
Joined: Jan 2007
Posts: 651
Germany
R
RedPhoenix Offline OP
User
RedPhoenix  Offline OP
User
R

Joined: Jan 2007
Posts: 651
Germany
Quote:

In C goto has no brackets, its "goto down" not "goto(down)".





Yes as I said I already realized that (it still doesn't make any sense to me, because all other instructions use brackets so why goto should not??).

But the real problem is, that it only accepts labels that stand obove the command, not below:

Code:
 
down:
//...
goto down;


works!


Code:
 
goto down;
//...
down:


works not!!!

In A6 this was no problem.

Last edited by RedPhoenix; 08/17/07 14:04.
Re: Goto command something went wrong! -A7.05 [Re: RedPhoenix] #148573
08/17/07 16:37
08/17/07 16:37
Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
Frederick_Lim Offline
User
Frederick_Lim  Offline
User

Joined: Oct 2003
Posts: 827
22�21'24"N 114�07'30"E
hmm..no problem to me.

I add this to my main and no problem
Code:

start:
goto quit;
..
..
goto start;
quit:
sys_exit(NULL);



The level will quit. If I remark the "goto quit;", the engine will dead loop and prompt not enough entity reserve error.

Re: Goto command something went wrong! -A7.05 [Re: Frederick_Lim] #148574
08/20/07 07:39
08/20/07 07:39
Joined: Jul 2000
Posts: 27,967
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,967
Frankfurt
Goto can jump forward and backward, but only within the same code module, i.e. within the { } brackets.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1