• Welcome to SC4 Devotion Forum Archives.
 

News:

The SC4 Devotion Forums are no longer active, but remain online in an archived, read-only "museum" state.  It is not possible for regular members to post or use the private messaging system, and no technical support will be provided for any issues pertaining to the forums in their current state.  Attachments (those that still work) are accessible without login.

The LEX has been replaced with SC4Evermore (SC4E), and SC4E maintains an active Discord server.  For traditional forums, we recommend Simtropolis.

Main Menu

Scripting Help

Started by Elric888, December 08, 2009, 10:11:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Elric888

Can someone here who is familiar with LUA scripting help me figure out what I'm doing wrong? I have two scripts which just don't seem to work..at all. The odd thing is they are essentially clones of two that do work. One is a randomizer script for UI queries made by Daely. The original script has no package id, and works fine. All I did for mine was change the output messages, and number of different messages, the IID of the LUA file, and the name of the message script to "E8_SKNameCounter" (and all corresponding lines). My UI works fine, except for the field which should display the random message.
The first test it displayed the descriptive tag in the UI "Name", which is odd since the captionres is pointing to the LText which contains #E8_SKNameCounter_message()# , so it should display the random name, but doesn't.
So I changed the Descriptive field to #E8_SKNameCounter_message()# , the it just displayed the whole string, instead of the functions random name. So then I deleted everything between the quotes, and left it just "", so of course now the field on the UI is blank.

The other problem is similar, cloned (and altered) random fluff news ticker messages which never show up. In this case I'm thinking it may be the package signature. Is there a specific set of numbers it should start with or something? I have looked at nearly every LUA file in the original simcity.dat, as well as BSC essentials, and some others. I know my LUA scripts are good, what am I missing?
I can send the files in question to someone to look at them if need be, I really need to get this solved.

RippleJet

Send a PM to Daeley. ;)

Quote from: Elric888 on December 08, 2009, 10:11:02 PM
In this case I'm thinking it may be the package signature. Is there a specific set of numbers it should start with or something?

That number is a signed integer, and it cannot be negative.
Thus, the first digit must not be 8, 9, A, B, C, D, E or F.

Elric888

the first number is 0 , as I read in a post in one of the discovery threads that it helps to have them start with zero, so it's safe to say its not the first # causing the problem.

RippleJet

Quote from: Elric888 on December 08, 2009, 10:11:02 PM
I can send the files in question to someone to look at them if need be, I really need to get this solved.

Or you could attach them to a post here. ;)

Elric888

Quote from: RippleJet on December 08, 2009, 10:42:29 PM
Or you could attach them to a post here. ;)
Not a bad idea, ok the file is attachedhere. The ticker file is incomplete, meaning several more messages are to be added, but I don't think it's the format thats wrong, so that shouldn't be a problem. Needless to say if you don't like spoilers, don't check this file  ()stsfd() .. it's part of a dependency file for a new industry chain to be submitted soon. (no hints just yet, I'm keeping the project under wraps for now ;D).

RippleJet

In the UI file, included in SKUI.DAT, the last GZWinText starts:

<LEGACY
   clsid=GZWinText
   iid=IGZWinText
   area=(11,103,276,135)
   fillcolor=(0,64,128)
   caption="#E8_SKNameCounter_message()#"
   captionres={b2f868e5,e8850001}
   winflag_visible=yes
   ...


The captionres points to GI 0xB2F868E5, 0xE8850001.
However, there is no LTEXT file with that address in your file.

The file you want it to link to has a GI of 0xB2F868E5, 0xE8880001.


As long as the captionres doesn't point to a valid LTEXT file, the caption will be displayed instead.

RippleJet

Regarding the SK News Ticker LUA...

That LUA file should start with:

dofile("_adv_sys.lua")
dofile("_adv_advice.lua")
dofile("adv_game_data.lua")
dofile("adv_fluffnews.lua")

_adv_advice.lua includes the constants starting with "advice_moods" and "tuning_constants".

adv_game_data.lua includes the definitions for the application data variables starting with "game".

adv_fluffnews.lua includes the definition for the function you've used, create_advice_fluff().
This LUA script can be found at TGI 0xCA63E2A3,0x4A5E8EF6, 0xFFA79144.
This script also calls those first three ones, so it is probably enough to include only the last "dofile" line.
Take a look at how adv_environment.lua at TGI 0xCA63E2A3, 0x4A5E8EF6, 0xFF1A27EC was done.

Elric888

Thanks!! I checked all those like three times, somehow that one digit got under my radar...how embarrasing. :thumbsup: You are a lifesaver. I don't suppose you checked the news tickers too? Anyway, thats a mistake I won't soon make again..LOL. Thanx again.

Elric888

I see you did. Alright very helpful, I was wondering about those calls..Thanks for your help..I was getting pretty frustrated with this..I really appreciate it..You'll definitely be on my list of thanks for my release. I may have another question or two later (gotta run right now..errands to do) I'll send you a PM when I get back about a related question. Thanks.