DarkMazer
-
Posts
107 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Calendar
Posts posted by DarkMazer
-
-
Walk and run speeds can only be powers of 2. So they can only be 1, 2, 4, 8, 16, 32, and maybe 64. It'd be nice if there were intermediates, but there aren't.
-
```
Sub QueryBox(index, Prompt)
Value = GetVar("responses.ini","Responses",Cstr(index))
If Prompt = 0 Then
Call playermsg(index, "lol", 12)
End If
End Sub
End Sub
```Delete the second End Sub.
```
If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) ".ini", "EXTRAS", "DOUBLEEXP") = "1" Then
Call SetPlayerExp(Index, GetPlayerExp(Index) + GetNpcExp(NPCNum))
End If
End Sub
```Replace with:
```
If GetVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "EXTRAS", "DOUBLEEXP") = "1" Then
Call SetPlayerExp(Index, GetPlayerExp(Index) + GetNpcExp(NPCNum))
End If
End Sub
```
```
Case 3
Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) ".ini", "EXTRAS", "DOUBLEEXP", "1")
Call PlayerMsg(Index, "For the next hour, you will have double-EXP", WHITE)
Call PlayerMsg(Index, "Please do not logout, or the item's effect will stop early", WHITE)
Call SetTimer("RemoveExp " & Index, 3600000)
Call TakeItem(Index, 81, 1)
Exit Sub
```Replace with:
```
Case 3
Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "EXTRAS", "DOUBLEEXP", "1")
Call PlayerMsg(Index, "For the next hour, you will have double-EXP", WHITE)
Call PlayerMsg(Index, "Please do not logout, or the item's effect will stop early", WHITE)
Call SetTimer("RemoveExp " & Index, 3600000)
Call TakeItem(Index, 81, 1)
Exit Sub
```
```
Case Else
Exit Sub
End Sub
```Replace with:
```
Case Else
Exit Sub
End Select
End Sub
```
```
Sub RemoveExp(Index)
Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) ".ini", "EXTRAS", "DOUBLEEXP", "0")
Call RemoveTimer("RemoveExp " & Index)
End Sub
```Replace with:
```
Sub RemoveExp(Index)
Call PutVar("Accounts\" & GetPlayerLogin(Index) & "\" & GetPlayerName(Index) & ".ini", "EXTRAS", "DOUBLEEXP", "0")
Call RemoveTimer("RemoveExp " & Index)
End Sub
```
That should be all the syntax problems. -
SetAttribute(map, x, y, attribute, data1, data2, data3, string1, string2, string3)
map, x, y: obvious
attributes (from source):
```
Public Const TILE_TYPE_WALKABLE = 0
Public Const TILE_TYPE_BLOCKED = 1
Public Const TILE_TYPE_WARP = 2
Public Const TILE_TYPE_ITEM = 3
Public Const TILE_TYPE_NPCAVOID = 4
Public Const TILE_TYPE_KEY = 5
Public Const TILE_TYPE_KEYOPEN = 6
Public Const TILE_TYPE_HEAL = 7
Public Const TILE_TYPE_KILL = 8
Public Const TILE_TYPE_SHOP = 9
Public Const TILE_TYPE_CBLOCK = 10
Public Const TILE_TYPE_ARENA = 11
Public Const TILE_TYPE_SOUND = 12
Public Const TILE_TYPE_SPRITE_CHANGE = 13
Public Const TILE_TYPE_SIGN = 14
Public Const TILE_TYPE_DOOR = 15
Public Const TILE_TYPE_NOTICE = 16
Public Const TILE_TYPE_CHEST = 17
Public Const TILE_TYPE_CLASS_CHANGE = 18
Public Const TILE_TYPE_SCRIPTED = 19
'Public Const TILE_TYPE_NPC_SPAWN = 20
Public Const TILE_TYPE_HOUSE = 21
'Public Const TILE_TYPE_CANON = 22
Public Const TILE_TYPE_BANK = 23
'Public Const TILE_TYPE_SKILL = 24
Public Const TILE_TYPE_GUILDBLOCK = 25
Public Const TILE_TYPE_HOOKSHOT = 26
Public Const TILE_TYPE_WALKTHRU = 27
Public Const TILE_TYPE_ROOF = 28
Public Const TILE_TYPE_ROOFBLOCK = 29
Public Const TILE_TYPE_ONCLICK = 30
Public Const TILE_TYPE_LOWER_STAT = 31
```data1, 2, 3: used in some tile types for integers (warp, item, etc.)
string1, 2, 3: used in some tile types for strings (notice, sign, etc.) -
If you want them to level up once they have enough experience, you need to add Call LevelUp(Index) after you set their experience. It'll only level the player up if they have enough experience, so you could put it anywhere a player gains experience for any reason and not have to worry.
-
Which version of Eclipse are you using, and where did you paste the code?
-
In this block:
```
If CanTake(Index, 178, 0) Then
Call GiveCurrency(Index, 277, 1)
Call playermsg(index, "You hand Her your graveyard key, She then hands it back", 14)
Call playermsg(index, "Thanks, I just never got to see one before!", 14)
Call playermsg(index, "She hands you 125 Gold QUEST COMPLETE", 14)
Call PutVar("Chest\" & GetPlayerName(index) & ".ini", "Chest", "Chest11", "Have")
Exit Sub
End If
Call playermsg(index, "Oh... You don't have it...", 14)
Exit Sub
End If
```The first "End If" should be "Else". -
I think "Currency" is a VBScript (and thus SadScript) keyword, so you can't use it as the name of a function. If that's not the problem, it might be because the NPCs are improperly set up. I'd make sure the NPCs have at least 1 HP if they still don't work.
-
Kinda. The way you have it there, it'll say: "Hello, young [class] come forth.", then it'll immediately say "This scripted tile has no apparent use." right after that. You should add a new case, case 1, right before case else, then cut and paste the if/elseif/end if section to case 1.
-
I can't find anything wrong with it. Perhaps it's not your MenuScripts sub, but your custom menus that are broken? Maybe you changed the menu titles or indexes around.
Perhaps you should try replacing it with your old MenuScripts and see if that actually works. If it does, then the problem is with MenuScripts, after all. Otherwise, it's elsewhere in your code. -
For the multiple ships thing, you can just do this:
Case 1
If [the player has permissions for galleon] Then
'modified sailing script
ElseIf [the player has permissions for light sloop] Then
'sailing script
End If
You only need 1 case to make it work. Also, note ElseIf is one word.
For items, you can just take everything away from the player's inventory (remember to save it to a .ini file), except the cannon, and give it back when the player steps onto land. For spells, you could do something similar.
I'll leave it to you to figure out the exact code, since you seem competent. -
Can you post your main.txt? Post a link to it, or if you want to post it here, put it in a code box ([ code] tags).
-
The only feature listed that IS scripted so far is the stacking buffs/debuffs, but I don't exactly feel like giving that out, as its author.
-
Try making sure the NPCs you're using have HP. Messages and scripts only trigger on an NPC when it has HP. (That's not really a scripting error, though…)
-
Try removing this line:
```
Player = 0
``` -
```
Dim BookPrice
Dim BookItemNum
Dim BorrowingTime
BookPrice = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookPrice") & "")
BookItemNum = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BookItemNum") & "")
BorrowingTime = Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime") & "")
If GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","Borrowing") = "Yes" Then
If BorrowingTime > 0 Then
BorrowingTime = BorrowingTime - 1
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime", BorrowingTime)
Call PlayerMsg(Index, "You have " & BorrowingTime & " borrowing time left.", BRIGHTBLUE)
End If
If BorrowingTime < 0 Then
If CanTake(Index, 4, BookPrice) = True Then
Call TakeItem(Index, 4, BookPrice)
Call PlayerMsg(Index, "You have been charged for not returning your book in the set time.", BRIGHTRED)
Else
Call PlayerMsg(Index, "You have been jailed for not returning your book in the set time, and not being able to pay.", BRIGHTRED)
Call PlayerMsg(Index, "You will get out of jail next time you log in.", BRIGHTRED)
Call PlayerMsg(Index, "You are blacklisted and can not borrow books from the library in a while.", BRIGHTRED)
Call PlayerMsg(Index, "Your book will be taken.", BRIGHTRED)
Call PlayerWarp(Index, 1, 0, 0)
Call TakeItem(Index, BookItemNum, 0)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Blacklist", 5)
Call PutVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library", "Jailed", "Yes")
End If
End If
End If
```If that doesn't work, then there's probably some bug in the .ini file itself or the code that puts values into it. -
This line:
Call PutVar(Int(GetVar("scripts\charextras\" & GetPlayerName(index) & ".ini", "Library","BorrowingTime"))-1))
Syntax is wrong. You only have the file path and header for the GetVar, and forgot it for the PutVar. -
Well, first off, you forgot some commas in Sub OnNewChar:
```
Sub OnNewChar(Index, CharNum)
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "sword", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "sword_exp", "0")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "2hsword", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "2hsword_exp", "0")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "mace", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "mace_exp", "0")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "staff", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "staff_exp", "0")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "dagger", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "dagger_exp", "0")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "throwing", "1")
Call PutVar("scripts\charextras\" & GetPlayerName(Index) & ".ini", "WEAPONS", "throwing_exp", "0")
End Sub
```I doubt that was the only problem, though. When I'm not quite so busy, I'll try to dive deeper into fixing this. -
It's been said before, but Index isn't a variable in Sub TimedEvents. If you want to get everyone to regenerate, you have to Dim Index, and add For Index = 1 To MAX_PLAYERS.
Also, if it's the time between regenerations you have problems with, you can change it in data.ini… -
Wait, I think I got this error myself a few times…
I think what causes it is if you have a menu open, and you try to add a label (or picture, or message box) with a lower index number than one you've already put in. Check to see if that's happening, and if it is, just change the indexes of the labels (or pictures etc.) so it doesn't do that.
Note: It does NOT give you this error if you're just changing a label or picture that already exists, it only happens if you're adding a new label or picture with a lower index number than one already there.
Ex:
Call CustomMenuLabel(99, etc.)
Call CustomMenuLabel(6, etc.)
will cause an RTE. -
Try re-installing the library files. I believe that's what the usual cause of RTE 339 is.
-
I don't really see why there'd be a problem, unless the folder "characters" does not exist inside the folder "scripts"… If it doesn't, add it and try again.
If it does, though, try changing:
> "" & level & ""
to
> level
Same goes for points.
If that doesn't work, just try messing around with it for a while. I've noticed that the variable never seems to be the right type you want it to be when you're working with PutVar… -
Okay, first is in the MenuScripts sub; I'm not sure if you've already fixed this one:```
If Clicked_Index = 2
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 3
Call SetPlayerFaction(Index, 2)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "2")
End If
If Clicked_Index = 4
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 5
Call SetPlayerFaction(Index, 3)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "3")
End If
If Clicked_Index = 6
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
If Clicked_Index = 7
Call SetPlayerFaction(Index, 4)
Call PutVar("/scripts/charextras" & GetPlayerName(Index) & ".ini", "Faction", "Faction", "4")
End If
If Clicked_Index = 8
Call PlayerWarp(Index, 63, 15, 15)
Call PlayerMsg(Index, "You were knocked unconcious and taken back to camp", BRIGHTRED)
End If
```Each If statement here needs a Then at the end of the line.
The next is in OnPVPDeath, there's a bunch of GetVar and PutVar statements with & floating around in them for no reason, and those need to be removed. Ex:
bounty = GetVar("bounty.ini", & GetPlayerName(Attacker),"Bounty")
reward = GetVar("bounty.ini", & GetPlayerName(Victim),"Bounty")
should be
bounty = GetVar("bounty.ini", GetPlayerName(Attacker),"Bounty")
reward = GetVar("bounty.ini", GetPlayerName(Victim),"Bounty")
And so on for the rest of the sub.
The next is in TakeItem, there's a few places where End Sub is used in place of Exit Sub. Fixed version of the sub:
```
Sub TakeItem(index, item, value)
If value = "all" Then
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, 0)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
Exit Sub
Else
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = item Then
Call SetPlayerInvItemNum(index, SLOT, 0)
Call SetPlayerInvItemValue(index, SLOT, GetPlayerInvItemValue(index, SLOT) - value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
Exit Sub
End If
End Sub
```
That should be all of the syntax errors in your main.txt. -
It looks like there were some other errors in your main as well. Try this.
edit: main removed since it was stretching the page, and I'm going to post the individual errors anyways -
Just put "walk" or "run" in there, quotes and all.
Script Not Working (SOLVED)
in Programming Questions
Posted
Other uses for speed could be special tiles/terrain (slow going on rough ground/tall grass, maybe antigrav fields that make you move really fast) or maybe as a gimmick in a special boss fight or something. There's plenty of uses for it, if you're creative. It'd be cool to have players that were slightly faster or slower than other players but not in a significant way, but that'd require source editing.