mIRC Blackjack Timeout Script - mirc

I have a bunch of code for a blackjack game script on mIRC.
Everything is running fine, but when a user starts a game of blackjack, no one else can play until that game finishes.
I was wondering if someone could help me out with coding it so that I can give user a 45 second timer between each action; if they time out, the script will reset, opening up the script for another user to play. This will void the game that's in use.
The code for the game is below.
;BLACKJACK
on *:TEXT:!blackjack*:#vegas:{
if (%bj == on) {
/msg $chan 10Blackjack is already in progress. Please wait your turn.
halt
}
if ( %hs [ $+ [ $nick ] ] != $null ) /notice $nick 10 $+ $nick $+ , you have a game in progress!!!
if ( %hs [ $+ [ $nick ] ] == $null ) {
if ( $2 == $null ) /notice $nick 10Please enter amount you want to bet. ex. !blackjack 20
if ($readini( casino.ini, $nick, Money ) == $null ) /notice $nick 10 $+ $nick is not yet registered. Type !atm
if ( $readini( casino.ini, $nick, Money ) < $2 ) /notice $nick 10You don't have that much money...try something lower!
if ( $readini( casino.ini, $nick, Money ) >= $2 ) {
if ( $2 < 1 ) {
/notice $nick 10Please bet more than 1 dollar.
halt
}
if ( $2 > 0 ) {
/set %bj on
/set %bet [ $+ [ $nick ] ] $2
/bjdeal
/msg $chan 10 $+ $nick bet $2 dollars on a hand of blackjack
/var %cch = $rand(1,4)
if ( %cch == 1) /msg $chan 10 $+ $nick $+ 's hand: 4,0 %hcard1 [ $+ [ $nick ] ] 4,0 %hcard2 [ $+ [ $nick ] ]
if ( %cch == 2) /msg $chan 10 $+ $nick $+ 's hand: 4,0 %hcard1 [ $+ [ $nick ] ] 1,0 %hcard2 [ $+ [ $nick ] ]
if ( %cch == 3) /msg $chan 10 $+ $nick $+ 's hand: 1,0 %hcard1 [ $+ [ $nick ] ] 4,0 %hcard2 [ $+ [ $nick ] ]
if ( %cch == 4) /msg $chan 10 $+ $nick $+ 's hand: 1,0 %hcard1 [ $+ [ $nick ] ] 1,0 %hcard2 [ $+ [ $nick ] ]
if (( %hcard1 [ $+ [ $nick ] ] == A ) && ( %hcard2 [ $+ [ $nick ] ] == A )) {
/set %addh [ $+ [ $nick ] ] 12
/set %aceh [ $+ [ $nick ] ] 0
}
if (( %hcard1 [ $+ [ $nick ] ] == A ) || ( %hcard2 [ $+ [ $nick ] ] == A )) { /set %aceh [ $+ [ $nick ] ] 0 }
/set %ccc [ $+ [ $nick ] ] $rand(1,2)
if ( %ccc [ $+ [ $nick ] ] == 1) /msg $chan 10Dealer's hand: 4,0 %ccard1 [ $+ [ $nick ] ] 12,0 ?
if ( %ccc [ $+ [ $nick ] ] == 2) /msg $chan 10Dealer's hand: 1,0 %ccard1 [ $+ [ $nick ] ] 12,0 ?
if ( %addh [ $+ [ $nick ] ] == 21 ) {
/set %bj [ $+ [ $nick ] ] $calc( $2 / 2 )
/set %bj [ $+ [ $nick ] ] $calc( %bj [ $+ [ $nick ] ] + $2 )
/msg $chan 4Blackjack!! $nick has won %bj [ $+ [ $nick ] ] dollars!!
/set %bj.temp $calc( $readini( casino.ini, $nick, Money ) + %bj [ $+ [ $nick ] ] )
/writeini casino.ini $nick Money %bj.temp
/unset %bj.temp
/unset %hs [ $+ [ $nick ] ]
/unset %bet [ $+ [ $nick ] ]
/unset %addh [ $+ [ $nick ] ]
/unset %addc [ $+ [ $nick ] ]
/unset %hcard1 [ $+ [ $nick ] ]
/unset %hcard2 [ $+ [ $nick ] ]
/unset %ccard1 [ $+ [ $nick ] ]
/unset %ccard2 [ $+ [ $nick ] ]
/unset %hcard3 [ $+ [ $nick ] ]
/unset %ccard3 [ $+ [ $nick ] ]
/unset %bj [ $+ [ $nick ] ]
/unset %aceh [ $+ [ $nick ] ]
/unset %double [ $+ [ $nick ] ]
/unset %bj
/halt
}
if ( %addh [ $+ [ $nick ] ] != 21 ) {
set %double [ $+ [ $nick ] ] $calc( %bet [ $+ [ $nick ] ] * 2)
if ( $readini( casino.ini, $nick, Money ) >= %double [ $+ [ $nick ] ] ) {
/msg $chan 10 Hit Stand or Double?
/set %d [ $+ [ $nick ] ] 0
/set %hs [ $+ [ $nick ] ] 0
/halt
}
if ( $readini( casino.ini, $nick, Money ) < %double [ $+ [ $nick ] ] )
{
/msg $chan 10 Hit or Stand?
/set %hs [ $+ [ $nick ] ] 0
/halt
}
}
}
}
}
}

