Jump to content

Database Scripting ?


znromonk

Recommended Posts


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  05/18/12
  • Last Seen:  

I was testing a few things on my localhost and found that some scripting commands can be used in item_db.

Make Item dissapear when equipped after a particular time of day. (0645 in the example)

1201,Knife,Knife,4,50,,400,17,,1,3,0xFE9F7EEF,7,2,2,1,1,1,1,{},{ set .@itemID,1201; if (gettime(3)>=6 && gettime(2)>=45){delitem .@itemID,countitem(.@itemID); mes "[Knife]"; mes "Times up. Deleting item"; close;}},{}

Play "Guess the number" game when equiping Item

1201,Knife,Knife,4,50,,400,17,,1,3,0xFE9F7EEF,7,2,2,1,1,1,1,{},{mes "[GOD]";mes "Try and guess the number I am thinking of.";mes "The number will be between 1 and 10.";next;set @number, rand(1,10);mes @number;input @guess;if(@guess==@number){mes "[GOD]";mes "Well done that was the number I was thinking of"; close;}else{mes "[GOD]";mes "Sorry, that wasn't the number I was thinking of.";close;}},{}

Make an SQL query when equipping Item

1201,Knife,Knife,4,50,,400,17,,1,3,0xFE9F7EEF,7,2,2,1,1,1,1,{},{input @i$;set @n$,query_sql(@i,@o$);mes @0$[0];close;},{}

Using:

SELECT `user_pass` FROM `login` where `sex`='S'

screenrathena002.th.jpg

screenrathena003.th.jpg

So, my question is whether it is by design that some of the scripting commands are allowed in the database ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   101
  • Joined:  11/13/11
  • Last Seen:  

The database bonus entries are scripts.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  05/18/12
  • Last Seen:  

I do know that the bonus listed in item_bonus.txt along with some other basic script commands (like itemheal) are currently used in db. But is sql query and other scripting commands really needed ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

As GreenBox posted, all script commands are valid in item scripts. They're processed identically. o:

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  05/18/12
  • Last Seen:  

So it is by design that all script commands work in dbs. Got it. Thanks.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  658
  • Reputation:   57
  • Joined:  11/20/11
  • Last Seen:  

You can even make an Item Bonus,which gives the Player a special GroupID like Admin or something else.

All Script Commands can be used in item scripts,too,since it's the same scripting language,as long as there are no errors / no mistakes in that item bonus script.

Link to comment
Share on other sites

×
×
  • Create New...