Eclipse
January 05, 2009, 09:56:55 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Chat Help Rules Arcade Search Calendar Gallery Login Register  
 
 
 
Recent Topics +-
Lostica [Project Revamp] by MrMiguu™
Today at 09:56:40 PM

Actual Map for the continents by Kreator
Today at 09:52:06 PM

Disparity Recruiting by Peter
Today at 09:49:31 PM

Okay Questions (very noob person here) by The Roujo
Today at 09:48:45 PM

fun with photoshop by MrMiguu™
Today at 09:48:19 PM

stackable items? by MrMiguu™
Today at 09:45:06 PM

scripts? by MrMiguu™
Today at 09:44:14 PM

Party system : is it possible? by MrMiguu™
Today at 09:43:48 PM

Which version of eclipse do you like most for sadscripting? by Kainan54
Today at 09:42:38 PM

Count to 1,000,000! by The Roujo
Today at 09:41:11 PM

Members Online +-
10 Guests, 20 Users
MrMiguu™,
Sablefalcon,
‪‫‬‭‮‪‫‬‭The Admiral,
Kreator,
Amperglyph,
Baron,
HawkStorm95,
Haruhito,
waffletamer,
Peter,
‪‫‬‭‮‪‫Kusy,
The Roujo,
shakadaran,
Simius Cruentus,
hammer,
FS:CG Admin[Shadowwulf],
dragonlord52,
dg1423,
Mitus,
Kainan54
Pages: [1]
  Print  
Author Topic: New functions! [1/5]  (Read 1804 times)
0 Members and 1 Guest are viewing this topic.
Godlord
Stephanus sum
Veteran
Teh Uberleet
*
Offline Offline

Posts: 4,109


View Profile WWW Email
« on: January 20, 2007, 06:36:02 AM »



I've made some easy functions for Sadscripting... You can use them if you want.
Quote
Non-scripter[1/5]
Beginner[1/5]
Advanced Scripter[1/5]
Expert[1/10]
Pro[1/100]

Code:
Code: [Select]
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
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
End If
End Sub

Function:
TakeItem(index, item, value)
value can be:
Quote
all(to take away all items)
0(if it is a non-stackable item)
1 or higher(if it is a stackable item)


Code:
Code: [Select]
Sub GiveItem(index, item, value)
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = 0 Then
Call SetPlayerInvItemNum(index, SLOT, item)
Call SetPlayerInvItemValue(index, SLOT, value)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub

Function:
GiveItem(index, item, value)
Quote
0(if it is a non-stackable item)
1 or higher(if it is a stackable item)


Code:
Code: [Select]
Sub ChangeItem(index, olditem, newitem, newval)
SLOT = 1
Do While SLOT < 24
If GetPlayerInvItemNum(index, SLOT) = olditem Then
Call SetPlayerInvItemNum(index, SLOT, newitem)
Call SetPlayerInvItemValue(index, SLOT, newval)
Call SendInventoryUpdate(index, SLOT)
SLOT = 24
End If
SLOT = SLOT+1
Loop
End Sub

Function:
ChangeItem(index, olditem, newitem, newval)
olditem = The Old Item
newitem = The New Item
newval = The New Value
This gives you a new function to change an old item to a new item :P.


Code:
Code: [Select]
Sub lockall(index, mode)
If mode = "true" Then
lockall = true
Elseif mode = "false" Then
lockall = false
End If

Add this under Sub OnAttack:
Code: [Select]
If lockall(index, mode) = true Then
Exit Sub
End If

Function:
lockall(index, mode)
Locks all the attacks of the player. (If it is set to true)
Mode is true or false.


Code:
Code: [Select]
Sub LoginCount(mode)
If LoginCount = "" Then
LoginCount = 0
End If
If mode = "+" Then
LoginCount = LoginCount + 1
Elseif mode = "-" Then
LoginCount = LoginCount - 1
End If
End Sub

Add this in Sub JoinGame above End Sub:
Code: [Select]
Call LoginCount("+")
Add this in Sub LeftGame above End Sub:
Code: [Select]
Call LoginCount("-")
Function:
LoginCount(mode)
mode is + or -
Quote
+ adds 1
- removes 1
This is to count the players online.


New commands in SadScript:
Quote
TakeItem(index, item, value)
GiveItem(index, item, value)
ChangeItem(index, olditem, newitem, newval)
lockall(index, mode)
LoginCount(mode)
Godlord
Stephanus sum
Veteran
Teh Uberleet
*
Offline Offline

Posts: 4,109


View Profile WWW Email
« Reply #1 on: January 22, 2007, 07:36:40 AM »

I've made a new function :D, ChangeItem(index, olditem, newitem, newval) it changes an old item to a new item, enjoy it :P.
kenny
Eclipse Gfx/scripter
Advanced Eclipser
*****
Offline Offline

Posts: 1,238


~Good Scripter~


View Profile WWW Email
« Reply #2 on: December 22, 2008, 05:45:55 AM »

just saw this thread and not sure if anyone noticed on the sub lockall(index, mode) there is no end sub, if someone just copys the script then it will bug their main. Probably best if a mod or someone fixes it.
Godlord
Stephanus sum
Veteran
Teh Uberleet
*
Offline Offline

Posts: 4,109


View Profile WWW Email
« Reply #3 on: December 22, 2008, 10:03:04 AM »

This topic is out-dated and lockall should make use of an array to prevent some other bugs.


Regards,
  Godlord.
Pages: [1]
  Print  
 
 

Powered by EzPortal
Powered by MySQL Powered by PHP Powered by SMF 2.0 Beta 4 | SMF © 2006–2008, Simple Machines LLC | Sitemap Valid XHTML 1.0! Valid CSS!
Page created in 0.368 seconds with 32 queries.