Description
This LUA allows you to create a animated image that showed frame by frame
This LUA is inspired by this thread: No Animated Avatars
Features
Easy to use(Only needs 1 function)
Uses Timer Extra function(timerEx) v4.0 (12)
File pattern support(so you only need to rename the file to like the pattern. Gonna explained below)
Configurable frame speed
To Do List
Animated PNG support(maybe)
How to Install
Read it at download file page
How to Create animated images
There is a 2 ways to create it.
With meta.txt(useful for static image setting)
1. Create new folder at gfx folder. This folder will contain your image frame
2. Put all the image at folder that you create before
3. Create new text file called meta.txt and open it
4. Write this in meta.txt
1
2
2
<File Pattern> <Image mode> <Speed in miliseconds>
File Pattern - The file pattern(gonna explained below)
Image mode - Image mode(relative to image)
Speed - Frame speed in miliseconds
5. Save
6. On your LUA, put this code somewhere depending on your LUA execution code
1
animated_image_id=imageanimated("gfx/<Folder name that you're create>/",true,nil,<X>,<Y>)
Y - Y position of the image(pixels)
7. Save, and run your LUA script again to test it
Without meta.txt(useful for dynamic image setting)
1. Repeat step 1 and step 2 above
2. On your LUA, put this code somewhere depending on your LUA execution code
1
animated_image_id=imageanimated("gfx/<Folder name that you're create>/",false,"<File pattern>",<X>,<Y>,<Mode>,<Player that can see it>,<Speed>)
3. Save, and run your LUA script again to test it
File Pattern
File pattern is a string that represent all image frame name. Some Example:
Your image frame name is gelap_1.png,gelap_2.png,...,gelap_5.png
Then the File Pattern string should be like this:
1
gelap_%d.png
Reserved Global Variables
__timerArg*
timerEx*
freetimerEx*
imageanimated
freeimageanimated
imageanimatedpos
tween_animatedmoverot
* - This variable doesn't re-created if already exist
Information
Hooks: 0
Lines: 178
Size: 4068 bytes
Functions
imageanimated(folder(string),use meta(boolean),file pattern(string),x(number),y(number),mode(number),player(number),frame speed(number))
Parameters
folder - Path to folder that contain all the image frame(with meta.txt if needed)
use meta - Use meta.txt file for settings?
file pattern - File pattern(explainen above), put nil if you use meta.txt
x - X position of the image(pixels)
y - Y position of the image(pixels)
mode - Image mode(list of image mode: image), put nil if you use meta.txt
player - Player that can see the image, put nil if you want to show it for all players
frame speed - Frame speed in miliseconds, put nil if you want the default speed(100) or if you use meta.txt
Returns: ID of animated image(0 on failture)(number)
WARNING: Using freeimage on animated image can cause unexpected berhaviour. Use freeimageanimated instead
freeimageanimated(animated image id(number))
Parameters
animated image id - ID of the animated image ID that want to be destroyed
Returns: none
WARNING: Using normal image Ids(created by image) in this function can cause unexpected berhaviour.
The rest of the function can you found at file
Notes
1. Your feedbacks, bug reports, suggestions on comments
2. It needs at least timerEx v3.0 or above(Because it's not override the variable, then you can delete the outdated timerEx)
3. Im sorry that there is no image but here is the link of the video: link
4. It needs some delay to show the first frame of the image when the function is called(maybe fixed at v1.1)
5. I put a example image frame at archive
Rules
You can use it for your server
You can edit it
You can upload at another website, say MikuAuahDark made it
You can't say this is yours
You can't upload on another website without put me on credits
Version History
v2.0
Timer doesn't destroyed at roundstart
Image animation doesn't destroyed internally at roundstart
Now it shows the first frame without delay
Deleted unused variables
tween_animatedmoverot
v1.0
Initial Release
Another MikuAuahDark Scripts
[UNUSED] Get Player Rank v1.4 (14)
Env_Laser v1.0 (7)
Weapon Hudtxt v1.0 (7)
Improved Badwords v2.0 (5)
edited 4×, last 03.11.13 01:05:39 am
Approved by Seekay
Download
6 kb, 506 Downloads