The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic 1v1 and SQL
Author Message
pinku
Journeyman
*

Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4



Post: #1
Automatic 1v1 and SQL
Hey everyone!

Code:
[function f_autotourney_1v1_timer]
    if (<more1> == 0)
        if (<more2> > 0)
            serv.b Reminder: Auto 1v1 beginning in <eval <more2> / 2> minutes, type .join for more details.
            //serv.b It will begin in <eval <more2> / 2> minutes
            more2 -= 1
        else
            serv.b Auto Tourney Attempting to Begin
            f_autotourney_1v1_begin
        endif
    elseif (<more1> == 1)
        SQLSELECT select charuid from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>'
        while (<SQLROWEOF> == 0) // Always check to make sure the clients are online
            obj = <SQLGETFIELD.0>
            if (<obj.isonline>)
                //Client Is Online
                //Ensure they are in the waiting area or are fighting.
                if (<obj.isevent.e_autotourney_wait>)
                    if (<obj.p.x> == 5385) && (<obj.p.y> == 1213)
                        //Client is in the right location, all is good
                    else
                        obj.f_1v1_disqualify 1
                    endif
                elseif (<obj.isevent.e_autotourney_fight>)
                    //Client Must be fighting, ensure they are in the arena.
                    if (StrMatch(*Pods,<obj.region.name>))
                        //All is good
                    else
                        obj.f_1v1_disqualify 4
                    endif
                else
                    obj.f_1v1_disqualify 3
                end
            else
                obj.f_1v1_disqualify 2
            endif
            SQLNEXTROW
        endwhile
        SQLSELECT select charuid from sphere_tourney where won='-1' AND num='<eval 0<var.autotourney.num>>'
        while (<SQLROWEOF> == 0) // Always check to make sure the clients are online and in pods
            obj = <SQLGETFIELD.0>
            if (<obj.isonline>)
                //if (<obj.isevent.e_autotourney_fight>)
                    if (StrMatch(*Pods,<obj.region.name>))
                        //All is good
                    else
                        obj.f_1v1_disqualify 4
                    endif
                //else
                //    obj.f_1v1_disqualify 5
                //endif
            else
                obj.f_1v1_disqualify 6
            endif
            SQLNEXTROW
        endwhile
                
        SQLSELECT select count(*) from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
        if (<SQLROWEOF> == 1)
            serv.b Database error.
        else
            local.count <SQLGETFIELD.0>
        endif
        if (<local.count> > 1)
            SQLSELECT select charuid from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>' ORDER BY Rand() LIMIT 2
            local.fight1 <SQLGETFIELD.0>
            SQLNEXTROW
            local.fight2 <SQLGETFIELD.0>
            serv.b <eval <local.count> /2> fights remaining in this round
            while (<SQLROWEOF> == 0)
                SQLNEXTROW
            endwhile
            obj = 0400300fe
            if (0<obj.tag.inuse> == 0)
                //Arena1 = 0400300fe
                //Slot1 = 5384 1215 1
                //Slot2 = 5397 1224 1
                obj.tag.inuse 1
                obj.more1 1
                obj.more2 10
                obj.timer 1
                obj.tag.fight1 <local.fight1>
                obj.tag.fight2 <local.fight2>
                obj = <local.fight1>
                obj.p = 5384 1215 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 1
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
                obj = <local.fight2>
                obj.p = 5397 1224 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 1
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
                timer 30
                return 1
            endif
            obj = 0400300ed
            if (0<obj.tag.inuse> == 0)
                //Arena2 = 0400300ed
                //Slot1 = 5399 1215 1
                //Slot2 = 5411 1224 1
                obj.tag.inuse 1
                obj.more1 1
                obj.more2 10
                obj.timer 1
                obj.tag.fight1 <local.fight1>
                obj.tag.fight2 <local.fight2>
                obj = <local.fight1>
                obj.p = 5399 1215 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 2
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                obj = <local.fight2>
                obj.p = 5411 1224 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 2
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                timer 30
                return 1
            endif
            obj = 0400300e9
            if (0<obj.tag.inuse> == 0)
                //Arena3 = 0400300e9
                //Slot1 = 5384 1228 1
                //Slot2 = 5397 1237 1
                obj.tag.inuse 1
                obj.more1 1
                obj.more2 10
                obj.timer 1
                obj.tag.fight1 <local.fight1>
                obj.tag.fight2 <local.fight2>
                obj = <local.fight1>
                obj.p = 5384 1228 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 3
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                obj = <local.fight2>
                obj.p = 5397 1237 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 3
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                timer 30
                return 1
            endif
            obj = 0400300d8
            if (0<obj.tag.inuse> == 0)
                //Arena4 = 0400300d8
                //Slot1 = 5399 1228 1
                //Slot2 = 5411 1237 1    
                obj.tag.inuse 1
                obj.more1 1
                obj.more2 10
                obj.timer 1
                obj.tag.fight1 <local.fight1>
                obj.tag.fight2 <local.fight2>
                obj = <local.fight1>
                obj.p = 5399 1228 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 4
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                obj = <local.fight2>
                obj.p = 5411 1237 1
                obj.update
                obj.stone 1
                obj.events -e_autotourney_wait
                obj.events +e_autotourney_fight
                obj.tag.autotourney.arena 4
                SQLREQUEST UPDATE sphere_tourney set won='-1' where charuid='<obj.uid>'
                timer 30
                return 1
            endif
        elseif (<local.count> == 1)
