GTA: Modification Area

A website for the GTA modding scene

Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Big-game starts raising Schneider's profile
Sun Mar 04, 2012 2:28 am by lavivi

» [Help] cleo created lighting
Thu Oct 14, 2010 1:03 am by findmy012

» Mission Question
Thu Oct 14, 2010 1:02 am by findmy012

» [IV] Spoiler Script
Thu Oct 14, 2010 1:02 am by findmy012

» Mission mod [help]
Sat Sep 18, 2010 5:50 pm by jayd00

» Bc7 Mod Help
Fri Aug 20, 2010 11:19 am by pengpeng

» Found a bug
Fri Dec 18, 2009 4:22 am by _CJ360_

» [IV] Novitec Rosso 599 GTB
Tue Nov 17, 2009 4:22 pm by Kotton

» Hello/Guidance Request
Mon Oct 12, 2009 6:45 am by Adler

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Affiliates
image

Image

Image

Image

Image

Image

Image

Image

Image

Image

image

Image

steve-m.com

Image


----- Русский -----

Если ваш сайт содержит большую коллекцию SCM/CLEO-скриптов (больше 16), напишите на мой e-mail, и я добавлю его в список. Приветствуются скрипты, которые не встречаются на других сайтах ... Спасибо. ))))


----- English -----

If your website has a big enough collection of SCM/CLEO scripts (more than 16) notify me by e-mail
, and I will add it to the list. The unique scripts are preferable ... Thank you. ))))

Log in

I forgot my password



December 2016
MonTueWedThuFriSatSun
   1234
567891011
12131415161718
19202122232425
262728293031 

Calendar Calendar


You are not connected. Please login or register

Read/Write Text Files

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Read/Write Text Files on Mon Sep 07, 2009 8:10 am

I was wondering if there was any way to read or write to a TEXT file... Although Sanny says that the opcode for read/writing can write to a text file, it writes to the file in binary format (for some reason).

Yet somehow a few clever people have managed to write plain text files (using hex, I think?)...

Basically I want to give the user to enter something into a file and the game to be able to read it.

Then I want to be able to make the game write something (say, coordinates) to a readable text file.



If that's not possible, I wanna be able to do it in a CLEO Script. Which would require starting the script, getting the pointer, reading the right part (right?)... But I'm not sure how to do it for a seperate script.


I'm working on a advanced debugging script (not one of those simple ones, either Very Happy)

View user profile http://gtag.gtagaming.com

2 Re: Read/Write Text Files on Thu Sep 17, 2009 9:46 am



I have been in Saint Petersburg, so sorry for the late reply. Yes, it's possible. And very easy, all is needed is to use the opcode to create this file, and the read the direct data from it. Would you explain what the actual problem is with creating it?

It's because when you tried, the text was in machine-language, and not readable by people?





Then I want to be able to make the game write something (say, coordinates) to a readable text file.



Easy. But while we are speaking of such thing in the SA Memory Topic, I posted a code, this code will work in main.scm (MPACK included), you can create a file named "playercoords.txt" in SA dir, put coords in it it does not matter if you use comma's (,) or dots (.) between the XYZ it will still work, press F5 in-game, and CJ will be teleported to this coords that you put in the file. I.e. a user can open this file and change the coords to what they want to.


Code:

:SetNewCoords
hex
 B8 B0 D7 5B 00 FF D0 C3 // C3 - ret
end


* Code sets the coords


Code:

:MovePlayer
0@ = -429863
1@ = 304497
while true
    wait 250
    &0(1@,1i) == 0xFF
    jf continue
    &0(0@,1i) = 0xA49960
    &0(0@,1i) += @_SetNewCoords
    0572: run_asm_inject true
end // while
:_SetNewCoords
hex
 B8 B0 D7 5B 00 FF D0 C3
end


For main.scm (uses ASM injector)


Code:

1@ = 304497


* Index of keys - http://sannybuilder.com/dev/keycodes.htm

P.S. In the Memory Topic, I posted a code which opens a custom IMG-files and reads the models inside of this file, maybe that will also help you.


Code:

const
 FILE = 1@
 FILE_PATH = "data/mytestfile.txt" 
end

....

if
    0A9A: FILE = openfile FILE_PATH mode 0x77  // "write text"
then
 // text file with the name "mytestfile.txt" will be created in the SA/data dir
    .....
    // write data to the TXT-file
end


File options


Code:

0x6272 – opens binary file for reading
0x72  – opens text file for reading
0x6277 – opens binary file for writing
0x77  – opens text file for writing






Last edited by gtasbigfoot on Sun Sep 20, 2009 8:44 am; edited 1 time in total


_________________
Some links for modding information:
• GTAModding Wiki
• Документация по моддингу GTA
• Sanny Builder (Русский)
• Sanny Builder Profile

View user profile http://gtamodding.com

3 Re: Read/Write Text Files on Sat Sep 19, 2009 7:30 am

You're a genius...

I wish I could test it out... But I'm inable to use my videocard :/

Thanks, anyway.

View user profile http://gtag.gtagaming.com

4 Re: Read/Write Text Files on Thu Sep 24, 2009 9:21 am

Deji wrote:You're a genius...

I wish I could test it out... But I'm inable to use my videocard :/

Thanks, anyway.



Sorry to hear that. I hope you get it working soon, or buy a new one. F**king video cards always go when you need them, uhh?


_________________
Some links for modding information:
• GTAModding Wiki
• Документация по моддингу GTA
• Sanny Builder (Русский)
• Sanny Builder Profile

View user profile http://gtamodding.com

5 Re: Read/Write Text Files Today at 10:32 pm

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum