[v1.2.4 - Nov 2nd] ACS.NET - Useful ACS functions!

Maps, modifications, add-ons, projects, and other releases for Zandronum. Also includes announcers.
User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

[v1.2.4 - Nov 2nd] ACS.NET - Useful ACS functions!

#1

Post by Vincent(PDP) » Sun Feb 01, 2015 10:05 pm

ACS.NET
Created by: Visual Vincent
What is this?
ACS.NET is an ACS library for Zandronum where I've implemented some functions that are similar to those in the .NET Framework.
Of course there is more than just .NET Framework functions, this is a library with a bunch of useful functions for ACS.

Well, I guess the above explains it pretty much...
So here are the functions currently available:
Spoiler: Available functions (Open)
Spoiler: From v1.0.0 and up (Open)
Spoiler: StringReplace (Open)
-- StringReplace --
Replace a specified substring in a string with another substring x amount of times.
Note that this is case sensitive.

InputString: The string containing the substring to replace.
FindString: The substring to search for.
ReplaceString: The substring that will replace the found substring.
Start: The position in the InputString to begin the search for the substring. (Zero-based)
Count: The amount of replacements that will be done (0 = Replace all found substrings).

Example usage: StringReplace("Shopping List", "o", "i", 0, 0);
Example will return: "Shipping List"
Spoiler: StringSplit (Open)
-- StringSplit --
Split string into array. The substrings will be put in the StringArray[] array.
Use the StringOccurences variable to get how many strings were put in the array.

InputString: The string to split up into an array.
Delimiter: A single char used to identify substring limits.
Limit: Maximal number of substrings the string should be splitted into. (-1 = Split until it reaches the max limit)

Example usage: StringSplit("Hello+There+Friend!", "+", -1);
Example will put in array: "Hello","There","Friend!"
Spoiler: SplitArrayToString (Open)
-- SplitArrayToString --
Writes the StringArray[] array of substrings down to a string. (One substring per line)
Spoiler: ClearSplitArray (Open)
-- ClearSplitArray --
Clears the StringArray[] array that holds all the strings gathered from the StringSplit() function.
Spoiler: StringFind (Open)
-- StringFind --
Retrieve the index of a substring in the specified string.

InputString: The string to search for the substring in.
LookFor: The substring to look for.
Start: The position in the string to begin the search for the substring. (Zero-based)

Example usage: StringFind("Hello mate!", "o", 0);
Example will return: 4
Spoiler: StringFindLast (Open)
-- StringFindLast --
Retrieve the last index of a substring in the specified string.

InputString: The string to search for the substring in.
LookFor: The substring to look for.

Example usage: StringFindLast("Donald Duck", "D");
Example will return: 7
Spoiler: StringSubstring (Open)
-- StringSubstring --
Retrieve a part of the specified string.

InputString: The string to substring.
Start: The startposition of the substring. (Zero-based)
Length: The amount of characters to get from the InputString. (-1 = Get the rest of the string)

Example usage: StringSubstring("Well, Hello There Friend!", 6, 11);
Example will return: "Hello There"
Spoiler: ConcatenateStrings (Open)
-- ConcatenateStrings --
Join two or more strings together.

Count: The amount of strings to join. (Allowed range: 2-4)
String 1: The first string to join with the second string.
String 2: The second string to join with the first string. (And also with the third string if Count is set to more than 2)
String 3: The third string to join with the first and second string. (And also with the fourth string if Count is set to more than 3)
String 4: The fourth string to join with the first, second and third string.

Example usage: ConcatenateStrings(3, "Hello ", "There!", " Who are you?", "");
Example will return: "Hello There! Who are you?"
Spoiler: StringJoin (Open)
-- StringJoin --
Concatenates String1 and String2 with the specified Separator in-between.

Separator: The separator string to put between String1 and String2.
String1: The first string to concatenate with the second one.
String2: The second string to concatenate with the first one.

Example usage: StringJoin(" += ", "150", "5");
Example returns: "150 += 5"
Spoiler: StringToCharArray (Open)
-- StringToCharArray --
Convert a string into an array of chars.
The chars will be put in the CharArray[] array.
Use the CharArrayLength variable to check how many chars there is in the array.

