Topic:   speak [GM/Applescript/UNIX]   (Read 36871 times)


0 Members and 4 Guests are viewing this topic.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
speak [GM/Applescript/UNIX]
« on: June 19, 2011, 04:44:39 PM »
The least used command in GM is the Applescript command, mostly because it requires learning another language. The only reason I decided to try it out was because, I thought I could find some stuff on the internet, and found out that you can also run Terminal commands through Applescript. and since I knew how to make it speak I wrote up this cmall little block
Code: [Select]
BEGIN APPLESCRIPT
do shell script "say kurt"
END APPLESCRIPT
very simple, and great reaction speed considering its running UNIX through Apple script through GameMaker.

For variations of the say command, that could make your game a bit more talkative. Check out my UNIX tut, or type 'man say' into the terminal.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: speak [GM/Applescript/UNIX]
« Reply #1 on: June 19, 2011, 07:08:46 PM »
Wow, this opens up a ton of possibilities.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: speak [GM/Applescript/UNIX]
« Reply #2 on: June 20, 2011, 01:37:40 PM »
yep. I'm going to use it in my short RPG Fathers.
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Al Staffieri


  • GMG-er

  • **

  • no avatar

  • Posts: 452

  • I love GameMaker
Re: speak [GM/Applescript/UNIX]
« Reply #3 on: September 03, 2011, 12:47:33 PM »
You can do this without the Unix shell script if you put the text to speak in quotes.

BEGIN APPLESCRIPT
  say "Hello"
END APPLESCRIPT


You can launch another application or make it active if it's already running behind GM

BEGIN APPLESCRIPT
tell application "GM Toolkit"
activate
end tell
END APPLESCRIPT


You can use GameMaker variables in Applescript like this:

a$ = "Kurt"
BEGIN APPLESCRIPT a$
Say "Hello"
Say a
Say "How are you today?"
END APPLESCRIPT


Some more examples of using AppleScript in GameMaker

BEGIN APPLESCRIPT
  set x to display dialog "Pick a color"  buttons {"Red", "Blue", "Green"}
  return button returned of x
END APPLESCRIPT = color$

PRINT You picked $color$$

-----

' Set sound volume

userask$ = USERASK Set sound volume (0 - 7)
IF userask$ = "" THEN EXIT
myVolume = VAL userask$
IF myVolume < 0 THEN myVolume = 0
IF myVolume > 7 THEN myVolume = 7

BEGIN APPLESCRIPT myVolume
tell application "Finder"
  set volume myVolume
end tell
END APPLESCRIPT

' test sound volume
BEEP


-----


' Ask a question

BEGIN APPLESCRIPT
set test to display dialog ¬
"What is your name?" buttons "OK" default button "OK" default answer "GameMaker User" with icon 1
return text returned of test
END APPLESCRIPT = myStr$

PRINT "Hello" $myStr$$

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: speak [GM/Applescript/UNIX]
« Reply #4 on: September 04, 2011, 04:06:18 PM »
Whoa! this is amazing  :o I may have to get around to learning applescript!
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: speak [GM/Applescript/UNIX]
« Reply #5 on: September 04, 2011, 04:35:47 PM »
Hmmmm. This sounds fantastic.

If GM had basic drawing functions I figure I could use AppleScript to execute some external C++ code and possibly make a fast, realistic GameMaker physics engine. Just an idea for application.