Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Getting Error and don't know what it means

Getting Error and don't know what it means

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ptrayal   (10 posts)  Bio
Date Mon 21 Nov 2011 03:17 PM (UTC)
Message
Hello:
I'm getting this error:
Run-time error
Plugin: Generic_GUI (called from world: Project Twilight)
Function/Sub: OnPluginTelnetSubnegotiation called by Plugin Generic_GUI
Reason: Executing plugin Generic_GUI sub OnPluginTelnetSubnegotiation
[string "Plugin"]:879: attempt to concatenate field 'GEN' (a nil value)
stack traceback:
[string "Plugin"]:879: in function 'draw_score'
[string "Plugin"]:1230: in function <[string "Plugin"]:1169>
Error context in script:
875 : y_offset = y_offset + 22
876 : -- text_line = 'Level '..msdp["LEVEL"]..' '..msdp["RACE"]..' '..msdp["CLAN"]
877 : text_line = msdp["CLAN"]
878 : if msdp["RACE"] == "Vampire" then
879*: outlined_text (colourGold, score_window, msdp["GEN"]..'th '..msdp["CLAN"]..'', 10, 5, y_offset, score_width)
880 : else
881 : outlined_text (colourGold, score_window, msdp["RACE"]..' ('..msdp["CLAN"]..')', 10, 5, y_offset, score_width)
882 : end -- if
883 :

And I can figure out it is saying that GEN is nil, but that cannot be the case. The code is:
MSDPSetNumber( d, eMSDP_GEN, d->character->gen );
and when I look at the pfile, it is saying it's 8th. So, I'm a bit confused. Can anyone help?
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #1 on Mon 21 Nov 2011 06:00 PM (UTC)

Amended on Mon 21 Nov 2011 06:01 PM (UTC) by Fiendish

Message
I don't know what any of this means:
Quote:
MSDPSetNumber( d, eMSDP_GEN, d->character->gen );
and when I look at the pfile, it is saying it's 8th.

But your error message means that msdp["GEN"] is nil. "Cannot be the case" is obviously wrong.

Quote:
outlined_text
Hey, that looks familiar. :D

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Ptrayal   (10 posts)  Bio
Date Reply #2 on Mon 21 Nov 2011 06:16 PM (UTC)
Message
OK, but I know it's wrong because it is giving me the correct number when I do a normal score, just not through MUSHclient.
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #3 on Mon 21 Nov 2011 06:29 PM (UTC)

Amended on Mon 21 Nov 2011 06:35 PM (UTC) by Fiendish

Message
Ptrayal said:
OK, but I know it's wrong because...

No. The code interpreter is not lying to you. It is not saying "I think maybe msdp["GEN"] is nil". It is saying "at this point in the code the memory address referenced by msdp["GEN"] is nil!" So listen to the interpreter and then try to figure out why.

Quote:
it is giving me the correct number when I do

Don't use words like "it" without describing what "it" is. "it" doesn't mean anything to anyone else.

Quote:
do a normal score
Again, this is not a meaningful phrase to people who are not you. Describe what "do a normal score" entails.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Ptrayal   (10 posts)  Bio
Date Reply #4 on Mon 21 Nov 2011 06:44 PM (UTC)
Message
OK, you are right. When I run the do_score command, it also calls the gen with this:
if(IS_VAMPIRE(ch))
{
sprintf(buf, " Generation: %d", ch->gen);
send_to_char(buf, user);
}

Now, when I parse it to MSDP, it get's parsed like this:
MSDPSetNumber( d, eMSDP_GEN, d->character->gen );

Just like I've done all the others. However, this one isn't working for MSDP. So, I know there is a variable assigned to it because when I do my score function, I get the correct number.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #5 on Mon 21 Nov 2011 07:24 PM (UTC)
Message
How about some debugging? Change:


if msdp["RACE"] == "Vampire" then
  outlined_text (colourGold, score_window, msdp["GEN"]..'th '..msdp["CLAN"]..'', 10, 5, y_offset, score_width)
else


to:


if msdp["RACE"] == "Vampire" then

  -- debugging

  if msdp["GEN"] == nil then
    Note "Problem with GEN in script!"
    require "tprint"
    tprint (msdp)
  end -- if

  outlined_text (colourGold, score_window, msdp["GEN"]..'th '..msdp["CLAN"]..'', 10, 5, y_offset, score_width)
else

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ptrayal   (10 posts)  Bio
Date Reply #6 on Mon 21 Nov 2011 07:46 PM (UTC)
Message
Well, I'm very confused. I got this.

Problem with GEN in script!
Run-time error
Plugin: Generic_GUI (called from world: Project Twilight)
Function/Sub: OnPluginTelnetSubnegotiation called by Plugin Generic_GUI
Reason: Executing plugin Generic_GUI sub OnPluginTelnetSubnegotiation
C:\Mushclient\lua\tprint.lua:36: attempt to call global 'type' (a string value)
stack traceback:
C:\Mushclient\lua\tprint.lua:36: in function 'tprint'
[string "Plugin"]:885: in function 'draw_score'
[string "Plugin"]:1239: in function <[string "Plugin"]:1178>

I'm not sure why it would be giving me gen in my telnet score but not here. Thoughts?
Top

Posted by Fiendish   USA  (2,534 posts)  Bio   Global Moderator
Date Reply #7 on Mon 21 Nov 2011 08:11 PM (UTC)

Amended on Mon 21 Nov 2011 08:58 PM (UTC) by Fiendish

Message
Ptrayal said:

OK, you are right. When I run the do_score command, it also calls the gen with this:
if(IS_VAMPIRE(ch))
{
sprintf(buf, " Generation: %d", ch->gen);
send_to_char(buf, user);
}

Now, when I parse it to MSDP, it get's parsed like this:
MSDPSetNumber( d, eMSDP_GEN, d->character->gen );

I don't know what or where "do_score" is. You're talking about these things as if I'm sitting there looking over your shoulder, but I'm not. In any case it seems clear to me that ch->gen and d->character->gen are not even remotely the same thing as msdp["GEN"] as they are clearly different references in different codes. Just because you want them to ultimately have the same value in them doesn't make them related in any solid way.

I'm guessing you're working with both the server and client end on this? Make sure the raw value is being sent by the server. Make sure the raw value is being received by the client. Make sure the client is doing the right thing with the raw value. If it helps, you know where the client is saying that the value is nil. So start working backwards from there.

Quote:
So, I know there is a variable assigned to it because when I do my score function, I get the correct number.
No, you know there is a value assigned to something else in a different piece of code.

Quote:
attempt to call global 'type' (a string value)

This means that your script has overridden the type function with a string by creating a variable with the name "type" and assigning it a value. Just don't create a variable with the name "type".

The following BAD code will do the same thing:
type = "hello"
print(type(5))

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #8 on Mon 21 Nov 2011 10:23 PM (UTC)
Message
Agreed, don't do that.

Leave the "type" function to do its normal thing. Who knows what else is going wrong because of that?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


21,690 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.