Reflex
Journeyman
Posts: 130
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Apr 2012
Reputation: 1
|
RE: first letter in the string
STRSUB will do this you can learn more about strings @ http://wiki.sphere.torfo.org/index.php/C..._10#STRSUB
Example from my Bank Check
Code:
ON=check*
IF (!(<ISEMPTY <STREAT <ARGS>>>))
IF (!(<ISNUM <STREAT <ARGS>>>))
SAY @946,3,1 You must say a value for your check.
ELSE
LOCAL.VALUE=<STREAT <ARGS>>
IF (<LOCAL.VALUE> > 10000000)
SAY @,,2 1010007
ELIF (<LOCAL.VALUE> < 10000)
SAY @,,2 500383
ELIF (<SRC.GOLD> < <LOCAL.VALUE>)
SAY @,,2 500380
// ^^ Checks for the Check
ELIF (<LOCAL.VALUE> >= 10000) && (<LOCAL.VALUE> <= 99999)
LOCAL.NEWHALF=<STRSUB 0 2 <dLOCAL.VALUE>>
LOCAL.NEWHALF2=,<STRSUB 2 3 <dLOCAL.VALUE>>
SRC.SYSMESSAGELOC -1,1042765,<dLOCAL.VALUE>
SERV.NEWITEM=i_check
NEW.TAG0.GOLDVALUE=<LOCAL.VALUE>
NEW.NAME=Check [<dLOCAL.newhalf><LOCAL.newhalf2>]
NEW.BOUNCE
SRC.GOLD -=<LOCAL.VALUE>
// Amount check so we know where to place comma
ELIF (<LOCAL.VALUE> >= 100000) && (<LOCAL.VALUE> <= 999999)
LOCAL.NEWHALF=<STRSUB 0 3 <dLOCAL.VALUE>>
LOCAL.NEWHALF2=,<STRSUB 3 3 <dLOCAL.VALUE>>
SRC.SYSMESSAGELOC -1,1042765,<dLOCAL.VALUE>
SERV.NEWITEM=i_check
NEW.TAG0.GOLDVALUE=<LOCAL.VALUE>
NEW.NAME=Check [<dLOCAL.newhalf><LOCAL.newhalf2>]
NEW.BOUNCE
SRC.GOLD -=<LOCAL.VALUE>
// Amount check so we know where to place comma
ELIF (<LOCAL.VALUE> >= 100000) && (<LOCAL.VALUE> <= 9999999)
LOCAL.NEWHALF=<STRSUB 0 1 <dLOCAL.VALUE>>
LOCAL.NEWHALF2=,<STRSUB 1 3 <dLOCAL.VALUE>>
LOCAL.NEWHALF3=,<STRSUB 3 3 <dLOCAL.VALUE>>
SRC.SYSMESSAGELOC -1,1042765,<dLOCAL.VALUE>
SERV.NEWITEM=i_check
NEW.TAG0.GOLDVALUE=<LOCAL.VALUE>
NEW.NAME=Check [<dLOCAL.newhalf><LOCAL.newhalf2><LOCAL.newhalf3>]
NEW.BOUNCE
SRC.GOLD -=<LOCAL.VALUE>
// Amount check so we know where to place comma
ELIF (<LOCAL.VALUE> == 10000000)
LOCAL.NEWHALF=<STRSUB 0 2 <dLOCAL.VALUE>>
LOCAL.NEWHALF2=,<STRSUB 2 3 <dLOCAL.VALUE>>
LOCAL.NEWHALF3=,<STRSUB 3 3 <dLOCAL.VALUE>>
SERV.NEWITEM=i_check
NEW.TAG0.GOLDVALUE=<LOCAL.VALUE>
NEW.NAME=Check [<dLOCAL.newhalf><LOCAL.newhalf2><LOCAL.newhalf3>]
NEW.BOUNCE
SRC.GOLD -=<LOCAL.VALUE>
SRC.SYSMESSAGELOC -1,1042765,<dLOCAL.VALUE>
// incase i forgot something..
ELSE
SAY @946,3,1 A check must be made in the amount between 10,000 and 10,000,000 Gold.
ENDIF
ENDIF
ENDIF
|
|
04-21-2012 08:43 PM |
|
|