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

A few Questions about Scripting


ell
 Share

Recommended Posts

Hello everyone, I am often asking things about scripting and I'm sure posting a load of topics is annoying so I am creating one topic and just puting all my questions in here! (hope thats allowed?) Thanks in advance ell.

Q1\. I am trying to make a skill system but i'm not entirely  sure how to sue PutVar and GetVar. so heres what i'v got so far.

```
Dim Fishing
Fishing = GetVar("accounts\CharacterSkills\" & GetPlayerName(Index) & "_skills.ini", "SKILLS", Fishing)
Call PlayerMsg(Index, "Your fishing skill is " & Fishing & ".", MAGENTA)
```
I have a file called TheLifeGiver.ini which contains…
```
[SKILLS]
Agility=1
Combat=1
Construction=1
Cooking=1
Crafting=1
Farming=1
Firemaking=1
Fishing=4
Fletching=1
Herblore=1
Hunting=1
Magic=1
Mining=1
Prayer=1
Ranged=1
Spellbinding=1
Slaying=1
Smithing=1
```And is located in
Server\Accounts\CharacterSkills

Also do I have to use Dim everytime I want to declare a variable?

The message wont show up, why not? thanks in advance ell.

Q2\. Is there a way to stop an npc from respawning for an individual player, so all the other players can see it unless they have already talked to it once? Thanks in advance ell.

Q3\. Can someone explain why alot of subs and functions and whatever use "Index" what does it mean or represent?

Q4\. How would I go about making a delay? (as is it waits a certain amount of time then goes onto the next comand)

Q5\. Can someone explain how to make a random number from 1-100?
Link to comment
Share on other sites

1\. Assuming the player's name is "TheLifeGiver", that script would be searching for "TheLifeGiver_skills.ini", not "TheLifeGiver.ini". And, no, you don't have to dim. At all. It's good practice for if you want to start using VB, but it has no real use in Eclipse.

2\. No, there's not. That'd take some source editing.

3\. Index refers to a specific player logged into the game. The first player logged on gets index 1, the second gets 2, etc. Index calls back to them, so if they trigger a script, thescript uses index to make that event happen relative to them.

4\. You can't use a "delay", per se, but you can use a timer, then run a second script. It can get a bit lengthy and segmented, especially if there's multiple delays, but it's the only way right now.

5\. There's a Rand() function. I believe it's Rand(100, 1) to make a number between 1 and 100, but it might be Rand(1, 100). Try either of those.
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...