Jump to content
Sign in to follow this  
theguy0000

need a bit of help...

Recommended Posts

theguy0000

i am writing a program for phpbb that will create MODs, and it doesnt write what i tell it to write.

heres part of the code from that program (parts with ";-;-;-;-;-;-;-;-;" are where unimportant parts were taken out):

$actionMenu=GUICtrlCreateCombo ( "SQL", 85, 25, 200, 23)
$actionMenuItems=GUICtrlSetData ( -1, "COPY|DIY INSTRUCTIONS|OPEN|FIND|REPLACE WITH|AFTER, ADD|BEFORE, ADD|INCREMENT|IN-LINE FIND|IN-LINE AFTER, ADD|IN-LINE BEFORE, ADD|IN-LINE REPLACE WITH" )
;-;-;-;-;-;-;-;-;
$action = GUICtrlRead ( $actionMenu )
$actionInputText = "# " & @CRLF & "#-----[ " & $action & " ]------------------------------------------" _
 & @CRLF & "# " & @CRLF
$textInput = GUICtrlCreateEdit ( $actionInputText, 40, 117, 300, 150 )
$text = GUICtrlRead ( $textInput )
$actions = $actions & $text & @CRLF
;-;-;-;-;-;-;-;-;
FileWrite ( $mod, $actions )

so lets say i select "SQL" from $actionMenu. $textInput comes up with the following contents:

# 
#-----[ SQL ]------------------------------------------
#
i type "do something" at the end of whats already there so i end up with
# 
#-----[ SQL ]------------------------------------------
# 
do something

but, here is what gets writtin to the file:

# 
#-----[ SQL ]---------------------
#

there is no "do something" at the end. whats the problem here?

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Jos

i am writing a program for phpbb that will create MODs, and it doesnt write what i tell it to write.

heres part of the code from that program (parts with ";-;-;-;-;-;-;-;-;" are where unimportant parts were taken out):

$actionMenu=GUICtrlCreateCombo ( "SQL", 85, 25, 200, 23)
$actionMenuItems=GUICtrlSetData ( -1, "COPY|DIY INSTRUCTIONS|OPEN|FIND|REPLACE WITH|AFTER, ADD|BEFORE, ADD|INCREMENT|IN-LINE FIND|IN-LINE AFTER, ADD|IN-LINE BEFORE, ADD|IN-LINE REPLACE WITH" )
;-;-;-;-;-;-;-;-;
$action = GUICtrlRead ( $actionMenu )
$actionInputText = "# " & @CRLF & "#-----[ " & $action & " ]------------------------------------------" _
 & @CRLF & "# " & @CRLF
$textInput = GUICtrlCreateEdit ( $actionInputText, 40, 117, 300, 150 )
$text = GUICtrlRead ( $textInput )
$actions = $actions & $text & @CRLF
;-;-;-;-;-;-;-;-;
FileWrite ( $mod, $actions )

so lets say i select "SQL" from $actionMenu. $textInput comes up with the following contents:

# 
#-----[ SQL ]------------------------------------------
#
i type "do something" at the end of whats already there so i end up with
# 
#-----[ SQL ]------------------------------------------
# 
do something

but, here is what gets writtin to the file:

# 
#-----[ SQL ]---------------------
#

there is no "do something" at the end. whats the problem here?

<{POST_SNAPBACK}>

What is the returncode from FileWrite ?

$rc=FileWrite ( $mod, $actions )

Make sure its 1 else the write failed...


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
theguy0000

return code...?

meh, heres the whole file:


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Jos

return code...?

meh, heres the whole file:

<{POST_SNAPBACK}>

Meh ??????????

Don't think this statement is at the right spot :

$text = GUICtrlRead ( $textInput )

You want the read the information from the field only at Save() time...

In func Save() you set $action to a string and never change it anymore... so how do you expect that the text from the edit field gets into the file ?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
theguy0000

$action and $actions are two seperate variables if that was missed...

but sorry, i dont get what you're saying.

and $text has to be declared there otherwise how can it do

$actions = $actions & $text & @CRLF
? Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Valuater

change this area

#comments-end
    $actionInputText = "# " & @CRLF & "#-----[ " & $action & " ]------------------------------------------" & @CRLF & "# " & @CRLF
    $textInput = GUICtrlCreateEdit ( $actionInputText, 40, 117, 300, 150 )
    
EndFunc
Func update()
    $text = GUICtrlRead ( $textInput )
    $actions = $actions & $text & @CRLF

    $fileName=InputBox ( "Save as...", bla bla.................

hope it helps

8)

