DEV Community

Paul Preibisch
Paul Preibisch

Posted on • Originally published at b3dmultitech.com on

1 1

Metaverse Gaming scripts

Hi everyone! The word ‘Metaverse’ is hot again so I’d like to invite you along on a journey I am taking down memory lane by re-immersing myself as an Educational Tool developer in the virtual world of Second Life and Opensim. This blog post will serve as the first part of a series of posts about the tools I am using to get the job done.

So let’s jump in and get ourselves a good code editor so we can hack away at some juicy LSL scripts! We could actually just use Second Life’s in-world editor, however using it is quite painful. The text is small and hard to read, and there is on auto code completion!

For this task, I will download and install the Eclipse IDE and then install the LSL Forge plugin which will provide us the very handy code completion tool, so we won’t have to look up every LSL command

Once the LSLForge plugin is installed, your Metaverse Scripting experience will improve dramatically.

Here is what the editor looks like in comparison with the in-world editor displayed above:

Eclipse with LLSForge Plugin

Good job! Now, for fun, here is a script I created called valueKey.lslp. Second Life’s version of the array is called a “list”. This script will read through the list, and print it out as key value pairs. Being able to store and retrieve key’s and values is an essential part when creating scripts with a even a moderate bit of logic and complexity.

Here it is:

keyValuesToString(list keyValues)
{ 
    integer index=0; 
    list records = llList2ListStrided(keyValues,0,-1,2); 
    integer length = llGetListLength(records); 
    llSay(0,"Length of records is : "+(string)length); 
    integer stride=2; 
    while (index < length) { 
      list item = llList2List(keyValues,index+index,index*stride+1); 
      string param = llList2String(item, 0); 
      string value = llList2String(item, 1); 
      llSay(0,(string)index+": key:"+param+", value:"+value); index++; 
   } 
} 
default { 
  state_entry() 
  { 
     llSay(0,"-----"); 
     list paramList=["name","fire","email","fire@b3dmultitech.com"]; keyValuesToString(paramList); 
  } 
}
Enter fullscreen mode Exit fullscreen mode

Happy coding!

The post Metaverse Gaming scripts appeared first on Paul Preibisch.

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay