Naum
2009-11-16 12:04:52
Hey,
Well, since MSI has started to develop a lot more and has started to expand, I and others thought there must be a set of 'guidelines' to follow :p. This will make it much more easier when other cities are added. etc.
From RM's post:
Don't think 'wtf is this thread 'bout?!', yet. As I have other stuffs to add:
1. When using the TItem record for ANYTHING, if you don't have anything in your Item.Bitmap then assign -1 to it. Do this instead of '0' as SCAR reads a pre-loaded bitmap as '0' as well. This will cut down on some very annoying errors, which would occur, in Banking.scar. I will add some detection to ensure we don't get Type Mismatch errrors. Example:
See a problem with this? No? Run this script:
It outputs a '0', so.. whats the problem?
In withdraw in banking.scar (not in there yet, but soon will be :p):
The synopsis:
When filling in TItem records for MSI, set any unused bitmap consituents to -1. Otherwise banking funcs, and i'm pretty sure lots of others, will recieve errors.
2. Same as above but for the Items.DTM, set it as -1 if it ain't being used.
3. We all need to make sure that when we change something, it will not have an impact on any other of the procedures. This may have cataclysmic effects.
4. Check everything compiles before committing!!! Use CompileMSI.scar, it helps other people loads :). Plus it will prevent other people having to spend hours sorting out compiling issues.
5. Not that important but I thought I'd mention it, when calling item records from ItemInfo.scar: you must load then using the 'load' procedures and you must lay them out as such:
For Example:
6.
Thanks.
Anyone have more to add?
Well, since MSI has started to develop a lot more and has started to expand, I and others thought there must be a set of 'guidelines' to follow :p. This will make it much more easier when other cities are added. etc.
From RM's post:
From: Rasta Magician
- Use Standards ! A code which can not be read by others is of no use to a team
- Separate the functions into various levels so others can use them too
eg.
Function TimeRunning: string;
begin
//code...
end;
//what is wrong with this? You will only be able to use it for how long it has been running!
//what is good then?
Function TimeToString(ms: Integer): string;
begin
//code...
end;
Function TimeRunning: string;
begin
Result := TimeToString(GetTimeRunning);
end;
- Name the Functions / Procedure appropriately !
– eg Function DoThatThingy –> DraynorFishToBank;
- Comment your Funcs & Procs! Make it easier for your script-mates to edit it and understand it
- Share the work load
- Agree to a format!
Don't think 'wtf is this thread 'bout?!', yet. As I have other stuffs to add:
1. When using the TItem record for ANYTHING, if you don't have anything in your Item.Bitmap then assign -1 to it. Do this instead of '0' as SCAR reads a pre-loaded bitmap as '0' as well. This will cut down on some very annoying errors, which would occur, in Banking.scar. I will add some detection to ensure we don't get Type Mismatch errrors. Example:
With Cabbage Do
..
Bitmap := 0; // no bitmap
See a problem with this? No? Run this script:
Var x : Integer;
Begin
X := BitmapFromString(30, 10, 'beNp7+fb1y1E0ikbRwCEANMw6Wg==');
WriteLn(x);
End.It outputs a '0', so.. whats the problem?
In withdraw in banking.scar (not in there yet, but soon will be :p):
If Items[I].BMP = -1 Then
Begin
WriteLn('There is no BITMAP filled in.');
Exit;
End Else
FindBitmap(Items[I].BMP,x ,y) //You will get the type mismatch here!!!The synopsis:
When filling in TItem records for MSI, set any unused bitmap consituents to -1. Otherwise banking funcs, and i'm pretty sure lots of others, will recieve errors.
2. Same as above but for the Items.DTM, set it as -1 if it ain't being used.
3. We all need to make sure that when we change something, it will not have an impact on any other of the procedures. This may have cataclysmic effects.
4. Check everything compiles before committing!!! Use CompileMSI.scar, it helps other people loads :). Plus it will prevent other people having to spend hours sorting out compiling issues.
5. Not that important but I thought I'd mention it, when calling item records from ItemInfo.scar: you must load then using the 'load' procedures and you must lay them out as such:
MSI_Item[{name of item here}].{data type}For Example:
MSI_GetItem(Cavada_Berries);
If FindBitmap(MSI_Item[Cavada_Berries].BMP, X, Y) Then6.
From: Rasta Magician
Adding on to that, if I see ANY hard coded values in the code, i'll kill you.
const
No_BMP = -1;
No_DTM = -1;
If Items[I].BMP = No_BMP Then
either put these in globals or at the top of whatever file you are using them in.
~RM
Thanks.
Anyone have more to add?