![]() |
strlen + #e
well im having a little scriptproblem
what i want is for it to take each letter of a string one by one, but i dont think im doing it quite right NPC Code: i guess thats where ive narrowed it to not working, because it wont take it piece by piece. |
lets say this.word2 = hello
Your script will set the string accordingly this.word2 = h this.word2 = e this.word2 = l this.word2 = l this.word2 = o if you want it as a list you will have to use addstring example NPC Code: |
Either PD has your answer, or you need to be more descriptive of your problem. Becouse the rest looks right.
|
ok i missed exactily what my point was, so far it is working right with the way you suggested to fix it, but it broke up all the parts and made a list with commas like
h,e,l,l,o but i fixed it thanks for your help :) |
setstring tword,Blahblah;
for (i=0;i<strlen(#s(tword));i++) { setstring tword2,#s(tword2)#e(i,1,#s(tword)); } gives you tword=Blahblah tword2=BlahblahB I dont know why it puts the B on thend, musta buggered up somewheres. |
Quote:
|
Quote:
|
Quote:
|
setstring tword2,;
setstring tword,Blahblah; for (i=0;i<strlen(#s(tword));i++) { setstring tword2,#s(tword2)#e(i,1,#s(tword)); } Still gives BlahblahB, dunno why. |
Quote:
|
Quote:
"setstring tword2,;" That is "unsetting" a string.. You cant assume stuff like that, ye know? |
Quote:
|
Quote:
|
Quote:
Ok... nor does that explain why the B is on the END of your string... OH, wait, did you use the debugger to view the string, or did you press F4 and look at the flag list? If you used F4, it might have re-parsed through the script and did what I said at the beginning. That would explain the B at the end rather than the beginning. Yeah, I just tested out that theory. That's exactly what it seems to be doing. Obviously a bug, as it shouldn't be going inside of a loop when it sets initial strings. Well, it's a bit awkward that it would even set strings before entering the level anyway... |
Quote:
|
Quote:
Fine, make a level.. a NPC: if (timeout||playerenters) { this.msg=123456; unset this.msg; timeout=0.05; message #v(this.msg); } Try that. |
Quote:
|
setstring this.word,Blah;
unset this.word; message #s(this.word); Will still message Blah. |
Quote:
if you do setstring clientr.test,hi; and you open the attributes, the string is shown in the flags section therefore it can be unset. If you still dont believe me, try this, its a weapon called Test: NPC Code: just say "set" "say" you'll see the npc say hi then say "unset" "say" the npc will then say nothing b/c this.test is no longer there |
Quote:
NPC Code: Use unset flag name in that case, not with variables or strings :P |
Quote:
|
geez lame people.
find another thread. this one has already been answered. and to delete a string use setring NPC Code: |
All times are GMT +2. The time now is 06:48 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.