Planet Samuro (France)
Messages
Guest_35859
Planet Samuro (France)
 
Messages
3D Chat
Mini-Chat

Message Panels : Aide Technique : script pour changer la texture d'un vĂȘtement
<<<First<<prev.>next.>>>Last>RepReply^Discussion ^vDiscussion vDelDelete the discussion
SamuroSamuro28/09Sent: 28/09/2024 21:00:541 / 1Message 1 from 1

// script pour changer la texture d'un vĂȘtement
// clothes texture changing script

void set (string texture)
{
  set_mesh_texture (mesh_nr => 1, texture => texture);
}


void set_texture_nr (int text_nr)
{
  string(32) name = "";
  int nr = 0;

  for (;;)
  {
    name = item_name (name);

    if (name == "")
      break;

    if (item_type (name) == "TEX")
    {
      if (text_nr == nr)
      {
        set (name);

        if (is_worn ())
          save_data_to_inventory (index => "textur", value => itos(nr));

        break;
      }
      nr++;
    }
  }
}



event touch ()
{
  key k = touched_avatar();
  string(32) name = "";
  int nr = 0;
  string(1024) s;

  if (!same_key (k, object_owner()))
    return;

  s = "";

  for (;;)
  {
    name = item_name (name);

    if (name == "")
      break;

    if (item_type (name) == "TEX")
    {
      if (s > "")
        s = s + ",";
      s = s + name + ":" + itos(nr++);
    }
  }

  display_menu (k, s);
}

event menu_selected (key avatar, int menu_id)
{
  set_texture_nr (menu_id);
}


event start()
{
  if (is_worn())
    load_data_from_inventory (index => "textur");
}


event inventory_data_arrived (string index, string value)
{
  if (value == "")
    set_texture_nr (0);
  else
    set_texture_nr (stoi(value));
}



<<<First<<prev.>next.>>>Last>RepReply^Discussion ^vDiscussion vDelDelete the discussion