mIRC Home    About    Download    Register    News    Help

Print Thread
Page 3 of 3 1 2 3
Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
ok i see, but wouldent it be better if there was a switch for overwrite? wink

But what are you thoughts on saving user stats.
Should i use the hashtables and then save it to an ini file or is my thinking viable to save the json then access it?

Last edited by Bast; 23/10/20 11:17 PM.
Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
Why cant i grab the null value in this string?
Code
$json(%stats,data,weekly,all,properties).value


the json looks like this.

Code
{
  "status": "success",
  "data": {
    "title": "mw",
    "platform": "battle",
    "username": "Ancientskull#1576",
    "type": "wz",
    "level": 55.0,
    "maxLevel": 0.0,
    "levelXpRemainder": 3000.0,
    "levelXpGained": 7000.0,
    "prestige": 0.0,
    "prestigeId": 0.0,
    "maxPrestige": 0.0,
    "totalXp": 960000.0,
    "paragonRank": 0.0,
    "paragonId": 0.0,
    "s": 0.0,
    "p": 0.0,
    "lifetime": {
      "all": {
        "properties": {

    "weekly": {
      "all": {
        "properties": null
      },
      "mode": {
        
      },
      "map": {
        
      }
    },
    "engagement": null
  }
}


so there is no data for weekly so i would want it to add null to my ini, so can check it and say, hey, there is no data for weekly.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
In JSON null means "no value", so the json script converts it to $null; that is, an empty string


I am SReject
My Stuff
Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
ofcource, i was seeing it as a text so i tried to do an if statement with null instead of $null blush

Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
Why cant i use this line? it always get stuck on this one even i thou i have the 4th word like that.

Code
f (($strip($4) != battle) || ($strip($4) != psn) || ($strip($4) != xbl)) { u need to type in battle,psn,xbl not $strip($4) 


This works just how it should.

Code
if (($strip($4) == battle) || ($strip($4) == psn) || ($strip($4) == xbl)) {


What am i doing wrong? my brain might be fried atm. laugh
or cant you use "or with not equal to"

Last edited by Bast; 28/10/20 12:07 AM.
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
Your first statement will always be true. Just like this will always be true:

if ( (%var != 1) || (%var != 2) )

Since a variable can't be both values, then at least 1 of them must be true. Maybe you want to do something like:

if (!$istok(battle psn xbl,$strip($4),32)) echo -a u need to type in battle,psn,xbl not $strip($4)

Or, you could do
if (($strip($4) == battle) || ($strip($4) == psn) || ($strip($4) == xbl)) { do stuff }
else { echo -a error }

Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
Thanks maroon for that explanation.

My brain felt like it melted whan i was looking att that row and felt like it should really work, but i couldent for my life figure out why. cool

Joined: Nov 2011
Posts: 38
B
Bast Offline OP
Ameglian cow
OP Offline
Ameglian cow
B
Joined: Nov 2011
Posts: 38
I do have this loop that does the job.
But
guns has 50 entrys
tactical 5
leathal 10

Question: Does this break the scipt? i dont get any error, but since their is different amount of entrys in every one!
should i make a loop on every single section or is it a better way of doing things?

Code
  var %i = 1 | while (%i <= $ini($shortfn($mircdirscripts) $+ %dstats $+ MW-Weapons.ini,GUNS,0)) {
    if ($readini($shortfn($mircdirscripts) $+ %dstats $+ MW-Weapons.ini,GUNS,%i) == %weapon $+ ) { .msg chan}
    if ($readini($shortfn($mircdirscripts) $+ %dstats $+ MW-Weapons.ini,TACTiCAL,%i) == %weapon $+ ) { .msg chan }
    if ($readini($shortfn($mircdirscripts) $+ %dstats $+ MW-Weapons.ini,LETHALS,%i) == %weapon $+ ) { .msg %chan }
    inc %i
  }
[u][/u]

Page 3 of 3 1 2 3

Link Copied to Clipboard