InputString: The string to convert to a char array.

Example usage: StringToCharArray("Hello");
Example will put in array: "H","e","l","l","o"
Spoiler: ClearCharArray (Open)
-- ClearCharArray --
Clears the CharArray[] array from all chars.
Spoiler: CharArrayToString (Open)
-- CharArrayToString --
Converts the CharArray[] array to a string.

Example usage: CharArrayToString();
If CharArray[] is like following: "H","e","l","l","o"
Example will return: "Hello"
Spoiler: CharArrayIndexToString (Open)
-- CharArrayIndexToString --
Converts a part of the CharArray[] array to a string.

Start: The position from where to get the first character from the char array to put in the string. (Zero-based)
End: The position from where to get the last character from char array to put in the string. (Zero-based)

Example usage: CharArrayIndexToString(1, 3);
If CharArray[] is like following: "H","e","l","l","o"
Example will return: "ell"
Spoiler: From v1.2.0 and up (Open)
Spoiler: StringCompare (Open)
-- StringCompare --
Compare two strings with each other.

Str1: The first string to compare with the second one.
Str2: The second string to compare with the first one.
Spoiler: StringRemove (Open)
-- StringRemove --
Deletes a specified amount of characters from the specified start position of the string.

InputString: The string to manipulate.
Start: The position where to begin deleting characters. (Zero-based)
Count: The number of characters to delete.

Example usage: StringRemove("Hello There!", 2, 2);
Example returns: "Heo There!"
Spoiler: StringContains (Open)
-- StringContains --
Returns a boolean value indicating wether the specified string
is present in InputString.

InputString: The string to check.
LookFor: The string to look for in InputString.

Example usage: StringContains("ABCDEFG", "D");
Example returns: True
Spoiler: StringStartsWith (Open)
-- StringStartsWith --
Returns a boolean value indicating wether InputString starts with
the specified string.

InputString: The string to check.
LookFor: The string to look for in the start of InputString.

Example usage: StringStartsWith("ABCDEFG", "ABC");
Example returns: True
..
2nd Example usage: StringStartsWith("ABCDEFG", "FG");
2nd Example returns: False
Spoiler: StringEndsWith (Open)
-- StringEndsWith --
Returns a boolean value indicating wether InputString ends with
the specified string.

InputString: The string to check.
LookFor: The string to look for in the end of InputString.

Example usage: StringEndsWith("ABCDEFG", "FG");
Example returns: True
..
2nd Example usage: StringEndsWith("ABCDEFG", "ABC");
2nd Example returns: False
Spoiler: StringInsert (Open)
-- StringInsert --
Inserts a specified substring in the specified string.

InputString: The string to manipulate.
Start: Where the substring will be inserted. (Zero-based)
InsertStr: The substring to insert.

Example usage: StringInsert("Hello my friend!", 5, " There");
Example returns: "Hello There my friend!"
Spoiler: StringSpace (Open)
-- StringSpace --
Returns a string consisting of the specified amount of spaces.

Count: The amount of spaces you want in the string.

Example usage: Str HelloWorld = StrParam(s:"Hello", StringSpace(5), s:"World!");
Example returns:

Code: Select all

"Hello     World!"
Spoiler: StringReverse (Open)
-- StringReverse --
Reverses the character order in a string.

String: The string to reverse.

Example usage: StringReverse("Hello There!");
Example returns: "!erehT olleH"
Spoiler: StringSelect (Open)
-- StringSelect --
Mark parts of the specified string with a specified color.

InputString: The string to manipulate.
Select: What to select.
Color: The color to use when selecting: CR_... (I.e CR_YELLOW).
Start: Where to in InputString to start looking. (Zero-based)
SelectAll: True: Select all occurences.

Example usage: StringSelect("I like cookies!", "like", CR_RED, 0, False);
Example returns: "I like cookies" - Where "like" is drawn in red color.
Spoiler: IIf_Int (Open)
-- IIf_Int --
Returns one of two integers, depending on the evaluation of an expression.

Expression: The expression you want to evaluate.
TruePart: The integer returned if Expression equals to True.
FalsePart: The integer returned if Expression equals to False.

