This is a short fragment from my script trading cryptocurrency:
HTTPRequest>https://api.nicehash.com/api?method=ord ... icehashAPI
Let>r=0
While>r<%NumberOfMYOrdersToCheck%
JSONParse>NicehashAPI,result.orders[%r%].limit_speed,SpeedLimit_0
JSONParse>NicehashAPI,result.orders[%r%].price,Paying_0
JSONParse>NicehashAPI,result.orders[%r%].id,OrderNumber_0
Let>r=r+1
JSONParse>NicehashAPI,result.orders[%r%].limit_speed,SpeedLimit_1
JSONParse>NicehashAPI,result.orders[%r%].price,Paying_1
JSONParse>NicehashAPI,result.orders[%r%].id,OrderNumber_1
Let>r=r+1
JSONParse>NicehashAPI,result.orders[%r%].limit_speed,SpeedLimit_2
JSONParse>NicehashAPI,result.orders[%r%].price,Paying_2
JSONParse>NicehashAPI,result.orders[%r%].id,OrderNumber_2
Message>SpeedLimit_0=%SpeedLimit_0%, SpeedLimit_1=%SpeedLimit_1%, SpeedLimit_2=%SpeedLimit_2%
//The same about Paying_n and OrderNumber_n
Wait>10
EndWhile
I take info about my orders via HTTPRequst in NicehashAPI variable and want to receive an information in message after the script checked all my orders (NumberOfMYOrdersToCheck). If I have several of them, I can write as I wrote here, but there should be a way to simplify it, if the amount of orders is large.
If I try to write:
Let>r=0
While>r<%NumberOfMYOrdersToCheck%
JSONParse>NicehashAPI,result.orders[%r%].limit_speed,SpeedLimit_r
JSONParse>NicehashAPI,result.orders[%r%].price,Paying_r
JSONParse>NicehashAPI,result.orders[%r%].id,OrderNumber_r
Let>r=r+1
Message>OrderNumber_r
Wait>1
EndWhile
I cannot receive numerical values of SpeedLimit_r, Paying_r and OrderNumber_r in Message, as I dont understand how to write Message line. Neither OrderNumber_r, nor %OrderNumber_r% and OrderNumber_%r% (analogically for Paying and SpeedLimit) gives me a numerical value in Message window. %%OrderNumber_%r%% also dont work.
My question, do I have such a variables as SpeedLimit_0, Paying_0, OrderNumber_0 (1,2,3 ...) after my this part of script is executed, or it is just a wrong way? Maybe I need to do it another way?
Variable_1, variable_2, variable_3, how to show them in message?
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Variable_1, variable_2, variable_3, how to show them in message?
Just assign the array type variable to a simple variable first:
Code: Select all
Let>tmp=SpeedLimit_%r%
MessageModal>tmp
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?