Pulling info from sql and displaying on npc

smoochy boys on tour

Sammy

Dedicated Member
Dedicated Member
Sep 9, 2007
66
1
54
how can i say pull numbers from a db in my sql and display it on an npc
for instance if i wanted to show users how much Silver they had

i made that up btw lol i not gonna use silver on me server :P

thanks in advance :)
 

chimera

LOMCN VIP
VIP
Jul 30, 2003
1,054
23
235
UK
Here is an example:

#IF
#ACT
mov a8 %USERNAME
mov D4 1
formatstr "FLD_CHARACTER='%s' AND FLD_TYPE='%s'" %A8 %D4
ReadValueSql "TBL_ITEM" %A9 "FLD_DESC3" [@luckvalue]
#ELSEACT
sysmsg "read fail"
break

[@luckvalue()]
#ACT
mov D6 %ARG(1)
goto @say
break

[@say]
#say
luck is <$output(d6)>
break
 
Upvote 0

Sammy

Dedicated Member
Dedicated Member
Sep 9, 2007
66
1
54
ok ive used that code but it only ever returns 0 :S only things i have changed are the bits below in the read value line

ReadValueSql "TBL_CHARACTER" %A9 "FLD_LEVELBONUS" [@luckvalue]

i dont see were i gone wrong :S my code is almost exactly same as yours m8
 
Upvote 0

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
sammy, if thats what you changed, keep an eye on the arg values you are pulling aswell, i believe you have to use arg(2)
 
Upvote 0

Sammy

Dedicated Member
Dedicated Member
Sep 9, 2007
66
1
54
Erm just outta interest were does it say which DB it is pulling info from :S

NVM got my answer from infliks tutorial post :)
 
Last edited:
Upvote 0