Orbital Scoreboard
VPX Sample Integration
4min
vpx getting & posting high scores 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ' x x x x x x x x x x x x x x x x x x x x x x x '/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ \\/ ' orbital scoreboard code '\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\\ ' x x x x x x x x x x x x x x x x x x x x x x x 	' 	' post scores 	' 	dim osbtemp\ osbtemp = osbdefinit 	dim osbtempscore\ osbtempscore = 0 	sub submitosbscore 	 on error resume next 	 if osbactive = 1 or osbactive = 2 then 	 dim objxmlhttpmain, url, strjsontosend 	 url = "https //hook integromat com/82bu988v9grj31vxjklh2e4s6h97rnu0" 	 strjsontosend = "{""auth"" """ & osbkey &""",""player id"" """ & osbid & """,""player initials"" """ & osbtemp &""",""score"" " & cstr(osbtempscore) & ",""table"" """& tablename & """,""version"" """ & myversion & """}" 	 set objxmlhttpmain = createobject("msxml2 serverxmlhttp") 	 objxmlhttpmain open "put",url, false 	 objxmlhttpmain setrequestheader "content type", "application/json" 	 objxmlhttpmain setrequestheader "application", "application/json" 	 objxmlhttpmain send strjsontosend 	 end if 	end sub	 	' 	' get scores 	' 	dim worldscores 	sub getscores() 	 if osbkey="" then exit sub 	 on error resume next 	 dim objxmlhttpmain, url, strjsontosend 	 url = "https //hook integromat com/kj765ojs42ac3w4915elqj5b870jrm5c" 	 strjsontosend = "{""auth"" """& osbkey &""", ""table"" """& tablename & """}" 	 set objxmlhttpmain = createobject("msxml2 serverxmlhttp") 	 objxmlhttpmain open "put",url, false 	 objxmlhttpmain setrequestheader "content type", "application/json" 	 objxmlhttpmain setrequestheader "application", "application/json" 	 objxmlhttpmain send strjsontosend 	 worldscores = objxmlhttpmain responsetext 	 vpmtimer addtimer 3000, "showsuccess '" 	 debug print "got the scores" 	 'debug print worldscores 	 splitscores 	end sub	 	dim scorevar(22) 	dim dailyvar(22) 	dim weeklyvar(22) 	dim alltimevar(42) 	sub emptyscores 	 dim i 	 	 for i = 0 to 42 	 alltimevar(i) = "0" 	 next 	 for i = 0 to 22 	 weeklyvar(i) = "0" 	 dailyvar(i) = "0" 	 next 	end sub 	emptyscores 	sub splitscores 	 on error resume next 	 dim a,scoreset,subset,subit,mynum,daily,weekly,alltime,x 	 a = split(worldscores," {") 	 subset = split(a(1),"\[") ' debug print subset(1) ' debug print subset(2) ' debug print subset(3) ' daily scores 	 mynum = 0 	 daily = split(subset(1)," ") 	 for each x in daily 	 mynum = mynum + 1 	 x = replace(x, vbcr, "") 	 x = replace(x, vblf, "") 	 x = replace(x, ",", "") 	 x = replace(x, """", "") 	 x = replace(x, "{", "") 	 x = replace(x, "}", "") 	 x = replace(x, "score", "") 	 x = replace(x, "initials", "") 	 x = replace(x, "weekly", "") 	 x = replace(x, "]", "") 	 x = replace(x, "alltime", "") 	 dailyvar(mynum) = x 	 if dailyvar(mynum) = "" then 	 if mynum = 2 or 4 or 6 or 8 or 10 or 12 or 14 or 16 or 18 or 20 then 	 dailyvar(mynum) = "obs" 	 else 	 dailyvar(mynum) = 0 	 end if 	 end if 	 debug print "dailyvar(" \&mynum & ")=" & x 	 next ' weekly scores 	 mynum = 0 	 weekly = split(subset(2)," ") 	 for each x in weekly 	 mynum = mynum + 1 	 x = replace(x, vbcr, "") 	 x = replace(x, vblf, "") 	 x = replace(x, ",", "") 	 x = replace(x, """", "") 	 x = replace(x, "{", "") 	 x = replace(x, "}", "") 	 x = replace(x, "score", "") 	 x = replace(x, "initials", "") 	 x = replace(x, "weekly", "") 	 x = replace(x, "]", "") 	 x = replace(x, "alltime", "") 	 weeklyvar(mynum) = x 	 if weeklyvar(mynum) = "" then 	 if mynum = 2 or 4 or 6 or 8 or 10 or 12 or 14 or 16 or 18 or 20 then 	 weeklyvar(mynum) = "obs" 	 else 	 weeklyvar(mynum) = 0 	 end if 	 end if 	 debug print "weeklyvar(" \&mynum & ")=" & x 	 next ' alltime scores 	 mynum = 0 	 alltime = split(subset(3)," ") 	 for each x in alltime 	 mynum = mynum + 1 	 x = replace(x, vbcr, "") 	 x = replace(x, vblf, "") 	 x = replace(x, ",", "") 	 x = replace(x, """", "") 	 x = replace(x, "{", "") 	 x = replace(x, "}", "") 	 x = replace(x, "score", "") 	 x = replace(x, "initials", "") 	 x = replace(x, "weekly", "") 	 x = replace(x, "]", "") 	 x = replace(x, "alltime", "") 	 alltimevar(mynum) = x 	 if alltimevar(mynum) = "" then 	 if mynum = 2 or 4 or 6 or 8 or 10 or 12 or 14 or 16 or 18 or 20 or 22 or 24 or 26 or 28 or 30 or 32 or 34 or 36 or 38 or 40 then 	 alltimevar(mynum) = "obs" 	 else 	 alltimevar(mynum) = "0" 	 end if 	 end if 	 debug print "alltimevar(" \&mynum & ")=" & x 	 next 	end sub 	sub showsuccess 	 pnote "scoreboard","updated" 	 'pupdmddisplay " ","scoreboard^updated",dmdnote,3,0,10 	end sub 	getscores subs to adjust (if using orbital framework) high score check 	sub checkhighscore() 	 dim tmp 	 tmp = score(currentplayer) 	 osbtempscore = score(currentplayer) 	 if tmp > highscore(3) then 	 awardspecial 	 vpmtimer addtimer 2000, "playsound ""vo contratulationsgreatscore"" '" 	 highscore(3) = tmp 	 'enter player's name 	 highscoreentryinit() 	 dof 403, dofpulse 'dof mx hi score 	 else 	 osbtemp = osbdefinit 	 submitosbscore 	 endofballcomplete 	 end if 	end sub high score commit 	sub highscorecommitname() 	 puplayer playresume 4 	 playclear pbackglass 	 puplayer setloop 2,0 	 puplayer playresume 4 	 playclear paudio 	 puplayer setloop 7,0 	 hsenteredname = hsentereddigits(1) & hsentereddigits(2) & hsentereddigits(3) 	 highscorename(3) = hsenteredname 	 checkorder 	 osbtemp = hsenteredname 	 submitosbscore 	 endofballcomplete() 	 puplayer labelset pbackglass,"highscore","",1,"" 	 puplayer labelset pbackglass,"highscorel1","",1,"" 	 puplayer labelset pbackglass,"highscorel2"," ",1,"" 	 puplayer labelset pbackglass,"highscorel3"," ",1,"" 	 puplayer labelset pbackglass,"highscorel4"," ",1,"" 	 hsbmodeactive = false 	end sub