Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-16-2010, 11:20 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Utility Collection

These are a few classes I've been using that I never really got around to making a proper release for (most of them don't warrant their own individual release). Some of them are likely to be added onto and changed later.

Most of them are fairly straightforward to understand, or they have documentation in the scripts.

util_common
Just a couple of simple functions I've needed. The first is a distance function that uses a heuristic. The second is a capitalization function.

util_dict
A simple associative array class. It doesn't use any fancy hash table lookups or anything, so it's probably not particularly efficient, but it gets the job done.

util_indent
A function to check the indentation of a line. Useful for parsing files where this may be necessary (I used it for parsing my behavior tree files).

util_path
The most useful (and lengthy) script in this collection. It's a wrapper around the built in findPathInArray() function. Since that function uses an awkward map array format and doesn't make particularly pretty paths (no diagonals) my function post-processes the generated path to make it better (though not much better, yet).

It's fairly well documented in the script, but just know that it also accounts for an NPC's size and where it should be blocked.

It also contains a function for traversing through the path, to make it simpler for you.

util_requesthttp2
To be honest, this isn't tested very well, but seeing as it's largely Inverness' util_sql but rewritten for requestHttp(), I don't see there being any issues with it, but please let me know if there are.

util_sleep2
An attempt to get around the issues with using sleep() inside of a timeout loop. Though it will still cause problems if used before setTimer() is called, if done afterwards it works fine.
Attached Files
File Type: zip utilities.zip (3.3 KB, 213 views)
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts

Last edited by coreys; 05-16-2010 at 11:40 PM..
Reply With Quote
  #2  
Old 05-17-2010, 05:42 PM
DrakilorP2P DrakilorP2P is offline
Registered User
DrakilorP2P's Avatar
Join Date: Apr 2006
Posts: 755
DrakilorP2P is just really niceDrakilorP2P is just really nice
Quote:
Originally Posted by coreys View Post
distance function that uses a heuristic..
Why?

Quote:
Originally Posted by coreys View Post
util_dict
A simple associative array class. It doesn't use any fancy hash table lookups or anything, so it's probably not particularly efficient, but it gets the job done.
Should have used dynamic variable names.
Reply With Quote
  #3  
Old 05-17-2010, 07:31 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
Quote:
Originally Posted by DrakilorP2P View Post
Why?
Because it's faster (square root is slow) and was more appropriate for some of the things I was using it for. For example, it helped speed up our hit detection on Rebirth quite a bit.

Quote:
Originally Posted by DrakilorP2P View Post
Should have used dynamic variable names.
I didn't want the possibility of interfering with built in variables or the function objects (especially that last one).
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:59 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.