Slight bit of help please

Join Discord

gandy

Dedicated Member
Dedicated Member
May 13, 2003
94
0
102
Hey all just messing about with a couple of NPC ideas and i have it working fine i just want it layed out differently...

Basically what i have is a table in SQL which looks a bit like:

|Name|a|b|c|d|e|f|g|h|i|j|k|

Now, when the player clicks the NPC the name is added to the database and columns A-K are filled with a default value of 0.

At certain points after doing certain things it will update a certain column to 1

i have all this working fine but what i want is to open another NPC, checks which colums have a 1 and display a link, if they have a 0 they wont show. This is pretty much the script i wrote for it.....
Code:
#ACT
FormatStr "FLD_NAME='%s'" %A0
ReadValueSql  "TBL_Test"  %A9 "a,b,c,d,er" [@TCheck1]

[@TCheck1()]
#IF
#ACT
mov D1 %ARG(1)
mov D2 %ARG(2)
mov D3 %ARG(3)
mov D4 %ARG(4)
mov D5 %ARG(5)
goto @TMenu1

[@TMenu1]
#IF
EQUAL D1 "1"
#SAY
Column A is Activated\
#IF
EQUAL D2 "1"
#SAY
Column B is Activated\
#IF
EQUAL D3 "1"
#SAY
Column C is Activated\
#IF
EQUAL D4 "1"
#SAY
Column D is Activated\
#IF
EQUAL D5 "1"
#SAY
Column E is Activated\
Now this works fine but you can only use so many %ARG(X) for each link. I sorted it by putting a Page2 and loading the rest of the values that way (which erases the 1st values). I dont really like it this way though as on page 1 there could only be 1 link activated. Is there anyway i could have them all showing on 1 page. I can VNC the script from my comp if you dont understand.

I guess i could Re-Write it all using Flags instead of SQL but id prefer not to as this gives you less control.

Thanks!
 
Last edited:

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
how does flags give you less controls, in your case flags do the same exact thing as your SQL script, except its much simpler to use. thats why flags were created so you didnt have to use this :)

but anyways... your first page of values shouldnt be erased. remember you got 99 D variables to use.. just pick new D variables for your 2nd page of queries.. or just do something like this....

Code:
#ACT
FormatStr "FLD_NAME='%s'" %A0
ReadValueSql  "TBL_Test"  %A9 "a,b,c,d,er" [@TCheck1]

[@TCheck1()]
#IF
#ACT
mov D1 %ARG(1)
mov D2 %ARG(2)
mov D3 %ARG(3)
mov D4 %ARG(4)
mov D5 %ARG(5)
goto @query2

[@query2]
#ACT
FormatStr "FLD_NAME='%s'" %A0
ReadValueSql  "TBL_Test"  %A9 "f,g,h,i,j" [@TCheck2]

[@TCheck2()]
mov D5 %ARG(1)
mov D6 %ARG(2)
mov D7 %ARG(3)
mov D8 %ARG(4)
mov D9 %ARG(5)
goto @TMenu1

[@TMenu1]
#IF
EQUAL D1 "1"
#SAY
Column A is Activated\
#IF
EQUAL D2 "1"
#SAY
Column B is Activated\
#IF
EQUAL D3 "1"
#SAY
Column C is Activated\
#IF
EQUAL D4 "1"
#SAY
Column D is Activated\
#IF
EQUAL D5 "1"
#SAY
Column E is Activated\
#IF
EQUAL D6 "1"
#SAY
Column F is Activated\
#IF
EQUAL D7 "1"
#SAY
Column G is Activated\
#IF
EQUAL D8 "1"
#SAY
Column H is Activated\
#IF
EQUAL D9 "1"
#SAY
Column I is Activated\

etc...
 
Last edited:
Upvote 0

gandy

Dedicated Member
Dedicated Member
May 13, 2003
94
0
102
Its easier to manually edit an SQL Table than messing about with flags, also i dont know how or where flags are stored so i cant edit them without a player being ingame and using the changeflag command.

I didnt know you could do your code like you have illustrated....

What i did was when i got the the second page stored the new Values in D1,2,3,4,5 again overwriting the first values. I assumed you could only use values u have stored in the previous check.

Will give it a try in a bit, Thanks.
 
Upvote 0

Geordiehc

Mad Dog Geo
VIP
Jul 4, 2007
2,827
49
195
Redditch, UK
Again surely temp flags is all you need if you only need a value from 0-1

#IF
CHECK [700] 1
#SAY
Column A is activated

#IF
CHECK [701] 1
#SAY
Column B is activated etc

Without knowing what your reasons are for making them i might be wrong but cant see why you couldnt use them even if you needed to reset them

#ACT
SET [700] 0
 
Upvote 0

gandy

Dedicated Member
Dedicated Member
May 13, 2003
94
0
102
Yes, in hindsight it would of been easier to use flags. Sorted now i think anyway. I never really liked using flags for some reason, even when i messed about with Mir2 and you had to use them.

I guess i just like seeing the table infront of me so i dont have to mess about with @CheckFlag ingame.

Thanks for your help both of you.
 
Upvote 0

Inflikted

LOMCN Veteran
Veteran
Aug 4, 2003
256
7
114
np :) i find it best to use flags for individual quests/etc..
if i need to make some sort of grp event or guild script.. then its better to use SQL.
 
Upvote 0