The Ifs would probably be faster if implemented as a select case statement. The speed difference may not be worth the trouble, though:-
They are more efficient as they break out and ignore the rest once a condition has been met (ie. "ok, pic=2 so i can do that bit and jump straight to end select ignoring 3,4,5 and 6") this is much better especially within intensive loops.Another thing that speeds stuff up is:
When using custom types, if you have LOADS of references to the same field in a function(for example):
function updatemonster(mymonster.monster) ;------------------------------------------------------------- ;in this function there are say.. 50 references to these: mymonster\xpos mymonster\ypos ;------------------------------------------------------------- end functionAccess to these is slower than normal vars, so this can sometimes be better:
function updatemonster(mymonster.monster) ;create some temp. local storage px#=mymonster\xpos py#=mymonster\ypos ;------------------------------------------------------------------------ ;now in this function there are 50 odd references to these instead: px py ;------------------------------------------------------------------------ ;then we need to perform an update the data table on exit. mymonster\xpos =px mymonster\ypos =py end functionIs faster and more efficient because it is only accessing the type fields twice, 1 read and 1 write instead of 50 times each.
However, if its just a few refs (eg 5 or less, this doesnt help much) the difference is fairly neglegable (and pointless) for just a few, but for many references i find this temporary replacement a faster option, especially in intensive looping.
!!!However, be careful if using a return somewhere in the function above, as any required changes to field data can be lost!!!