Difference between revisions of "RecursiveDialog"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '{{LSL_Function |func=recursiveDialog |mode=user |p1_type=key|p1_name=agent|p1_desc=key of the agent |p2_type=string|p2_name=message|p2_desc=message to be displayed |p3_type=list|...')
 
m (<lsl> tag to <source>)
 
Line 8: Line 8:
|func_desc=Allows for a list longer than 12 elements to be displayed.  
|func_desc=Allows for a list longer than 12 elements to be displayed.  
|func_footnote=The elements are reversed when put into the dialog.
|func_footnote=The elements are reversed when put into the dialog.
|spec=<lsl>
|spec=<source lang="lsl2">
//Created by Spoof Kelberry
//Created by Spoof Kelberry
recursiveDialog(key avatar, string message, list buttons, integer channel){  
recursiveDialog(key avatar, string message, list buttons, integer channel){  
Line 17: Line 17:
     } if(a) llDialog(avatar,message,llList2List(buttons,j,j+a),channel);
     } if(a) llDialog(avatar,message,llList2List(buttons,j,j+a),channel);
}
}
</lsl>
</source>
|examples=<lsl>
|examples=<source lang="lsl2">
//Created by Spoof Kelberry
//Created by Spoof Kelberry
recursiveDialog(key avatar, string message, list buttons, integer channel){  
recursiveDialog(key avatar, string message, list buttons, integer channel){  
Line 35: Line 35:
}
}


</lsl>
</source>
|helpers
|helpers
|notes
|notes

Latest revision as of 15:33, 22 January 2015

Summary

Function: recursiveDialog( key agent, string message, list buttons, integer channel );

Allows for a list longer than 12 elements to be displayed.

• key agent key of the agent
• string message message to be displayed
• list buttons button labels
• integer channel channel the dialog's response will be handled on

The elements are reversed when put into the dialog.

Specification

//Created by Spoof Kelberry
recursiveDialog(key avatar, string message, list buttons, integer channel){ 
    integer a = llGetListLength(buttons)%12; integer i;
    integer c = llFloor(llGetListLength(buttons)/12)+1; integer q; integer j; 
    for(i = 0; i < c-1; i++){ list w; 
        w = llList2List(buttons,j,j+11); j += 12; llDialog(avatar,message,w,channel); 
    } if(a) llDialog(avatar,message,llList2List(buttons,j,j+a),channel);
}

Examples

//Created by Spoof Kelberry
recursiveDialog(key avatar, string message, list buttons, integer channel){ 
    integer a = llGetListLength(buttons)%12; integer i;
    integer c = llFloor(llGetListLength(buttons)/12)+1; integer q; integer j; 
    for(i = 0; i < c-1; i++){ list w; 
        w = llList2List(buttons,j,j+11); j += 12; llDialog(avatar,message,w,channel); 
    } if(a) llDialog(avatar,message,llList2List(buttons,j,j+a),channel);
}
default
{
    state_entry()
    {
        recursiveDialog(llGetOwner(),"Hello!",["This","list","is","greater","than","12","elements","but","it","will","create","another","dialog."],-1);
    }
}