ID:139623
 
proc
Say(ref, text, increment, delay=1)
for(var/i=1, i<=length(text), i+=increment)
ref<<copytext(text, i, i+increment)+"\..."
ref << sound('Talk Boy.wav')
sleep(delay)
ref<<""
var/Talking
mob
verb
Say(txt as text)
set hidden = 1
if(src.muted)
src << "<font color=blue>You have been muted!"
return
var/text
text = txt
if(Talking == 1)
alert("Wait until the previous message finishes!")
return
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>:"}
Talking = 1
Say(world,"[text]",1)
Talking = 0
return

When I use this verb, two things happen:
1. It does not display the message, only the person who is sending it.
2. It tells me to wait until the message finishes, yet it never started.

Why is it doing this?
I tried the same code in Legend Of Zelda RPG and it works perfectly, yet in Naruto Smash Bros. it doesn't work.

var/text=txt is pointless

I tested this snippet, which is essentially the same thing.
proc/say(ref,txt,seg,dly=1)
for(var/i=1,i<=length(txt),i+=seg)
ref<<copytext(txt,i,i+seg)+"\..."
sleep(dly)
ref<<""

client/verb/say(txt as text)
if(txt)
say(world,txt,1)

...and got the following errors...

runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
verb name: say (/client/verb/say)
usr: Spunky_Girl (/mob)
src: Spunky_Girl (/client)
call stack:
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
...
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say("lol")
In response to Spunky_Girl
Spunky_Girl wrote:
var/text=txt is pointless

I tested this snippet, which is essentially the same thing.
> proc/say(ref,txt,seg,dly=1)
> for(var/i=1,i<=length(txt),i+=seg)
> ref<<copytext(txt,i,i+seg)+"\..."
> sleep(dly)
> ref<<""
>
> client/verb/say(txt as text)
> if(txt)
> say(world,txt,1)
>

...and got the following errors...

runtime error: Maximum recursion level reached (perhaps there is an infinite loop)
To avoid this safety check, set world.loop_checks=0.
verb name: say (/client/verb/say)
usr: Spunky_Girl (/mob)
src: Spunky_Girl (/client)
call stack:
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
...
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say(, , 1)
Spunky_Girl (/client): say("lol")
Even though text=txt is useless in "most cases" doesn't mean in this case it is. When I don't have that it disconnects me or doesn't do anything at all.
That isn't the same thing anyways.
When you use the proc, you have to put:
Say(world,"[txt]",1)

not
Say(world,txt,1)

Because txt is text, which implies you should use quotes, which means if you want the message to actually display you use "[txt]" instead of txt.
Can you please use my snippet of code, not a similar one, to tell me what is wrong with the code that I have? I would rather have someone help me on an error of a string of code I provide, not a string of code "similar" to the one I provide. There is a big difference.
In response to Narutorox123456
Hahahaha, no. "[xyz]" is exactly the same as just xyz if xyz is just text. Spunky_Girl actually is showing you EXACTLY what the error is. Try reading the post more closely (HINT: IT'S WRITTEN NINETEEN TIMES).
In response to Garthor
Honestly, I don't know what those error lines mean exactly either :( I've never seen them before as a result of my own programming :\ I don't even know what the OP is trying to do, other than make a generic "say" proc I guess. I just made an equivalent program and ran it to see what happens. That's what I got.
In response to Garthor
Garthor wrote:
Hahahaha, no. "[xyz]" is exactly the same as just xyz if xyz is just text. Spunky_Girl actually is showing you EXACTLY what the error is. Try reading the post more closely (HINT: IT'S WRITTEN NINETEEN TIMES).

OBJECTION! I have an ace attorney game and it won't work for messages unless I use "" in it. Same applies to LozRPG. Think of it this way: you know src << "blahblah". putting src << blahblah would give you errors, correct? Same applies to this. When I do txt alone it gives me errors. When I do "[txt]", it doesn't. Also, the only reason he got those errors are because his string of code is completely different from mine. Why don't you read more closely?
In response to Spunky_Girl
Spunky_Girl wrote:
Honestly, I don't know what those error lines mean exactly either :( I've never seen them before as a result of my own programming :\ I don't even know what the OP is trying to do, other than make a generic "say" proc I guess. I just made an equivalent program and ran it to see what happens. That's what I got.

No. I am not making a generic say proc. I am making it so it types it up and shows one letter at a time. You will know what I mean by playing Phoenix Wright Ace Attorney or any Ace Attorney based game. Also, it isn't the same. You put
if(txt)
which implies it is checking if a message was inputted, which is not in my string of code. I'll ask again: Can you please use my string of code and tell me what is wrong with it? It doesn't require posting another string of code. Just give an example that makes sense. Not "Read this post". Something like, "You log in and you are src, let's call you 1. Now you get verbs. You login with a previous save file. You are now 2 and 1 is placed with a pile of junk and the verbs you get are gone."

It's hard for me to read a post irrelevant to a specific issue and understand it. Especially since I just turned 14 on october 15.
In response to Narutorox123456
Very funny.

The error is still exactly what I've already indicated. The error Spunky_Girl got was a bit more spectacular than the one you're having, due to some minor details, but it's still fundamentally the same error. I suggest you actually read what I've already written and think it over a bit.

Also: stop wasting time trying to prove how awesome and smart you are and how wrong everybody else is. I'd give you the answer directly if you didn't have such an obnoxious attitude.
In response to Narutorox123456
A raw text string is not the same as a variable/object reference.
"blahblahblah" //raw text string
blahblahblah //variable or object reference
//----------------

If a variable's value is a text string, you may pass that as an argument or pass the text string directly. It accomplishes the same thing.

EDIT
Oh, and as for the "if(txt)" line... It is a sanity check to see if the variable has a value, and if it does, call the proc. Just something that I do as a habit, and does not change how the programming fundamentally works.
1) Your text variable in mob/verb/Say() is absolutely pointless. Just keep and utilize the txt variable.

2) The reason why it only shows "User says:" is because you MADE it that way. Take a look at:
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>:"}

