SphereCommunity
SERV.WRITEFILE??? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: SERV.WRITEFILE??? (/Thread-SERV-WRITEFILE)



SERV.WRITEFILE??? - Llirik - 09-29-2015 01:05 AM

How can I use this command:

SERV.WRITEFILE c:\sphere\accounts\sphereacct.scp Account

?

18:03:ERROR:(test.scp,6)Undefined keyword 'WRITEFILE'


RE: SERV.WRITEFILE??? - Artyk - 09-29-2015 01:37 AM

You have to enable file handling in sphere.ini in this section :
Code:
// Option flags
// Flags for options that affect server behaviour but not compatibility
// See the revisions.txt file for more details on this
// OF_NoDClickTarget        00000001 // Weapons won't open a target in the cursor after DClicking them for equip.
// OF_NoSmoothSailing        00000002 // Deactivate Smooth Sailing for clients >= 7.0.8.13
// OF_ScaleDamageByDurability    00000004 // Weapons/armors will lose DAM/AR effect based on it's current durability
// OF_Command_Sysmsgs        00000008 // Shows status of hearall, allshow, allmove... commands after toggling them
// OF_PetSlots            00000010 // Enable AOS pet follower slots on chars. If enabled, all players must have MAXFOLLOWER property set (default=5)
// OF_OSIMultiSight        00000020 // Enabling this prevents all the items inside a multi of being sent until a player enters the multi.
// OF_Items_AutoName        00000040
// OF_FileCommands        00000080
// OF_NoItemNaming        00000100 // Disable the DEFMSG."grandmaster_mark" in crafted items
// OF_NoHouseMuteSpeech        00000200 // By default players outside multis can't hear what is told inside, this flag disable this.
// OF_NoContextMenuLOS        00000400 // By default you need to be in LOS to pet/vendor to use the context menu, this flag disables this
// OF_Flood_Protection        00001000
// OF_Buffs            00002000 // Enable the buff/debuff bar on ML clients >= 5.0.2b
// OF_NoPrefix            00004000 // Add prefix "A" and "An" to itemnames or not
// OF_DyeType            00008000 // if set allows using i_dye on all t_dye_vat instead of only i_dye_tub
// OF_DrinkIsFood        00010000 // type T_DRINK will increase FOOD lvl like T_FOOD
// OF_DClickNoTurn        00020000 // the player won't turn when dclick or targ an item
// OF_Specific            01000000 // Specific behaviour, not completly tested

OF_FileCommands is what you need


RE: SERV.WRITEFILE??? - Criminal - 09-29-2015 05:57 AM

[FUNCTION DELETEFILE]
IF !(<FILE.INUSE>)
FILE.MODE.APPEND=1
FILE.DELETEFILE <ARGS>
FILE.CLOSE
ENDIF

[FUNCTION WRITEFILE]
IF !(<FILE.INUSE>)
FILE.MODE.CREATE=1
FILE.MODE.APPEND=1
FILE.MODE.WRITEFLAG=1
IF (<FILE.OPEN <STRARG <ARGS>>>)
FILE.WRITELINE <STREAT <ARGS>>
FILE.CLOSE
ENDIF
ENDIF


RE: SERV.WRITEFILE??? - XuN - 09-29-2015 04:49 PM

(09-29-2015 05:57 AM)Criminal Wrote:  [FUNCTION DELETEFILE]
IF !(<FILE.INUSE>)
FILE.MODE.APPEND=1
FILE.DELETEFILE <ARGS>
FILE.CLOSE
ENDIF

[FUNCTION WRITEFILE]
IF !(<FILE.INUSE>)
FILE.MODE.CREATE=1
FILE.MODE.APPEND=1
FILE.MODE.WRITEFLAG=1
IF (<FILE.OPEN <STRARG <ARGS>>>)
FILE.WRITELINE <STREAT <ARGS>>
FILE.CLOSE
ENDIF
ENDIF

Best way is to use these functions, here you have an example:

writefile scripts\test.scp,example_text_made_by=<name> //writefile script_file_name,data. Using this comma is mandatory.

This will output 'example_text_made_by=your_name'


RE: SERV.WRITEFILE??? - Llirik - 09-30-2015 07:37 PM

Thank you!


RE: SERV.WRITEFILE??? - invernizzi - 12-29-2016 09:59 AM

Thx a lot!