Example usage: IIf_Int(5 > 3, 65536, 32768);
Example returns: 65536
..
Why?:
5 is greater than 3. That's why the function returns the TruePart, which is 65536.
Spoiler: IIf_Str (Open)
-- IIf_Str --
Returns one of two strings, depending on the evaluation of an expression.

Expression: The expression you want to evaluate.
TruePart: The string returned if Expression equals to True.
FalsePart: The string returned if Expression equals to False.

Example usage: IIf_Str(5 > 3, "This is correct", "This is incorrect");
Example returns: "This is correct"

2nd Example usage: IIf_Str("Hello" == "There", "This is correct", "This is incorrect");
2nd Example returns: "This is incorrect"
..
Why?:
1st: 5 is greater than 3. That's why the function returns the TruePart, which is "This is correct".
2nd: The string "Hello" is not equal to "There".
That's why the function returns the FalsePart, which is "This is incorrect".
Spoiler: IIf_Bool (Open)
-- IIf_Bool --
Returns one of two booleans, depending on the evaluation of an expression.

Expression: The expression you want to evaluate.
TruePart: The boolean returned if Expression equals to True.
FalsePart: The boolean returned if Expression equals to False.

Example usage: IIf_Bool(5 > 3, True, False);
Example returns: True

2nd Example usage: IIf_Bool(5 > 3, False, True);
2nd Example returns: False
Spoiler: IsTrue (Open)
-- IsTrue --
Checks wether an expression equals to False.

Expression: The expression to check.

Example usage: IsTrue(5 < 3);
Example returns: False
..
Why?:
The function returns False because 5 is not less than 3.
Spoiler: IsFalse (Open)
-- IsFalse --
Checks wether an expression equals to False.

Expression: The expression to check.

Example usage: IsFalse(5 < 3);
Example returns: True
..
Why?:
The function returns True because it's correct that 5 is not less than 3.
Spoiler: IsNot_Int (Open)
-- IsNot_Int --
Checks if two integers ARE NOT the same.
Returns True if they aren't.

Int1: The first integer to check with the other.
Int2: The second integer to check with the first.

Example usage: IsNot_Int(5, 3);
Example returns: True
..
Why?:
The function returns True because 5 does not equal to 3.
Spoiler: IsNot_Str (Open)
-- IsNot_Str --
Checks if two strings ARE NOT the same.
Returns True if they aren't.

Str1: The first string to check with the other.
Str2: The second string to check with the first.

Example usage: IsNot_Str("Hello", "Hello");
Example returns: False
..
Why?:
The function returns False because Str1 IS ACTUALLY equal to Str2.
Spoiler: Math_Factorial (Open)
-- Math_Factorial --
Calculate the factorial of a number.

number: The number to use for the calculation.

Example usage: Math_Factorial(6);
Example returns: 720
..
Why?:
Math_Factorial(6) = 720 because 6! = 6*5*4*3*2*1 = 720.
Spoiler: Math_Hypotenuse (Open)
-- Math_Hypotenuse --
Calculate the hypotenuse of a triangle.

side1: The first side of the triangle.
side2: The second side of the triangle.

Example usage: Math_Hypotenuse(5, 8);
Example returns: 9
..
Why?:
The square root of 5^2 + 8^2 equals the
sqaure root of 25 + 64 which equals to 9,433981132056604.
And because Doom rounds the number down, it's rounded to 9.
Spoiler: Math_TriangleSide (Open)
-- Math_TriangleSide --
Calculate one side of a triangle using it's hypotenuse
and the other side.

Hypotenuse: The triangle's hypotenuse.
side1: One side of the triangle.

Example usage: Math_TriangleSide(9, 8);
Example returns: 5
Spoiler: Math_AreaOfCircle (Open)
-- Math_AreaOfCircle --
Calculate the area of a circle.
Originally, this function gets overloaded when
using a radius greater than 102.
In order to prevent this, the function will
automatically use PI as 3 instead for numbers
greater than 102.

Radius: The radius of the circle.

