1 / 56

Sega 500

Sega 500. Wrapping up t he MUI, And the Power of Shortcuts. You may have noticed…. That there are a few things that my installer does that I didn’t cover last class… Like the sound and the splash screen for example. And so… .

Download Presentation

Sega 500

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sega 500 Wrapping up the MUI, And the Power of Shortcuts.

  2. You may have noticed… • That there are a few things that my installer does that I didn’t cover last class… • Like the sound and the splash screen for example.

  3. And so… • Today, we’re going to round out our NSI scripts by looking at some of the odds and ends that come with the MUI. • And looking at how we can make the “create shortcut” option work in in our favour.

  4. So first off… • Lets just root around the NSIS directory some. • Doing so, you’ll find lots of nsi scripts…But the ones we are really interested in are in the contrib folder.

  5. Take for example • The folder names “splash”. Inside of which you’ll find all sorts of juicy goodness…

  6. What’s this? • Ok, I see the nsi file cool… • But why are there project and workspace files? • ...and the C code for that matter?

  7. Before we look inside… • Compile the NSI file and see what it gives us. • Hey, cool! It throws this up to the screen before the installer runs!

  8. And yeah… • This is how I build the splash screen. • So what’s going on here? • Well, the short answer is that the NSIS comes with several DLL plug-ins which we can use to customise the interface.

  9. Look in the plugins folder.

  10. Look in the plugins folder. • That’s all the plugins that the NSIS comes with and you can use any one of the. • The best thing is, they all come with samples and a fairly decent readme’s.

  11. And! • As you may have guesses, since we have the dsp and dsw files, they are open source. • Meaning, you can write your own if you like!

  12. But… • I’ll leave that for you to explore on you own… • However, do consider the fact that the installation is the very first exposure that the user has to your game.

  13. Hence… • You should consider this part of the experience of your game and some effort should go into reflecting this. • Just as a for instance:

  14. Red Alert

  15. Red Alert • Was the first company to realize this and really made an interesting install experience with all sorts of game info and catchy music. • Now, I’m not suggesting that you take it to this extreme, just seriously consider it.

  16. Ok, the Splash screen • The example code really covers all we need to know about it. • The only catch is that it has to be done in the .onInit function. • From the example:

  17. Splash screen Function .onInit SetOutPath $TEMP File /oname=spltmp.bmp "my_splash.bmp" splash::show 1000 $TEMP\spltmp Pop $0 ; $0 has '1' if the user closed the splash screen early, ; '0' if everything closed normal, and '-1' if some error occured. Delete $TEMP\spltmp.bmp FunctionEnd

  18. Splash screen • This works like the prebeginplay function in UT. It gets called before the installer actually kicks up. • Then we store a copy of the image in a temp directory for the DLL to load up and use. SetOutPath $TEMP File /oname=spltmp.bmp "my_splash.bmp"

  19. Splash screen • Simply calls the DLL file to display the image (from the temp directory) for X milliseconds. splash::show 1000 $TEMP\spltmp

  20. Splash screen Pop $0 ; $0 has '1' if the user closed the splash screen early, ; '0' if everything closed normal, and '-1' if some error occurred. • And this line pretty much explains itself… • Using this? Copy, Paste, change the parameters for your file and duration. • Really, not much other option here.

  21. Splash screen • Just remember to delete the temp file when your done with it. • However, we can also use this to play a sound file as well…you may have noticed. Delete $TEMP\spltmp.bmp

  22. Splash screen • This really boils down to adding 2 lines of script…no more. • Which sound to play, and delete it when your done… File /oname=spltmp.wav “my_Sound.wav" … <show code> … Delete $TEMP\spltmp.wav

  23. Before we move on… • I want to take a look at the bgImage example as well. • This little app does something similar to the splash screen in that it throws up a full screen back ground image.

  24. bgImage • Now, the functionality is pretty much the same…but there is one thing I’d like to point out, it also plays sounds…lots of sounds…actually the entire windows media directory if you want! • Not worrying about the rest of the file at the moment, here’s how they did it.

  25. bgImage • Essentially they have created a looping condition based on the user feed back from the Message boxes.

  26. bgImage FindFirst $0 $1 $WINDIR\Media\*.wav StrCmp $0 "" skipSound moreSounds: StrCmp $1 "" noMoreSounds BgImage::Sound /NOUNLOAD /WAIT $WINDIR\Media\$1 MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds FindNext $0 $1 Goto moreSounds noMoreSounds: FindClose $0 skipSound:

  27. bgImage • Will grab the first wave file it finds in the it windows media directory. • If it comes back empty, it skips to the end of the function. FindFirst $0 $1 $WINDIR\Media\*.wav StrCmp $0 "" skipSound

  28. bgImage • Otherwise, it does a comparison to the feed back from the user (in register $1) • Then plays the sound through the DLL. StrCmp $1 "" noMoreSounds BgImage::Sound /NOUNLOAD /WAIT $WINDIR\Media\$1

  29. bgImage MessageBox MB_YESNO "Another sound?" IDNO noMoreSounds FindNext $0 $1 Goto moreSounds • If the user hits yes in the message box, we gab another sound based on the last index we had, and loop again.

  30. bgImage noMoreSounds: FindClose $0 • And of course, close the file when we are done. • Now this got me a thinking…

  31. Incrementing Background • “How difficult would it be to have and incrementing background image?“ • E.g. A different one for each section…

  32. Incrementing Background • As it turns out, not hard. But due to the nature of the NSIS script…the logic is a bit…different. • But I really only needed 2 functions and some test sections to pull it off.

  33. Background++ function .onInit strcpy $0 "0" InitPluginsDir ;; load our images File /oname=$PLUGINSDIR\modern-wizard.bmp "${NSISDIR}\Contrib\Icons\modern-wizard.bmp" File /oname=$PLUGINSDIR\checks1.bmp "${NSISDIR}\Contrib\Icons\checks1.bmp" File /oname=$PLUGINSDIR\checksX.bmp "${NSISDIR}\Contrib\Icons\checksX.bmp" ;; show the Init window BgImage::Init /NOUNLOAD /FILLSCREEN $PLUGINSDIR\modern- wizard.bmp functionend

  34. Background++ • All the does is load up a bunch of images to use as our background and throws the first one at the screen. • Next up was the actual function for the backgound…

  35. Background++ function BG Strcmp $0 "1" NEXT1 Strcmp $0 "2" NEXT2 goto end ; 1st pass...init bg NEXT1: BgImage::SetImage /NOUNLOAD /FILLSCREEN $PLUGINSDIR\checks1.bmp goto end NEXT2: BgImage::SetImage /NOUNLOAD /FILLSCREEN $PLUGINSDIR\checksX.bmp end: intop $0 $0 + 1 functionend

  36. Background++ • All that is really happening is that each time the function is called, we check to see which goto case to jump to (my kingdom for switch statement). • At which point we toss the next image up.

  37. Background++ • And lastly, we increment register $0 which we set in the oninit function to 0. • And then finally, in each section, we call the BG function…and lo and behold, it changes with each section. 

  38. Background++ • The only thing we have to remember to do is destroy the image class when we are done with it… Section "three" call BG MessageBox MB_OK "3" BgImage::Destroy SectionEnd

  39. And now… • Time to talk about the power of the shortcut as it relates to UT. • We’ve already talked about the creatshortcut command, so why am I showing you this?

  40. Power of the Shortcut • Well, as you no doubt, UT will accept a command line parameter for it’s execution. • This is how we can specify this like the game type and number of players through WOTgreal.

  41. Power of the Shortcut • Remember this? • Well that’s exactly what’s going on. A command line is being pass in when the UT is run.

  42. Power of the Shortcut • So, can you see where I’m going with this? • We can do exactly the same thing with shortcuts, thus customizing UT’s execution.

  43. Power of the Shortcut • Ok, so big whoop! I can specify the gametype and number of bots and what not…yippee. • We’ll actually you can do a whole lot more than that…like tell it which ini file to load!

  44. Power of the Shortcut • So for example you could do something like have UT run and ini file which is specific to your gametype. • And to illustrate the point, if I create a shortcut on my desktop for UT and add F:\UT2003\System\UT2003.exe -Userini=Spam.ini

  45. Power of the Shortcut • It will run UT using my Spam.ini for my player setting. • Go ahead. Copy user.ini and rename to spam…then change the defaultplayer name. • You’ll see it works nicely…

  46. Power of the Shortcut • This works for both the UT2003 and user ini files…consult the UDN for a complete list. http://udn.epicgames.com/pub/Technical/CommandLineOptions/

  47. Power of the Shortcut • Now, this doesn’t quite cover all the tricks… • Remember this fella? • Well, we can specifythis too 

  48. Power of the Shortcut • However, it’s a little strange. • The first thing is to make a copy of the UT2003.exe and name it whatever you like. • Then, in the help folder, create an image for the splash screen of the same name but with the addition of “logo”.

  49. Power of the Shortcut • So, we should have: • Now we edit the shortcut to read: Eze.exe in the system folder EzeLogo.bmp in the help folder F:\UT2003\System\Eze.exe -userlogo=EzeLogo.bmp

  50. Power of the Shortcut • And Shazam! • Our custom splash screen!

More Related