Re: divide by zero erro

2000-06-07 Thread Nelson Zink

Rick,

Avoids the repeat loop and potential problems there.

For one-stop shopping for random numbers:
put random(gUpper-gLower) + gLower into MCH

Nelson

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




numeric sensitive (?)

2000-04-28 Thread Nelson Zink

Nicolas,

Does mc have a specific function that, like caseSensitive, restricts
data-input to numbers? If not, any alternate suggestions? Use matchText or
offset, right?

I ask because, after implementing Nelson Zink's clock-timer script (thank
you!), I realized what some misguided (evil minded?!) user could do when
prompted by:

  ask "Count down how many seconds?" with 300


Try this:

ask "Count down how many seconds?" with 300
if it is not a number or it1 or it1 then  --pick your own upper 
limit
beep
answer quoteitquote" is not a number I like! Enter something 
reasonable."
    exit mouseup
  end if

Nelson Zink

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Re: Script Editing in Browse Mode

2000-04-06 Thread Nelson Zink

Sivakatirswami,

 But what about a global implementation? I tried to put that into the front
script, but after the first mouseUp which open script editor.

Try this in the stack script:

on mousemove
  if the optionkey is down then edit script of the target
  else pass mousemove
end mousemove

With the optionkey down any mouse movement over a target will open its 
script.

Nelson

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.




Multi-card glorified Find Again

2000-03-20 Thread Nelson Zink

Mary,

 gTextToSkip needs to be reset in the Find Again script.

Let me know what you're thinking. I don't want to reset it outside of
the FIND button because I always want to find the next occurrence after
the previous found occurrence. In the single-card stacks, I could just
hit Find Again all the way to the end of the field.

It's reset before moving to the next cd so searching will start at the 
beginning of the fld.

I've cut out the colorizing and scrolling bits with rely on gChunk as
well as resetFoundText, which returns the highlighted text to its
original format.

Then you've removed your reason for using OFFSET.  FIND is an easier way 
to go anyway and you can locate, hilite text, etc. using FOUND 
information anyway. The following is a single background button script 
that should do the job. Changes its name and color as it does its work.

on mouseUp
  global findIt,searchLight
  if the short name of me is "Find" then
ask "What text do you want to find?"
if it is empty then exit mouseUp
go cd 1  --or whatever is the first cd of the search fld
put "go" into searchLight
put it into findIt
find whole findIt in fld "Storytext"
if the result is empty then
  set the name of me to "Find Again"
  set the backcolor of me to "red"
else answer "Sorry, the text was not found."
  else
find whole findIt in fld "Storytext"
if  searchLight is "stop" or the result is "not found" then
  answer "Sorry, no more occurrences of the text were found."
  set the name of me to "Find"
  set the backcolor of me to "green"
 end if
  end if
end mouseUp

For multi-card searches put the following in the cd script of the first 
cd of the search field. It just stops FIND from endlessly wrapping around.

on openCard
  global searchLight
  put "stop" into searchLight
end openCard

If you're talking about a one cd search field you can remove the 
searchLight stuff from the btn script.  Or leave it in.  Whatever suits 
your housecleaning preference.

NZN



Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.



Multi-card glorified Find Again

2000-03-19 Thread Nelson Zink

Mary,

 I sure could use some help wrappin' my head around this one.

Try the following:

FIND BUTTON SCRIPT:
on mouseUp
  global gTextToFind,gTextToSkip,gChunk
  ask "What text do you want to find?"
  if the result is "Cancel" then exit mouseUp
  else
put it into gTextToFind   -- to feed Find Again
go first cd  --you may need this
# start looking
repeat forever
  put offset(gTextToFind, fld "storyText") into tTextOffset
  if tTextOffset  0 then   -- found it!
beep
put "char"  tTextOffset  "to"  tTextOffset + \
length(gTextToFind) -1  "of fld 1" into \
gChunk  -- for colorizing
put tTextOffset + length(gTextToFind) - 1 into \
gTextToSkip  -- tells Find Again where to start
# colorizing here
# scroll the field
exit mouseUp
  else