Example usage: Math_AreaOfCircle(5);
Example returns: 78
..
Why?:
The area of a circle is calculated (r^2) * PI.
And because Doom rounds it's numbers down,
3,14159265358979323846 * 25 = 78,5398163397448309615 (rounded to: 78)
Spoiler: Math_VolumeOfSphere (Open)
-- Math_VolumeOfSphere --
Calculate the volume of a sphere.
Originally, this function easily got overloaded.
To prevent this from happening, it automatically calculates
the volume using PI as 3, instead of
the fixed point 3.14159265358979323846, for numbers over 13.

Radius: The radius of the sphere.

Example usage: Math_VolumeOfSphere(5);
Example returns: 523
..
Why?:
The volume of a sphere is calculated ((r^3) * (4*PI)) / 3.
And because Doom rounds it's numbers down,
(12,56637061435917295384 * 125) / 3 = 523,59877559829887307666666666667 (rounded to: 523)
Spoiler: PlayerName (Open)
-- PlayerName --
Returns the name of the specified player.

number: The number of the player which's name to get.

--- Constants/macros (#Define, #LibDefine) ---
Spoiler: Math_PI (Open)
-- Math_PI --
Math's PI as fixed point.
Spoiler: Math_e (Open)
-- Math_e --
Math's e as fixed point.
Spoiler: IntegerMaxValue (Open)
-- IntegerMaxValue --
The maximum possible value of an Integer.
Spoiler: IntegerMinValue (Open)
-- IntegerMinValue --
The minimum possible value of an Integer.
Spoiler: From v1.2.2 and up (Open)
Spoiler: ParseInt (Open)
-- ParseInt --
Parse (convert) an integer out of a string.

WARNING:
The input MUST be of type String (Str).
If the input is of type Integer (Int) and the
integer is too big, it will cause the game to crash!


InputString: The string to parse to integer.

Example usage: ParseInt("32767");
Example returns: 32767 (as Int)
Spoiler: From v1.2.3 and up (Open)
Spoiler: ParseFloat (Open)
-- ParseFloat --
Parse (convert) a string to fixed point.

WARNING:
The input MUST be of type String (Str).
If the input is of type Integer/Fixed point (Int) and
it's too big, it will cause the game to crash!


InputString: The string to parse to fixed point.

Example usage: ParseFloat("1.375");
Example returns: 1.375 (or 90112 as a normal Int)

INTEGRAL MAX INPUT: 32767
FRACTIONAL MAX INPUT: .32767


-> This means that the largest parsable
fixed point is 32767.32767, or else it
will overflow.
Ex: 32800.0 will overflow, 3.45849 will overflow.
Spoiler: From v1.2.4 and up (Open)
Spoiler: Math_Abs (Open)
-- Math_Abs --
Return the absolute value of a negative integer.

Example usage: Math_Abs(-32);
Example returns: 32

2nd Example usage: Math_Abs(135);
2nd Example returns: 135
Case sensitivity
Sadly all find/replace functions are case sensitive, which means that when for example searching for the string "wood" in "woodchuck", "wood" must have the same casing as the "wood" in "woodchuck". So for example "Wood" or "WOOD" or "WooD" won't match.

Also note that most of the search/replace functions are capable of finding whole strings and not just characters (letters)!
Changelog
v1.2.4
* Fixed so that ParseInt and ParseFloat supports parsing of negative numbers.
* Included Math_Abs with the library (required for ParseFloat to work).

v1.2.3
* Added a ParseFloat function to parse strings to fixed point!

v1.2.2
* Fixed bugs with StringReplace and StringSubstring. (I.e StringReplace won't replace text if it's in the very end of the string)
* Added a ParseInt function to parse/convert strings to integers!

v1.2.1:
* Removed the Math_PI, Math_e, IntegerMinValue, IntegerMaxValue functions and replaced them with macros. (#LibDefine)
Note that the macros still have the same name as the functions. :)

v1.2.0:
* Added tons of new functions!
(Check the function list above, under "v1.2.0 and up")
* Updated the example WAD.
* Bug fixes.
Example WAD in action!
Spoiler: Video (Open)
phpBB [video]
The [video] tag is deprecated, please use the [media] tag
Problems or suggestions?
If you are experiencing any problems with this library, OR if you just have got any suggestions regarding it (i.e implementation suggestions, fixes etc.):
Contact me on this forum or on support@mydoomsite.com

The above applies for questions and help too. :)

