Profil de Windows Live Ag...Windows Live AgentsPhotosBlogListes Outils Aide

Blog


30 juin

It's all about context!

 

 

  Today we're going to talk a bit about contexts and what wonderful things you can do with them.

Well, maybe not "Wall-E opening sequence" wonderful, but they sure come in handy to control what your agent is doing in an easy and trouble-free way. With the help of contexts you can separate clearly your routines according to any condition, without having to worry about micro-managing their scores or doing systematic checks.

We're going to take a closer look at a few different uses and related buddyscript features, from the very simple to... the wee bit advanced. Tomorrow we'll explore another use for them, and discuss public variables and performance issues.

 

Here is how, for example, you could make sure that only users on MSN get access to the activity window features:

 

 

context MSN_Only {out-of-context="0" in-context="100" condition="SYS.User.Service eq \"MSN\""}

// out-of-context: score adjustment for the queries inside the context that don't verify the condition (here,   0 = no match)

// in-context    : score adjustment for the queries inside the context that do verify the condition    (here, 100 = no adjustment)

 

start context MSN_Only

 

? Start the activity.

  - Sending you an invitation...

 

end context MSN_Only

 

 

 An interesting thing to note is that you don't have to end the context at the end of our file. If you were to start the context in a package, then every domain including this package, directly or indirectly, would be within that context and abide by its rules. So here you could have all domains related to Activity Window include this package, and be protected automatically.

  You could apply this principle to restrict certain features or queries based on any condition, like age, country, market, number of visits or what the user's high-score is at your quizz game.

 

You can also restrict access to the agent even though it's launched and live on Messenger, while it's in development or beta phase:

 

 

// This table lists the screennames of authorized users

// Using "exact" as an index method will help make searches more performant

datatable AuthorizedUsers

  load ScreenName {index="exact"} from

    mememe@hotmail.com

    uberbetatester@live.com

    popaandmoma@live.com

    mygloriousboss@live.com

 

function UserIsAuthorized()

  if ShellMode() // Shellmode() returns true if we're in the SDK

    return true

  SN = get ScreenName in AuthorizedUsers where ScreenName is SYS.User.ScreenName

    // Found the screename: access granted!

    return true

  return false

 

// Here the in-context is set to 1000 to make sure that any other routine is overruled.

context Unauthorized {out-of-context="0" in-context="1000" condition="!UserIsAuthorized()"}

 

start context Unauthorized

 

+ =AnythingStrong

  - Sorry, I'm in closed beta phase and can't talk to you yet. No peeping!

 

// Within a context, regular matching still happens as they're all subject to the same adjustment.

? But I am a Very Important Person!

  - The Boss said: no exceptions.

 

end context Unauthorized

 

 

 

  Another use, very similar in implementation, is to restrict certain debug or testing queries to a set of super-users, listed this time in a text file. The textfile-based table is easier to maintain independently from the code, and can be changed without having to restart the agent: all you need is to set an expire date for the file to be reloaded.

 

 

datatable SuperUsers {expire="in one day"}

  // The list will be timed out and reloaded once a day from the file.

  load ScreenName {index="exact"} from file

    superusers.txt

 

function IsSuperUser()

  if ShellMode()

    return true

  SN = get ScreenName in SuperUsers where ScreenName is SYS.User.ScreenName

    return true

  return false

 

context RestrictedStrings {out-of-context="0" in-context="100" condition="IsSuperUser()"}

 

start context RestrictedStrings

 

// This topic is only accessible to the right people:

+ debug all variables

  - As you wish.

  dbg_display STORED_USER_VARIABLES

 

 

That’s it for today. See you tomorrow for another round of goodies!

 

Commentaires (5)

Veuillez patienter...
Le commentaire entré est trop long. Raccourcissez-le.
Vous n'avez rien entré. Réessayez.
Il est actuellement impossible d'ajouter votre commentaire. Réessayez plus tard.
Pour ajouter un commentaire, tu dois avoir l'autorisation de tes parents. Demander l'autorisation
Tes parents ont désactivé les commentaires.
Il est actuellement impossible de supprimer votre commentaire. Réessayez plus tard.
Vous avez dépassé le nombre maximal de commentaires qu'il est possible d'envoyer le même jour. Réessayez dans 24 heures.
Votre compte a pu laisser les commentaires désactivés parce que nos systèmes indiquent que vous risquez d'arroser d'autres utilisateurs de messages. Si vous pensez que votre compte a été désactivé par erreur, contactez l'assistance en ligne de Windows Live.
Effectuez la vérification de sécurité ci-dessous pour finaliser l'envoi de votre commentaire.
Les caractères entrés pour la vérification de sécurité doivent correspondre à ceux de l'image ou du fichier audio.