One way to do this is to start a timer which will unset your variables when X amount of time has passed. For example:
on *:TEXT:!blackjack*:#vegas:{
if ($timer(blackjack)) {
; the timer exists so a game is already in progress
}
else {
; start the timer
startblackjacktimer
; put your code here
}
}
alias startblackjacktimer {
; change 45 to amount of seconds
; this alias will start a timer to call 'resetblackjack'
.timerblackjack 1 45 resetblackjack
}
alias resetblackjack {
; do your variable reset here
}
For each command they can do you have to restart the timer by triggering the startblackjack alias again.
If you have any more questions, feel free to ask them.

Related

Data loading limit oracle apex 5

I am using data load page in oracle apex 5, when I load my .csv file which contains more than 90 columns and 1,000 rows.. I've noticed that I only can see 45 colums and 500 rows in the report..
Can I change that limit for rows and columns? where?
the answer is NO, apex collection doesn't allow such number of columns.
There is a solution for loadig more than 45 Columns to a collection, Anton Scheffer used this method in his apex Plugin excel2collections where he would use the first Columns to identify a single row in the collection.
Load more than 50 columns. Because we can store only 50 varchar2
columns in a APEX collection, columns above 50 are loaded in a second
row. Attribute N001 stores the row number, attribute N002 stores the
column number of C001.
That way you could identify one row of data by the N002 Column e.g.
N001 C001 C002 C003 C004 C005 C006 .. C050
01 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]
51 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]
101 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]
01 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]
51 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]
101 [ ] [ ] [ ] [ ] [ ] [ ] .. [ ]

How to add a 2 second delay to the postmessage alias (mIRC)

I've been trying for days to add a 2 second delay to the "postmessage" alias in this code. Nothing I've tried seems to work. How do you add a 2 second delay to this script ? Like make the first message be sent immediately when triggered but the second one 2 seconds after the first.
The full code is here.
this is the portion of the code I need help with:
alias postmessage {
IF (%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]) {
VAR %x_notes 1
WHILE ($gettok(%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ],%x_notes,32)) {
MSG $chan %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
UNSET %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
INC %x_notes
}
UNSET %notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
}
}
You have to make another alias with a timer to call the postmessage alias
For example
alias postmessageDelayed {
; the next line of code will have a delay of 2 seconds
.timer 1 2 postmessage
}
alias postmessage {
IF (%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]) {
VAR %x_notes 1
WHILE ($gettok(%notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ],%x_notes,32)) {
MSG $chan %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
UNSET %note_from_to. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $v1 ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
INC %x_notes
}
UNSET %notes_for. [ $+ [ $server ] ] [ $+ [ . ] ] [ $+ [ $chan ] ] [ $+ [ . ] ] [ $+ [ $nick ] ]
}
}
1 means run only once
2 means use a delay of two seconds before executing
To use this call postmessageDelayed instead of postmessage

