SQL scripting

hallmat

LOMCN Veteran
Veteran
Feb 19, 2007
555
2
105
ok i have tryed my hand at SQL scriptig but cant seem to get the Variables correct
well i think its at the variables im having trouble

anyway here is script

Code:
[@main]
#IF
#ACT
ReadValueSql  "TBL_character"  %A9  "FLD_Level" [@nextline]
[@nextline()]
#ACT
    Mov    D1      %ARG(2)    
 
goto @nextline2
[@nextlive2]
#say
<$output(A3)> is now level <$output(d1)>



basicly what i want is a NPC that will output what a person's level is at any given time its as a part of a Quest the rest of the quest is fine but that part is giving me errors or just returning 0

may thanks
 

Geordiehc

Mad Dog Geo
VIP
Jul 4, 2007
2,827
49
175
Redditch, UK
I still think it would be much easier to do

#IF
Checklevel
#ACT
MOV D0
#SAY
<$USERNAME> is now level <OUTPUT(D0)>

It is a much less complicated way of doing it imo.
 
Upvote 0

chimera

LOMCN VIP
VIP
Jul 30, 2003
1,054
23
215
UK
you are asking the script to remember something and call it D0 but there is nothing there...

#ACT
Mov D0 7

calls D0 7

-----------------------

#IF
checklevel 5

would check the usernames level is 5 or more, if it's not you could
#SAY
not high enough level

If you are really wanting an accurate and exact level output then the best way is to write a readsql suscript to be honest.

If you're still stuck let me know but I know you know how to do this :)
 
Upvote 0

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,401
36
275
Germany
at first, ohhhh my god ... ^^

ok hallmat, test this ;-)

Code:
[@main]
#ACT
  FormatStr "FLD_CHARACTER='%s'"  %USERNAME
  ReadValueSql  "TBL_character"  %A9  "FLD_Level" [@nextline]

[@nextline()]
#ACT
  Mov  P1  %ARG(1)    
#SAY
  <$output(USERNAME)> is now level <$output(P1)>

%A9 "FLD_Level" [@nextline]
you have ONE and call ARG(2) then you get nothing
or a Error ^^ ARG mean the SQLRecord you get and in this you have One and not two so you must call ARG with (1)
if you use more like "FLD_Level, FLD_OTHER" then you get level with ARG(1) and Other with ARG(2).

You see I have restructure your Code a bit and fill it with all the needed Infos so you can made a NPC and put it in and test it so.


/Coly
 
Upvote 0

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,401
36
275
Germany
Yes it is wrong ^^, with Checklevel you can check if the User Level > or <
like this :

#IF
CheckLevel 40
#SAY
OK your level is 40 or higher

or

#IF
!CheckLevel 40
#SAY
OK your level is 40 or lower
 
Upvote 0

Geordiehc

Mad Dog Geo
VIP
Jul 4, 2007
2,827
49
175
Redditch, UK
Yes it is wrong ^^, with Checklevel you can check if the User Level > or <
like this :

#IF
CheckLevel 40
#SAY
OK your level is 40 or higher

or

#IF
!CheckLevel 40
#SAY
OK your level is 40 or lower
Yeah i knew this but i thought it worked with level as well as i'm sure it works with similar thing but oh well least i know now :)
 
Upvote 0

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,401
36
275
Germany
other I everytime see is all made it so :

Code:
[@blub]
[COLOR="Red"]#IF[/COLOR]  <-- ?? don't put it on the first if you don't use it
#ACT
 ....

In my Time with Mir3 I have write many Scripts and some very special ^^ like my Quest System (some know) and more. So I believe I have a littel
bit Knowlage in Mir3 Scripting ;-)
I can say the most Scripts I have see, have so many Lines, very unreadable with not using good Function Names and no use of the very strong Mir3 Scripting things to made it fast, good and with a hand full Lines and not 1000000 Lines.

I have done ^^
 
Upvote 0

BlackT

Dedicated Member
Dedicated Member
Sep 20, 2006
91
10
34
So I believe I have a littel
bit Knowlage in Mir3 Scripting ;-)

Sorry for offtopic, but I suppose I won't get any answer by PM :)
So I ask Coly here: you said you can access other DB than Game3G. Is this available in SQL like:

SELECT field1 FROM Account.Table WHERE ....

even if you're connected to Game3G DB? I know this is possible in other SQL engines if connected user has granted privileges on more DBs.

Vielen Dank!
 
Upvote 0

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,401
36
275
Germany
[Offtopic]
Yes I have read your PM but no Idea how you need it and you have ask for Wil / Wix and not for SQL things...
[/Offtopic]

I can you see yes it is possible to access all DBs you love or need ^^ but not only with Mir3 script, for this you need many more and very good Knowlage in MS-SQL DB-Coding (Stored Procedures and Trigger and so one)
If you know all then you need to understand the Mir3 Script system fully to find a way to work with the SP and Trigger... Normaly I don't give info over my Server Internal things but I can you say : Yes I use all I have write here long time and it work for my Strong Quest System. The most Code for my Quest System is Codet direct in MS-SQL SPs.

Vielen Dank! <--
Question : you come from Germany ?
 
Upvote 0

BlackT

Dedicated Member
Dedicated Member
Sep 20, 2006
91
10
34
Thanks for sharing the idea of SP, triggers, etc, it sounds interesting :)
Just I'm not sure how much load is on SQL server and if it's safe to use so much SQL for quests.


PS: remember "Poseidon"? We played together (with BlackMoon, Jesterhead, Alex C., etc) on Illu :)
 
Upvote 0

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,401
36
275
Germany
lol Poseidon, ok ^^ I know the wizard from Illu ;-) so you know the Quest system or have it see and play with it.

SPs is designed for Massive Ask to the DB or better say you Call the function in the DB and it work direct in the DB, it is faster and you can make more.
Using SPs for Quest need some Ideas and is a bit tricky to have more then one Quest Check. ahmm atm I blieve I have 512 Quests Checks in the DB and on one I can hold 9 Stats so I can made massive long Quest like the Sintist Quest with over 6 NPCs.
 
Upvote 0