Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ comma replacing

comma replacing

This subject is now closed.     Refresh page


Posted by Helpless   (48 posts)  Bio
Date Mon 24 Jun 2013 06:59 PM (UTC)

Amended on Mon 24 Jun 2013 07:00 PM (UTC) by Helpless

Message
im trying to make a JScript to keep track of how much gold i deposit throughout the day.
the problem is the comma in the deposit amount is messing it up...i've tried messing with
the replace function (provided in the mushclient helpfiles) and didnt get anywhere (im a newb).

sometimes the results of depositing 1,000 coins were "01000" and if repeated deposit, sometimes would say "51201000". it would never add the amounts though.

<trigger
enabled="y"
match="*You deposit * coins in the bank."
send_to="12"
sequence="100"
>

<send>
money = GetVariable ("money");

if (money == null)
money = "0";
world.SetVariable ("money", parseInt (money) + %2);
</send>
</trigger>

as long as the amount i deposit doesn't have a comma, it works fine.
(my attempts to mess with Replace aren't shown here...they failed and yours
will most likely work :P)
Top

Posted by Helpless   (48 posts)  Bio
Date Reply #1 on Tue 25 Jun 2013 02:55 PM (UTC)
Message
all these people viewing my post and no one wants to help? why :/
Top

Posted by Nick Gammon   Australia  (23,169 posts)  Bio   Forum Administrator
Date Reply #2 on Wed 26 Jun 2013 08:53 AM (UTC)
Message
Quote:

(my attempts to mess with Replace aren't shown here...they failed and yours
will most likely work :P)


Because you failed to show your attempts.

Don't cross post, I'll lock this thread.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,824 views.

This subject is now closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.