if the number of this cd=the number of cds then exit repeat
else
 go next cd
end if
  end if
end repeat
answer "Sorry, the text was not found"
  end if
end mouseUp

FIND AGAIN BUTTON SCRIPT:
on mouseUp
  global gTextToFind,gTextToSkip,gChunk
  resetFoundText  -- takes highlighting off
  repeat forever
put offset(gTextToFind, fld "storyText",gTextToSkip) into tTextOffset
if tTextOffset  0 then   -- found it!
  beep
  put "char"  tTextOffset  "to"  tTextOffset + \
  length(gTextToFind) -1  "of fld 1" into \
  gChunk  -- for colorizing
  add tTextOffset + length(gTextToFind) - 1 to \
  gTextToSkip  -- tells Find Again where to start
  # colorizing here
  # scroll the field
  exit mouseUp
else
  if the number of this cd=the number of cds then exit repeat
  else
put empty into gTextToSkip --reset for next cd search
go next cd
  end if
end if
  end repeat
  answer "Sorry, no more occurrences of the text were found."
end mouseUp

The repeat loops are practically the same. 
You need to ADD to gTextToSkip in the Find Again script.
gTextToSkip needs to be reset in the Find Again script. 
Not sure you need gChunk as a global.
Take out the beeps if they're annoying, I used them to be sure things 
were working.  

Nelson

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.



cut copy paste buttons on the mac

2000-03-15 Thread Nelson Zink

Jeff,

just hard to stop 
my brain loop of hitting the f keys... any solutions out there???

The following is mine--placed in the home stack. I use it mostly for F5 
and F8--they both toggle. F1 (undo) is a little quirky sometimes, but I 
don't think I understand what 'undo' means in MC.

on functionkey theKey
  if thekey is 1 then undo
  if thekey is 2 then cut
  if thekey is 3 then copy
  if thekey is 4 then paste
  if thekey is 5 then
get the tool
if it="browse tool" then choose pointer tool
else choose browse tool
  end if
  if thekey is 8 then
get the openstacks
if "tools" is in it then close stack "tools"
else palette "tools"
  end if
  if thekey is 9 then edit the script of this cd
  if thekey is 10 then edit the script of this stack
  if thekey is 11 then edit the script of stack "home"
end functionkey

What's the thing (critter?) under your name?

Nelson

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to [EMAIL PROTECTED], not this list.



button bounce script

2000-03-05 Thread Nelson Zink

Brian ,

The idea is to make a button react when you click on it.

Is this the kind of thing you're looking for?

on thumb
  put 30 into RR  --number of repeats
  put 5 into WW --speed setting
  repeat RR  --contract
put the rect of the target into temp
add 1 to item 1 of temp
add 1 to item 2 of temp
add -1 to item 3 of temp
add -1 to item 4 of temp
set the rect of the target to temp
wait WW milliseconds
  end repeat
  
  repeat RR  --expand
put the rect of the target into temp
add -1 to item 1 of temp
add -1 to item 2 of temp
add 1 to item 3 of temp
add 1 to item 4 of temp
set the rect of the target to temp
wait WW milliseconds
  end repeat
end thumb

on thumb2
  put 3 into FR  --flicker rate
  put  the backgroundcolor of the target into temp
  repeat 5
set the backgroundcolor of the target  to green
wait FR ticks
set the backgroundcolor of the target  to red
wait FR ticks
  end repeat
  set the backgroundcolor of the target to temp
end thumb2

Or do you just want to make extra double sure that the button doesn't 
creep on you?  
If so, try:

on downThumbnail
  put the rect of the target into temp
  move the target relative  2, 2 in 90 millisecs
  move the target relative  -2, -2 in 90 millisecs
  set the rect of the target to temp
end downThumbnail


NZN

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm



MetaCard CGI

1999-12-28 Thread Nelson Zink

By request, the personal story of "Setting up a website to do e-commerce 
using MetaCard as the CGI component" has been updated and is back online 
at: http://www.navaching.com/pagem.html

Nelson Zink

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm



Apache Server and Metacard CGI's

1999-11-16 Thread Nelson Zink

David,

Anyone out there who can help me set up Apache on Linux to run Metacard
CGI's?

I just went through a torturous two week doing just that. It sounds like 
you're considerably more advanced than I, so it should be easier for you. 
I decided to write about my experience and what I learned.  Find it at 
www.navaching.com/pagem.mt

You won't need to do anything with either Apache or Linux.

Nelson Zink



Apache Server and Metacard CGI's

1999-11-16 Thread Nelson Zink

I fouled up the ending of the address. The email I just sent in should 
say: 

David,

Anyone out there who can help me set up Apache on Linux to run Metacard
CGI's?

I just went through a torturous two week doing just that. It sounds like 
you're considerably more advanced than I, so it should be easier for you. 
I decided to write about my experience and what I learned.  Find it at 
www.navaching.com/pagem.html

You won't need to do anything with either Apache or Linux.

Nelson Zink



converting seconds to minutes seconds

1999-11-14 Thread Nelson Zink

Leston,

 I've got a "countdown" clock in my app that shows time remaining

Stick the following into a cd fld script and you're set.

on mouseUp
  global CountTimer
  ask "Count down how many seconds?" with 300
  put the milliseconds+(it*1000)into CountTimer
  set the backcolor of me to red
  send mousedown to me
end mouseup

on mousedown
  global CountTimer
  if CountTimerthe milliseconds then
set the numberformat to "00."
put (CountTimer-(the milliseconds))/1000 into temp
put trunc(temp/60) into mints
put temp mod 60 into seccs
put mints":"seccs into me
send mousedown to me in 300 milliseconds
  else
set the backcolor of me to green
put  "Reset" into me
  end if
end mousedown



escaping a repeat loop

1999-11-10 Thread Nelson Zink

Nicolas,

 For impatient users of my stacks, I'd like to rescript this
 mouseDown-initiated repeat loop so that it can be escaped (via the
 return key?) without leaving group "bin-bon!" hidden:

Try the following:

repeat 2
  show group "bin-bon!"
  wait 400 milliseconds
  getOuttaHere
  hide group "bin-bon!"
  wait 600 milliseconds
  getOuttaHere
  show group "bin-bon!"
end repeat

on getOuttaHere
if  the commandkey is down  then
  show group "bin-bon!"
      exit repeat
end if
end getOuttaHere

Nelson Zink



NETIQUETTE

1999-11-01 Thread Nelson Zink

RenÈ

Thanks for using an appropriate wording of the subject of your mail. Check 
out NETIQUETTE if you do not know what I am talking about, please.

Where would I find NETIQUETTE?

Nelson Zink



Re: Digest metacard.v003.n121

1999-10-31 Thread Nelson Zink

Dear Nicolas,

On one card I have 20 buttons whose script is the same but which I now want
to change, preferably with some sort of repeat loop rather than manually
button by button, e.g.,:

Easy to do. Change the script of cd btn 1 to what you want, then:

repeat with zz=2 to 20
  set the script of cd btn zz to the script of cd btn 1
end repeat

In hindsight, I should've scripted some sort of subroutine.

Then take care of it now.  Make the script of cd btn 1:

On mouseup
  ShakeRattleAndRoll
end mouseup

set cd btn scripts as above and stick the ShakeRattleAndRoll handler 
somewhere in the message path of the cd btns. 

Nelson Zink



Distant Finding

1999-01-03 Thread Nelson Zink

R¸diger,

There are better options:   if "007" is in fld "Agents" of cd "Espionage" 
then ...

H, the old 'it's obvious' trick again.

Thanks, just what I wanted.

Nelson



Distant Finding

1999-01-02 Thread Nelson Zink

All,

I want to know whether a particular number resides in a distant cd fld 
and am using the Find function to make the determination. However, I 
don't want to be transported to that card. Any clever combination of Find 
and Result?
 
What I really want to say is: 
if the result of find "007" in cd fld Agents of cd Espionage is "not 
found" then MailThePackage 

Nelson Zink