Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding a val to a var


munro
 Share

Recommended Posts

ok this is annoying me, I've been working on scripts for hours and cant get this one to work…

well its not that its a cant add to it. what i need to do is add a value to a variable without resetting the variable.

I've tried different lines of put and get var but none work. can someone help
Link to comment
Share on other sites

sorry but that would work how with this statement?

Call SetPlayerHP(index, GetPlayerHP(index) + 5)                   
call SOMETHINGvar("\Scripts\skill\" & GetPlayerName(index) &".ini", "Prayer", "XP", SOMETHING)

something would be…well what i have no idea what to add
Link to comment
Share on other sites

well you'd use a getvar, store it in a variable. and use either var = int(var) + 1 then a putvar with var, or just have a putvar with (int(var) + 1) in it. if you wanna explain what you want the script to do, and post what you have, I'd be happy to help you.
Link to comment
Share on other sites

> Call PutVar("\Scripts\skill\" & GetPlayerName(index) &".ini", "Prayer", "XP", GetVar("\Scripts\skill\" & GetPlayerName(index) &".ini", "Prayer", "XP") + 5)

You'll have to use GetVar to get the same value. It seems redundant, but it's how it has to be done. Alternatively, if you don't like the way this looks, you can do something like this:

> Value = GetVar("\Scripts\skill\" & GetPlayerName(index) &".ini", "Prayer", "XP") + 5
> Call PutVar("\Scripts\skill\" & GetPlayerName(index) &".ini", "Prayer", "XP", Value)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...