Jump to content
  • 0

Script Help with atoi itemname


Innos

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  62
  • Reputation:   5
  • Joined:  08/23/17
  • Last Seen:  

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.

1.PNG

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

atoi stands for ASCII to Integer. String -> Number

getitemname uses an integer value you don't need to use atoi.

  • Upvote 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

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 by Haruka Mayumi
  • Like 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  62
  • Reputation:   5
  • Joined:  08/23/17
  • Last Seen:  

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!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  477
  • Reputation:   269
  • Joined:  06/13/17
  • Last Seen:  

oh yes. i forgot to change that too =)

You're welcome

Edited by Haruka Mayumi
Typo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...