Mongodb sphere2d query

Hi i have an collection which contains this object
{
"_id":"53b0807ca004f2ad5f0c9839",
"id":"3427734",
"version":"4",
"timestamp":"2012-08-04T12:06:46Z",
"changeset":"12608469",
"uid":"604523",
"user":"673a",
"fenced":"yes",
"landuse":"cemetery",
"name":"Friedhof St. Peter (Alter Friedhof)",
"poly":{
"type":"Polygon",
"coordinates":[
[
[
8.6763586,
49.5531628
],
[
8.6765129,
49.553132
],
[
8.6763608,
49.5528116
],
[
8.6767028,
49.5527433
],
[
8.6765809,
49.5524866
],
[
8.6770135,
49.5524431
],
[
8.6784924,
49.5520942
],
[
8.6788149,
49.5521769
],
[
8.6789908,
49.5524369
],
[
8.6793862,
49.5525109
],
[
8.6786997,
49.5530378
],
[
8.6779331,
49.5531445
],
[
8.6769458,
49.5532933
],
[
8.6766567,
49.5533521
],
[
8.6764405,
49.5533353
],
[
8.6763586,
49.5531628
]
]
]
}
}
now i'm makeing a query
{
"poly":{
$geoIntersects:{
$geometry:{
"type":"Polygon",
"coordinates":[
[
[
-180.0,
90.0
],
[
180.0,
90.0
],
[
180.0,
-90.0
],
[
-180.0,
-90.0
],
[
-180.0,
90.0
]
]
]
}
}
}
}
but it does not return the object.. it returns nothing. Any ideas why?
The GeoJson object that you passed is not acceptable. I changed the query parameter a little bit and it now works. As you have already understood now that the GeoJson object should fit within one hemisphere. If you need some demonstration of the $geoIntersect functionality of MongoDB, you can run the following query and see that it gives your polygon in the results:
db.Test.find({
"poly":{
'$geoIntersects':{
'$geometry':{
"type": "Polygon",
"coordinates": [
[
[
8.6763586,
49.5531628
],
[
8.6788149,
49.5521769
],
[
8.6786997,
49.5530378
],
[
8.6763586,
49.5531628
],
[
8.6763586,
49.5531628
]
]
]
}
}
}
});
Seems that my query won't work, i found this in the docs:
http://docs.mongodb.org/manual/reference/operator/query/geoIntersects/
Note
Any geometry specified with GeoJSON to $geoIntersects queries, must fit within a single hemisphere. MongoDB interprets geometries larger than half of the sphere as queries for the smaller of the complementary geometries.
i can only query fopr the right hmisphere
{
"poly":{
$geoIntersects:{
$geometry:{
"type":"Polygon",
"coordinates":[
[
[
1.0,
90.0
],
[
180.0,
90.0
],
[
180.0,
-90.0
],
[
1.0,
-90.0
],
[
1.0,
90.0
]
]
]
}
}
}
}

Geolocation querying returns random values in mongod;

