Jump to content
  • 0

getguildname bug (?)


Angeluz

Question


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  102
  • Reputation:   16
  • Joined:  07/28/12
  • Last Seen:  

Hi, I have the following problem with the getguildname command, at the moment that no member has connected after a reload I get return parameter null

	mes "Guild name "+getguildname(22)+".";
	set .@nb, query_sql("select name from guild where guild_id = 22 limit 1",.@guild_name$);
	if ( .@nb == 0 ) {
		mes "No existe.";
		Close;
	}
	mes "Guild Name "+.@guild_name$+".";
	close;

Image DB

image.png.74b9640b055926a20fc64cefab10a5a9.png

Image script

image.png.fc7d44687197c4b07db0fd6af21ac72e.png

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

here's normal [ r16311 ]

prontera,155,191,5	script	teste22	112,{
	mes "guild name: "+getguildname(getcharid(2))+"";
	mes "guild name: "+getguildname(1)+"";
	close;
}

 

@Edit:
I did another test and the result was abnormal!

https://streamable.com/6czh9

Edited by Hyroshima
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

using the npc script right after create a new guild? 

if yes, then its probably because the server havent obtained the information yet

you can try use the *requestguildinfo(...) to fix/update the info of the newly created guild.

*requestguildinfo <guild id>{,"<event label>"};

This command requests the guild data from the char server and merrily continues
with the execution. Whenever the guild information becomes available (which
happens instantly if the guild information is already in memory, or later, if it
isn't and the map server has to wait for the char server to reply) it will run
the specified event as in a 'donpcevent' call.

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  102
  • Reputation:   16
  • Joined:  07/28/12
  • Last Seen:  

It also doesn't work with the requestguildinfo command

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

-	script	sample	-1,{
	
	OnInit:
		// sleep 2000;
		
		.guild_id = 1;
		
		debugmes("====== OnInit (ID = "+.guild_id+") =========");
		debugmes("Guild Name = " + getguildname(.guild_id));
		.@size = query_sql("SELECT name FROM `guild` WHERE `guild_id` = "+.guild_id+" LIMIT 1", .@guild_name$);
		debugmes("Guild Name (SQL) = " + .@guild_name$);
		requestguildinfo .guild_id, strnpcinfo(3)+"::OnRequestInfo";
		end;
		
	OnRequestInfo:
		debugmes("====== OnRequestInfo =========");
		debugmes("Guild Name = " + getguildname(.guild_id));
		.@size = query_sql("SELECT name FROM `guild` WHERE `guild_id` = "+.guild_id+" LIMIT 1", .@guild_name$);
		debugmes("Guild Name (SQL) = " + .@guild_name$);
		end;
}

Output:

[Info]: consolemes: ====== OnInit (ID = 1) =========
[Info]: consolemes: Guild Name = null                <--- It failed
[Info]: consolemes: Guild Name (SQL) = Sleepywood
[Info]: consolemes:
====== OnRequestInfo =========
[Info]: consolemes: Guild Name = Sleepywood          <--- Now it worked.
[Info]: consolemes: Guild Name (SQL) = Sleepywood

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...