Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   GUI Image Viewer (https://forums.graalonline.com/forums/showthread.php?t=134266039)

Emera 03-19-2012 09:21 PM

GUI Image Viewer
 
1 Attachment(s)
I've been scripting this on Delteria for the past 20 minutes, and I got to the end of scripting it and I wondered if the forums will benefit from this script. I don't know if it will be much use to anybody, but it came in handy to me! Please leave some feedback on the code so I can better it. Rip it apart if you like.

It's basically a GUI that lists all the image files in a folder and lets the user view them through the GUI. Nothing too amazing!

http://pastebin.graalcenter.org/read...01056847901010

xXziroXx 03-19-2012 09:28 PM

Why would anyone use this over, say I don't know, browsing the same images from their Graal folder?

Emera 03-19-2012 09:31 PM

Quote:

Originally Posted by xXziroXx (Post 1689290)
Why would anyone use this over, say I don't know, browsing the same images from their Graal folder?

It's usable through Graal and you can browse images that haven't been downloaded yet.

BlueMelon 03-19-2012 09:34 PM

I also made a similar tool for Era and is also currently used on Delteria,

to get images from current level:
PHP Code:

for ( temp.npcid 0temp.npcid npcscounttemp.npcid ++;){
          if(!(
npcstemp.npcid].image in temp.images)){
            
temp.images.add(npcstemp.npcid].image);
          }
    }
// return temp.images; // Or w.e. you want to do with them. 


Emera 03-19-2012 09:40 PM

1 Attachment(s)
Updated. The image window now contains a scroll control that scales itself to the size of the image. You don't have to deal with only viewing the top left of the image if the image is bigger than the control. Viewing tilesets and larger images suits this.

I've also added a new text bar that allows viewing a specific file name instead of finding it through searching with the folder list option.

http://pastebin.graalcenter.org/read...d=103360414039

BlueMelon 03-19-2012 09:46 PM

Personally, I would suggest using a tree view instead of a list and sort the images names alphabetically. This would be more user friendly and good practice :)

Emera 03-19-2012 09:47 PM

1 Attachment(s)
Quote:

Originally Posted by BlueMelon (Post 1689295)
Personally, I would suggest using a tree view instead of a list and sort the images names alphabetically. This would be more user friendly and good practice :)

I've never properly used a tree view before, so I'll look into it. Thanks for the advice <3
Update, I've added a file count and also added a sort() when adding the files to the text list.
If anybody has any more suggestions, just post them here so I can add them.

http://pastebin.graalcenter.org/read...=4762178107710

Emera 03-20-2012 06:24 PM

Fixed a stupid mistake where the script was triggering the client every time a new file was added to the list, which sometimes resulted in being disconnected from the server if there was 1000 odd files being added to the list!

Update. Bumped the size of the GUI up and moved some controls about. It's easier to read longer image names in the left hand text list now.

http://pastebin.graalcenter.org/read...=6011061830108

fowlplay4 03-21-2012 02:50 AM

It's way too small, write a hack that implements an image viewer into the Client-RC File Browser instead.

Tricxta 03-21-2012 03:42 AM

Quote:

Originally Posted by fowlplay4 (Post 1689449)
It's way too small, write a hack that implements an image viewer into the Client-RC File Browser instead.

but...that's a real challenge!!

Gunderak 03-21-2012 07:15 AM

Lol ^

Mark Sir Link 03-21-2012 09:44 AM

Quote:

Originally Posted by Tricxta (Post 1689451)
but...that's a real challenge!!

not really...

PHP Code:

//#CLIENTSIDE
function onCreated(){
  
this.filetypes = {"png""mng""gif"};
}

function 
FileBrowser_FilesList.onSelect(idtextrow){
  for(
temp.type this.filetypes){
    if(
text.pos(type) > -1){
       
FileBrowser_DebugText.addtext("" NL "<img src =\""@text.substring(0text.pos(type) + type.length())@"\">"true);
    }
  }


PS I was too lazy to create a new GUI object that drew where the mouse was when hovering over a file name but it's not really too far off of this

everyone always make things far harder than they need to be please stop doing that

Tricxta 03-21-2012 11:45 AM

well played


All times are GMT +2. The time now is 09:35 PM.

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