More feature/function ideas
Blitz3D Forums/Blitz3D Programming/More feature/function ideas
| ||
This would be pretty neat, and quite a timesaver: A function or logical operator that returns true if a variable's numerical value is somewhere between two others, or near them based on some number. It's handy for finding if an entity is near another. An operator for this could look like variableA <5> VariableB That would sort of represent larger than or smaller than (variables A and B), by some amount (the middle number). Hey, I can write like the Ms. Word help file! Actually, I'll make my own function for this shortly and post it, but this would be to make it look nicer and be easier to write out. Now, number 2. This one couldn't be done with normal user made functions: A ResetVariable(variable) function. This could reset variables to their original values without the programmer having to scroll all the way back up to find out what that value is. |
| ||
request 1... You can use EntityDistance() for this. request 2... This would require blitz to use twice as much memory, to store current value and the original value. and it would only be useful to lazy coders ;) |
| ||
what if it was a special function that just replaced itself with the value after looking back on its own at compilation? You can use EntityDistance() for this. EntityDistance could only return an exact number... A rather long if statement would then have to follow to get the rest right. I said that "It's handy for finding if an entity is near another," what I meant by that was as an example. You would first use entityDistance, and then use that requested operator to figure out the rest more easily. |
| ||
Request 1 - I'm not entirely sure what you mean but I've no doubt it could be done in a simple function? Is this what you mean ? Probably not ...Function Between( q#, lo#, hi# ) return (q >= lo and q <= hi) end function So, to check if EntityA is Between 5 and 10 units from EntityB use.. Is_Between = Bewteen( ENTITDISTANCE(EntityA,EntityB),5,10 ) |