Halp

Seems simple enough but I’m not sure why it’s not working correctly, should I use addstring, replacestring instead…?
Basically there are 3 slots that each display at a certain position, when the player says “me”, slot1’s text changes).

// slot text
setstring slot1,Block1 Created.;
setstring slot2,Block2 Created.;
setstring slot3,Block3 Created.;
 
// slot position
if(playerenters) {
 showtext 677,20,20,Verdana,b,#s(slot1);
 showtext 678,20,23,Verdana,b,#s(slot2);
 showtext 679,20,26,Verdana,b,#s(slot3);
}
 
if(playerchats && strequals(#c,me)) {
 setstring slot1,Block4 Created.;
}

oh and I figured slots = arrays, but this seemed easier to do.

I think replace string is what you want

strtofloat(#s(slot1))

Nap tried that earlier, stupid showtext displays the whole thing as a string.

yeah…

Oh. I didn’t even read your post. The chat won’t change if it’s not on a timeout.

I’m not sure what you mean by that?

…waiting to be spooon fed.

He means wrap your show text in a loop.

Here’s the fix :stuck_out_tongue:

// slot text
setstring slot1,Block1 Created.;
setstring slot2,Block2 Created.;
setstring slot3,Block3 Created.;

// slot position
if(playerenters) {
 showtext 677,20,20,Verdana,b,#s(slot1);
 showtext 678,20,23,Verdana,b,#s(slot2);
 showtext 679,20,26,Verdana,b,#s(slot3);
}

if(playerchats && strequals(#c,/createblock1)) {
 setstring slot1,Block4 Created.;
 showtext 677,20,20,Verdana,b,#s(slot1); // again
}

edit: actually I might need the loop so I can keep track of the slots filled.

I don’t get it. You completely disregarded the advice and came up with a hackish product.

What I meant was this

if (created || playerenters) {
  if (!int) {
    set int;
    setstring slot1,Block1 Created.;
    setstring slot2,Block2 Created.;
    setstring slot3,Block3 Created.;
  }
  timeout = 0.05;
}

if (playerchats && strequals(#c,me)) setstring slot1,Block4 Created.;

if (timeout) {
  showtext 677,20,20,Verdana,b,#s(slot1);
  showtext 678,20,23,Verdana,b,#s(slot2);
  showtext 679,20,26,Verdana,b,#s(slot3);
  timeout = 0.05;
}

I initially tried wrapping it in a loop as you said (I’m not sure if you saw what I did before), but then I figured that just adding the showtext again would force the text to change so I went with that. :slight_smile: