Author Topic: Need help please with Messages  (Read 1250 times)

0 Members and 1 Guest are viewing this topic.

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #15 on: May 05, 2012, 07:10:41 PM »
This is what I'm using now...

Code: [Select]
Timer = GetGameTime() + 0
while GetGameTime() < Timer do
coroutine.yield()
end
MessageA()

Timer = GetGameTime() + 7
while GetGameTime() < Timer do
coroutine.yield()
end
MessageB()

Timer = GetGameTime() + 9
while GetGameTime() < Timer do
coroutine.yield()
end
MessageC()

Timer = GetGameTime() + 11
while GetGameTime() < Timer do
coroutine.yield()
end
MessageD()

Timer = GetGameTime() + 13
while GetGameTime() < Timer do
coroutine.yield()
end
MessageE()



like always, I can't do something -.-, can you tell me why this isn't working?

Code: [Select]
if GetAsteroid(1).NumDysonTrees == 4 then
MessageF()
end

It doesn't crash my game or anything, I can play it but when Asteroid 1 gets 4 DysonTrees the messagef doesn't pop up

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: Need help please with Messages
« Reply #16 on: May 05, 2012, 07:17:08 PM »
Having chained while loops isn't a good idea. Try keep everything in one while loop and use if statements, that way multiple things can happen :)

Also, the stopper might be because something crashed the LevelLogic, it tends to get crappy after a fail that isn't lethal to the game. Although this might be it, don't waste your time searching for fault too much as we don't really know what we're digging in. Maybe you should take a closer look to what WaitDialog() really does? Try make an asteroid get a lot of seedlings after the WaitDialog function in any message and see when things happen(before/after skipping message)

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #17 on: May 05, 2012, 07:38:19 PM »
So is this what your saying?

Code: [Select]
Timer = GetGameTime() + 0
end
MessageA()

Timer = GetGameTime() + 7
end
MessageB()

Timer = GetGameTime() + 9
end
MessageC()

Timer = GetGameTime() + 11
end
MessageD()

Timer = GetGameTime() + 13
end
MessageE()

while GetGameTime() < Timer do
coroutine.yield()
end

Also this is WaitDialog()

Code: [Select]
function WaitDialog()
while GetDialogActive() do
coroutine.yield()
end
end

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: Need help please with Messages
« Reply #18 on: May 05, 2012, 08:11:35 PM »
Code: [Select]
message = 0;
while GameRunning() do

if (GetDialogActive() ~= true) then
if (message == 0) then
MessageA();
elseif (message == 1) then
MessageB();
end
else
if (message < 2) then
message = message + 1;
end
end
end

Hope it works :)

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #19 on: May 05, 2012, 08:24:56 PM »
I was hoping it did, but it didn't do anything when I loaded the game up?

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #20 on: May 06, 2012, 02:43:17 PM »
Hey Aino, this is how the messages are run in other levels of the iPad, so I decided to use it, and it's worked for messages...

Code: [Select]
if IsiOS() then
SelectionClear()
WaitReal(2)
SetLevelDim(true)
Message("01_DARK", true, 1.0, "Top")
WaitMessage(true)
SetLevelDim(false)
SetCameraPosition(-800,0)
SetCameraZoom(1000)
else
MessageBox("01_01")
WaitDialog()
end

--
-- Mission text
--
if IsiOS() then
WaitReal(2)
Message("01_SPRAWL", true, 1.0, "Left")
WaitMessage(true)
SetEnemyInfoAvailable(true)
SetCoreInfoAvailable(true)
SetAttribsInfoAvailable(true)
SetTreeInfoAvailable(true)
else
MessageBox("01_02")
WaitDialog()
end

if IsiOS() then
WaitReal(2)
Message("01_SEEDLING", true, 1.0, "Left")
WaitMessage(true)
SetCameraZoom(2000)
SetCameraPosition(300,0)
else
MessageBox("01_02")
WaitDialog()
end

if IsiOS() then
SetDysonTreeButtonAvailable(true)
WaitReal(2)
Message("01_DYSON", true, 1.0, "Right")
WaitMessage(true)
else
MessageBox("01_02")
WaitDialog()
end

For example were it says       Message("01_DYSON", true, 1.0, "Right")

it's refering to another file called lang.csv which is full of text, which literally relates to all the text, I could change every text I wanted to.

Code: [Select]
01_DYSON Click the Asteroid,~Plant four Dyson Trees.

Taken from the land.csv file

The only problem now I face is that I wanted the user to plant 4 dyson tree's and then when the 4 dyson trees are planted a message pops up

e.g
Code: [Select]
Message("01_DYSON", true, 1.0, "Right")
Do i need to add something at the start of LevelLogic() like GetEmpire(1):UpdateNumDysonTrees

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #21 on: May 06, 2012, 04:27:49 PM »
Just figured it out -.- so annoying how easy it is to figure it out, but it took a while...

Code: [Select]
while GetEmpire(1).NumTrees < 1 do
coroutine.yield()
end

if IsiOS() then
SetSpeedSwitchAvailable(true)
WaitReal(2)
Message("01_SPEED", true, 1.0, "Right")
WaitMessage(true)
end

Never knew the while part had to be before the bottom bit -.-

Aino

  • Ent
  • ******
  • Thank You
  • -Given: 1
  • -Receive: 20
  • Posts: 1,483
  • They'll eat you next!
  • Eufloria: Yes
Re: Need help please with Messages
« Reply #22 on: May 07, 2012, 01:19:42 PM »
If you use those texts, the changes will only be visible for you, you should keep the text as you had it in the messageboxes :)

Tomfloria

  • Shrub
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 232
  • First iOS modder :D
Re: Need help please with Messages
« Reply #23 on: May 07, 2012, 01:37:36 PM »
Hey Aino, I changed it yesterday, because it was getting annoying for me so it now looks like...

Code: [Select]
if IsiOS() then -- This asteroid
WaitReal(0)
Message("This Unknown Asteroid...", true, 1.0, "Right")
WaitMessage(true)
else
MessageBox("01_01")
WaitDialog()
end

My previous approach for the iPad users was to upload the lang.csv and that...