I am trying to use mongodb $near operator to get some documents from database according to user's position.
So, after i've got user coordinates, i query a collection which has the right geospatial index ensured before :
computed_places.ensureIndex({'geoJson.coordinates' : "2d"}, function(err,ok) {)
with this query:
computed_places.find({'geoJson.coordinates' :
{$near:
{$geometry:
{type : "Point" ,
coordinates:[user.longitude , user.latitude]}},
$maxDistance : 200
}})
})
But after the first test it sounds returning random documents, as i've input
longitude: 11.870853799999999,
latitude: 45.4109512
And documents returned had this values (one pair for each document, which is the content of 'geoJson.coordinates' field):
[7.42149, 9.00046 ]
[ -1.50372, 12.3791 ]
[ 15.30972, -4.41944 ]
[ 15.0444, 12.1047 ]
[ -16.27479, 12.58644 ]
[ -16.47951, 14.69669 ]
[ -16.96598, 14.79575 ]
[ -17.46682, 14.68189 ]
[ -17.45258, 14.69922 ]
[ -17.46331, 14.68731 ]
[ -17.46232, 14.69187 ]
[ -16.42596, 16.06252 ]
[ 29.74278, -2.61611 ]
[ 30.06219, -1.95994 ]
[ 30.21835, 0.67669 ]
[ 30.27613, 0.65909 ]
[ 30.65717, -0.61551 ]
[ -9.54612, 30.40618 ]
[ 32.01435, 0.0026 ]
[ 32.01889, 1.8425 ]
[ 32.31678, 2.78819 ]
[ 32.56815, 0.33572 ]
[ 32.57702, 0.33791 ]
[ 32.58911, 0.41068 ]
[ 32.59748, 0.32096 ]
[ 32.62691, 0.34929 ]
[ 32.6354, 0.26048 ]
[ -8.02018, 31.64532 ]
[ -8.01542, 31.64902 ]
[ -4.97333, 34.06444 ]
[ -6.86187, 33.98307 ]
[ -6.8614, 33.98705 ]
[ -1.89851, 34.65022 ]
[ -6.80016, 34.04182 ]
[ 35.08467, 0.25603 ]
[ 31.053, -17.784 ]
[ 33.99323, -11.422 ]
[ 32.54222, 15.61222 ]
[ -5.89351, 35.73639 ]
[ 33.52946, 14.38584 ]
[ 36.82248, -1.27937 ]
[ -4.47724, 36.71546 ]
[ -6.29799, 36.53392 ]
[ -3.60341, 37.17572 ]
[ -3.6021, 37.17812 ]
[ -3.60446, 37.18048 ]
[ -3.59712, 37.1935 ]
[ -3.59772, 37.20488 ]
[ -5.99051, 37.3808 ]
[ -6.06589, 37.37031 ]
[ -1.17451, 38.02272 ]
[ 28.1617, -25.7322 ]
[ -3.46826, 37.99136 ]
[ -4.80046, 37.86933 ]
[ -4.78746, 37.87324 ]
[ -4.78191, 37.88005 ]
[ -4.7673, 37.8851 ]
[ -0.68716, 38.27538 ]
[ 27.99889, -26.18333 ]
[ -0.51224, 38.38446 ]
[ 18.8647, -33.9301 ]
[ 38.50135, 7.06233 ]
[ -9.19215, 38.6979 ]
[ 38.75917, 9.04667 ]
[ -9.11664, 38.7562 ]
[ -0.06884, 39.99415 ]
[ 27.72312, -29.45066 ]
[ -5.6689, 40.96603 ]
[ 2.16353, 41.38636 ]
[ 2.11051, 41.39367 ]
[ 0.62332, 41.60818 ]
[ 32.5833, -25.9667 ]
[ 32.58496, -25.974 ]
[ 32.59976, -25.95979 ]
[ -0.88738, 41.68331 ]
[ -8.39647, 41.56104 ]
[ -5.5597, 42.61231 ]
[ 29.89667, 31.19626 ]
[ 29.90528, 31.20194 ]
[ 31.20797, 30.02733 ]
[ 29.9989, 31.26448 ]
[ 25.10237, 35.31901 ]
[ 31.22038, 30.0574 ]
[ 31.23613, 30.04574 ]
[ 31.2625, 30.04583 ]
[ 5.44321, 43.23243 ]
[ 5.44209, 43.23268 ]
[ 5.35897, 43.29198 ]
[ 5.40025, 43.28711 ]
[ -5.77641, 43.24242 ]
[ 5.38261, 43.29817 ]
[ 5.37486, 43.29979 ]
[ 5.39214, 43.30123 ]
[ 5.37923, 43.30398 ]
[ -3.79904, 43.47363 ]
[ 5.39339, 43.30592 ]
[ 5.45815, 43.31909 ]
[ 5.41609, 43.33851 ]
[ 31.60639, 30.15028 ]
[ 22.37148, 37.52703 ]
That results seem random compared to my input, but also among themselves. What am i doing wrong? This is the strcture of queried documents:
doc = {
"geoname_id": 6269578
, names: {
en: "Pedagogical University"
}
, country: "VN"
, geoJson: {
type: "Point"
, coordinates: [
106.68259
, 10.76154
]
}
, timezone: "Asia/Ho_Chi_Minh"
, "_id": new ObjectID("530dffbe734e07e50d9b5ef9")
};

