Difference between revisions of "User:Free Portal/Sandbox/LSL Library/Simple Group Invite"

From Second Life Wiki
Jump to navigation Jump to search
Line 26: Line 26:
== Rules ==
== Rules ==
<div style="padding: 0.5em">
<div style="padding: 0.5em">
별다른 라이센스는 없으나 어디에 사용하셔도 좋치만 스크립트를 담아가시거나 다른곳에 게시하거나 공개할때는 출처를 반듯이 명시 해주시기 바랍니다.
별다른 라이센스는 없으나 어디에 사용하셔도 좋치만 스크립트를 담아가시거나 다른곳에 게시하거나 공개할때는 출처를 반드시 명시 해주시기 바랍니다.
</div></div>
</div></div>


<div id="box">
<div id="box">
== Script Source ==
== Script Source ==
<div style="padding: 0.5em 0.5em 1.5em">
<div style="padding: 0.5em 0.5em 1.5em">

Revision as of 16:13, 13 November 2013

Simple Group Invite

간단한 그룹 초대 스크립트

주요 기능

오브젝터를 터치하면, 오브젝트에 설정되어 있는 그룹의 링크를 읽어서 채팅 로그에 출력을합니다.그리고 메뉴가 뜨는데요. 메뉴에는 그룹 가입 방법이 잘 설명되어 있습니다. 아울러 메뉴에는 2가지 버튼이 있습니다.

  1. 버튼은 오브젝트의 인벤토리안에 있는 모든 랜드마크를 주는 기능
  2. 버튼에는 홈페이지를 뛰워주는 기능.

사용 방법은 간단합니다. 오브젝트 생성하고, 컨텐츠 탭에서 새 스크립트를 클릭한후에 새로 생성된 스크립터의 내용을 아래의 소스를 복사해서 붙혀 넣기 하면됩니다.

*주의: 반드시 오브젝트의 그룹을 초대 하고 싶은 그룹으로 설정을 하셔야 합니다. 간혹 보면 이걸 잘못 설정해둬서 엄하게 남의 그룹 그룹원을 늘려주는 분이 있으시더군요.

Rules

별다른 라이센스는 없으나 어디에 사용하셔도 좋치만 스크립트를 담아가시거나 다른곳에 게시하거나 공개할때는 출처를 반드시 명시 해주시기 바랍니다.

Script Source

<lsl> // Simple group invite // @author Free Portal

// ------------------------------------------------------------------------ // Global Variables: // ------------------------------------------------------------------------ integer channelDialog; integer listenID;

// ------------------------------------------------------------------------ // Constants: // ------------------------------------------------------------------------ list MAINMENU = ["Landmark", "Website"]; // edit menu name here string TITLE_MSG = "Touch to Join\nour Group"; string MENU_MSG =" 통신창을 (Ctrl+H) 열어서 그룹 링크를 클릭하시고 JOIN 버튼을 눌러주세요.

Click the link from Chat History (Ctrl+H) and then click on JOIN button!";

// ------------------------------------------------------------------------ // User Defined Functions // ------------------------------------------------------------------------

// ------------------------------------------------------------------------ // giveUrl // ------------------------------------------------------------------------ // @param: // key id // // @comment: // give to url // ------------------------------------------------------------------------ giveUrl (key id) {

   // edit here
   llLoadURL(id, "My WebSite", "http://www.aaa.com");

}

// ------------------------------------------------------------------------ // giveLandMark // ------------------------------------------------------------------------ // @param: // key id // // @comment: // give to landmark // ------------------------------------------------------------------------ giveLandMark (key id) {

   integer itemNum = llGetInventoryNumber(INVENTORY_LANDMARK);
   while (itemNum)
       llGiveInventory(id, (llGetInventoryName(INVENTORY_LANDMARK,
           itemNum = ~-itemNum)));   

}

// ------------------------------------------------------------------------ // inviteGroup // ------------------------------------------------------------------------ // @param: // key id // // @comment: // invite to Group // ------------------------------------------------------------------------ inviteGroup (key id) {

   key groupID = llList2Key (llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
      
   if (groupID == NULL_KEY) {
       llInstantMessage(id, "Set the Group for this object");
   }
   else {
       llInstantMessage(id, "Pleas click the link! secondlife:///app/group/"
           + (string)groupID + "/about");
   }
  
   llSetTimerEvent(10.0);

}

// ------------------------------------------------------------------------ // menuList // ------------------------------------------------------------------------ // @param: // key id // string message // // @comment: // read menu index from menu list // ------------------------------------------------------------------------ menuList (key id, string message) {

   integer index = llListFindList(MAINMENU, [message]);
  
   if (index != -1) {
       if (index == 0) {               // menu index 0
           giveLandMark (id);
       }
       else if (index == 1) {          // menu index 1
           giveUrl (id);
       }
   }
      

}

// ------------------------------------------------------------------------ // Main Script // ------------------------------------------------------------------------ default {

   state_entry() {
       llSetText(TITLE_MSG, <1,1,1>, 1.0);
   }
   touch_start(integer total_number) {
       integer touchNum = 0;
       for (touchNum = 0; touchNum <= total_number-1; touchNum++) {
           channelDialog = (-1 * (integer)("0x" +
               llGetSubString((string)llDetectedKey(touchNum), -5, -1)));
           llDialog(llDetectedKey(touchNum), MENU_MSG, MAINMENU,
               channelDialog);
           listenID = llListen( channelDialog, "", llDetectedKey(touchNum),
               "");
           inviteGroup (llDetectedKey(touchNum));
       }
   }
  
   timer () {
       llListenRemove(listenID);
       llSetTimerEvent(0);
   }
  
   listen(integer channel, string name, key id, string message) {
       menuList (id, message);
       llListenRemove(listenID);
   }

} </lsl>