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 / A propeties file....

Author
Message
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 29th Apr 2012 02:20 Edited at: 25th Nov 2016 19:40
---
cheers
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 29th Apr 2012 02:21
*Yeah, forgot to say, it doesnt work

//Anton
Kobaltic
12
Years of Service
User Offline
Joined: 24th Jan 2012
Location: PA, USA
Posted: 29th Apr 2012 06:44
try this in the do loop, not sure if it will work

Auger
12
Years of Service
User Offline
Joined: 21st Aug 2011
Location: Out There
Posted: 29th Apr 2012 08:01
Have you checked the value of "a" before it reaches the second part of your code?

Might be a Variable scope issue as in it might need to be declared globally.
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 29th Apr 2012 11:21
Do a print(a) to see the value of a, I guess it's neither 1 or 2.

btw, why not just use: playmusic(a) instead of doing the IF commands?

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Apr 2012 14:56 Edited at: 29th Apr 2012 14:57
Might be simply because it is treating the file as a string, rather than an integer? You could try using this between your open code parts.

As Impetus says, if you are setting up the music with a text file why not just use this. If the file is being read correctly you don't need the if checks.

If the file is being read correctly you don't need the if checks.

Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 29th Apr 2012 21:02
Ok, Ive found the problem, having already created the text file and making sure that is only contained "1", when I call the print command, apparently if I define a as an integer its = 0 and if I define a$ as a string then its = "" (nothing). It seams to be having problems reading the file. Could this be becuase of administrator restrictions making a lot of actions "Access deneid" because im in the "Program files"??

//Anton
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 29th Apr 2012 21:23
I'm not sure if AppGameKit can read from "normal" TXT files, you'll have to use AppGameKit to create the file in the first place. I think a "normal" TXT file, has headers and extra data, that confuses AGK.

----------------
AGK user - novice
Did Amiga / AMOS programming in the 90's, just started programming again with AGK.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Apr 2012 22:46
Quote: "I'm not sure if AppGameKit can read from "normal" TXT files, you'll have to use AppGameKit to create the file in the first place. I think a "normal" TXT file, has headers and extra data, that confuses AGK."


Nah, a text file is only text, with no hidden data. AppGameKit can read this fine.

"here is a an expression to remember - He who has the gold makes the rules."
Paypal disagreed!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 30th Apr 2012 00:28
Quote: "Nah, a text file is only text, with no hidden data. AppGameKit can read this fine."

That's right. You can read strings directly from a text file as well as most other standard "text" based files such as html, xml etc.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 30th Apr 2012 01:16 Edited at: 30th Apr 2012 01:19
If you want to manually control the contents of the file (outside of the game) and treat it as a normal .txt file, you don't use the Read/Write(Integer|Float|String). Those work in a binary file mode, not a plain text mode.

Plain text files use Write/ReadString.

Here are the functions I currently use for plain text files (some are commented better than others):


'ta_' stands for 'Triassic Associates, Inc. function/data'. Triassic Associates, Inc. is my company, and I am the only entity in it.

Cheers,
Ancient Lady
Auger
12
Years of Service
User Offline
Joined: 21st Aug 2011
Location: Out There
Posted: 30th Apr 2012 01:59
As Ancient Lady has already posted your problem is that your trying to read in a text number instead of a binary number.

If you wanted to use ReadInteger you'd first have to save out the file as binary. Here's some code for that



Your best bet would be just use plain text and then just
convert the string to an integer using Val()



Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 30th Apr 2012 11:13
Ok, so thanks to you guys, I got the files working and a propper value is now being printed! However, when I use Cyberspace's code:

nothing plays, and I am sure that I have got a music file assigned to 1.

Edit: Ok nothing to worry about now! I got it playing, but only when the top bar is held. Working on a solution now. Thanks alot guys

If anyone was interested here is what I did:
Firstly I created a new textfile using agk, and then using the (Val(a$)) = blabalblah thing I got the if argument to work too.

//Anton
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 30th Apr 2012 13:27
Ok no more help is needed, got the properties file system working for audio and music! Thanks for the help. My project now has 367 lines of code for setup and the menu's

//Anton

Login to post a reply

Server time is: 2024-05-04 15:35:12
Your offset time is: 2024-05-04 15:35:12