Rent type system I suppose.

Just messed around with this. It’s only a test thing really and I haven’t fully gone through it so it probably has fuckups in it.

I seen some post about a rent system or something and beholder made one, but I decided I would make one and kind of made it work like a class.

As I said before it’s not finished.

The main room handler thing

// NPC made by Chicken_l33t
if (created || playerenters) {
  setshape 1,32,32;
  save[0] = 5;
  setstring save[1],Chicken,test,lol;
  setstring save[2],Chicken,zomg,roflcopters;
}

if (actiontest){
  for (a = 0; a < sarraylen(save[1]); a++){
    if (strequals(#p(1),#I(save[#p(2)],a))){
      if (strequals(#p(3),add)){
        addstring save[#p(2)],#p(4);
        setplayerprop #c,#p(4) has been added to permitted list.;
      }

      if (strequals(#p(3),remove)){
        removestring save[#p(2)],#p(4);
        setplayerprop #c,#p(4) has been removed to permitted list.;
      }

      if (strequals(#p(3),touch)){
        setplayerprop #c,You may enter sir;
      }
      if (strequals(#p(3),check)){
        setplayerprop #c,Current permitted: #s(save[#p(2)]);
      }
      return;
    } else {
      setplayerprop #c,Sorry you're not permitted to do this!;
    }
  }
}
// NPC made by Chicken_l33t

if (playerenters || created){
  setshape 1,32,32;
  this.room = 1;
  save[1] = this.room;
}

if (playertouchsme) {
  for (i = 0; i < npcscount; i++){
    if (npcs[i].save[0] == 5){
      triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),touch;
    }
  }
}

if (playerchats){
  if (strequals(#c,/room#v(this.room)check)){
    for (i = 0; i < npcscount; i++){
      if (npcs[i].save[0] == 5){
        triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),check;
      }
    }
  }

  if (startswith(/room#v(this.room)add,#c)){
    for (i = 0; i < npcscount; i++){
      if (npcs[i].save[0] == 5){
        triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),add,#e(10,35,#c);
      }
    }
  }

  if (startswith(/room#v(this.room)remove,#c)){
    for (i = 0; i < npcscount; i++){
      if (npcs[i].save[0] == 5){
        triggeraction npcs[i].x,npcs[i].y,test,#v(npcs[0].id),#a,#v(this.room),remove,#e(12,35,#c);
      }
    }
  }

}

if (actiontest2){
  message Response from: #p(0);
}

To add new room/doors to rooms just change this.room = 1; to this.room = 2; to in a new NPC and if you go beyond that make sure to add a new string list in the main NPC.

and again it’s just a test NPC.

For the setting of a new level i’ll be using something like setlevel2 x,y,room#p(whateveritwasiforgot).nw

setstring save[1],Chicken,test,lol;
setstring save[2],Chicken,zomg,roflcopters;

Saves don’t work that way! D:

really? they seem to work fine offline and online tbh, but oh well! XD oh fuck haha… integer values. I never actually noticed that XD

Well they do work, but they’re not real save[]'s, they’re just strings named “save[#]” on the client, just so you know. lol

XD. I’ve used save[]'s before a lot in the past, but never with strings at all and I imagine that’s because I knew that they didn’t work like that. It’s been a few years since I have scripted so I’m pretty much going by all memory and sometimes glancing at commands.rtf so that’s probably how the mistake occurred.

Anyways was there anything else you can point out to fix? like that? I know there’s a few grammar problems from when I copied and pasted some stuff lol.

Nah, its fine, though technically you could use callnpc index,params; Same thing as doing a triggeraction on that x & y

Oh, right. I’ve never actually used call NPC XD might give it a go in the future. Thanks for the input.