Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-19-2012, 09:21 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
GUI Image Viewer

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
Attached Thumbnails
Click image for larger version

Name:	imageviewer.PNG
Views:	261
Size:	42.7 KB
ID:	54382  
__________________
Reply With Quote
  #2  
Old 03-19-2012, 09:28 PM
xXziroXx xXziroXx is offline
Master of Puppets
xXziroXx's Avatar
Join Date: May 2004
Location: Sweden
Posts: 5,288
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Send a message via AIM to xXziroXx Send a message via MSN to xXziroXx
Why would anyone use this over, say I don't know, browsing the same images from their Graal folder?
__________________

"A delayed game is eventually good, but a rushed game is forever bad." - Shigeru Miyamoto
Reply With Quote
  #3  
Old 03-19-2012, 09:31 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by xXziroXx View Post
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.
__________________
Reply With Quote
  #4  
Old 03-19-2012, 09:34 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
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. 
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #5  
Old 03-19-2012, 09:40 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
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
Attached Thumbnails
Click image for larger version

Name:	imageviewer.PNG
Views:	196
Size:	42.9 KB
ID:	54383  
__________________
Reply With Quote
  #6  
Old 03-19-2012, 09:46 PM
BlueMelon BlueMelon is offline
asdfg
BlueMelon's Avatar
Join Date: Sep 2008
Posts: 1,481
BlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to beholdBlueMelon is a splendid one to behold
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
__________________
http://i.imgur.com/OOJbW.jpg
Reply With Quote
  #7  
Old 03-19-2012, 09:47 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
Quote:
Originally Posted by BlueMelon View Post
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
Attached Thumbnails
Click image for larger version

Name:	imageviewer.PNG
Views:	216
Size:	36.2 KB
ID:	54384  
__________________

Last edited by Emera; 03-19-2012 at 10:04 PM..
Reply With Quote
  #8  
Old 03-20-2012, 06:24 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
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
__________________

Last edited by Emera; 03-20-2012 at 08:32 PM..
Reply With Quote
  #9  
Old 03-21-2012, 02:50 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
It's way too small, write a hack that implements an image viewer into the Client-RC File Browser instead.
__________________
Quote:
Reply With Quote
  #10  
Old 03-21-2012, 03:42 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
Quote:
Originally Posted by fowlplay4 View Post
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!!
Reply With Quote
  #11  
Old 03-21-2012, 07:15 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road
Lol ^
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion
Reply With Quote
  #12  
Old 03-21-2012, 09:44 AM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by Tricxta View Post
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

Last edited by Mark Sir Link; 03-21-2012 at 09:55 AM..
Reply With Quote
  #13  
Old 03-21-2012, 11:45 AM
Tricxta Tricxta is offline
The Muffin Man
Tricxta's Avatar
Join Date: Oct 2010
Location: Australia
Posts: 563
Tricxta is a jewel in the roughTricxta is a jewel in the rough
well played
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 03:54 PM.


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