// 0400300fe
//0400300ed
//0400300e9
//0400300d8
            if (0<uid.0400300fe.tag.inuse> == 0) && (0<uid.0400300ed.tag.inuse> == 0) && (0<uid.0400300e9.tag.inuse> == 0) && (0<uid.0400300d8.tag.inuse> == 0)
                SQLSELECT select count(*) from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>+1>'
                if (<SQLROWEOF> == 1)
                    serv.b Database error.
                else
                    local.count2 <SQLGETFIELD.0>
                endif
                if (<local.count2> < 1)
                    //The one remaining client is the winner
                    SQLSELECT select charuid from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
                    obj = <SQLGETFIELD.0>
                    serv.b <obj.name> is the last one left in round <eval 0<var.autotourney.round>>. He is the winner!


                    if (<var.autotourney.round>==00)
                        obj.newitem i_treasure_food
                        obj.act.cont <obj.findlayer.21.uid>
                    endif

                    if (<var.autotourney.round>==01)
                        obj.newitem i_treasure_large_gold
                        obj.act.cont <obj.findlayer.21.uid>
                    endif

                    if (<var.autotourney.round>==02)
                            obj.newitem i_treasure_huge_gold
                            obj.act.cont <obj.findlayer.21.uid>
                    endif

                    if (<var.autotourney.round>==03)
                            obj.newitem i_treasure_huge_gold
                            obj.act.cont <obj.findlayer.21.uid>
                            obj.newitem i_treasure_killremove_small
                        obj.act.cont <obj.findlayer.21.uid>
                    endif

                    if (<var.autotourney.round> > 03_
                        obj.newitem i_treasure_huge_gold
                        obj.act.cont <obj.findlayer.21.uid>
                        obj.newitem i_treasure_killremove_large
                        obj.act.cont <obj.findlayer.21.uid>
                    endif



                    obj.newitem random_statue
                    obj.act.color colors_rare_all
                    obj.act.cont <obj.findlayer.21.uid>
                    obj.newitem i_tourny_ticket
                    obj.act.cont <obj.findlayer.21.uid>
                    obj.events -e_autotourney_wait
                    obj.tsendme 1    
                    var.autotourney
                    var.autotourney.started
                    more1 = 0
                    more2 = 0
                    timer = 60*60*3
                    return 1
                else
            
                    SQLSELECT select charuid from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
                    obj = <SQLGETFIELD.0>
                    serv.b <obj.name> is the last one left in round <eval 0<var.autotourney.round>>, and will be passing into round <eval 0<var.autotourney.round>+1>
                    SQLREQUEST UPDATE sphere_tourney set won=1 where charuid='<obj.uid>' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>'
                    SQLREQUEST INSERT INTO sphere_tourney (charname, charuid, won, round, num) VALUES('<obj.name>', '<obj.uid>', '0', '<eval 0<var.autotourney.round> + 1>', '<eval 0<var.autotourney.num>>')
                    timer 1
                    return 1
                endif
            else
                say Tourney Pods are in use.. waiting
            endif
        else
            SQLSELECT select count(*) from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>'
            //if (<SQLROWEOF> == 1)
            //    serv.b Database error.
            //else
            //    local.count2 <SQLGETFIELD.0>
            //endif
            //if (<local.count2>==0)
            //    serv.b No one is left in round <eval 0<var.autotourney.round>>. There is no winner!
            //    var.autotourney
            //    more1 = 0
            //    more2 = 0
            //    timer = 60*60*8
            //    return 1
            //endif
            if (0<uid.0400300fe.tag.inuse> == 0) && (0<uid.0400300ed.tag.inuse> == 0) && (0<uid.0400300e9.tag.inuse> == 0) && (0<uid.0400300d8.tag.inuse> == 0)
                timer 30
                var.autotourney.round <eval 0<var.autotourney.round>+1>
                serv.b End of Round <eval 0<var.autotourney.round>>, intermission will be <timer> seconds.
            else
                 say Tourney Pods are in use.. waiting
            endif


        endif
        
                
                
                
            
        //Arena1 = 04002db90
        //Slot1 = 5384 1215 1
        //Slot2 = 5397 1224 1
        //Arena2 = 04002db1b
        //Slot1 = 5399 1215 1
        //Slot2 = 5411 1224 1    
        //Arena3 = 04002dc82
        //Slot1 = 5384 1128 1
        //Slot2 = 5397 1237 1
        //Arena4 = 04002dc04
        //Slot1 = 5399 1228 1
        //Slot2 = 5411 1237 1    
        //say x
        //var.round 0
        //Intermission for first fight.
        //SQLSELECT select charuid from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>' AND round='<eval 0<var.autotourney.round>>' LIMIT 2
        //if (<SQLROWEOF> == 1)
        //    serv.b Database error.
        //else    
        //    local.char1 = <SQLGETFIELD.0>
        //    SQLNEXTROW
        //    if (<SQLROWEOF> == 1)
        //        local.char2 = 0 // Should never happen.
        //    else
        //        local.char2 = <SQLGETFIELD.0>
        //    endif
        //    
        //    serv.b Selected two random players to fight {<uid.<local.char1>.name>, <uid.<local.char2>.name> }
        //    more1 = 2
        //    while (<SQLROWEOF> == 0)
        //        SQLNEXTROW
        //    wend
        //endif
    endif
    serv.newitem i_gold
    new.p 5398, 1226, 1
    new.f_autotourney_1v1_checkforcorpses
    new.remove
    timer 30

[function f_autotourney_1v1_checkforcorpses]
foritems 50
    if (<type> == t_corpse)
        removefromview
//        p =  5275 1174
        attr = 08010
        cont = 04006bcd2
        timer = -1
    endif
endfor

[function f_autotourney_1v1_begin]
    var.autotourney.started 1
    SQLSELECT select count(*) from sphere_tourney where won='0' AND num='<eval 0<var.autotourney.num>>'
    if (<SQLROWEOF> == 1)
        serv.b Database error.
    else
        serv.b <SQLGETFIELD.0> Players currently in the tournament.
        while (<SQLROWEOF> == 0)
            SQLNEXTROW
        end while
        more1 = 1
        timer = 10
        serv.b Intermission for <timer> seconds until the first fight.
    endif
    serv.b Beta


[function f_join_1v1]


sysmessage Joining 1v1
dialog d_1v1_join

[dialog d_1v1_join]
300,300
src.dialogclose d_1v1_join
page 0
gumppic 0 0 2080
gumppic 18 37 2081
gumppic 18 107 2081
gumppic 18 177 2082
gumppic 18 247 2083
dtext 30 7 100 ColdfireUO Automated Tournement

dtext 30 7 100
dhtmlgump 30 55 240 100 1 0 You've been invited to a 1v1 tournement with the following rules, please click 'Okay' to accept.         (Blue means the options are enabled)
if (<var.autotourney.flags>&01)
    dtext 30 170 100 (o) Mage
else
    dtext 30 170 33 (x) Mage
endif
if (<var.autotourney.flags>&02)
    dtext 30 190 100 (o) Melee
else
    dtext 30 190 33 (x) Melee
endif
if (<var.autotourney.flags>&04)
    dtext 30 210 100 (o) Loot
else
    dtext 30 210 33 (x) Loot
endif
if (<var.autotourney.flags>&08)
    dtext 160 170 100 (o) No Fizzling
else
    dtext 160 170 33 (x) No Fizzling
endif
if (<var.autotourney.flags>&010)
    dtext 160 190 100 (o) No Healing
else
    dtext 160 190 33 (x) No Healing
endif
if (<var.autotourney.flags>&020)
    dtext 160 210 100 (o) Mounts
else
    dtext 160 210 33 (x) Mounts
endif

button 35 255 241 242 1 0 0
button 220 255 247 248 1 0 1


//dhtmlgump 20 60 500 200 0 0 You've been invited to a ColdfireUO 1v1 Automatic tournement. The rules are as follows <qval <var.autotourney.flags>&01 ? Mage:><qval <var.autotourney.flags>&02 ? Melee:><qval <var.autotourney.flags>&04 ? Loot:No Loot><qval <var.autotourney.flags>&08 ? No fizzling :><qval <var.autotourney.flags>&010 ? No Healing :><qval <var.autotourney.flags>&020 ? With Mounts :>

[dialog d_1v1_join button]
onbutton=0
sysmessage Canceled.
onbutton=1
f_autotourney_1v1_accept

[function f_autotourney_1v1_accept]
//    if !(<isgm>)
//        sysmessage Testing in progress, you cannot join.
//        return 1
//    endif

    if (<isevent.e_jail_control>)
        sysmessage You are jailed, no.
        return 1
    endif
    if (<isevent.e_autotourney_wait>)
        sysmessage You are already in the tournement
        return 1
    endif
    if (0<var.autotourney.started>)
        sysmessage The tourney has already begun
        return 1
    endif

    dispel_all
    if (<flags>&statf_dead)
        resurrect
    endif
    hits = <src.str>
    stam = <src.dex>
    mana = <src.int>
    serv.b <Name> has joined the tournement
    serv.log <Name> has joined the tournement
    events +e_autotourney_wait
    SQLREQUEST INSERT INTO sphere_tourney (charname, charuid, won, round, num) VALUES('<name>', '<uid>', '0', '0', '<eval 0<var.autotourney.num>>')
    if (<findlayer(25)>)
        if (<VAR.autotourney.flags>&020)
            tag.wasmounted = 1
            FLAGS &= ~statf_onhorse
        else
            tag.ride <findlayer(25).more2>
            dclick
            try uid.<tag.ride>.go 5306,1163
        endif
    endif
    p 5385 1213 1
    update
    tag.tourney 1
    tag.karma <karma>
    tag.fame <fame>
    tag.kills <kills>

[function f_autotourney_1v1_death]
        //Arena1 = 04002db90
        //Slot1 = 5384 1215 1
        //Slot2 = 5397 1224 1
        //Arena2 = 04002db1b
        //Slot1 = 5399 1215 1
        //Slot2 = 5411 1224 1    
        //Arena3 = 04002dc82
        //Slot1 = 5384 1128 1
        //Slot2 = 5397 1237 1
        //Arena4 = 04002dc04
        //Slot1 = 5399 1228 1
        //Slot2 = 5411 1237 1    
// 0400300fe
//0400300ed
//0400300e9
//0400300d8

doswitch <eval 0<tag.autotourney.arena>>
    serv.b Error
    obj =  0400300fe
    obj = 0400300ed
    obj = 0400300e9
    obj = 0400300d8
enddo
if (<isonline>)
    newitem i_res_timer
    act.morep <p>
    act.equip
    act.timer 0
else
    tag.logoutp 5380 1217 1
endif
if (<obj.tag.fight1> == <uid>)
    local.winner <obj.tag.fight2>
else
    local.winner <obj.tag.fight1>
endif
SERV.LOG winner = <local.winner> loser = <uid>

SQLREQUEST DELETE FROM sphere_tourney where charuid='<local.winner>' AND num='<eval 0<var.autotourney.num>>'

SQLREQUEST DELETE FROM sphere_tourney where charuid='<uid>' AND num='<eval 0<var.autotourney.num>>'

SQLREQUEST INSERT INTO sphere_tourney (charname, charuid, won, round, num) VALUES('<uid.<local.winner>.name>', '<local.winner>', '0', '<eval 0<var.autotourney.round> + 1>', '<eval 0<var.autotourney.num>>')
obj.tag.inuse
events -e_autotourney_fight
obj = <local.winner>
obj.events -e_autotourney_fight
obj.events +e_autotourney_wait
obj.p 5385 1213 1
obj.update

if (<var.autotourney.flags>&04)
newitem i_bag
act.color colors_blue
DROPALL <act.uid>
//for <eval <findlayer.21.rescount> - 1>
//    if !(<findlayer.21.findcont(<local._for>).attr>&04)
//        obj = <findlayer.21.findcont(<local._for>.uid>
//        obj.cont <act.uid>
//    endif
//endfor
for 24
    if (<local._for> == 11) || (<local._for> == 9) || (<local._for> == 15) || (<local._for> == 16) || (<local._for> == 21)
        //Do Nothing with this
    else
        if !(<findlayer(<local._for>).attr>&04)
            obj = <findlayer(<local._for>).uid>
            obj.removefromview
            obj.cont <act.uid>
        endif
    endif
endfor
obj = <local.winner>
act.name <name>'s remains from tourney <eval 0<var.autotourney.num>>
act.cont <obj.findlayer.29.uid>
endif

[itemdef i_res_timer]
ID=i_memory
TYPE=t_eq_script
name=tourney res timer

on @timer
cont.p <morep>
trysrc <cont.uid> cont.tsendme 1

if (<var.autotourney.round>==0)
    trysrc <cont.uid> cont.newitem i_treasure_food
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
endif

if (<var.autotourney.round>==1)
    trysrc <cont.uid> cont.newitem i_treasure_large_gold
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
endif

if (<var.autotourney.round>==2)
    trysrc <cont.uid> cont.newitem i_treasure_huge_gold
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
endif

if (<var.autotourney.round>==3)
    trysrc <cont.uid> cont.newitem i_treasure_huge_gold
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
    trysrc <cont.uid> cont.newitem i_treasure_killremove_small
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
endif

if (<var.autotourney.round> > 3)
    trysrc <cont.uid> cont.newitem i_treasure_huge_gold
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
    trysrc <cont.uid> cont.newitem i_treasure_killremove_large
    trysrc <cont.uid> cont.act.cont <cont.findlayer.21.uid>
endif

remove
return 1

[function f_autotourney_start_1v1]
    SQLREQUEST DELETE FROM sphere_tourney
    more2 = 12
    serv.b 1v1 has been selected as the auto tournement.
    serv.b type .join to see more information.
    //01 == Mage
    //02 == Melee
    var.autotourney 1
    var.autotourney.started
    local.rand = <eval rand(0,500)>
    //Choose Mage / Melee
    if (<local.rand> < 350)
        local.flags <local.flags>|03 //Mage / Melee
    elseif (<local.rand> < 425)
        local.flags <local.flags>|01 //Mage
    else
        local.flags <local.flags>|02 //Melee
    endif
    //loot
    //04 == Loot
    local.rand = <eval rand(0,500)>
    if (<local.rand> > 300)
        local.flags <local.flags>|04
    endif
    //No Fizzle
    //08 == No Fizzle
    local.rand = <eval rand(0,500)>
    if (<local.rand> > 450)
        local.flags <local.flags>|08
    endif
    //No Heal
    //010 == No Heal
    local.rand = <eval rand(0,500)>
    if (<local.rand> > 450)
        local.flags <local.flags>|010
    endif
    //Mounts
    //020 == Mounts allowed
    //local.rand = <eval rand(0,500)>
    //if (<local.rand> > 250)
    //    local.flags <local.flags>|020
    //endif
    //sysmessage <local.flags>
    var.autotourney.flags <local.flags>
    var.autotourney.round  0
    var.autotourney.num = <Eval 0<var.autotourney.num> + 1>
    SERV.LOG SQLREQUEST INSERT INTO sphere_tourney_options (num, flags) VALUES ('<eval 0<var.autotourney.num>>', '<var.autotourney.flags>')
    SQLREQUEST INSERT INTO sphere_tourney_options (num, flags) VALUES ('<eval 0<var.autotourney.num>>', '<var.autotourney.flags>')
    //serv.b Tournament Number: <eval 0<var.autotourney.num>>
    
[function f_1v1_disqualify]
if (<argn> == 1)
    local.reason contestant is waiting, but not in waiting area.
elseif (<argn> == 2)
    local.reason contestant is logged off
elseif (<argn> == 3)
    local.reason error, user is not waiting, nore fighting.
elseif (<argn> == 4)
    local.reason contestant has left pods
elseif (<argn> == 5)
    local.reason contestant is in fight queue but does not have fight event
elseif (<argn> == 6)
    local.reason contestant is offline during a fight.
else
    local.reason unknown reason
endif
if ((<argn> > 0) && (<argn> < 4))
    p = 5381 1220 1
    tag.logoutp 5381 1220 1
    update
    serv.log SQLREQUEST DELETE FROM sphere_tourney where charuid='<uid>'  AND num='<eval 0<var.autotourney.num>>'
    SQLREQUEST DELETE FROM sphere_tourney where charuid='<uid>'  AND num='<eval 0<var.autotourney.num>>'
elseif ((<argn> > 3) && (<argn> < 7))
    p = 5381 1220 1
    tag.logoutp 5381 1220 1
    f_autotourney_1v1_death 1
    //hits 0
    serv.log SQLREQUEST DELETE FROM sphere_tourney where charuid='<uid>'  AND num='<eval 0<var.autotourney.num>>'
    SQLREQUEST DELETE FROM sphere_tourney where charuid='<uid>'  AND num='<eval 0<var.autotourney.num>>'
endif
events -e_autotourney_wait
events -e_autotourney_fight
serv.b <name> is disqualified from the tournament <local.reason>
serv.log <name> is disqualified from the tournament <local.reason>

I got this automatic 1v1 from Coldfire's script pack and I'm having some trouble understanding some SQL terms that are on the script. Including: SQLROWEOF, SQLGETFIELD and SQLNEXTROW. The tables and everything else is fine.

When asking dagger4k (the uploader - thanks for your attention Big Grin), he said:

Quote:The thing is coldfire used a custom version of sphere 55rc3 ( i think this was the base version) to the point in which the owner added custom triggers and shortcuts that were hardcoded. Soooo I assume that these "SQLROWEOF, SQLGETFIELD and SQLNEXTROW" are some of those custom triggers.

And yes, I checked again and they are hardcoded.

Now, I know it's probably hard to figure out what the author did, but does anyone know ways to script around this or at least have guess?

Thanks everyone!
01-10-2014 05:13 PM
Find all posts by this user Like Post Quote this message in a reply
amonvangrell
Banned

Posts: 337
Likes Given: 17
Likes Received: 32 in 20 posts
Joined: Aug 2012

britannia shard

Post: #2
RE: Automatic 1v1 and SQL
omg was that sphere scp? O_O''
01-10-2014 07:50 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #3
RE: Automatic 1v1 and SQL
I dont read the whole script, but maybe its something like this
-SQLROWEOF: verify if the current row is the last row from the SQL result. Used inside WHILE, the script will loop through all SQL rows and stop when reach the last row
-SQLNEXTROW: goes to next row
-SQLGETFIELD: the same as <DB.ROW.n.something>
-SQLSELECT: the same as DB.SELECT

sphere 55rc3 doesnt have support for SQL, maybe thats why the script uses many weird SQL functions, the developer created all these functions itself. But you can rewrite all these SQL functions using sphere hardcoded SQL functions
(This post was last modified: 01-31-2014 02:50 AM by Coruja.)
01-31-2014 02:48 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)