• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How do I capture the parameters typed after spell words?

Drakkhan

Illuria Project Lead
Joined
Oct 3, 2013
Messages
141
Reaction score
22
Consider the spell:

Heal Friend --> exura sio "John"

The string "John" is mysteriously transferred into the (table?) variable "var" in the spell's lau script:

function onCastSpell(cid, var)

How do I use var as a string variable? I want to be able to use the string "John" in my code within the onCastSpell() function...

Regards,

Drakkhan
 
SOLVED: Extensive searching through code produced that var has different types that can be accessed. Consider the following bit of useless code for example:

Code:
local type = var.type
--in the above line, type will be an integer
--that references what "type" of parameter
--was put into 'var' (usually this type
--relates to numbers, or text).

local num = var.number
--in the above line, if var.type is a number
--type, 'num' will be an integer which is the
--number value of the input parameter (in
--my case, the string "John" was processed
--and var.number stored John's CID number)

local str = var.text
--in the above line, if var.type is a text type,
--'str' will be a string which is the text value
--of the input provided by the user. I have
--not witnessed this case, yet.

--The solution to my problem
local str = getPlayerName(var.number) --str is "John"
 
No Problem. I usually post my questions here early in the evening and then, as long as no one solve them for me, I try to solve them myself... I hate to be the person who's like "SKRIPT PLSPLSPLS!!!" So I come back and share my results :D
 
Back
Top Bottom