Jump to content

Need help with a string problem (I think we had a misunderstanding)


Recommended Posts

I am trying to make a text based adventure game, but I want to add cheat codes to it, so you just type in the code and it gives you a bonus or something. That is why I needed to know how to do it. I will just say the problem again. I wanted it to concatenate x amount of any letter you type to a string whilst the program is running. Sorry if it bothers you for me to remake the topic :/

Link to comment
Share on other sites

  • Moderators

NewNinja,

A simple question - in this game do you intend to have some form of input or edit control into which you type and then press a button/Enter key to start parsing the text, or are you looking to read all the user keypresses without them ever being displayed on screen? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Well I want it that people will not know that you can cheat on it, I think that is what some of the fun is. I just need something which will be able to read what the user types in then it anaylses the whole string to see if it has the cheat code in. If you think someone is going to use the code as a key logger you can just message it to me?

Edited by NewNinja
Link to comment
Share on other sites

  • Moderators

NewNinja,

That does not answer the question I asked. What code have you got so far to read the user's input? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Here is all of my code so far

$run = True
$Main = GUICreate("Adventure Game", 250, 100)
$character_setup = GUICtrlCreateInput("Replace this text with you adventurer's name", 10, 10, 230, 20)
$cheatcodestring = ""
$start = GUICtrlCreateButton("Start the Adventure!", 10, 40, 230, 30)
GUISetState(@SW_SHOW, $main)
while $run = True
Switch GUIGetMsg()
     Case - 3
      Exit
EndSwitch
; Then the code for recognizing the cheatcode goes here
    if $cheatcodestring = "super" Then
   
    EndIf
WEnd
Edited by NewNinja
Link to comment
Share on other sites

  • Moderators

NewNinja,

And how will you proceed during the game? Will the user always type into that GUI or some other input control? How are you filling that $cheatcodestring variable? ;)

I am trying very hard to find a reason not to lock this thread and you are not being very helpful. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

sorry for the late reply,

It is just going to be a series of text boxes with two buttons which will change the outcome. The user must choose the right options to get the successful outcome. After typing in your name you are only going to be clicking buttons. Could you explain what you mean by filling the $cheatcodestring variable? sorry :s

Link to comment
Share on other sites

  • Moderators

NewNinja,

Could you explain what you mean by filling the $cheatcodestring variable?

You start off with an empty variable:

$cheatcodestring = ""

and later in the script check it:

if $cheatcodestring = "super" Then

So the question is - How do you get a value into that variable? If you are going to parse the content of your "series of text boxes" then there is no problem at all. If you are looking to intercept keystrokes made when no such "text box" is on the screen then you have a problem because that would require keylogger-type code which is one of the real no-noes here.

Is that clear enough to get a clear answer from you? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...