What language is this? (for an IRC Bot)

Finally found some of my really old scripts I had written for an IRC Bot about 10 years ago. I had no idea what I was doing, and was wondering if anyone knew what this was written in and any information?
on *:sockread:$1:{
var %stattype $1
if ($sockerr) {
.notice [ %nickname [ $+ [ %stattype ] ] ] Error.
halt
}
else {
var %statread
sockread %statread
if (Stat:* * * * iswm %statread) {
.tokenize 32 %statread
.notice [ %nickname [ $+ [ %stattype ] ] ] 1[ Username:7 $upper( [ %username [ $+ [ %stattype ] ] ] ) 1] [ Skill: 7 $upper(%stattype) 1]
.notice [ %nickname [ $+ [ %stattype ] ] ] 1[ Level:7 $3 1 $chr(124) Exp:7 $4 1 $chr(124) Rank:7 $2 1]
.notice [ %nickname [ $+ [ %stattype ] ] ] 1[ Next lvl:7 $calc($3 + 1) 1 $chr(124) Exp to:7 $bytes($calc( [ %lvl [ $+ [ $calc($3 + 1) ] ] ] - $remove($4,$chr(44))),b) 1]
.notice [ %nickname [ $+ [ %stattype ] ] ] 1[ Bandits:7 $bytes($calc($calc( [ %lvl [ $+ [ $calc($3 + 1) ] ] ] - $remove($4,$chr(44)))/(51*1.33)),b) 1 $chr(124) S.Warriors:7 $bytes($calc($calc( [ %lvl [ $+ [ $calc($3 + 1) ] ] ] - $remove($4,$chr(44)))/(67*1.33)),b) 1 $chr(124) Dagg(74):7 $bytes($calc($calc( [ %lvl [ $+ [ $calc($3 + 1) ] ] ] - $remove($4,$chr(44)))/(70*1.33)),b) 1 $chr(124) Ogre(53)/Ice Warrior:7 $bytes($calc($calc( [ %lvl [ $+ [ $calc($3 + 1) ] ] ] - $remove($4,$chr(44)))/(60*1.33)),b) 1]
.sockclose %stattype
}
}
}
on $*:TEXT:$(/#(hp|att|str|ran|mag|pra|def|coo|woo|fir|fle|run|sla|min|smi|cra)/):#: {
var %stattype $left($remove($1,!,#),3)
.tokenize %stattype 32
if ($2 != $null) {
sockopen %stattype rscript.org 80
set [ %username [ $+ [ %stattype ] ] ] $2
set [ %nickname [ $+ [ %stattype ] ] ] $nick
}
elseif ($2 == $null) {
sockopen hp rscript.org 80
set [ %username [ $+ [ %stattype ] ] ] $nick
set [ %nickname [ $+ [ %stattype ] ] ] $nick
}
else {
.notice $nick Error. Sorry.
}
}
This is the mIRC scripting language for the mIRC client.
Oh and it seems to do something with (pff knowledge from when I was 12) training thieving on bandits in the game runescape through the service rscript.org.
MIRC Remote Events.
I'm sure that you wrote your program in the mIRC scripting language (inofficial mSL). You can find more about that on its official website. Currently i try to figure out what are you doing ;) I stay tuned.