SReject / JSON-For-Mirc

JSON parser for mIRC
19 stars 6 forks source link

mIRC hangs on Windows Server 2016 Datacenter (64bits) #54

Closed westor7 closed 3 years ago

westor7 commented 4 years ago

Hello,

I was testing that following code in a windows vps and then the mIRC hangs, i cannot reproduce the same hang in Windows 10 so i cannot understand what is happening here.

JSON Version: 2.0.4000 Tested under: mIRC 7.61

Windows VPS Machine Specs: http://speccy.piriform.com/results/x5ywqsssPIvmAHrEHlhbmpK

JSON Raw:

{
    "status": {
        "timestamp": "2020-03-10T19:47:28.971Z",
        "error_code": 0,
        "error_message": null,
        "elapsed": 10,
        "credit_count": 1,
        "notice": null
    },
    "data": {
        "BTC": {
            "id": 1,
            "name": "Bitcoin",
            "symbol": "BTC",
            "slug": "bitcoin",
            "num_market_pairs": 7763,
            "date_added": "2013-04-28T00:00:00.000Z",
            "tags": [
                "mineable"
            ],
            "max_supply": 21000000,
            "circulating_supply": 18264037,
            "total_supply": 18264037,
            "platform": null,
            "cmc_rank": 1,
            "last_updated": "2020-03-10T19:46:36.000Z",
            "quote": {
                "USD": {
                    "price": 7918.59556072,
                    "volume_24h": 41619636640.1489,
                    "percent_change_1h": 0.552288,
                    "percent_change_24h": 1.2324,
                    "percent_change_7d": -9.57501,
                    "market_cap": 144625522309.02582,
                    "last_updated": "2020-03-10T19:46:36.000Z"
                }
            }
        }
    }
}

Code:

Usage: /conv 0 <amount> <from-crypto> <to-currency> Example: /conv 0 1 btc usd

alias conv {
  if (!$2) && (!$3) && (!$4) && ($2 !isnum) { return }
  if ($3 == $4) { return }

  var %v = conv_ $+ $ctime $+ $ctime $+ $ticks $+ $ticks

  jsonopen -ui %v https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest?symbol= $+ $upper($3) $+ &convert= $+ $upper($4) $+ &CMC_PRO_API_KEY=4ca2446d-9d3c-4587-8249-288143152362
  if ($jsonerror) { echo 4 -s JSON ERROR: $jsonerror | jsonclose %v | return }

  var %data = $json(%v,data,$upper($3),quote,$upper($4),price).value
  if (!%data) { return }

  ; THE FOLLOWING LINE HANGS OUT THE MIRC
  var %24h_percentage = $json(%v,data,$upper($3),quote,$upper($4),percent_change_24h).value
  ; After a lot of time spending in a lot of testing cases, when i disable that line the stuck stopped.

  if (%24h_percentage) { var %24h = (0 $+ $iif($left(%24h_percentage,1) == -,4,9+) $+ %24h_percentage $+ % /5 24h) }

  jsonclose %v

  var %price = $calc($abs($2) * %data)
  if (!%price) { return }

  echo -a The currently amount of $abs($2) $upper($3) %24h to $upper($4) is: $bytes(%price,b)
}
westor7 commented 3 years ago

@SReject

Any idea how to solve that issue ?

SReject commented 3 years ago

Sadly, I do not. I use win10 and have no issues.

SReject commented 3 years ago

Closing due to inactivity.