How to implement ZMPP2 for glulx(ANSWERED)

I thought maybe I should start this as a new topic, as my question has changed considerably.

So I downloaded it, because it looks like exactly what I need, but I can’t find an .exe file. So I searched and found a bunch of scala files in a folder labeled ZMPP2 for glulx…

So my question is, what do I do with them?

Did you download the compiled version from github.com/weiju/zmpp2/downloads ?

You should be able to launch the zmpp-glulx.jar file in that package.

WHEW! Thank you so much Zarf! That is exactly what my problem was! It works very well as a stand-alone. In order to use it as an applet, I know I have to put it in the same file as my story file… but do I have to alter the code in the play.html file? in order for it to use the ZMPP instead of the Quixe player? (obviously I should get rid of that anyway)

There must be some sort of instruction or manual or tutorial on getting this to run as an applet… if anyone can help I would greatly appreciate it. I have the story files and the .jar file loaded to the server (in the same file)… but now what???

You need to look up how to embed an applet into a web page. In the embed you’ll set the parameters of the applet, which are (according to the usage file from the zmpp download)


**************************
Running as an applet
**************************

applet parameters:

1. story-file:
--------------
the URL of the story file, must be on the same server as the jar file

2. blorb-file (optional):
------------------------
the URL of the blorb file, must be on the same server as the jar file

3. save-to (optional):
---------------------
if set to "file", the applet will try to save a game state to the
user's file system, the default value is "memory" which saves a game
within the Java VM's memory

4. fixed-font-name/std-font-name (optional):
--------------------------------------------
the name of the standard and fixed fonts, the fixed font should be
a font with a fixed width like Courier or Monospaced

5. fixed-font-size/std-font-size (optional):
--------------------------------------------
the point size of the fixed font and the standard font. Can be set to any
integer number, however, it is recommended to set them to reasonable values
(e.g. 10-20)

6. default-background/default-foreground (optional):
----------------------------------------------------
specify default background and foreground colors for the applet.

possible values are:

- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- gray

6. antialias (optional):
------------------------

turns the antialias for text rendering on/off.
possible values: "on", "off", "true", "false"

The parameters are used in the object tag, something like so

<html>
<head>
<title>My Applet</title>
</head>

<body>
My Applet<br><br>
<object type="application/x-java-applet">
<param name="code" value="zmpp-1.5-preview1.jar">
<param name="blorb-file" value="my-game.gblorb">
<p>You do not have Java available, or it is disabled.</p>
</object>
</body>
</html>

Note that there is an tag, which may work too, but it’s not recommended.

I don’t know if this is the problem or not, but that is for zmpp and I am using zmpp2 for glulx. I did try that code (thank you for trying to work this out with me, btw!), but it didn’t work… just a blank white page with the title on in.

I looked at the html for the zork game running on zmpp… (but again it’s not zmpp2) it had this (I altered with my file names and my preferences):

[code]

  <param name="std-font-size" value="14">
  <param name="default-background" value="black">
  <param name="default-foreground" value="green">
  <param name="antialias" value="true">
</applet>
[/code] it does use the applet tag you advised against though. I did manage to get the java loading icon - and then error saying it couldn't find "zmpp-glulx.jar". Although it is in the same server in the same file. I do have a question about that am I supposed to be putting just the file name or the file path? I am not sure what else to do.

Maybe as a starting point use a Glulx game ZMPP demoes instead of Zork:


<html> 
  <head> 
  <title>ZMPP/Glulx - Dead Cities</title> 
  <script language="javascript"> 
    function focusapplet() {
      window.document.applets[0].focus();
    }
  </script> 
  </head> 
  <body onLoad="window.onclick = focusapplet;"> 
    <h1>Dead Cities</h1> 
    <applet code="org.zmpp.glulx.swing.GlulxApplet" codebase="."
            archive="zmpp-glulx-8.jar,muxm-spi-0.1.jar,tritonus-share-0.3.6.jar,jogg-0.0.7.jar,jorbis-0.0.15.jar,vorbisspi-1.0.3.jar" width="640" height="520"> 
      <param name="java_arguments" value="-Dapple.awt.graphics.UseQuartz=true -Xmx512m"> 
      <param name="story-file" value="DeadCities.gblorb"> 
    </applet> 
  </body> 
</html> 

When you say ‘same file’ do you mean the same directory? If everything is in the same directory you shouldn’t need to put the file path. If they’re in different directories, you’ll need to specify paths, or at least relative paths.

If the above doesn’t help you’re probably best off contacting Wei-ju, he reads the forums sometimes but maybe not very often.

YES! THANK YOU! It took me a bit, because I don’t really know what I’m doing but:

[code]

ZMPP2/Glulx Testing

Testing

<applet code="org.zmpp.glulx.swing.GlulxApplet"

codebase="."
archive=“zmpp-glulx.jar” width=“1000”

height=“600”>
<param name=“java_arguments” value="-

Dapple.awt.graphics.UseQuartz=true -Xmx512m">

[/code] [size=85]Leave this alone(I kept trying to replace it :unamused: : <applet code="org.zmpp.glulx.swing.GlulxApplet"

This needs to be replace with the name of your .jar file:
archive=“zmpp-glulx.jar” width=“1000”
height=“600”>

This needs to be replaced with the name of your.gblorb story:

lor][/size]

Again, THANK YOU for all of the help!! :mrgreen: