Jump to content
  • 0

position title


Question

Posted (edited)

Using SQL entries I instead of numbers appearing in-game I would like the value 0 appear as apple, 1 appear as grapes, 2 appear as watermelon etc etc.

mes "[ " +.@position[.@a]+" ]");     <<< This will appear as a number in-game from the guild position table. How to attach a word to the corresponding number.
mes " ";
close;
}
Edited by Isaiah

8 answers to this question

Recommended Posts

Posted (edited)


.@guild_id = 100;

setarray .@name_list$,

"Apple",

"Orange",

"Watermelon",

"Banana",

"Strawberry";

.@name_list_size = getarraysize( .@name_list$ );

query_sql( "SELECT `name`,`position` FROM `guild_member` WHERE `guild_id` = "+.@guild_id+" ORDER BY `position` LIMIT "+.@name_list_size,.@name$,.@position );

.@name_size = getarraysize( .@name$ );

mes "["+getguildname( .@guild_id )+"]";

for( .@i = 0; .@i < .@name_size; .@i++ )

mes .@name$[.@i]+" | "+.@name_list$[ .@position[.@i] ];

close;

Edited by Emistry
  • Upvote 1
Posted

Why not use an if-else/switch statement instead of attaching them as a permanent variable?

 

if(.@position[.@] == 0) mes "Apple";
else if...

 

But anyways, to answer your question though, use $ as the prefix. You can find the variables stored in mapreg table

 

set $fruit$[0],"Apple";

 

Kindly correct if i have stated something wrong or misunderstood your question..

Posted
query_sql( "SELECT `name`,`guild_id`,`position` FROM `guild_member` where guild_id = 100 LIMIT 5",.@Name$,.@gid,.@position );
mes "[ Fruit Clan ]";
mes " ";
for( set .@a,0; .@a < getarraysize(.@name$); set .@a,.@a + 1)
if(.@position[.@] == 0) mes "Apple";
else if(.@position[.@] == 1) mes "Orange";
mes " "+.@name$[.@a]+ " | " +.@position[.@a]+" | ";
mes " ";
close;
}

@sandbox It doesn't appear to work.

Posted

@sandbox

 

It still doesn't show the member's position as "apple"

 

It now looks something like

 

[Fruit Clan]

 

apple

Name | 0 |   // 0 meaning guildmaster.

Posted (edited)

@Emistry

 

Thanks for the quick response. I didn't get any errors on the console although the npc is only showing the guild name of ID 100. And nothing else.

Edited by Isaiah
Posted

@Emistry

 

Thanks for the quick response. I didn't get any errors on the console although the npc is only showing the guild name of ID 100. And nothing else.

.@name_list_size = getarraysize( .@name_list$ );

refer above script...updated

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...