Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
cuprohastes
Wanderer


Joined: 22 Oct 2006
Posts: 92

PostPosted: Sat Jul 19, 2008 12:51 pm   

How do I... Make an image viewer?
 
Using Zugg's URL detection pattern, edited to only trigger on URLS that end .gif, .JPG and.PNG, it should be possible to use #makewindow to pop up a floating window, then use the #mxp <image ... > tag to display an image in that window.

The first thing that happens when I enter a URL is that the image is downloaded, then I have to enter just the image name to get it to display. Is there any way this whole plan will actually work or is MXP jsut not set up for allowing this sort of shenannigans?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jul 25, 2008 8:41 am   
 
Here's a crude image viewer that should do what you want, or at least give you a good starting point.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="60" copy="yes">
    <pattern>showim (http*)</pattern>
    <value><![CDATA[#mxp <image fname=%char(34)%1%char(34)>
$filename = %subregex(%1,"http.*/","")
#show $filename
#mxp <image fname=%char(34)./images/$filename%char(34)>
#mxp <FRAME Name="Frame" action="open" Left="-50c" Top="0" Width="50c" Height="50c">
#execwin Frame {#clr}
#execwin Frame {#mxp <image fname=%char(34)./images/$filename%char(34)>; #echo hello}]]></value>
  </trigger>
</cmud>


To use it, try the following command:
Code:
#show showim http://forums.zuggsoft.com/forums/images/avatars/172896370346230b24779a1.gif


There are a couple things to note, which may be by design or may be bugs.

1. The #image command assumes an absolute path and reference a relative directory.

2. <image url="http://XXXXX"> only downloads the image, it doesn't display it.

[Edit] I don't know my MXP Well enough but #2 here might actually be a bug. Any MXP wiz's care to chime in?

3. <image fname="XXXXX"> will properly display a local image and can reference a relative directory
_________________
Asati di tempari!

Last edited by Tech on Fri Jul 25, 2008 11:23 pm; edited 1 time in total
Reply with quote
cuprohastes
Wanderer


Joined: 22 Oct 2006
Posts: 92

PostPosted: Fri Jul 25, 2008 4:17 pm   
 
THanks! I'll give it a whirl!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net