Have fun!
Last edited by Vincent(PDP) on Mon Nov 02, 2015 6:07 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Konda
Forum Regular
Posts: 487
Joined: Thu Jun 07, 2012 5:22 pm

RE: [v1.0.0 - Feb 1st] ACS.NET - Useful ACS functions!

#2

Post by Konda » Sun Feb 01, 2015 11:07 pm

You know, we should have a thread in one of the project-based forums that lists all these ACS projects that contain useful functions. I've seen something like this released a long time ago. The more, the better.
Last edited by Konda on Sun Feb 01, 2015 11:08 pm, edited 1 time in total.

Code: Select all

<Synert> fuck
<Synert> plugged in my memory stick and got a bsod

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.0.0 - Feb 1st] ACS.NET - Useful ACS functions!

#3

Post by Vincent(PDP) » Sun Feb 01, 2015 11:18 pm

Konda wrote: You know, we should have a thread in one of the project-based forums that lists all these ACS projects that contain useful functions. I've seen something like this released a long time ago. The more, the better.
Perhaps you meant stralloc?
Although it's not really the same, but yeah. :)

Yes, I agree with you on the ACS project category.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#4

Post by Vincent(PDP) » Sun Feb 08, 2015 4:08 pm

I have updated the library, adding tons of new functions to it and fixed some bugs.
I have also updated the post and put each function in it's own spoiler and categorized the functions!

(Note that the example WAD is also updated)
Last edited by Vincent(PDP) on Sun Feb 08, 2015 4:31 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#5

Post by Klofkac » Wed Feb 11, 2015 9:30 am

Okay... Let me say some things.

The functions Math_Pi and Math_e are just returning a constant... Wouldn't be easier making them #define constants instead? Calling a functions is using more instructions, adding stuff to the stack, etc etc, and thus is slower.
IsTrue, IsFalse... Really? I cannot imagine code "if (IsTrue(a == b))"... That sounds really silly and redundant. Yes, I am aware of exception handling, but all variables in ACS are internally integer, so the exceptions just cannot happen. IfFalse can be safely used as if (!(expression)).

Otherwise, the string-related functions are useful.
Last edited by Klofkac on Wed Feb 11, 2015 9:31 am, edited 1 time in total.
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#6

Post by Ivan » Wed Feb 11, 2015 12:57 pm

Have a read about using constants: Read me
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#7

Post by Vincent(PDP) » Wed Feb 11, 2015 1:40 pm

I already know about using constants but then you gotta do #Include "ACSNET.acs" to be able to use the constants too, and doing so will return errors when compiling. And I'd rather have one library instead of one containing all functions and another one just containing a few constants.
Last edited by Vincent(PDP) on Wed Feb 11, 2015 1:45 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Klofkac
Forum Regular
Posts: 481
Joined: Sat Jun 09, 2012 1:31 pm
Location: Ask Grandvoid servers

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#8

Post by Klofkac » Wed Feb 11, 2015 1:53 pm

Ivan wrote: Have a read about using constants: Read me
Can we use const in ACS? No. ACS is not c++. It just has similar syntax. So we can only use the #define-like syntax for this.
Vincent(PDP) wrote: I already know about using constants but then you gotta do #Include "ACSNET.acs" to import the script, and doing so will return errors when compiling. And I'd rather have one library instead of one containing all functions and another one just containing a few constants.
ZDoom Wiki for the libraries
You need to #import it. Using #include is wrong.
And is there a problem regarding having the constant definitions in same library as functions? From the ZDoom Wiki:
ZDoom wiki wrote: If you define constants in your library, and you want these constants to be accessible by the importing maps, you need to use #libdefine instead of #define.
Last edited by Klofkac on Wed Feb 11, 2015 5:02 pm, edited 1 time in total.
𝕂𝕝𝕠𝕗𝕜𝕒𝕔

User avatar
Ivan
Addicted to Zandronum
Posts: 2219
Joined: Mon Jun 04, 2012 5:38 pm
Location: Omnipresent

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#9

Post by Ivan » Wed Feb 11, 2015 5:15 pm