You're kind of missing some of your logical process there.

3) It's quite obvious you copy+pasted and/or do not understand the logical process of programming, let alone the capability of programming with DM.

You should make Talking a client variable, not a global variable.

Etc. etc. etc.
In response to Maximus_Alex2003
Still missing the actual issue here, but shhh. I want to see if he can figure this one out on his own.
In response to Maximus_Alex2003
Maximus_Alex2003 wrote:
1) Your text variable in mob/verb/Say() is absolutely pointless. Just keep and utilize the txt variable.

2) The reason why it only shows "User says:" is because you MADE it that way. Take a look at:
> world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>:"}
>

You're kind of missing some of your logical process there.

3) It's quite obvious you copy+pasted and/or do not understand the logical process of programming, let alone the capability of programming with DM.

You should make Talking a client variable, not a global variable.

Etc. etc. etc.

Please do not lie. I did not copy and paste that, for it is used to make an original game called "Naruto Smash Bros" being a side-scroller game with not only Naruto characters, but some other ones like Mario or Miles Edgeworth. Don't even dare try the "you do not know any programming because I just explained why something happened irrelevent to the error". It doesn't matter WHY it showed "[usr] says:" it matters why the proc I gave you has an error. Stupid Troll
In response to Narutorox123456
I want to end the shennanigans.

Your proc is resulting in an infinite loop, which means that your test is always true to your initial value. If it were working properly then your test would eventually return a false.

Look over your code, or spunky_Girls code for a better example, and find where the problem is. Go step by step in the way that dreamseeker would. You'll find the issue.

...besides that, it seems like the error message is telling you that the ref and txt are null.
In response to Bravo1
Bravo1 wrote:
I want to end the shennanigans.

Your proc is resulting in an infinite loop, which means that your test is always true to your initial value. If it were working properly then your test would eventually return a false.

Look over your code, or spunky_Girls code for a better example, and find where the problem is. Go step by step in the way that dreamseeker would. You'll find the issue.

...besides that, it seems like the error message is telling you that the ref and txt are null.

Okay. Thank you for actually telling me in plain words. Something Garthor couldn't do. Also I would rather look at my code, since spunky's code is nothing like what I want to have happening. And the error message is nothing with the ref or text. The errors I get are either being auto-disconnected or getting a message saying someone is already talking, which isn't the case. I think I have to check my world_loop_check. Again, thanks for doing what Garthor can't have enough patience or intelligence to do. (That is, problem solving.)
In response to Bravo1
Bravo1 wrote:
...besides that, it seems like the error message is telling you that the ref and txt are null.

Not important, actually. Just a minor side-effect of the error, and probably not very helpful (really it's actually somewhat confusing) in terms of debugging it.
Replace
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>:"}

With:
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>: [txt]"}

In response to Darker Legends
lmao! I totally overlooked that. Nice job, Spunky. xD
In response to Spunky_Girl
It actually has nothing to do with the problem.

People need to stop providing incorrect advice and just leave Numbername to figure it out for himself. It'll be good for him.
In response to Darker Legends
Darker Legends wrote:
Replace
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>:"}
>

With:
world << {"<font face="Comic Sans MS"><font color=blue>[src.name] says:<font color=green><b>: [txt]"}

That's not the issue here.
Hi,

Your Say verb and Say proc have the same name. This causes an infinite loop as BYOND is calling the verb instead of the proc. This also causes the alert message ("Wait until the previous message finishes"), because the verb recalls itself while "Talking" is set to 1. Rename your Say proc (or verb) and it should work.