Innos Posted October 11, 2017 Group: Members Topic Count: 18 Topics Per Day: 0.01 Content Count: 62 Reputation: 5 Joined: 08/23/17 Last Seen: March 11, 2019 Share Posted October 11, 2017 Can everyone help me for my Script. I have Problems with set .@itemname$, getitemname( atoi( .@risk_price ) ); mes " ~ "+.@itemname$+""; give me not the right Item Name after the second try. And i mean the answer is not the right item id in the array, it's only the first id. Quote Link to comment Share on other sites More sharing options...
0 Skorm Posted October 11, 2017 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted October 11, 2017 atoi stands for ASCII to Integer. String -> Number getitemname uses an integer value you don't need to use atoi. 2 Quote Link to comment Share on other sites More sharing options...
0 Haruka Mayumi Posted October 12, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 485 Reputation: 271 Joined: 06/13/17 Last Seen: April 14 Share Posted October 12, 2017 (edited) What happened in your script is. the value of risk_price is being converted from Integer to Integer.. atoi only accept String to integer. As you can see on the error, it says "Expected String" Here's the right code i guess =) riskPlay: setarray .@risk_price[0],501,502,503,504,504; set .@randitem, rand(0,getarraysize(.@risk_price ) ); set .@itemname$, getitemname( .@risk_price[.@randitem] ); set .@win,rand(0,1); if(.@win == 1){ mes "You won!"; mes " ~ "+.itemname$; getitem .@risk_price[.@randitem],1; }else{ mes "You Lose"; } Edited October 12, 2017 by Haruka Mayumi 1 Quote Link to comment Share on other sites More sharing options...
0 Innos Posted October 12, 2017 Group: Members Topic Count: 18 Topics Per Day: 0.01 Content Count: 62 Reputation: 5 Joined: 08/23/17 Last Seen: March 11, 2019 Author Share Posted October 12, 2017 with change 6 hours ago, Haruka Mayumi said: mes " ~ "+.itemname$; to 6 hours ago, Haruka Mayumi said: mes " ~ "+.@itemname$; works perfectly. Thanks for your help! Quote Link to comment Share on other sites More sharing options...
0 Haruka Mayumi Posted October 12, 2017 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 485 Reputation: 271 Joined: 06/13/17 Last Seen: April 14 Share Posted October 12, 2017 (edited) oh yes. i forgot to change that too =) You're welcome Edited October 12, 2017 by Haruka Mayumi Typo Quote Link to comment Share on other sites More sharing options...
Question
Innos
Can everyone help me for my Script.
I have Problems with
mes " ~ "+.@itemname$+""; give me not the right Item Name after the second try. And i mean the answer is not the right item id in the array, it's only the first id.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.