EDIT and you will need to declare.... i do it like this

Dim $file = "", $actions = "", $action = "", $text = "", $TextInput = ""

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
Valuater

another suggestion...

look at removing this area

$fileName=InputBox ( "Save as...", "Type the file name you would like to save the mod as. (don't forget to add .mod or .txt"_
    & " at the end, or you will end up with an unusable file!)")
    If $fileName = 2 Then Exit
    global $file=InputBox ( "Save as...", "Type the location of where to save the mod file:", @HomeDrive & @HomePath & "\" & $fileName, "", _
    -1, -1, 0, 0)
    If $file = 2 Then Exit

because it's not real clean and the user has to type the location

replace it with this

$file = FileSaveDialog( "Type the file name you would like to save the mod as.",  @HomeDrive & @HomePath & "\", "Mod File (*.mod)", 3 + 16)
; option 3 = dialog remains until valid path/file selected

you would need to change your script just a little

like remove

_FileCreate ( $file )

just an idea that i think will improve your scripts overall utility

Hope it helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
theguy0000

change this area

[...]

hope it helps

8)

EDIT and you will need to declare.... i do it like this

Dim $file = "", $actions = "", $action = "", $text = "", $TextInput = ""

8)

<{POST_SNAPBACK}>

change it to what?

thanks


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Valuater

change it to what?

thanks

<{POST_SNAPBACK}>

Just look at these few lines on your original code....

move these two lines

$text = GUICtrlRead ( $textInput )

$actions = $actions & $text & @CRLF

into the update() function

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites
SupraNatural

Do you realize that if you go to actions, pick one and hit add then switch to mod info the edit box stays there. You should make a child window for actions.


Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Share this post


Link to post
Share on other sites
theguy0000

Valuater, after i do what you said, it comes up with this error

C:\Documents and Settings\hp\My Documents\AutoIt\MODmaker\MODmaker.au3(96,35) : WARNING: $textInput: possibly used before declaration.

$text = GUICtrlRead ( $textInput )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\hp\My Documents\AutoIt\MODmaker\MODmaker.au3(96,35) : ERROR: $textInput: undeclared global variable.

$text = GUICtrlRead ( $textInput )

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\Documents and Settings\hp\My Documents\AutoIt\MODmaker\MODmaker.au3 - 1 error(s), 1 warning(s)

>AU3Check Ended with Error(s).

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Valuater

Valuater, after i do what you said, it comes up with this error

<{POST_SNAPBACK}>

as i previously stated

EDIT and you will need to declare.... i do it like this

Dim $file = "", $actions = "", $action = "", $text = "", $TextInput = ""

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
theguy0000

where would i do that?


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
Valuater

where would i do that?

<{POST_SNAPBACK}>

Your original code

#comments-start
                          phpBB MOD maker
                         version 0.1.8 beta
                    Created by msr2 and bojak71730
             Also, thanks to LxP for fixing major read and write issues
                        Written using AutoIt3
                     http://www.autoitscript.com
#comments-end
#region general preparation
; everything in this region does the necesary actions to prevent errors and/or warnings when running the script
#include <GUIConstants.au3>
#include <file.au3>
$file = ""
$actions = ""
$action = ""
$text = ""
#endregion
#region GUI
GUICreate("phpBB MOD maker")

change it to

#comments-start
                          phpBB MOD maker
                         version 0.1.8 beta
                    Created by msr2 and bojak71730
             Also, thanks to LxP for fixing major read and write issues
                        Written using AutoIt3
                     http://www.autoitscript.com
#comments-end
#region general preparation
; everything in this region does the necesary actions to prevent errors and/or warnings when running the script
#include <GUIConstants.au3>
#include <file.au3>

Dim $file = "", $actions = "", $action = "", $text = "", $TextInput = ""

#endregion
#region GUI
GUICreate("phpBB MOD maker")

got it ??? and it works right ???

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites
theguy0000

works prfect, thanks!

supranatural, thanks, i will do that.


The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites
SupraNatural

Can i ask why that made a difference? I mean why did moving it and the changing it to dim help? I guess i should read up more on dim.

@theguy0000

I was once a frequent phpbb user and what i found most annoying was staring at those txt documents when adding a mod, my suggestion to you is also to make a mod reader, i think it would be popular. Ex:

Files To Edit:

index.php

cash.php

othershit.php

Sql to change:

Whole bunch of crazy shit!

Edited by SupraNatural

Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Share this post


Link to post
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
Sign in to follow this  

×