Standardized ash libs

Paragon

Member
Ok... I started a StdAsh.ash lib right now it hasn't got too much in it but I kind of wanted to get the ball rolling. Each function is documented and credited in the .ash file. If I used a function you want me to not have used, or if I credited the wrong code monkey. Let me know. Remeber to feel free to suggest functions, prewritten or requests.
changelog:
[size=8pt]
Ver 1.0 22Feb08:
void SET_D_PRINT(int )
void D_PRINT(string msg, int lvl)
boolean OBTAIN(int n, string cond, location locale)
boolean USE_UPTO(int n, item doodad, boolean purchase)
int min(int a, int b)
float min(float a, float b)
int max(int a, int b)
float max(float a, float b)
int pin(int low, int hi, int val)
float pin(float low, float hi, float val)
element to_element(int)
int to_int(element)
element NEXT_ELEMENT(int, int )
element NEXT_ELEMENT(int)
element NEXT_ELEMENT(element, int)
element NEXT_ELEMENT(element)
int ELEMENT_DAMAGE(int, int)
int ELEMENT_DAMAGE(element, element)
element ELEMENT_WEAKNESS(int, boolean)
element ELEMENT_WEAKNESS(element, boolean)
element ELEMENT_WEAKNESS(int)
element ELEMENT_WEAKNESS(element)
[/size]


So I was looking at a recent post by raorn about some requests for some functions to be directly accessible from the ash scripting language when holatuwol made a very good point about how some and possibly many common tasks could be put into standardized .ash libraries. Personally I think this would be a very good idea.
So, I was thinking about the best way to go about implementing this. My thoughts were pretty much as follows, I would start a thread where people could make suggestions about common functions they would think belongs in such a lib. and I, along with anyone else willing to help could start creating a libash.ash file. I think that at first, we probably wouldn't have to many functions so one .ash file would be able to handle it... but if it started to grow we could break them into multiple libs... plus it would be easy to have a "Master" copy which held all the functions created so far and if you didn't need all the functions you could make a copy of the master, delete the unused functions and include only the code you used.
Also one of the good things about making such a standardized lib is that we can all work together and hopefully end up with the best implementations of each of these suggested functions.

So... I'll start this thread to let anyone request or suggest some functions.
 

Attachments

If we are going to start using a standardized lib I'd like to be able just to call the functions in it , rather than having to include it as we do now. The reason for this is that then I don't have to start worrying about possible name clashes with internal functions and variables. I suppose a way around this would be to start all internal names in the lib with some obscure prefix but that seems like a bit of a bodge.

Tom
 
@Zarqon: I'd like to add the obtain and use_upto functions from the wossit script to this lib. if it is ok with you. Also, if it is good with you I'd like to add a line of code to allow -1 to be passed as n to signify that we should use as many of the item that we have no matter what number of item we have.
 
I was under the impression that there was not a way to make a library file in ASH. By that I mean there isn't a way to use java-like syntax and write something like the following:

Code:
import ashlib.ash;

Was I mistaken? Is something similar to the above code possible? If so, it would make a standardized library much more usable.
 
It appears Paragon hasn't been here for almost a month, but I wouldn't mind working on keeping together a stdlib for ASH. I'll throw something together between what Paragon had and what I've written, and throw it up here.

EDIT: It's up, though none of the functions I added are documented at the top. Hope they help somebody

EDIT: From now on, an updated version will be available at http://alhifar.dyndns.org/mafia/scriptlets/stdlib.inc.ash
 
Last edited:
Back
Top