2 - PowerPoint PPT Presentation

About This Presentation
Title:

2

Description:

arrGreets = NewSet('ciao,hola,hello') Speak arrGreets(RndInt(3)) Ciao. Hello. Ciao. Hola. www.dimensionex.net. book. crown. scroll. sword. setObjects. SET. www. ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 36
Provided by: cristia5
Category:
Tags: ciao

less

Transcript and Presenter's Notes

Title: 2


1
2 Scripting
SW Development CourseMultiplayer Multimedia Apps
on the Web
  • Events
  • Language elements
  • Flow control constructs
  • Implicit parameters
  • Movement EVENTs
  • Navigating documentation
  • Array and SETs

2
EVENT
  • Whatever happens, an EVENTO triggers
  • When an EVENT triggers, the system looks for a
    specific piece of software
  • At each call, if that piece of software is found,
    it is executed

3
EVENT example
  • At the games startup
  • onStart Event
  • If code for onStart is found, it is executed

4
EVENT
  • EVENT id_evento
  • Instruction
  • Instruction ..
  • End_EVENT
  • ? verify Developers Ref.

5
EVENT Example
  • EVENT onStart
  • Call PopMonster() My function make a
    monster to pop up in a random room
  • End_EVENT

6
EVENT example
  • A character gets looked at (clicked on)
  • The event person.onLook triggers
  • If existing, the event gets executed and stop.
  • Otherwise the generic event onLook triggers
  • If existing, the event gets executed.

7
Implicit parameters
  • OWNER who owns the event equals to this in
    Java
  • AGENT who started the action
  • TARGET third actor (sometimes used, mostly not)

8
EVENT Model person.onLook
AGENT
OWNER
9
onLook EVENT Example
  • SCRIPTS
  • EVENT guy.onLook
  • Speak OWNER,AGENT,So, whats up?"
  • END_SCRIPTS

10
Speak
  • Speak speaker,destination, phrase , phrase
  • speaker
  • Defaults to OWNER
  • destination
  • Defaults to AGENT
  • If there are many phrases, they are printed in
    cycle

11
Speak from this
  • SCRIPTS
  • EVENT guy.onLook
  • Speak OWNER,AGENT,So, whats up?
  • END_SCRIPTS

12
to this (compact form)
  • SCRIPTS
  • EVENT guy.onLook
  • Speak So, whats up?
  • END_SCRIPTS

13
Pre-defined values
  • SYS (System voice)
  • Use as speaker when needed
  • WORLD (All connected players)
  • Use as destination

14
onLook EVENT Example
  • SCRIPTS
  • EVENT guy.onLook
  • Speak SYS,WORLD,Player AGENT looks
    OWNER
  • END_SCRIPTS

15
Object Model di CHARACTERS
  • Use the dot . to refer to an objects property
  • Person.name Name of the person
  • Person.container Where person is (room object)
  • Person.container.id (rooms ID)
  • Person.container.name (rooms name)

16
Print
  • Print dest, What , what
  • Print In this room theres some light
  • Print OWNER OWNER AGENT AGENT
    TARGET TARGET

17
Assignment remember a value
  • Birthday July 26th
  • Print Birthday
  • July 26th

18
If .. Else
  • If (condition)
  • Istructions
  • Else
  • Istructions
  • End_If
  • No THEN
  • End_If and not End If

19
RndInt(N)
  • Returns a random nunmber from 1 a N

20
If .. Else
  • If RndInt(2) 1
  • Print ODD!
  • Else
  • Print EVEN!
  • End_If

21
EVENT Model person.onHear
TARGET
AGENT
OWNER
22
Printing implicit parameters
  • Print OWNER OWNER AGENT AGENT
    TARGET TARGET

23
Inspecting the log
  • System folder
  • File name is debug.log
  • number of slot you used
  • Note If it is missing then edit setting debugTo
    in the worldnav.properties file

24
Echoing speech
  • EVENT person.onHear
  • Speak OWNER,AGENT,You said TARGET ,
    what do you mean?
  • END_EVENT

25
EVENT Model room.onLoose
AGENT
TARGET
OWNER
26
EVENT Model person.onExit
OWNER
AGENT
TARGET
27
EVENT Model person.onEnter
OWNER
AGENT
TARGET
28
EVENT Model room.onReceive
AGENT (?)
TARGET
OWNER
29
Navigating Developers Reference
  • How DimensioneX works
  • Configuration
  • Design-time part (DXW)
  • Run-Time part (SmallBasic)
  • Objects Object Model
  • System (built-in) Events
  • Available Functions
  • Available Istructions

30
Array
arrGreets
1
2
3
4
ciao
hola
hi
hello
31
Array RndInt(N)
  • arrGreets NewSet(ciao,hola,hello)
  • Speak arrGreets(RndInt(3))
  • Ciao
  • Hello
  • Ciao
  • Hola

32
SET
33
For Each Next
  • For Each var In set
  • Instructions
  • Next
  • Careful! To set and arrays

34
For Each Next SET
  • Print present characters
  • For Each x In getCharactersIn(WORLD)
  • Print x.name
  • Next

35
Summary
  • Events
  • Language elements
  • Flow control constructs
  • Implicit parameters
  • Movement EVENTs
  • Navigating documentation
  • Array and SETs
Write a Comment
User Comments (0)
About PowerShow.com