ID:167049
 
How do i add cheat words that you type into the 'say' thing and it like increases your wealth or your hp no matter how many times you put it in?
if you have a proc for say this might work(..not sure if it will work...just trying to help.)
mob/proc/CHEAT()
if(usr.say<<"ghfhj")
usr.Wealth+=1000
usr.Health+=1000
else
..()
In response to Dragon_Fire6564
how do you make a proc for say?
In response to VolksBlade
mob/proc/Say(T as text)
if(T == "Cheat Code") //cheat code in here
src.gold += 1000 //effect of code in here
src.health += 1000 //effect of code in here
else //if it isn't the cheat code
view()<<"[src] says: [T]" //proceed with say verb

In response to VolksBlade

mob/proc/Say(msg as text)
view()<<"[usr] Says : [msg]"

thats the proc
mob/verb/say()
usr.Say()

thats the verb with the proc being called
mob/verb/Say(T as text)
if(T=="LOLICHEAT")
src.gold+=100000
else
world<<"[src]: [T]"
client/command_text="say \"" //automatically press the speech bubble upon login for you
mob
verb
say(t as text|null)
if(!t)return
if(length(t)>355)t=copytext(t,1,355)
t=html_encode(t)
t=dd_replacetext(t,"\n","\\n")
if(t=="yet another generic random cheatcode")
wealth++ //add 1 to wealth
viewers()<<"<b>[src]</b>: [t]"


If you want it to be one-use only, see this example:

client/command_text="say \"" //automatically press the speech bubble upon login for you
mob
var/list/cheated
verb
say(t as text|null)
if(!t)return
if(length(t)>355)t=copytext(t,1,355)
t=html_encode(t)
t=dd_replacetext(t,"\n","\\n")
if(cheated&&!(t in cheated))
switch(t)
if("yet another generic random cheatcode")
if(!cheated)cheated=new/list()
wealth++ //add 1 to wealth
cheated+=t
if("I want HP!")
if(!cheated)cheated=new/list()
hp++ //add 1 to hp
cheated+=t
viewers()<<"<b>[src]</b>: [t]"
view_cheat()
if(cheated&&cheated.len)src<<"You have cheated [cheated.len] times."
else src<<"You have never cheated."


I'll give you a warning: if you use the former, you will most likely get players who find out that by typing "I like this game." they get 10 gold and start spamming it to keep getting 10 gold.

01000100011000010111010001100001
The easiest way is just to use the 'set hidden = 1' setting for verbs.
In response to Android Data
My only concern in your code Andriod Data is the dd_replacetext(). I'm pretty sure that isn't a built in proc.

What library did you use?
In response to Crzylme
Crzylme wrote:
My only concern in your code Andriod Data is the dd_replacetext(). I'm pretty sure that isn't a built in proc.

What library did you use?
Whoops. I directly copied/pasted it, because I use it in all of my projects. It uses hub://Deadron.TextHandling, which is a free library. Alternatively, you can remove the dd_replacetext() entry, but this will allow players to use the \n macro to create newlines, which can be used for spamming purposes.
In response to Foomer
Foomer wrote:
The easiest way is just to use the 'set hidden = 1' setting for verbs.
Granted, my method uses five extra characters (oh my!), your method is not so handy: the say verb will not appear in the command list if you press the spacebar without any command entered, but will instead have to be typed in it's entirity because it's invisible. By using set category=null, the verb remains visible in the list, making command inputs easier. For instance, some people want to have the speech bubble button turned off and type "sa <SPACE>" to begin writing a message. For these people, it would not be in their favor if the say verb would be hidden.

The set hidden=1 instruction should only be used if you want to hide the verb entirely. Please, get rid of your habit.
In response to Android Data
I believe what foomer means is:

mob/verb/CheatCode()
set hidden = 1
src.gold+=1000000000
In response to Airjoe
I'm pretty sure thats what I meant, but I'm still trying to figure out what HE meant.
In response to Foomer
I agree. No idea why people would use procs and stuff.
In response to Foomer
Foomer wrote:
I'm pretty sure thats what I meant, but I'm still trying to figure out what HE meant.
He ment that if a player says something, the player gains HP, and if the player says something else the player gains money. set hidden=1 would be useful for the purpose of hiding the cheatcodes if they were all seperate verbs, but they're not; they're called if you speak a naughty word.
mob
verb
Say(t as text)
set category = "Commands"
if(!t)return
var/hm = lowertext(t)
if(findtext(t,"\n")) return
if(findtext(hm,"cheatzz")
usr.health += 10
return //return so it doesnt keep going and display the cheat to view.
view() << "usr] says: [t]"
In response to Evidence
Evidence wrote:
> mob
> verb
> Say(t as text)
> set category = "Commands"
> if(!t)return
> var/hm = lowertext(t)
> if(findtext(t,"\n")) return
> if(findtext(hm,"cheatzz")
> usr.health += 10
> return //return so it doesnt keep going and display the cheat to view.
> view() << "usr] says: [t]"
>
>

1. It was already answered.
2. You don't prevent HTML from being used, you just discard the message if there's a newline in it (sometimes it happens accidental), you mistyped [usr] and someone may say "if you say cheatzz then you get 10 health" and it'd still return, which is annoying, espessially for Volks if he wants to tell others a cheat.

The only good thing I can find using your method is the lowertext() which makes things easier, but even then, most cheatcodes would probably have different caps in them to make it harder to guess.

3. For Volks: yes, it would be better if the cheatcodes were a part of the name of the player, to make things harder to guess. Such a system would be easy to create.
In response to Android Data
The lowertext() in there is bogus anyway.
findtext() treats all letters lowertext to begin with, FindText() on the other hand is case-sensitive.
In response to Smoko
Depends on how everything is being called. I normally call most things though procs because they get called by things like Topic(), Login(), and a few other built in procs. So you just pass info from verb/Say() to proc/RSay() or something like that.
In response to Android Data
Ah. I was understanding his reference to the "'say' thing" as meaning the bar where you type stuff in.