SRL Archive - OSR Help

Whats wrong with my syntax?


abundances

2012-05-12 19:54:48

im new to coding in simba whats wrong with this code


Function Walk(bank: Boolean): Boolean;
begin
if bank = True Then
begin
ObjDTM_WalkPath(['61:150:3:1:7:112:26:1:7:99:19:1:7:96:49',
'28:128:3:1:7:113:109:1:7:74:113:1:7:53:131',
'14:111:3:1:7:53:96:1:7:125:66:1:7:104:83',
'40:72:3:1:7:121:62:1:7:32:84:1:7:15:76',
'34:79:3:1:7:57:83:1:7:74:92:10:7:90:95'], 0, 100, 5, True, True);
end;
else
begin
ObjDTM_WalkPath(['154:76:3:10:7:137:97:10:7:137:67:10:7:43:120',
'152:68:3:1:7:32:93:1:7:49:101:1:7:139:78',
'139:36:3:1:7:70:96:1:7:121:83:1:7:142:65',
'112:11:3:1:7:66:131:1:7:88:114:1:7:126:108'], 0, 100, 5, True, True);
end;

end;

tehq

2012-05-12 19:56:36

Take out the ; after the first end.

abundances

2012-05-12 19:59:53

thank you very much. still learning here i know VB6 and C# working on a scrip to use a yak pak and make scrolls

cycrosism

2012-05-12 20:48:39

I could explain this to you if you wish.

When ending an if statement with an "else" you have to make sure it is "end else" if you started the statement with a begin. So for example you could do

If loggedin then writeln("logged in") else writeln("not logged in");


Because I didn't write "If loggedin then begin"

But if you started it with a begin then you will need an end else. The downside with doing it this way is you can only have one function/procedure called after the if statement, if you want more, you need to start it with a begin.

abundances

2012-05-12 22:39:01

thanks for the input. my script i am working on is coming along good. probably will have the beta done tomorrow cycrosism once im done will you look at it and give me any input or hints on how to make it better? it will have comments and stuff in it so its easy to read. the standards i follow are probably not right but looks all right when you read the code.

cycrosism

2012-05-13 00:32:36

Yes I could have a look at it, but I haven't coded in a while, if you do post the code here I am sure some other skilled members would be happy to look at it for you