Tải bản đầy đủ - 0 (trang)
Hack 36. Play Zork on Your BlackBerry

Hack 36. Play Zork on Your BlackBerry

Tải bản đầy đủ - 0trang

OneoftheproblemswithbothZ2MEandZeeMEisthattheycomewithone

game(Mini-Zork).Toaddanothergame,you'llneedtomodifythejarfileand

installitonyourdevice.

Becausethereisalimitonthesizeofajarfile(thebiggestjarI'vebeenableto

loadis76K),youneedtopicksmallgames.Toseeadirectorylistingofallthe

Z-codegamesintheinteractivefictionlibrary,visitftp://ifarchive.org/ifarchive/games/zcode/.IfyouopenthatURLupinafilesystemviewer,suchas

theMacOSXFinderorWindowsExplorer,you'llbeabletosortbyfilesize.

LookforsmallZ-codefiles,andcross-referencewhatyoufindwiththelistings

atBaf'sGuidetotheInteractiveFictionArchive:visit

http://www.wurb.com/if/platform,scrolldownto"Z-code,"andclickthelink.

Thenyoucanlookupagameyou'reinterestedinandreadasynopsisand

review.Notallgamesarelisted,butBaf'sisauthoritativeenoughthatyousafely

usetheabsenceofareviewasafilter.Ifyou'vegotallthetimeintheworld,

though,youshouldtryeverything.Thereareworsethingsyoucoulddowith

yourtime.

Forexample,suppose905.z5catchesyoureye.It's60.5Kandmightbesmall

enough.SoyouheadonovertoBaf's,locateareview,andseethatitgota

decentreview(fourstars).Thenyoudownloadthefile,andusetheinstructions

listedinthenextsectionstopackageit.Next,createa.jar(or.alx),postitona

