Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Excel to AGK2 - Copy text

Author
Message
kozma_11
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location: Scotland
Posted: 29th Oct 2016 15:08
Hi,

I use Excel to write some code for AGK2 (to build some of my functions that have a large number of variables that I like to tweet en mass using Excel) but I always struggle to get the text from Excel to AGK. I've tried loads of things like saving as different .txt files and tried copying from them to AppGameKit but I still have problems. It will usually compile Ok, but once I add some more code I'll start getting loads of GOTO errors during compiling. The debugger will take me to a line that I've pasted in and it will be fixed if I go to the start of the next line, hit del to jump back up to the end of the previous line then hit enter again. I think it's because Mac Excel adds a certain character at the end of each line when you save it as text that AppGameKit doesn't like? I've tried some VBA functions to export the text in a minimalistic form but still get the errors.

Any ideas on how to copy code from excel to AppGameKit would be appreciated

Thanks!
John
El Presidente
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Oct 2016 17:19
Umm, Excel and AppGameKit are two entirely different programs. You can't simply copy cell functions or macros into agk and expect it to work. You need to convert it to agk code. manually.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Oct 2016 17:32
I think this is regarding using Excel to write AppGameKit code, not using Excel code in AGK.
I don't use Mac Excel because of it's limitations and quirks. But if you have the built-in constant VBCrLf (Visual Basic Carriage Return Line Feed) then you should add this to the end of each line with a macro.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
nickele upgraded
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Birthplace of Democracy
Posted: 29th Oct 2016 20:01
Forgive me if I say something stupid, but can't Excel save in 'csv' format?
It is basically plain text and can be easily read by txt readers & pasted to AGK2.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Oct 2016 21:49
Ok I'm totally lost. Why would anyone want to write agk code in Excel? Yes Excel can save a CSV file. But I'm not understanding what or why you're trying to do this.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 29th Oct 2016 22:47 Edited at: 29th Oct 2016 22:48
I do something similar for generating SQL statements. Using a really simple example, you need to insert 500 values into a table, all listed in a worksheet. Then in another worksheet you write the SQL with a place holder:

Insert into myTable (Field1) Values(&VAL)

Then you write a macro that writes out one row per value to a text file. As it writes them out, the placeholder &VAL is replaced by the value in the main worksheet.

This is in its simplest form. In reality the SQL is many lines long and quite complex, with many placeholders and additional logic to build the statements. I guess Kozma is doing the same to generate repetitive code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Nov 2016 14:10
i believe in excel is the new line only cr and not cr lf.
you can see the hidden chars in notepad++ as small icons.

AGK (Steam) V2.0.21 : Windows 10 Pro 64 Bit : AMD (16.6) Radeon R7 265 : Mac mini OS Sierra (10.12)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 2nd Nov 2016 15:47
Quote: "Any ideas on how to copy code from excel to AppGameKit would be appreciated"

Copy to notepad first, then recopy to AGK.
kozma_11
21
Years of Service
User Offline
Joined: 17th Sep 2003
Location: Scotland
Posted: 6th Nov 2016 18:09
Thanks for the replies everyone! BatVink is right in terms of how I use Excel to write AppGameKit functions.

I used to run Windows on my mac and think I used to copy to word or notepad before and it worked but now I don't have Windows installed, I've tried it in textedit and it doesn't work. I've tried exporting as CSV but it always adds ' " ' on some lines so makes it a hassle to fix once it's in AGK.

Good news though, I've tried using an online text editor - http://www.rapidtables.com/tools/notepad.htm - and it does the job. Copy to there, then copy to AppGameKit and no errors! Woohoo!

John
El Presidente

Login to post a reply

Server time is: 2024-11-25 02:14:32
Your offset time is: 2024-11-25 02:14:32