Mark v W


I am starting to lose my mind here! I am developing my first third-party game for the Windows Live Messenger and I can't seem to get the example scripts to work.

This is wat my XML looks like:
< xml version="1.0" >
<Entry>
  <EntryID>7</EntryID>
  <Error />
  <Locale>en-us</Locale>
  <Kids>1</Kids>
  <Page>1</Page>
  <Category>50</Category>
  <Sequence>10</Sequence>
  <Name><my game name></Name>
  <Description><my description></Description>
  <URL><working link></URL>
  <IconURL />
  <Type>Dir</Type>
  <Height>500</Height>
  <Width>500</Width>
  <Location>side</Location>
  <MinUsers>2</MinUsers>
  <MaxUsers>2</MaxUsers>
  <PassportSiteID>1</PassportSiteID>
  <EnableIP>true</EnableIP>
  <ActiveX>true</ActiveX>
  <SendFile>False</SendFile>
  <SendIM>False</SendIM>
  <ReceiveIM>False</ReceiveIM>
  <ReplaceIM>False</ReplaceIM>
  <Windows>true</Windows>
  <MaxPacketRate>120</MaxPacketRate>
  <UserProperties>true</UserProperties> 
  <ClientVersion>6.0</ClientVersion>
  <AppType>1</AppType> 
  <Hidden>false</Hidden>
</Entry>

This example script I am trying to get to work:
<HTML>
    <HEAD>
     <TITLE>Game</TITLE>
  
  <script type="text/javascript">
  <!--
  if (window.external.users.inviter === window.external.users.me) {
  // I invited another user to this conversation.
  document.write("I am the Inviter.");
  }
  else {
  // I am the user who accepted the invitation.
  document.write("I am not the Inviter.");
  }
  //-->
  </script>
    </HEAD>
    <BODY>

    </BODY>
</HTML>

What happends
REMOTE USER:
I am not the Inviter.

LOCAL USER:
I am not the Inviter.

Can someone please tell me why this script ain't working, it's comming straight from the documentation.
Or does someone has a working example of some sort so I can see if that script without adjustments works on my computer

Thanks in advance,
Mark





Re: User Collection

J-Thread


I think you need the right case. Alhough this example is in the docs, it is wrong. It should be:
if (window.external.Users.Inviter === window.external.Users.Me) {
// I invited another user to this conversation.
document.write("I am the Inviter.");
}
else {
// I am the user who accepted the invitation.
document.write("I am not the Inviter.");
}





Re: User Collection

Mark v W

Thanks a lot for replying appreciate the effort. Though even with the captions it's still not showing me the right result, both of the players are not the inviter. Is the example working for you





Re: User Collection

J-Thread

Yes it is working here... So I don't know what could be the problem...



Re: User Collection

Mark v W

Somehow the code below works like a charm, this is really strange! The above code displays both being not the inviter but the code below shows the name of the inviter perfectly. If I invite it shows my name, if my buddy invites it shows his. I still don't get why the above doesn't work, could you please be so kind to copy the exact code you are using including the HTML tags so I can copy and paste and see what it does here

Thanks in Advance,

Mark

--------------------------------------------------------------------

<HTML>
<HEAD>
<TITLE>My First Game</TITLE>

<script type="text/javascript">
var Users = window.external.Users;

for (i=0; i < Users.Count; i++) {
document.write("User Item " + i);

if (Users.Item(i) == Users.Me) {
document.write(" [me] ");
document.write(Users.Me.Name);
} else {
document.write(Users.Item(i).Name);
}

document.write("<br>");
}

document.write(Users.Inviter.Name);
</script>

</HEAD>
<BODY>

</BODY>
</HTML>






Re: User Collection

Mark v W

Allright now everything seems to be working, don't know what the difference is but this seems to be working, so the admin can close this thread if he/she likes. Problem solved.

<script type="text/javascript">
var Users = window.external.Users;

for (i=0; i < Users.Count; i++) {
document.write("User Item " + i);

if (Users.Item(i) == Users.Me) {
document.write(" [me] ");
document.write(Users.Me.Name);
} else {
document.write(Users.Item(i).Name);
}

document.write("<br>");
}

document.write(Users.Inviter.Name);
document.write("<br>");

if (Users.Inviter == Users.Me) {
document.write("YOU ARE THE INVITER! WOOHOO!");
} else {
document.write("YOU ARE NOT THE INVITER!");
}
</script>






Re: User Collection

Mark v W

Allright I found the core to my problem if I put the following in a function that is being called by an OnLoad function. So for example <BODY ONLOAD="DisplayNames()">
   function DisplayNames() {
    var Users = window.external.Users;
    
    for (i=0; i < Users.Count; i++) {
     document.write("User Item " + i);
     
     if (Users.Item(i) == Users.Me) {
      document.write(" [me] ");
      document.write(Users.Me.Name);
     } else {
      document.write(Users.Item(i).Name);
     }
     
     document.write("<br>");
    }
   }


It finds an access denied error at Users.Item(i).

If I put it out of the onload it works perfectly.