IIRC Zandronum, Zdoom and GZdoom are written in C++, so they should in theory share similar semantics.
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===

User avatar
ibm5155
Addicted to Zandronum
Posts: 1641
Joined: Tue Jun 05, 2012 9:32 pm
Location: Somewhere, over the rainbow

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#10

Post by ibm5155 » Wed Feb 11, 2015 6:01 pm

Written in C or not, their ACS interpreter is totally different from C.
Unless on the future they implementa gcc compiler, but I beat they ll not do that, trying to controll, malloc, realloc, free and pointers would be a pain in the ass...
Last edited by ibm5155 on Wed Feb 11, 2015 6:02 pm, edited 1 time in total.
Projects
Cursed Maze: DONE, V2.0
Zombie Horde - ZM09 map update: [3/15/13]
Need help with English? Then you've come to the right place!

<this post is proof of "Decline">

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.0 - Feb 8th] ACS.NET - Useful ACS functions!

#11

Post by Vincent(PDP) » Wed Feb 11, 2015 8:50 pm

Klofkac wrote: You need to #import it. Using #include is wrong.
And is there a problem regarding having the constant definitions in same library as functions? From the ZDoom Wiki:
ZDoom wiki wrote: If you define constants in your library, and you want these constants to be accessible by the importing maps, you need to use #libdefine instead of #define.
I know I need to #Import it, but I said that it was necessary to #Include it if you use #Define.

I've never thought of #LibDefine, even though I've read about it before. :)
Thanks Klofkac, I'll update the library soon.
Vincent(PDP) wrote: but then you gotta do #Include

Okay. Updated! :)

(Yes, I kept IsTrue and IsFalse on purpose. I'll deal with them later. AND YES, I know it's easy to remove them.) --There, possible future questions/statements answered. C:
Last edited by Vincent(PDP) on Wed Feb 11, 2015 9:20 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#12

Post by Vincent(PDP) » Wed Feb 25, 2015 12:57 pm

Updated the library to v1.2.2!

Updates:
* StringReplace and StringSubstring bugfixes.

* Added the new function ParseInt to be able to convert strings to integers!
(Check the information under "From v1.2.2 and up")


ParseInt is able to parse strings into integers (numbers).
Say that you for example have a string that you need to use as an integer, number:
"169"

Then you'll just have to pass it to ParseInt and it will be parsed into a number!
ParseInt("169") = 169
Last edited by Vincent(PDP) on Wed Feb 25, 2015 12:58 pm, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Sean
IRC Operator
Posts: 951
Joined: Thu Jan 16, 2014 9:09 pm
Location: United Kingdom
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#13

Post by Sean » Thu Feb 26, 2015 7:55 pm

I think this library has some functions that can be useful. I think it also has some that are pretty useless, like the already mentioned IsTrue and IsFalse functions.
It also does feel a bit like .NET - mainly because All The Functions And Stuff Are Named With Capitals Everywhere and the simple naming.
This could be useful for people new to ACS, and maybe advanced users.
<capodecima> i dont say any more word without my loyer jenova

Watermelon
Zandrone
Posts: 1244
Joined: Thu Jun 28, 2012 9:07 pm
Location: Rwanda

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#14

Post by Watermelon » Thu Feb 26, 2015 9:11 pm

Great idea IMO, though I think it needs to expand into new areas.

If you can simplify some areas, that'd be nice. For example, I wrote 1000 lines of code a long time ago to handle images with my own wrapper for all different resolutions, machines etc. Something like that would be really useful to developers.



EDIT: I'd also like to note that I'm unsure if Zan still caps at 256 function... or if ZDoom raised this limit. If its still capped at 256 functions, you will quickly run into some problems...
Last edited by Watermelon on Thu Feb 26, 2015 9:56 pm, edited 1 time in total.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#15

Post by Vincent(PDP) » Fri Feb 27, 2015 8:36 am

Watermelon wrote: If you can simplify some areas, that'd be nice. For example, I wrote 1000 lines of code a long time ago to handle images with my own wrapper for all different resolutions, machines etc. Something like that would be really useful to developers.
I'm not getting what you mean...
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

