The list of
button commands
Examples
Description:
The Hyper Buttons can be
thought of as sprites, regions, animations, pictures, or buttons that can
be created at runtime . The Hyper Buttons can also be though
of as 3d objects in the world with you're character that can be set at
a specific depth (that is to say, your character can hide behind them).
They define an area in the VirtualFriend™ Window which can trigger an action
when the User clicks it. This region can consist of any number of images
which can play like an animation, or can contain no images, and simply
defines an invisible, but active, region in the VirtualFriend™ character
Window. You can think of a button with no images as a Hotspot on the background
image(like a hotspot on an image map on a web page).
The Coordinate System used
to define the button world:
In order for your buttons to
always appear in the same place in your characters's ever changing
world, the coordinate system is based
on percentages of the entire window (that's the window where your vf lives)
0 is 0%, and, 1 is 100%, hence, if
you wanted to specify 32% you would type .32.
Also, the coordinate system starts
from the bottom left corner with x increasing to the right, and y increasing
uppward. (play arround with
defining the region, and it'll become more clear,
see below for more details)
Button Images:
The images you define a button
with need to hold to a couple of rules.
1: they must be of dimension
that are a power of 2. Such as 32 X 32 or 128 X 1024 etc...
2: the upper left pixel in the
image will be used as a transparent color, so make sure it's the
color you want it to be, or
half your image could be invisible.
NOTE: Currently the only working
transparent colors are White (255,255,255) and Black (0,0,0)
Button
Types:
These two letter names will be used
in defining and redefining
the type of a button
pp push
pop button.
This is a button that displays one image when at rest, and then a two frame
animation when clicked
tg
toggle button.
This is a button which toggles through the images contained in the button.
Each time it is clicked, it
it goes to the next image in the button. You could use this to do a slide
show.
an animated
button. This
currently defaults to an animate once button.
ao
animate once button. This button plays through
all the images in the button and finishes with the first image displayed.
al
animate loop button. This is a button that play
through all the images in the button over and over, in a loop.
Defining
a Button:
As with all hypertext commands,
the command to define a hyper button begins with \ht.
The generalized full command apears
like this:
\ht_defbuttonXX_type_action_"
x1 , y1 , x2 , y2 , command/filename , image1.bmp , image2.bmp , ... ,
imageN.bmp"
where 'XX' is a numeric
identifier such as 01 or 99 (don't forget the 0 in front if there is only
1 number.)
(you will use this identifier in any future corespondence with the button
you created.)
where 'type' is one of
the button types described above.
where 'action' is one
of the actions described above.
where 'x1 , y1 , x2
, y2 , ' define the rectangular region the button lives in.
x1 and y1 specify one corner,
and x2 and y2 specify the other corner diagonally related to the first
corner.
where 'command/filename'
is the command/filename/parameter associated with the specified action.
where 'image1.bmp ,
image2.bmp , ... , imagen.bmp' is an optional list of images that belong
to this button
Take note that the order in
which they are listed is the order in which they will appear if animated
or toggled. There can be 1,
none, or many images listed.
Examples:
Example 1: A Push pop button
Suppose that you have 2 images
called 'button1.bmp' and 'button2.bmp' and you want your button to look
like a normal button, such that
when you push it it shows your button2.bmp image, then it shows button1.bmp
again. Now, suppose that
when the button is clicked, you want your character to say "Hello Friend".
and you want it to be in the
upper left quarter of your virtual friends world. You also want this button
to be known as 01.
your command would look like:
\ht_defbutton01_pp_speak_"0
, 0.5 , 0.5 , 0 , Hello Friend , button1.bmp , button2.bmp"
that's it!
Example 2: A button with no images
/ An invisible region
\ht_defbutton05_pp_speak_"0
, 0.5 , 0.5 , 0 , I love you , "
This would define a region in
the upper left corner that would make your character say,"Hello Friend"
any time you clicked in it.
NOTE: If there are
no images, it really doesn't matter what you put as the type
of button,
as long as you put something!
Example 3: Animating in a loop:
\ht_defbutton05_al_speak_"0
, 0.5 , 0.5 , 0 , Hello Friend , f1.bmp , f2.bmp , f3.bmp , f4.bmp"
Example 4: Animating once:
\ht_defbutton05_ao_speak_"0
, 0.5 , 0.5 , 0 , Hello Friend , f1.bmp , f2.bmp , f3.bmp , f4.bmp"
Notice that the only difference between
both of these examples is the type. You specify 'al' for your animation
to run in a loop, and you specify
ao for your animation to run once whenever it is activated.
If your animation is running in a loop,
that doesn't mean that the action associated with that button will run
in a
loop as well. The action will
still only happen when the button is activated(when the user clicks it).
|