Pour ajouter un commentaire, connectez-vous avec votre identifiant Windows Live ID (si vous utilisez Messenger ou Xbox LIVE, vous avez un identifiant Windows Live ID). Connectez-vous


Vous n'avez pas d'identifiant Windows Live ID ? Inscrivez-vous

Aucun noma écrit :
gateway SQU-203 400VTX 450XL series laptop battery Packard Bell Easynote F5280 Laptop Battery MYBAT9528 (CBI1010A) laptop battery Battery For Bell BP-8089 BP-8089X BP-8389 BP-8089P laptop battery laptop battery for mitac 8080p laptop battery battery for MTA8170-1166 8100 8170 8170A 8175 laptop battery MITAC 8375 8575 8575A 8575P LAPTOP BATTERY black laptop battery nec pc-vp-wp44 op-570-75901 laptop battery battery for NEC PC-VP-WP22 OP-570-75303 75301 laptop battery Battery For Nec Versa E400 Mitac 8677 4CGR18650A2-MSL laptop battery LAPTOP BATTERY SONY VAIO VGP-BPS2 VGP-BPS2B VGP-BPS2A black laptop battery 7.2ah LAPTOP BATTERY SONY VAIO VGP-BPS2 VGP-BPS2B VGP-BPS2A black laptop battery Original SONY pcga-bp2e vgp-bp2ea pcg-gr100 Battery laptop battery laptop battery for PA2457UR PA2458UR laptop battery Laptop Battery PA2487UR PA2487U for Toshiba 4000 1800 laptop battery new battery fits Toshiba Portege 7000 7020 PA2506UR laptop battery Battery For Toshiba PA3285U PA3284U A10 A15 E10 E15 F10 laptop battery New BATTERY For TOSHIBA 5000 5100 PA3123U PA3178U laptop battery Battery For Toshiba Portege M200 M205 PA3128U PA3191U black laptop battery Battery for Toshiba Satellite 1100 1110 PA3209U-1BRS laptop battery Battery for Toshiba PA3399U-1BRS PA3399U-2BAS 1BAS laptop battery Toshiba PA3356U-3BAS PA3356U-3BRS PA3456U-1BRS Battery laptop battery toshiba pa3420u-1brs l10 l15 l20 laptop battery TOSHIBA PA3451U-1BRS PABAS067 laptop battery Battery For PA3383 TOSHIBA Satellite PA3383U-1BRS 12cells laptop battery TOSHIBA SATELLITE M65 BATTERY PA3431U-BRS PABAS068 laptop battery clevo m540 laptop battery
27 Nov.
19 Oct.
Aucun noma écrit :

Hi,Do you need digital signages, advertising displays, digital sign, advertisement displays and advertising players? Please go Here:www.amberdigital.com.hk(Amberdigital).we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

amberdigital Contact Us

website:www.amberdigital.com.hk
alibaba:amberdigital.en.alibaba.com[cbggheeggfeccd]

18 Oct.
Aucun noma écrit :

Amberdigital Branch,Southern Stars Enterprises Co is specializing in the development and manufacturing of mp4 advertisement players, SD card players and advertisement LCD displays. Established in 1996, we have explored and developed the international market with professionalism. We have built a widespread marketing network, and set up a capable management team dedicated to provide beyond-expectation services to our customers.

amberdigital Contact Us
Southern Stars Enterprises Co (Hong Kong Office)
Add:3 Fl, No.2, Lane 2, Kam Tsin Tsuen, Sheung Shui, Hong Kong
Tel:+852 2681 4099
Fax:+852 2681 4586

Southern Stars Enterprises Co (Shenzhen Office)
Add:DE, 16/F, Building 2, Nanguo Tower, Sungang Road, Shenzhen, China
Tel:+86 755 2592 9100
Fax:+86 755 2592 7171

E-mail:sstar@netvigator.com
website:www.amberdigital.com.hk
alibaba:amberdigital.en.alibaba.com[dccciaahfhceib]

28 Août
Rhysa écrit :
I used theese now smater child dosen't talk to me
6 Juil.

Rétroliens

L'URL de rétrolien de ce billet est :
http://windowsliveagents.spaces.live.com/blog/cns!5BCD45E519E07634!691.trak
Blogs Web qui font référence à ce billet
  • Aucune