Well since you are using functions you either need to set your variables in your function instead of in your loop or declare them as global. I prefer to declare them global.
I added :
global ca#=camera angle y()
global ch#=10
global x1#
global y1#
global z1#
above the loop
secondly I moved the commands that follow and point to the object to run after you edit the camera values. I just put them at the end of the function (this is just what I prefer to do).
Some of your variable declarations were in your loop so it kept resetting them. So when you edit them in your function they just reset and then it updates. I moved those above the main loop.
I also increased the matrix size, just so it would be easier to see the camera move.
The final source is here
REM Project: gemstone
REM Created: 10/13/2004 2:42:56 PM
REM
REM ***** Main Source File *****
REM
rem Best display
if check display mode(1024,768,32)=1
set display mode 1024,768,32
endif
rem Init app
sync on : sync rate 60 : backdrop on :` hide mouse
`setup main int.
make matrix 1,300,200,20,20
make object cube 1,5
make camera 1
global ca#=0
global ch#
ch#=10
global x1#
global y1#
global z1#
`start the game
do
`int. players positions
x1#=object position x(1)
y1#=object position y(1)
z1#=object position z(1)
`int. camera positions
controlcam(5)
sync
loop
`Functions
function controlcam(camspeed#)
if leftkey()=1 then ca#=wrapvalue(ca#+camspeed#)
if rightkey()=1 then ca#=ca#-camspeed#
if upkey()=1 and ch# < 201 then ch#=ch#+camspeed#
if downkey()=1 and ch# > -1 then ch#=ch#-camspeed#
`follow the player
set camera to follow 1,x1#,y1#,z1#,ca#,100,ch#,20,1
`always taget the player
point camera 1,x1#,y1#,z1#
endfunction
This works with DBPro. If you are using DBC then you need to make the variables as arrays thus making them global.
Aku Soku Zan