Jump to content
  • 0

question about scripts


Question

Posted

is there a script that allow me to connect to database so that i can select all data i need then display it on the npc??

 

thanks

 

---

im planning to make a npc that use @slaveclone then slaveclone all existing characters on the database

5 answers to this question

Recommended Posts

Posted

thanks for the fast reply, but what is the use of the next variables after the sql query??



here is my code, but when i clicked my npc it wont talk haha

 

 

    set .@nb, query_sql("SELECT `name`, `account_id` FROM `char` ORDER BY `account_id` ASC LIMIT 5", .@name$, .@account_id);
    mes "[Character List]";
    for(set .@i,1; .@i <= .@nb; set .@i,.@i+1){
        mes .@i+". "+.@name$[0]+" ("+.@account_id[0]+")";
    }
Posted

The first value start at index 0 to index ( .@nb - 1 ) in yours variables so you need

for(set .@i,0; .@i < .@nb; set .@i,.@i+1){
	mes (.@i+1)+". "+.@name$[.@i]+" ("+.@account_id[.@i]+")";
}
Posted

A menu to select one name?

for(set .@i,0; .@i < .@nb; set .@i,.@i+1){
	mes (.@i+1)+". "+.@name$[.@i]+" ("+.@account_id[.@i]+")";
	.@menu$ = .@menu$ + "+.@name$[.@i]+" ("+.@account_id[.@i]+"):";
}
.@s = select( .@menu$ ) -1;

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...