websiteforanOTAdownload(orusetheApplicationLoader)[Hack#97],and

startplayingthegameonyourBlackBerry.



Ifyoudowanttopost.jadand.jarfilesonyourownwebsite,make

sureyouhavetheproperMIMEtypessetup[Hack#97].



3.6.2.UseZ2ME

Z2MEisavailablefromhttp://gpf.dcemu.co.uk/asanover-the-airinstallation

(OTA).TherearealsoApplicationLoaderversionsavailableifyouhave

problemswiththeOTAinstall(seePhillipBogle'spostat



http://www.thebogles.com/blog/2005/06/play-infocom-classics-on-your.htmlif

youaredeterminedtodoanOTAinstall).WhenyoulaunchZ2ME,Mini-Zork

willappear.Figure3-18showsanintrepidadventurerdoingsomethingvery

wise.

Figure3-18.Noonewantstobeeatenbyagrue



AlthoughMini-Zorkwillkeepyoubusyforawhile,youmightwanttoplay

someothergames.Ittakesabitofefforttosetthisup(andit'sloteasierwith

ZeeME),butit'swellworthit.Unfortunately,Z2MEonlysupportsInform

Version3,andyoumaynotbeabletofindmanycompiledgamesinthatformat

(Versions5andhigheraremorecommon).Butifyousearchthearchive(and

Baf'sguide),you'llfindsome.

Supposeyoudownloaddejavu.z3fromtheInteractiveFictionarchive.Younow

needtorebuildtheZ2MEjarfiletoholdthisnewgame.

You'llneedtograbthesourcecodetotheBlackBerryversionofZ2MEfrom

http://gpf.dcemu.co.uk/andopenitintheBlackBerryJDE.Removeminizork.z3

fromtheprojectandreplaceitwithdejavu.z3.Then,findthe

blackberryZ2ME.jadfileintheprojectandchangetheZfile:entryfrom:







to:



Zfile:minizork.z3







Zfile:dejavu.z3



Saveandcompiletheproject,andyou'llhaveajarthatcontainsadifferent

game.



3.6.3.ZeeME

ZeeME'suserinterfaceisabitrougherthanZ2ME's,butitsupportsnewerZcodefiles,andalsohasaniftypackagerthatletsyoueasilycreatejarsofgames.

TouseZeeMEonaBlackBerry,scrollallthewaytothebottomofthescreen,

typeyourcommandin,andclickthetrackwheeltobringupthemenu.Click

Input,asshowninFigure3-19,toenteryourcommand.Besuretousethe

Settingsmenutosetacomfortablescreenwidthaswell.

YoucandownloadZeeMeathttp://www.gizmo-a-gogo.org/ZeeME/index.html.

Boththe.jarand.jadfilesareincludedonthesite.Sincethejar'sMANIFEST

containseverythingZeeMEneedstoknowtofunction,youcaninstalldirectly

fromthe.jarratherthanfromthe.jad.

AswithZ2ME,ZeeMEincludesMini-Zork.Ifyouwanttorunadditional

games,you'llneedtocreateaseparate.jarfileforeachofthem.Alsoavailable

ontheZeeMEwebsiteistheZeeMEPackager,whichisasimpleapplication

youcanusetocreateZeeMEjars(youshouldbeabletodouble-clickonthe

packager.jarfiletorunit).SimplyspecifytheZ-codefile,thegamename,and

thenameofthejaryouwanttocreate,asshowninFigure3-20.

Figure3-19.ZeeME'sminimalistuserinterface



Figure3-20.Packagingup905



Postthis.jaronlineforanOTAdownload(asdescribedin"FindGamesto

Play"),orusetheApplicationLoadertoinstallit.Ifyouneedtocreatea.jadfor

it,it'sprettyeasy.Usejartvfjarfile(forexample,jartvf

905.jar)tofindoutthenameoftheZ-codefile(forexample,

zeeme/games/905.z5)anditssize.You'llalsoneedtoknowthesizeofthe.jar

itself.

Setupthe.jadasfollows:





GameTitle0:9:05







MIDlet-Jar-Size:73066







GameFile0:/zeeme/games/905.z5







MIDlet-1:Minizork,,zmachine.ui.ZeeMEMidlet







MIDlet-Jar-URL:905.jar







MIDlet-Version:0.1.0







MIDlet-Name:9:05







MIDlet-Vendor:CraigSetera







GameLength0:61952



Youcanalsopeekinthejar'sMETA-INF/MANIFEST.MFfiletogettheneeded

values.



3.6.4.HacktheHack

It'samazinglyeasytomakeyourowngame.GrahamNelson'sInform

(http://www.inform-fiction.org/)willletyoucreateZ-codegames.Here'sthe

codeforasimplegamewhereyouaretrappedinalousyplaceuntilyoucanget

yourBlackBerryworkingagain:





ConstantStory"MyBlackBerry";







ConstantHeadline







"^Asimpleamusement^";







Include"Parser";







Include"VerbLib";







Include"Grammar";







Objectbattery"battery"







withdescription"ABattery",







name"battery",







before[;











Insert:











if(second==blackberry&&blackberryhasop











deadflag=2;!indicatesyou'vewonthegam











}







],







hasconcealed;







Objectblackberry"BlackBerry"







withname"blackberry",article"your",







description[;







if(selfhasopen){











"ThisisaBlackBerry7100t;it'smissingab











}else{











"ThisisaBlackBerry7100t";











}







],







before[;







Open:















if(selfhasntopen){















giveselfopen;















"Younoticethatthebatterycompartm















}else{















"That'salreadyopen.";















}







],







hascontaineropenable;







ObjectStartroom"Street"







withdescription











"Thisisadarkanddampstreet,anditdoesn't











You'restandingundertheonlystreetlampyou











forblocks.Ifyoucalledsomeone,they'dcome











pickyouup.",







n_to"Thatwaydoesn'tfeelsafe.",







s_to"Maybeifitwasn'tsodarktothesouth.",







w_to"It'sdarkthatway,andyouhearhungrysquishi







e_to"Youfeelsaferunderthelamp.",







haslight;







Objectrock"rock"Startroom







withdescription"Thisisadampandyuckyrock.",







name"rock",







before[;







LookUnder:







if(batteryhasconcealed){!It'sconcealeduntil











movebatterytoplayer;











givebattery~concealed;











"Youfoundabattery!";







}else{







"There'snothingelseundertherock.";







}







];







[Initialise;







location=Startroom;







moveblackberrytoplayer;







"^^^BlackBerryAdventure^";







];



DownloadanInformcompilerandthelibraries(abunchof.hfiles)andcopy

themintothesamedirectory.Atthetimeofthiswriting,thelatestInform

compiler(6.3)wascreatingZ-codefilesthatweretoolargetocreatea

reasonablysized.jar,soIsuggestthatyougrabaVersion5compilerand

librariesfromhttp://www.ifarchive.org/indexes/ifarchiveXinfocomXcompilersXinform5.html.

Savethecodeintoafileinthesamedirectory,andcallitbbgame.inf.Whenyou

lookatthecontentsofyourworkingdirectory,ifyouseethesefiles,youknow

you'regoodtogo(ifyou'reonUnix,Linux,orMacOSX,Informwon'thavean

.exeextension):

bbgame.inf

grammar.h

inform.exe

parser.h

verblib.h

Compilebbgame.inftoa.z5filewith:





informbbgame.infbbgame.z5



Youshouldnowhaveafilecalledbbgame.z5.Usetheinstructionsfromthe

previoussectionstopackageitupina.jarfile,andplayitonyourBlackBerry.

Formoreinformationabouthackingyourowninteractivefictiongames,see

http://www.inform-fiction.org/index.html.

BrianJepson



Chapter4.TheInternetandOther

Networks

Section4.1.Hacks3750:Introduction

Hack37.ConfigureYourBlackBerryforInternetAccess

Hack38.BlogfromYourBlackBerry

Hack39.ReadNewsandBlogsontheBlackBerry

Hack40.ControlAnotherComputerRemotely

Hack41.UseGoogleMaps

Hack42.TelnetorSSHtoInternetServers

Hack43.TelnetorSSHtoIntranetServers

Hack44.ChatoverIM

Hack45.ChatoverIRC

Hack46.BookmarkItondel.icio.us

Hack47.UseBackpackasYourMobileWorkspace

Hack48.UseGmailasaSpam-Catcher

Hack49.UseYourBlackBerryBrowserto…

Hack50.FindYourWaywithaGPS



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Hack 36. Play Zork on Your BlackBerry

Tải bản đầy đủ ngay(0 tr)

×