User avatar
Sean
IRC Operator
Posts: 951
Joined: Thu Jan 16, 2014 9:09 pm
Location: United Kingdom
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#16

Post by Sean » Fri Feb 27, 2015 4:26 pm

Vincent(PDP) wrote:
Watermelon wrote: If you can simplify some areas, that'd be nice. For example, I wrote 1000 lines of code a long time ago to handle images with my own wrapper for all different resolutions, machines etc. Something like that would be really useful to developers.
I'm not getting what you mean...
I think what he means by that is functions that minimises code that would take up many lines to just a function.
<capodecima> i dont say any more word without my loyer jenova

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#17

Post by Vincent(PDP) » Sat Feb 28, 2015 10:58 am

Well, yeah... I probably could simplify some. I've already been trying to keep them small so... :)
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Thomas
 
Posts: 51
Joined: Fri Jun 22, 2012 9:41 am

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#18

Post by Thomas » Tue Mar 31, 2015 11:38 pm

I can definately see some useful functions here! Especially the string functions etc. although I have some doubts about the geometric functions. I don't really see why you would ever want to calculate the volume of a sphere, let alone the area of a circle. Maybe in some rare cases there might be a use, but personally I would let these functions out as they are really simple as well.
Klofkac wrote: Can we use const in ACS? No. ACS is not c++. It just has similar syntax. So we can only use the #define-like syntax for this.
Actually, const is a valid keyword in ACS. Although you cannot use it to declare contant variables. It is used to tell the compiler that an argument for a function is constant. It was used in the early days of ACS in Hexen, to save a rather tiny amount of time while running.
Last edited by Thomas on Tue Mar 31, 2015 11:38 pm, edited 1 time in total.

User avatar
Nash
 
Posts: 23
Joined: Sat Jan 25, 2014 8:55 am
Location: Kuala Lumpur, Malaysia
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#19

Post by Nash » Sat Oct 31, 2015 3:07 pm

Hello, is it allowed to use this library as part of another project released under the terms of GPL? Thanks.

EDIT: I also have a feature request. Can you make a ParseFixed that works the same as ParseInt but for fixed point numbers? Currently ParseInt just ignores the fractional values so I can't use it. :(
Last edited by Nash on Sat Oct 31, 2015 6:06 pm, edited 1 time in total.

User avatar
Vincent(PDP)
Forum Regular
Posts: 527
Joined: Thu Mar 14, 2013 7:35 pm
Location: Sweden
Clan: My DOOM site
Clan Tag: <MDS>
Contact:

RE: [v1.2.2 - Feb 25th] ACS.NET - Useful ACS functions!

#20

Post by Vincent(PDP) » Sat Oct 31, 2015 10:40 pm

Nash wrote: Hello, is it allowed to use this library as part of another project released under the terms of GPL? Thanks.
Are you saying you want to distribute this under another license?
If so, what's missing from the current one? Can't you just use that?
Nash wrote: EDIT: I also have a feature request. Can you make a ParseFixed that works the same as ParseInt but for fixed point numbers? Currently ParseInt just ignores the fractional values so I can't use it. :(
You mean like the following?

Code: Select all

ParseFixed("1.25") = 1.25 (81920)
Sure thing!
Don't know how hard it will be, but I'll try. :cool:
Oh wait, are you perhaps asking if it's okay to release this library with a project, where the project is released under GPL?

If so, then yes. This was intended to be distributed with other projects, no matter their license as the license for this still applies.
As long as you follow ACS.NET's license terms it's alright.

You could add a little annotation, referring to ACS.NET's license, in your project. Or just create your own license similar to GPL.

Okay Nash!
Updated the library to v1.2.3. I named the function "ParseFloat", thought it sounded better. :smile:
Last edited by Vincent(PDP) on Sun Nov 01, 2015 12:55 am, edited 1 time in total.
//Visual Vincent ( Vincent (PDP) )
- My DOOM site Team

My projects:
Spoiler: (Open)
Doom Writer
Escape From The Laboratory - Done
Escape From The Laboratory Part 2
Parkskolan Zombie Horde Map (ZM10) - Done
In game Admin Commands for Zandronum.
Achievement Mod for Zandronum
Stats mod

Post Reply