Variable_1, variable_2, variable_3, how to show them in message?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
Fred
Newbie
Posts: 18
Joined: Sat Aug 05, 2017 4:44 pm

Variable_1, variable_2, variable_3, how to show them in message?

Post by Fred » Tue Apr 10, 2018 2:49 pm

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?

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
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?

Post by Marcus Tettmar » Mon Apr 16, 2018 2:44 pm

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?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts